id
stringlengths
40
40
text
stringlengths
9
86.7k
metadata
stringlengths
3k
16.2k
source
stringclasses
1 value
added
stringdate
2024-11-21 00:00:00
2024-12-12 00:00:00
created
stringdate
2024-11-21 00:00:00
2024-12-12 00:00:00
5b11dd360e1d625ebeb5a4e0c89f64fa2968a496
PDF hosted at the Radboud Repository of the Radboud University Nijmegen The following full text is a preprint version which may differ from the publisher's version. For additional information about this publication click this link. http://hdl.handle.net/2066/141416 Please be advised that this information was generated on 2020-05-14 and may be subject to change. ABSTRACT Symbolic execution is a program analysis technique that is used for many purposes, one of which is test case generation. For loop-free programs, this generates a test set that achieves path coverage. Program loops, however, imply exponential growth of the number of paths in the best case and non-termination in the worst case. In practice, the number of loop unwindings needs to be bounded for analysis. We consider symbolic execution in the context of the tool Symbolic Pathfinder. This tool extends the Java Pathfinder model-checker and relies on its bounded state-space exploration for termination. We present an implementation of $k$-bounded loop unwinding, which increases the amount of user-control over the symbolic execution of loops. Bounded unwinding can be viewed as a naive way to prune paths through loops. When using symbolic execution for test case generation, branch coverage will likely be lost when paths are naively pruned. In order to improve coverage of branches within a loop body, we present a technique that semi-automatically concretizes variables used in a loop. The basic technique is limited and we therefore present annotations to manually steer symbolic execution towards certain branches, as well as ideas on how the technique can be extended to be more widely applicable. Categories and Subject Descriptors D.2.5 [Software Engineering]: Testing and Debugging—symbolic execution, testing tools; F.3.2 [Logics and Meanings of Programs]: Semantics of Programming Languages—program analysis General Terms Verification, Algorithms Keywords Symbolic execution, branch coverage, test case generation 1. INTRODUCTION Testing is the most widely used technique for detecting faults in software. Software companies often dedicate over 50% of development time to testing. For safety-critical applications, this number is even larger. Composing an extensive set of test inputs is a complicated task, as the test designer must achieve some form of coverage. For instance, statement coverage requires that all statements in the program have been executed at least once. Symbolic execution is a well-known technique from program analysis, which can be used for test case generation. In symbolic execution, a program is executed with symbols in place of concrete input. A path-condition is maintained, i.e., updated on each branch, that indicates the constraint under which this path is followed. Effectively, this means that if the generated constraints lie within the set of decidable theories, symbolic execution enumerates all paths through the software and the generated test cases provide full path-coverage. However, in programs with loops, any extra iteration of a loop introduces a new path, introducing exponential growth in the number of paths. Moreover, in loops that depend on input values, the number of paths may be infinite (81.8% of loops in the applications studied in survey paper [13] by Xiao et al. are input-dependent). Therefore, in practice, symbolic execution has to be bounded. Since in general, it is impossible to know a priori how many iterations are needed to enter certain branches, this means that likely, any notion of coverage is lost. We consider symbolic execution in the context of the tool Symbolic Pathfinder (SPF) [8], which combines the model-checker Java Pathfinder [5] with symbolic execution and constraint solving to, among other objectives, generate test cases. SPF currently implements bounding of the search-space explored by the model-checker rather than bounded unwinding of loops. This means that the number of unwindings of loops is affected by the structure and complexity of the surrounding code. It is therefore hard to predict the number of unwindings for a particular loop, especially if other loops are present. We present the implementation of a more flexible and intuitive bounding mechanism for loops: $k$-bounded unwinding, making it possible to unwind the same number of iterations for each loop. Additionally, we present an annotation to specify $k$-bounds that are loop-specific. Both types of bounding (loop bounding and search space bounding) may cause important paths through a program to be missed by SPF. When used to generate a set of test cases, this means that the test set will not cover all branches in the loop body. Paths are pruned by naively dropping all with more than $k$ iterations, which can make it very complicated to achieve high coverage. We strive to improve the object branch coverage of the set of test cases generated by SPF. A set of test inputs provides object branch coverage if running the program for those test inputs executes every branch in the bytecode level control-flow graph. Since in the bytecode level control-flow graph (CFG), evaluation of a condition such as $b_1 \land b_2$ amounts to two CFG nodes, as opposed to a single node in the source code level CFG, object branch coverage implies branch coverage. Object branch coverage is thus a more rigorous coverage metric than source-level branch coverage. We present an annotation which can be used to concretize symbolic variables. This can be used to fix symbolic variables to a set of concrete values that cover all branches in the loop body. Furthermore, we present a technique which can infer these cases for loops that are independent of context. The approach is limited, but represents a small step in improving the object branch coverage of the generated test set. Our contribution is thus threefold: 1. An implementation of $k$-bounded unwinding of loops in SPF. 2. A separate concretization technique, using annotations to concretize variables upon loop entry. 3. An experimental method to semi-automatically infer these annotations, based on out-of-context symbolic execution of the loop body. ### 1.1 Related Work A good survey on symbolic execution for software testing is given in [2]. Several extensions to classical symbolic execution and state-of-the-art tools are discussed. A survey on loop problems for dynamic symbolic execution (DSE) is given in [13]. DSE executes the program using concrete random inputs and collects the path condition on the side. An interesting result is that 81.8% of loops in the studied applications are dependent on input, thus possibly non-terminating. The most common way to deal with this type of loops is bounded iteration, solving the termination problem at the cost of completeness of the generated test set. Search-guiding heuristics can be used to guide symbolic execution to certain “interesting” paths, making the pruning less naive. A more complex approach is to create loop summaries: a set of formulas based on loop invariants and induction variables that summarizes the effects of the loop. This is a complex task which is infeasible for many loops. In fact, the state-of-the-art loop summarization algorithm presented in [4] can only summarize 6 out of 19 input-dependent loops in their experiment. Single-path symbolic execution is a variation of DSE, in which a set of executions which follow the same control-flow path is considered. It is extended with a mechanism for loops in [1]. Iteration counters named trip count variables are introduced that can be linked to a known input grammar. It is shown that this is a powerful tool for finding problems such as buffer overflow vulnerabilities. Verification of program properties using SPF is discussed in [9]. Loops are handled using invariants. Verification of a post-condition of a loop can be simplified to verification of the loop invariant before executing the loop (base case), after a generic iteration using symbolic execution (inductive case), plus implication of the post-condition from the invariant. Gladisch describes a method to generate a test set with full feasible branch coverage, using the theorem prover KeY in [3]. It requires that strong preconditions, postconditions and loop invariants are supplied and leverages the theorem prover to replace symbolic execution of a loop by the application of a loop invariant rule. Several types of preconditions are formed for loops, which guarantee the execution of all branches in and after the loop. Trtik presents a technique for handling loops in symbolic execution in [12]. He introduces path counters with update paths (increment by one) and reset paths (set to zero). Symbolic values of program variables can then be expressed in terms of these counters. This theoretically tackles the problem in part, but more complex loops quickly result in non-linear constraints which are expensive to solve or even undecidable. ### 2. BOUNDING LOOPS IN SPF In this section we present our implementation of $k$-bounded unwinding of loops in SPF. Consider the method in Listing 1. As $i$ is assigned a symbolic value, symbolic execution of this program iterates over the loop infinitely many times. In practice, symbolic execution is bounded. SPF currently does not implement bounding itself, but instead relies on the bounded state-space exploration implemented in Java Pathfinder. This means that the number of unwindings of loops is affected by the structure and complexity of the surrounding code. 1. boolean $m$(int $i$) { 2. boolean $b = false$ ; 3. while ($i > 0$) { 4. if ($i == 10$) { 5. $b = true$ ; 6. $i --$; 7. } 8. return $b$ ; 9. } Listing 1: Example program with a loop. To cover all branches, it is desired to unwind the loop in Listing 1 at least 10 times. Say we have a simple main method that initializes the object and then calls this method on it. If we set the depth-limit on the number of explored states to 4, the loop will be unwound only once, because of the other states on the path related to calling the method from the main function. The depth bound is based on the number of ChoiceGenerator objects that are encountered by Java Pathfinder. It cannot distinguish between choices related to a loop or other points of non-determinism. It gets harder to estimate the number of unwindings when there are other choice points on the path. Say, if there was a single if-statement after the loop, a depth-limit of 5 would be needed to unwind the loop once. Moreover, the number of choice points may differ between paths. Therefore, a different number of iterations might be unwound for the same loop in different paths. This makes it very hard to control the number of unwindings that will actually be done for a given loop. ### 2.1 K-Bounded Unwinding We implemented $k$-bounded unwinding in SPF, in a listener called the KBoundedSearchListener. When this class is initialized, the CFG is built and the dominance set is calculated, in order to detect headers and back-edges of loops (a loop header is the single point of entry into the loop). A node $n_1$ dominates a node $n_2$ if all paths from the entry node to $n_2$ go through $n_1$. If an edge exists in the CFG from $n$ to $h$ and $h$ dominates $n$, then the edge is the back-edge of a loop with header $h$. This loop detection algorithm is implemented in the LoopFinder class. Headers are stored in objects of the Location class, which combines a method name and an instruction position. The instructions of the choice points following the loop headers are also stored, because that is where the actual branching occurs (loop headers typically consist of a load instruction). The listener then counts the number of unwindings of each loop, using a stack, by listening for registered ChoiceGenerator objects. These are objects that Java Pathfinder uses to navigate over decisions, where paths branch. When the k-bound is reached for a certain loop, the remaining paths through this loop are pruned by setting the next ChoiceGenerator to done. Bounded unwinding is activated by adding the listener to the Java Pathfinder configuration and setting the configuration option kbound=K, where K is the maximal number of unwindings. The implementation currently is limited to intra-procedural analysis (only loops within the analysed method itself are detected and bound, not those in called methods). An inter-procedural version will be implemented in the near future. ### 2.2 Specifying Loop-Specific Bounds In some cases, one might want a certain loop to be unwound more than others, or maybe it is clear that unwinding it only once is enough. For those cases we have added an annotation to express loop-specific bounds. It is added to the header of a Java method and has the following syntax: \[ @K\text{Bound}(k = \{\text{"}N_1 : b_1\text{"}, \ldots, \text{"}N_n : b_n\text{"}\}) \] Where each \( N_i \) is a loop identifier, determined by the order of loop headers from the top of the method in its source code, and each \( b_i \) is an integer bound. ### 3. Concretizing Loop Variables Typically, when symbolically executing a loop, up to a fixed number of \( k \) iterations are unwound and the path condition includes propositions expressing the number of unrolled iterations. For example \( i > 0 \land i = 1 > 0 \land i - 2 \leq 0 \) signifies two unrolled iterations for the example in Listing 1. As the number of iterations of loops is potentially infinite, a selection of paths through loops needs to be pruned. Unwinding of loops up to a given bound can often be ineffective in achieving our testing goals, e.g. object branch coverage. As we are considering symbolic execution in the context of test case generation, we are interested in obtaining test sets with better coverage. We therefore propose to prune paths through loops based on object branch coverage, by concretizing variables that are used in a loop to values that ensure coverage of all branches within its body. For instance, for the loop in Listing 1, concrete values 0, 1 and 10 might be used for \( i \). We present an annotation for concretization in this section. A method for inferring usable concrete values is described in Section 3. The annotation is added to the method-header and has the following syntax: \[ @\text{UseModels}(\text{models} = \{C_1, \ldots, C_k\}) \] Where each \( C_k \) represents a concretization string: \[ C_k := \text{"}N_x. [v_1^k, \ldots, v_j^k] \to [m_1^k, \ldots, m_j^k]\text{"} \] Where \( N_x \) is the identifier of a loop (determined by the order of loop headers from the top of the method in its source code), \( v_i^x \) is a program variable to be concretized and \( m_i^x \) is the model to concretize it to. In each of the \( k \) concretization strings, several variables may be concretized that might differ from the other concretization strings. When only a single variable and model combination is used, brackets may be omitted. As an example, to concretize \( i \) to 20 in the first loop of a method one can use the following annotation: \[ @\text{UseModels}(\text{models} = \{"1.i \to 20"\}) \] When concretizing, an equality between the model-value and the symbolic value of the program variable upon entry to the loop is added to the path condition. E.g., if the value of a program variable \( i \) is \( i + 3 \) before the loop and there is an annotation that \( i \) should be concretized to 20, then 20 = \( i + 3 \) is added to the path condition. By concretizing the symbolic variables to these models, we prune all other paths, making the search-space finite. Concretization can thus replace other bounding methods. Note, however, that all iterations corresponding to the bound will need to be unrolled. For instance, if for our running example, a model \( m \) is found, the loop needs to be unrolled \( m \) times. When variables are concretized for a loop, they are concretized for the program as a whole. Thus, when symbolically executing nested loops, concretization for an inner loop also affects the outer loop (and the rest of the program). Thus, care must be taken not to add conflicting annotations. ### 4. Out-of-Context Symbolic Execution of the Loop Body In this section we present a technique that can infer variable values to concretize to for branch coverage of the loop body. It is inspired by \[1\], in which a loop body is symbolically executed with fresh symbols in order to prove a loop invariant. This technique is not yet automated. It consists of the following steps: 1. Symbolically execute the loop body out-of-context, i.e., with fresh symbols. 2. Solve the generated path conditions to obtain a model for each of them. 3. Concretize the values of the variables by adding the concrete values to the path condition (e.g., for models \( i = 0 \) and \( i = 1 \) we add \( i = 0 \lor i = 1 \)). Thanks to using fresh symbols for program variables, the search will not be biased to their symbolic values before entering the loop. The result of step 1 is a set of path conditions, capturing all behaviors one iteration of the loop can exhibit. Models for these path conditions can then be found using off-the-shelf constraint solvers. Only variables that are used in the loop body or loop guard should be concretized. Otherwise, symbolic execution will settle on a limited set of paths through the entire program. These are also the only variables that need to be fresh for the out-of-context symbolic execution. Variables for which the model is not constrained by the path condition will also not be concretized, as these do not influence the flow of control in the loop. 4.1 Example When symbolically executing the method in Listing 1 with $k$-bounded unwinding and $k = 2$, the following 3 path conditions are generated: \[ \begin{align*} i & \leq 0 & (1a) \\ i & > 0 \land i \neq 10 \land i-1 \leq 0 & (1b) \\ i & > 0 \land i \neq 10 \land i-1 > 0 \land i-1 \neq 10 \land i-2 \leq 0 & (1c) \end{align*} \] Using the Yices solver, we get models $i = 0$, $i = 1$ and $i = 2$. The branch where $b$ is assigned a value of true is missed. Let us now take the loop body out of context. A new method containing the extracted body is shown in Listing 2. The while has been replaced by an if, because we want the resulting models to satisfy the loop guard (except for the model that we also need in which the loop is not entered). ```java 1 void outofcontext(int i, boolean b) { 2 if (i>0) { 3 if (i==10) 4 b = true; 5 i--; // 6 } 7 } ``` **Listing 2: The loop body from Listing 1 taken out of context.** Symbolic execution of this extracted loop body results in the following path conditions: \[ \begin{align*} i & \leq 0 & (2a) \\ i & > 0 \land i \neq 10 & (2b) \\ i & > 0 \land i = 10 & (2c) \end{align*} \] Using the Yices solver, we get models $i = 0$, $i = 9$ and $i = 10$. Because there are no statements before the loop, we can simply use these symbols in the path condition as-is (no mapping, as explained in Section 3 is needed). The paths through the loop can now be pruned in a more informed manner which enables object branch coverage by adding the models to the path condition. One can think of this as adding the following assumption before the loop: ``` assume (i==0 || i==9 || i==10); ``` Note that using the path conditions instead of the models would not prune the paths. A $k$-bound with $k \geq 10$ would still be needed to cover all branches. 4.2 Limitations The concretization approach to handle loops has two major limitations. We discuss these here, including ideas on how we intend to address them in the future. Given these limitations, it is recommended to use the loop concretization technique for test case generation in combination with a coverage checker. Such a tool can check if the test set achieves object-branch coverage and point to branches that are missed. The user can then go back and add annotations to direct SPF to improve the generated test set. **Context-dependence.** Out-of-context symbolic execution finds models for the out-of-context loop body. In cases such as the running example of this paper, adding these models to the path condition achieves object branch coverage, because the execution of the loop does not depend on this context. However, when the execution of the loop-body is dependent on the context, the models may be infeasible and the search will back-track. Consider, for instance, the loop in Listing 3. This method is taken from the Java prototype of the Airborne Coordinated Conflict Resolution and Detection (ACCoRD) framework developed and maintained by the NASA Langley formal methods group.[3] This is a framework for formal specification and verification of state-based airspace separation assurance algorithms. This specific method estimates the change of vertical speed from a sequence of velocity vectors stored in the containing object. The numPtsVsRateCalc parameter specifies the number of data points used in the average and the method returns the vertical acceleration. The sign of the return value indicates the direction of the acceleration. ```java 1 public double avgVsRate(int numPtsVsRateCalc) { 2 int n = size(); 3 if (numPtsVsRateCalc < 2) numPtsVsRateCalc = 2; 4 int numPts = Math.min(numPtsVsRateCalc, n); 5 double vsLast = 0; 6 double tmLast = 0; 7 double vsRateSum = 0.0; 8 for (i=n-1; i>=numPts-1 && i>=0; i--) 9 StateVector svt = get(i); 10 double vs = svt.v().vs(); 11 double tmTr = time(i); 12 if (i < n-1) 13 double vsRate = (vs-vsLast)/(tmTr-tmLast); 14 vsRateSum = vsRateSum + vsRate; 15 } 16 vsLast = vs; 17 tmLast = tmTr; 18 } 19 if (numPts < 2) return 0; 20 else return vsRateSum/(numPts-1); ``` **Listing 3: Loop for which its execution is dependent on its context, taken from the ACCoRD conflict resolution and detection framework.** If we analyze the body of the loop at lines 8-18 out-of-context, we get the following models (each row corresponds to a path through the loop body; other variables are omitted because they do not influence the control-flow in the loop and are therefore not concretized): <table> <thead> <tr> <th>$i$</th> <th>$n$</th> <th>numPts</th> </tr> </thead> <tbody> <tr> <td>47</td> <td>89</td> <td>97</td> </tr> <tr> <td>0</td> <td>0</td> <td>0</td> </tr> <tr> <td>-24</td> <td>-43</td> <td>89</td> </tr> <tr> <td>-77</td> <td>86</td> <td>92</td> </tr> </tbody> </table> The problem with these models is that the value of numPts is defined as the minimum of numPtsVsRateCalc and $n$ on Line 4, but none of these models except for one satisfy the consequential constraint numPts $\leq n$. Furthermore, the path condition upon entry to the loop will contain a constraint $i = n-1$, as this is what $i$ is initialized to on Line 8. This constraint is also not satisfied by any of the models. Therefore, when we add these constraints to the path condition, none of the paths through the loop are feasible. We intend to create a refinement loop, which iteratively refines the constraint to satisfy with a model. The constraint is first set to the path condition of the path we are working on. The model that is found by the solver is then checked against the path conditions of the paths leading to the loop. If all of these conflict with the model, the constraint is strengthened with the conflicting sub-constraint of the path conditions. Complexity lies in finding this conflicting sub-constraint. Furthermore, we will introduce an annotation to specify whether or not loop variable concretization should be used. **Iteration-count dependence.** Consider the example in Listing 4. There is only a single path through the loop body. Its path condition is \( i > 0 \) and a model is \( i = 1 \). When considering only this path, the path where the method does “something” (Line 8) is missed. ```java void m(int i) { int j = 0; while (i > 0) { j++; i --; } if (j == 20) { //do something } } ``` Listing 4: Loop which shows dependence on iteration count. In this case, the problem can be solved by using a manual annotation that states that \( i \) should be concretized to 20. There may also be branching in the loop that only occurs for a particular iteration, the conditional on Line 12 of Listing 4 is an example of this. The condition used in this case is true for any path, except for the first one. Such a case may be solved by setting a \( k \)-bound that is high enough. The general case, where a branch may occur after \( n \) iterations, is equivalent to the halting problem. However, this does not mean that certain cases may not be tackled. An idea to improve this, is to add the iteration count as a variable to symbolic execution or detect induction variables, as is done e.g. in [12] and [4]. The symbolic value of variables can then be expressed using the number of iterations of each loop. The technique works with nested loops. In that case, the technique should be applied for the innermost loop first. The concrete values can then be used when the technique is applied to the outer loop(s). 5. CONCLUSIONS We have presented a series of improvements to the loop-handling capabilities of Symbolic Pathfinder: - An implementation of \( k \)-bounded unwinding of loops. - Novel annotations to concretize variables, directing symbolic execution towards otherwise missed branches. - A technique to infer concrete values for concretization. The inference method has two major limitations: 1. when loops are context-dependent, and 2. when program variables are dependent on the number of loop iterations. We suggest some extension ideas to address these limitations. The problem of pruning paths through loops is a notoriously hard one. A large body of literature on the topic exists and no proposed solution is complete. Our work represents a series of small steps towards better treatment of loops. **Future Work** We will develop the ideas discussed in Section 4 of this paper and implement them in SPF. Furthermore, in [7, 6, 10], an extension to SPF is discussed that compares software versions and generates test cases for paths that are impacted by changes only. This incremental analysis implies a significant reduction in the number of generated test cases. Extensions of our method that are specific for incremental analysis can potentially reduce this number even further and improve object branch coverage. 6. REFERENCES
{"Source-Url": "https://repository.ubn.ru.nl/bitstream/handle/2066/141416/141416.pdf?sequence=1", "len_cl100k_base": 6079, "olmocr-version": "0.1.53", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 19950, "total-output-tokens": 7336, "length": "2e12", "weborganizer": {"__label__adult": 0.00039839744567871094, "__label__art_design": 0.00022709369659423828, "__label__crime_law": 0.0003750324249267578, "__label__education_jobs": 0.00048160552978515625, "__label__entertainment": 5.2928924560546875e-05, "__label__fashion_beauty": 0.00015747547149658203, "__label__finance_business": 0.00013899803161621094, "__label__food_dining": 0.0003108978271484375, "__label__games": 0.0006079673767089844, "__label__hardware": 0.0007038116455078125, "__label__health": 0.0004897117614746094, "__label__history": 0.0001913309097290039, "__label__home_hobbies": 6.967782974243164e-05, "__label__industrial": 0.0003135204315185547, "__label__literature": 0.0002448558807373047, "__label__politics": 0.0002658367156982422, "__label__religion": 0.0004277229309082031, "__label__science_tech": 0.008758544921875, "__label__social_life": 7.95125961303711e-05, "__label__software": 0.003276824951171875, "__label__software_dev": 0.9814453125, "__label__sports_fitness": 0.000396728515625, "__label__transportation": 0.0005006790161132812, "__label__travel": 0.00020372867584228516}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 28717, 0.04646]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 28717, 0.65526]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 28717, 0.88825]], "google_gemma-3-12b-it_contains_pii": [[0, 367, false], [367, 5276, null], [5276, 11812, null], [11812, 17945, null], [17945, 23400, null], [23400, 28717, null]], "google_gemma-3-12b-it_is_public_document": [[0, 367, true], [367, 5276, null], [5276, 11812, null], [11812, 17945, null], [17945, 23400, null], [23400, 28717, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 28717, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 28717, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 28717, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 28717, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 28717, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 28717, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 28717, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 28717, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 28717, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 28717, null]], "pdf_page_numbers": [[0, 367, 1], [367, 5276, 2], [5276, 11812, 3], [11812, 17945, 4], [17945, 23400, 5], [23400, 28717, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 28717, 0.03297]]}
olmocr_science_pdfs
2024-12-09
2024-12-09
291d95962ae975e3a03208423e20a3ffa4f48a3e
[REMOVED]
{"Source-Url": "http://www-public.tem-tsp.eu/~conan/Publications/2012_ami.pdf", "len_cl100k_base": 4227, "olmocr-version": "0.1.53", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 23675, "total-output-tokens": 7008, "length": "2e12", "weborganizer": {"__label__adult": 0.0003039836883544922, "__label__art_design": 0.0006856918334960938, "__label__crime_law": 0.0006594657897949219, "__label__education_jobs": 0.000946044921875, "__label__entertainment": 0.0001366138458251953, "__label__fashion_beauty": 0.00019681453704833984, "__label__finance_business": 0.0006728172302246094, "__label__food_dining": 0.0003561973571777344, "__label__games": 0.0005517005920410156, "__label__hardware": 0.0016660690307617188, "__label__health": 0.0008769035339355469, "__label__history": 0.0004856586456298828, "__label__home_hobbies": 0.00012958049774169922, "__label__industrial": 0.0006108283996582031, "__label__literature": 0.0003476142883300781, "__label__politics": 0.0005459785461425781, "__label__religion": 0.0004589557647705078, "__label__science_tech": 0.361328125, "__label__social_life": 0.00015974044799804688, "__label__software": 0.0386962890625, "__label__software_dev": 0.5888671875, "__label__sports_fitness": 0.00024116039276123047, "__label__transportation": 0.0005764961242675781, "__label__travel": 0.0002570152282714844}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 29274, 0.03756]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 29274, 0.38703]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 29274, 0.88308]], "google_gemma-3-12b-it_contains_pii": [[0, 2420, false], [2420, 3803, null], [3803, 6655, null], [6655, 9972, null], [9972, 13260, null], [13260, 16287, null], [16287, 19695, null], [19695, 22304, null], [22304, 25832, null], [25832, 29274, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2420, true], [2420, 3803, null], [3803, 6655, null], [6655, 9972, null], [9972, 13260, null], [13260, 16287, null], [16287, 19695, null], [19695, 22304, null], [22304, 25832, null], [25832, 29274, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 29274, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 29274, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 29274, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 29274, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 29274, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 29274, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 29274, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 29274, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 29274, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 29274, null]], "pdf_page_numbers": [[0, 2420, 1], [2420, 3803, 2], [3803, 6655, 3], [6655, 9972, 4], [9972, 13260, 5], [13260, 16287, 6], [16287, 19695, 7], [19695, 22304, 8], [22304, 25832, 9], [25832, 29274, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 29274, 0.0]]}
olmocr_science_pdfs
2024-12-08
2024-12-08
cae718e6dbe943bfd6209a680338471cfb1bccf9
What is a Pattern Database? - PDB = a heuristic stored as a lookup table - Invented by Culberson and Schaeffer (1994) - created by “abstracting” the state space Key properties: - guaranteed to be a lower bound - guaranteed to be “consistent” - the bigger the better (as a general rule) Success Story #1 - 15-puzzle ($10^{13}$ states). - 2 hand-crafted patterns (“fringe” (FR) and “corner” (CO)) - Each PDB contains >500 million entries - Used symmetries to compress and enhance the use of the PDBs - Used in conjunction with Manhattan Distance (MD) Reduction in size of search tree: - MD = 346 * max(MD, FR) - MD = 437 * max(MD, CO) - MD = 1038 * max(MD, dovetail(FR, CO)) + tricks Success Story #2 Rich Korf (1997) - Rubik’s Cube ($10^{19}$ states). - 3 hand-crafted patterns, all used together (max) - Each PDB contains over 42 million entries - took 1 hour to build all the PDBs Results: - First time random instances had been solved optimally - Hardest (solution length 18) took 17 days - Best known MD-like heuristic would have taken a century Example: 8-puzzle <table> <thead> <tr> <th>1</th> <th>2</th> </tr> </thead> <tbody> <tr> <td>3</td> <td>4</td> </tr> <tr> <td>6</td> <td>7</td> </tr> </tbody> </table> 181,440 states Domain = blank 1 2 3 4 5 6 7 8 “Patterns” created by domain abstraction <table> <thead> <tr> <th>1</th> <th>2</th> </tr> </thead> <tbody> <tr> <td>3</td> <td>4</td> </tr> <tr> <td>6</td> <td>7</td> </tr> </tbody> </table> This abstraction produces 9 patterns Domain = blank 1 2 3 4 5 6 7 8 Abstract = blank Pattern Space Pattern Database <table> <thead> <tr> <th>Pattern</th> <th>Distance to goal</th> </tr> </thead> <tbody> <tr> <td></td> <td>0 1 1 2 2 2</td> </tr> </tbody> </table> <table> <thead> <tr> <th>Pattern</th> <th>Distance to goal</th> </tr> </thead> <tbody> <tr> <td></td> <td>3 3 4</td> </tr> </tbody> </table> Calculating $h(s)$ Given a state in the original problem: \[ \begin{array}{ccc} 8 & 1 & 4 \\ 3 & 5 & \\ 6 & 7 & 2 \\ \end{array} \] Compute the corresponding pattern: \[ \begin{array}{ccc} \text{Red} & \text{Red} & \\ \text{Red} & \text{Red} & \\ \text{Red} & \text{Red} & \\ \end{array} \] Look up the abstract distance-to-goal: 2 Domain Abstraction \[ \begin{array}{ccc} 1 & 2 \\ 3 & 4 & 5 \\ 6 & 7 & 8 \\ \end{array} \] Domain = blank 1 2 3 4 5 6 7 8 Abstract = blank 0 0 0 6 7 8 30,240 patterns Fundamental Questions **How to invent effective heuristics?** Create a simplified version of your problem. Use the exact distances in the simplified version as heuristic estimates in the original. **How to use memory to speed up search?** Precompute all distances-to-goal in the simplified version of the problem and store them in a lookup table (pattern database). 8-puzzle: $A^*$ vs. PDB size [Graph showing the comparison between $A^*$ nodes expanded and pattern database size] **Automatic Creation of Domain Abstractions** - Easy to enumerate all possible domain abstractions Domain = blank 1 2 3 4 5 6 7 8 Abstract = blank 0 0 0 0 0 0 0 0 - They form a lattice, e.g. Domain = blank 1 2 3 4 5 6 7 8 Abstract = blank 0 0 0 0 0 0 0 0 is “more abstract” than the domain abstraction above **Efficiency** Time for the preprocessing to create a PDB is usually negligible compared to the time to solve one problem-instance with no heuristic. Memory is the limiting factor. **Making the Best Use of Memory** - Compress an individual Pattern Database - Lossless compression - Lossy compression must maintain admissibility - Allows you to - use a PDB bigger than will fit in memory - use multiple PDBs instead of just one - Merge two PDBs into one the same size - Culberson & Schaeffer’s dovetailing - Jonathan’s new idea **Compression Results** - 16-disk 4-peg TOH, PDB based on 14 disks - No compression: 256Megs memory, 14.3 secs - Lossless compression: 256k memory, 23.8 secs - Lossy compression: 96Megs, 15.9 secs - 15-puzzle, additive PDB triple (7-7-1) - No compression: 537Megs memory, 0.069 secs - Lossy compression, two PDB triples 537Megs memory, 0.021 secs Max’ing Multiple Heuristics • Given heuristics $h_1$ and $h_2$ define $h(s) = \max ( h_1(s), h_2(s) )$ • Preserves key properties: – lower bound – consistency Question • Given a fixed amount of memory, $M$, which gives the best heuristic? – 1 pattern database (PDB) of size $M$ – max’ing 2 PDBs of size $M/2$ – max’ing 3 PDBs of size $M/3$ – etc. 1 large pattern database 2 half-size pattern databases Many small pattern databases \[ S = \Phi_1 \ldots \Phi_n \] \[ h(s) \quad \ldots \quad h(s) \] \( \max \) Rubik’s Cube <table> <thead> <tr> <th>PDB Size</th> <th>n</th> <th>Nodes Generated</th> </tr> </thead> <tbody> <tr> <td>13,305,600</td> <td>8</td> <td>2,654,689</td> </tr> <tr> <td>17,740,800</td> <td>6</td> <td>2,639,969</td> </tr> <tr> <td>26,611,200</td> <td>4</td> <td>3,096,919</td> </tr> <tr> <td>53,222,400</td> <td>2</td> <td>5,329,829</td> </tr> <tr> <td>106,444,800</td> <td>1</td> <td>61,466,541</td> </tr> </tbody> </table> Summary <table> <thead> <tr> <th>State Space</th> <th>Best n</th> <th>Ratio</th> </tr> </thead> <tbody> <tr> <td>(3x3)-puzzle</td> <td>10</td> <td>3.85</td> </tr> <tr> <td>b-pancake</td> <td>10</td> <td>8.59</td> </tr> <tr> <td>(8,4)-Topspin (3 ops)</td> <td>9</td> <td>3.76</td> </tr> <tr> <td>(8,4)-Topspin (8 ops)</td> <td>9</td> <td>20.89</td> </tr> <tr> <td>(3x4)-puzzle</td> <td>21+</td> <td>165.5</td> </tr> <tr> <td>Rubik’s Cube</td> <td>6</td> <td>23.28</td> </tr> <tr> <td>15-puzzle (additive)</td> <td>5</td> <td>2.38</td> </tr> <tr> <td>24-puzzle (additive)</td> <td>8</td> <td>1.6 to 25.1</td> </tr> </tbody> </table> \( \text{RATIO} = \frac{\text{nodes generated using one PDB of size M}}{\text{nodes generated using n PDBs of size M/n}} \) Rubik’s Cube CPU Time <table> <thead> <tr> <th>#PDBs</th> <th>Nodes Ratio</th> <th>Time Ratio</th> </tr> </thead> <tbody> <tr> <td>8</td> <td>23.15</td> <td>12.09</td> </tr> <tr> <td>6</td> <td>23.28</td> <td>14.31</td> </tr> <tr> <td>4</td> <td>19.85</td> <td>13.43</td> </tr> <tr> <td>2</td> <td>11.53</td> <td>9.87</td> </tr> <tr> <td>1</td> <td>1.00</td> <td>1.00</td> </tr> </tbody> </table> time/node is 1.67x higher using six PDBs **Techniques for Reducing the Overhead of Multiple PDB lookup** **Early Stopping** IDA* depth bound = 7 g(s) = 3 ⇒ Stop doing PDB lookups as soon as h > 4 is found. **Might result in extra IDA* iterations** PDB₁(s) = 5 ⇒ next bound is 8 PDB₂(s) = 7 ⇒ next bound is 10 **Consistency-based Bounding** A PDB₁(A) = 1 PDB₂(A) = 7 B Because of consistency: PDB₁(B) ≤ 2 PDB₂(B) ≥ 6 ⇒ No need to consult PDB₁ **Experimental Results** • 15-puzzle, five additive PDBs (7-7-1) - Naïve: 0.15 secs - Early Stopping: 0.10 secs • Rubik’s Cube, six non-additive PDBs - Naïve: 27.125 secs - Early Stopping: 8.955 secs - Early Stopping and Bounding: 8.836 secs **Why Does Max’ing Speed Up Search?** **Static Distribution of Heuristic Values** - Max of 5 small PDBs **Runtime Distribution of Heuristic Values** **Saving Space** - If \( h_1 \) and \( h_2 \) are stored as pattern databases, \( \max(h_1(s), h_2(s)) \) requires twice as much space as just one of them. - How can we get the benefits of \( \max \) without using any extra space? - “Dovetail” two PDBs - Use smaller PDBs to define max **Dovetailing** - Given 2 PDBs for a state space construct a hybrid containing some entries from each of them, so that the total number of entries is the same as in one of the originals. - The hope: almost as good as max, but only half the memory. **Dovetailing based on the blank** **Any “colouring” is possible** **Dovetailing – selection rule** - Dovetailing requires a rule that maps each state, s, to one of the PDBs. Use that PDB to compute h(s). - Any rule will work, but they won’t all give the same performance. - Intuitively, strict alternation between PDBs expected to be almost as good as max. Dovetailing compared to Max’ing Experimental Results - Culberson & Schaeffer 1994: - Dovetailing two PDBs reduced #nodes generated by a factor of 1.5 compared to using either PDB alone - Holte & Newton (unpublished): - Dovetailing halved #nodes generated on average Example of Max Failing <table> <thead> <tr> <th>Depth Bound</th> <th>h1</th> <th>h2</th> <th>max(h1, h2)</th> </tr> </thead> <tbody> <tr> <td>8</td> <td>19</td> <td>17</td> <td>10</td> </tr> <tr> <td>9</td> <td>32</td> <td>18</td> <td>18</td> </tr> <tr> <td>10</td> <td>50</td> <td>35</td> <td>35</td> </tr> <tr> <td>11</td> <td>110</td> <td>53</td> <td>53</td> </tr> <tr> <td>12</td> <td>142</td> <td>108</td> <td>108</td> </tr> <tr> <td>13</td> <td>200</td> <td>124</td> <td>124</td> </tr> <tr> <td>14</td> <td>440</td> <td>314</td> <td>314</td> </tr> <tr> <td>15</td> <td>801</td> <td>450</td> <td>450</td> </tr> <tr> <td>16</td> <td>1,345</td> <td>816</td> <td>816</td> </tr> <tr> <td>17</td> <td>1,194</td> <td>949</td> <td>949</td> </tr> <tr> <td>18</td> <td>2,079</td> <td>2,055</td> <td>2,055</td> </tr> <tr> <td>19</td> <td>3,430</td> <td>2,453</td> <td>2,453</td> </tr> <tr> <td>20</td> <td>7,197</td> <td>820</td> <td>820</td> </tr> <tr> <td>TOTAL</td> <td>5,581</td> <td>16,312</td> <td>16,312</td> </tr> </tbody> </table> How to generalize Dovetailing to any abstractions of any space Multiple Lookups in One Pattern Database Example <table> <thead> <tr> <th>state</th> <th>goal</th> </tr> </thead> <tbody> <tr> <td>2 5</td> <td>1 2</td> </tr> <tr> <td>6 1 8</td> <td>3 4 5</td> </tr> <tr> <td>3 4 7</td> <td>6 7 8</td> </tr> </tbody> </table> Domain = blank 1 2 3 4 5 6 7 8 Abstract = blank 1 0 0 0 0 0 0 0 distance Standard PDB lookup <table> <thead> <tr> <th>abstract state</th> <th>abstract goal</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>1</td> </tr> </tbody> </table> Second lookup, same PDB <table> <thead> <tr> <th>abstract state</th> <th>abstract goal</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>1</td> </tr> </tbody> </table> **Relevance?** Why is this lookup relevant to the original state? **Two Key Properties** 1. Distances are Symmetric 2. Distances are tile-independent **Experimental Results** - 16-disk, 4-peg TOH, PDB of 14 disks - Normal: 72.61 secs - Only the second lookup: 3.31 secs - Both lookups: 1.61 secs - 15-puzzle, additive PDB (8-7) - Normal: 0.034 secs - Only the second lookup: 0.076 secs - Both lookups: 0.022 secs **Additive Pattern Databases** Adding instead of Max’ing • Under some circumstances it is possible to add the values from two PDBs instead of just max’ing them and still have an admissible heuristic. • This is advantageous because \[ h_1(s) + h_2(s) \geq \max(h_1(s), h_2(s)) \] Manhattan Distance Heuristic For a sliding-tile puzzle, Manhattan Distance looks at each tile individually, counts how many moves it is away from its goal position, and adds up these numbers. \[ \begin{array}{c c c} 1 & & 3 \\ 2 & 3 & 1 \\ \end{array} \] \[ \text{MD}(s) = 2 + 1 + 2 = 5 \] M.D. as Additive PDBs (1) \[ \varphi_1(x) = \begin{cases} x & \text{if } x = 1 \\ \text{blank} & \text{otherwise} \end{cases} \] \[ \begin{array}{c c c} 1 & & 1 \\ \varphi_1(\text{goal}) & \varphi_1(s) \\ \end{array} \] \[ \text{PDB}_1(\varphi_1(s)) = 2 \] \[ \text{MD}(s) = \text{PDB}_1(\varphi_1(s)) + \text{PDB}_2(\varphi_2(s)) + \text{PDB}_3(\varphi_3(s)) \] In General... Partition the tiles in groups, \( G_1, G_2, \ldots, G_k \) \[ \varphi_i(x) = \begin{cases} x & \text{if } x \in G_i \\ \text{blank} & \text{otherwise} \end{cases} \] **Korf & Felner’s Method** Partition the tiles in groups, $G_1, G_2, \ldots, G_k$. $$\varphi_i(x) = \begin{cases} x & \text{if } x \in G_i \\ \text{blank} & \text{if } x = \text{blank} \\ \text{otherwise} & \end{cases}$$ Moves of $\square$ cost zero. **What’s the Difference?** - Moves of $\square$ cost zero. - The blank cannot reach the position without disturbing tile 1 or tile 2. **Hierarchical Search** **On-demand distance calculation** - To build a PDB you must calculate all abstract distances-to-goal. - Only a tiny fraction of them are needed to solve any individual problem. - If you only intend to use the PDB to solve a few problems, calculate PDB entries only as you need them. Calculate Distance by Searching at the Abstract Level Replace this line: \[ h(s) = \text{PDB}[\phi(s)] \] by \[ h(s) = \text{search}(\phi(s), \phi(\text{goal})) \] (recursive) call to a search algorithm to compute abstract distance to goal for state s Hierarchical Search 15-puzzle Results (1) • Felner’s 7-7-1 additive PDB: – takes 80 minutes to build (4,800 secs) – Solves problems in 0.058 secs (on average) • Felner’s 8-7 additive PDB – Takes 7 hours to build (25,200 secs) – Solves problems in 0.028 secs 15-puzzle Results (2) Hierarchical IDA*, 1 Gigabyte limit – Using the same abstraction for all problems, solving takes 242 secs (on average), or 207 secs if the cache is not cleared between problems – Max’ing over Corner & Fringe abstractions, solving takes 150 secs (on average) – Using a customized abstraction for each problem, solving takes 74 secs (on average) Thesis topics abound! General Dovetailing A Partial-Order on Domain Abstractions - Easy to enumerate all possible domain abstractions Domain = blank 1 2 3 4 5 6 7 8 Abstract = blank 0 0 0 0 0 0 0 0 - and to define a partial-order on them, e.g. Domain = blank 1 2 3 4 5 6 7 8 Abstract = blank 0 0 0 0 0 0 0 0 is “more abstract” than the domain abstraction above. Lattice of domain abstractions The “LCA” of 2 Abstractions LCA = least-abstract common abstraction General Dovetailing - Given PDB₁ and PDB₂ defined by ϕ₁ and ϕ₂ - Find a common abstraction ψ of ϕ₁ and ϕ₂ - Because it is a common abstraction there exist ϕ₁ and ϕ₂ such that ϕ₁ ϕ₁ = ϕ₂ ϕ₂ = ψ - For every pattern, p, defined by ψ, set SELECT[p] = ϕ₁ or ϕ₂ - Keep every entry (pₖ, h) from PDB for which SELECT[ψ(pₖ)] = i. - Given state s, lookup SELECT[ψ(s)](s)
{"Source-Url": "https://webdocs.cs.ualberta.ca/~holte/CMPUT651/pdb20041031.pdf", "len_cl100k_base": 5042, "olmocr-version": "0.1.53", "pdf-total-pages": 17, "total-fallback-pages": 0, "total-input-tokens": 38536, "total-output-tokens": 5518, "length": "2e12", "weborganizer": {"__label__adult": 0.0005140304565429688, "__label__art_design": 0.0007777214050292969, "__label__crime_law": 0.0009236335754394532, "__label__education_jobs": 0.0016727447509765625, "__label__entertainment": 0.0002856254577636719, "__label__fashion_beauty": 0.0002911090850830078, "__label__finance_business": 0.0007576942443847656, "__label__food_dining": 0.0004880428314208984, "__label__games": 0.003955841064453125, "__label__hardware": 0.00211334228515625, "__label__health": 0.0007109642028808594, "__label__history": 0.0007290840148925781, "__label__home_hobbies": 0.0005574226379394531, "__label__industrial": 0.0017232894897460938, "__label__literature": 0.000621795654296875, "__label__politics": 0.0005207061767578125, "__label__religion": 0.0006589889526367188, "__label__science_tech": 0.314453125, "__label__social_life": 0.00023484230041503904, "__label__software": 0.0186920166015625, "__label__software_dev": 0.6474609375, "__label__sports_fitness": 0.0007448196411132812, "__label__transportation": 0.0008320808410644531, "__label__travel": 0.00031566619873046875}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 12729, 0.07468]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 12729, 0.19481]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 12729, 0.76125]], "google_gemma-3-12b-it_contains_pii": [[0, 1100, false], [1100, 1610, null], [1610, 2604, null], [2604, 3842, null], [3842, 4264, null], [4264, 5501, null], [5501, 6194, null], [6194, 6639, null], [6639, 7250, null], [7250, 8248, null], [8248, 8713, null], [8713, 9176, null], [9176, 10283, null], [10283, 10992, null], [10992, 11883, null], [11883, 12298, null], [12298, 12729, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1100, true], [1100, 1610, null], [1610, 2604, null], [2604, 3842, null], [3842, 4264, null], [4264, 5501, null], [5501, 6194, null], [6194, 6639, null], [6639, 7250, null], [7250, 8248, null], [8248, 8713, null], [8713, 9176, null], [9176, 10283, null], [10283, 10992, null], [10992, 11883, null], [11883, 12298, null], [12298, 12729, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 12729, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 12729, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 12729, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 12729, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 12729, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 12729, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 12729, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 12729, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 12729, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 12729, null]], "pdf_page_numbers": [[0, 1100, 1], [1100, 1610, 2], [1610, 2604, 3], [2604, 3842, 4], [3842, 4264, 5], [4264, 5501, 6], [5501, 6194, 7], [6194, 6639, 8], [6639, 7250, 9], [7250, 8248, 10], [8248, 8713, 11], [8713, 9176, 12], [9176, 10283, 13], [10283, 10992, 14], [10992, 11883, 15], [11883, 12298, 16], [12298, 12729, 17]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 12729, 0.18207]]}
olmocr_science_pdfs
2024-12-06
2024-12-06
ea22aac9fbe4a7f96979c622b083210749b246e6
Announcement • Homework #1 is On Piazza • due date is next Wednesday • TA office Hours for HW#1: Friday 12:30-2:30PM (May 22) Tuesday 12:30-2:30PM (May 26) • Location: EB3353 Cache Design Key elements are: - Cache size - Block size - Mapping function - Replacement algorithm - Write policy - Number of cache levels Cache Design How to improve access time? - **Hit ratio** - The fraction of all memory accesses that are found in the faster memory (e.g., the cache). - **Average access time of processor** \[ T_s = H \times T_1 + (1-H) \times (T_1 + T_2) = T_1 + (1-H) \times T_2 \] - \( T_s \): Average access time - \( T_1 \): Access time of M1 (e.g., cache memory) - \( T_2 \): Access time of M2 (e.g., main memory) - \( H \): Hit ratio How to improve access time? Locality and Caching \[ T_s = H \times T_1 + (1-H) \times (T_1 + T_2) = T_1 + (1-H) \times T_2 \] H is determined by the locality of memory. • Matrix Multiplication ```python for i in 0..n for j in 0..m for k in 0..p C[i][j] = C[i][j] + A[i][k] * B[k][j]; ``` ```python for i in 0..n for k in 0..p for j in 0..m C[i][j] = C[i][j] + A[i][k] * B[k][j]; ``` 1) Multiprocessor I. Asymmetric Multiprocessing II. Symmetric Multiprocessing 2) Multiplecore - Most systems use a **single general-purpose processor** - Most systems have special-purpose processors as well Multiprocessor systems growing in use and importance - Also known as parallel systems, tightly-coupled systems - (cheaper than using multiple computers) - Two types 1. Asymmetric Multiprocessing 2. Symmetric Multiprocessing - Advantages include 1. Performance 2. Availability (graceful degradation or fault tolerance) 3. Incremental growth Symmetric Multiprocessing Architecture - There are multiple similar processors - These processors share same main memory and I/O modules - All processors can perform the same functions (same role or capability) - The system is controlled by an integrated OS - Scheduling among processors! - Synchronization! Computer System Architecture: Multicore Design Learning Objectives • The key functions of an operating system • Discuss the evolution of operating system for early simple (Batch systems to modern complex systems) Functions in the same way as ordinary computer software It is a programs that executed by the processor, but with extra privileges OS relinquishes control of the processor to execute other programs and must depend on the processor to allow it to regain control Operating System Objectives - **Convenience** - Makes the computer more convenient to use - **Efficiency** - Allows computer system resources to be used in an efficient manner - **Ability to evolve** - Permit effective development, testing, and introduction of new system functions without interfering with service Operating Systems Services Two major tasks of an OS system: - Providing convenient environment for user/application - Provide some set of services for user applications - Visible to users - Resource allocation and management - Not much visible to users - How memory is allocated between different users? 1) One set of OS services provides functions that are helpful to the user: - **User interface**: almost all OS have a user interface (UI): varies between Command-Line, Graphics User Interface (GUI), Batch - **Program development**: editors and debuggers - **Program execution**: The system must be able to load a program into memory and to run that program. - **Access to I/O devices** (I/O operation) - **Controlled access to files** - **System access** - **Error detection and handling** 2) Another set of OS functions exists for ensuring the efficient operation of system itself via resource sharing. - **Resource allocation**: when multiple users running concurrently, resources must be allocated to each of the. - **Accounting**: To keep track of which user use how much and what kinds of computer resources. - **Protection and security**: The owner of information should be able to control use of that information. Operating System as Resource Manager Figure 2.2 The Operating System as Resource Manager Operating System Services: Overall Picture - User and other system programs - GUI - Batch - Command line - User interfaces - System calls - Program execution - I/O operations - File systems - Communication - Resource allocation - Accounting - Error detection - Protection and security - Services - Operating system - Hardware • CLI: Command Line Interface (CLI) or command interpreter (shell) – Sometimes implemented in kernel – Sometimes by systems program for example in unix it is a shell – fetches a command from user and executes it • Command may be built-in, • Command may be another program • GUI: User-friendly desktop interface – Icons represent files, programs, actions, etc. Many operating systems now include both CLI and GUI interfaces Linux: command shells available (CLI); KDE as GUI The MacOS X GUI System Calls - Interface between OS and user programs (to perform privileged operations) - **Programming interface** to the services provided by the OS – i.e. interface provided to applications - Are called by a running program to get services - Typically written in a high-level language (C or C++) - Machine dependent, but can be invoked by standard procedure libraries - Even a simple program may make a lot of calls per second. What are system calls used for? Anything to do with: - Accessing devices – Accessing files – Requesting memory – Setting/changing access permissions - Communicating with other processes - Stopping/starting processes - Open a file - Get data from the network - Kill a process Types of System Calls - Process control - File management - Device management - Information maintenance - Communications - Protection - Security - … Accessing and Executing System Calls - System calls typically **not accessed directly** by programs. - Mostly accessed by programs via a high-level **Application Program Interface (API) (i.e. a library)** rather than direct system call use. - APIs are wrapper functions for the system calls. - Three most common APIs are: - Win32 API for Windows, - POSIX API for POSIX-based systems (including virtually all versions of UNIX, Linux, and Mac OS X), - Java API for the Java Virtual Machine (JVM) API Support for System Calls - Your Program - open(...); - ... - API - open(…) - {…} - fopen(…) - {…} - System Calls - sys_open(…) - {…} - Kernel Code - Standard C library Code - Your Program Code User level code Kernel level code Why use APIs rather than system calls directly? ✓ **Platform independent:** System calls differ from platform to platform. ✓ **Upgrade:** The operating system may provide newer versions of a system call with enhanced features. ✓ **More functionality:** The API usually provides more useful functionality than the system call directly. ✓ **More flexibility:** The API can support multiple versions of the operating system and detect which version it needs to use at runtime. Linux system calls Around 300-400 system calls <table> <thead> <tr> <th>Number</th> <th>Generic Name of System Call</th> <th>Name of Function in Kernel</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>exit</td> <td>sys_exit</td> </tr> <tr> <td>2</td> <td>fork</td> <td>sys_fork</td> </tr> <tr> <td>3</td> <td>read</td> <td>sys_read</td> </tr> <tr> <td>4</td> <td>write</td> <td>sys_write</td> </tr> <tr> <td>5</td> <td>open</td> <td>sys_open</td> </tr> <tr> <td>6</td> <td>close</td> <td>sys_close</td> </tr> <tr> <td>...</td> <td>...</td> <td>...</td> </tr> <tr> <td>39</td> <td>mkdir</td> <td>sys_mkdir</td> </tr> <tr> <td>...</td> <td>...</td> <td>...</td> </tr> </tbody> </table> A round 300-400 system calls # Examples of Windows and Unix System Calls <table> <thead> <tr> <th>Category</th> <th>Windows</th> <th>Unix</th> </tr> </thead> <tbody> <tr> <td><strong>Process Control</strong></td> <td>CreateProcess()</td> <td>fork()</td> </tr> <tr> <td></td> <td>ExitProcess()</td> <td>exit()</td> </tr> <tr> <td></td> <td>WaitForSingleObject()</td> <td>wait()</td> </tr> <tr> <td><strong>File Manipulation</strong></td> <td>CreateFile()</td> <td>open()</td> </tr> <tr> <td></td> <td>ReadFile()</td> <td>read()</td> </tr> <tr> <td></td> <td>WriteFile()</td> <td>write()</td> </tr> <tr> <td></td> <td>CloseHandle()</td> <td>close()</td> </tr> <tr> <td><strong>Device Manipulation</strong></td> <td>SetConsoleMode()</td> <td>ioctl()</td> </tr> <tr> <td></td> <td>ReadConsole()</td> <td>read()</td> </tr> <tr> <td></td> <td>WriteConsole()</td> <td>write()</td> </tr> <tr> <td><strong>Information Maintenance</strong></td> <td>GetCurrentProcessID()</td> <td>getpid()</td> </tr> <tr> <td></td> <td>SetTimer()</td> <td>alarm()</td> </tr> <tr> <td></td> <td>Sleep()</td> <td>sleep()</td> </tr> <tr> <td><strong>Communication</strong></td> <td>CreatePipe()</td> <td>pipe()</td> </tr> <tr> <td></td> <td>CreateFileMapping()</td> <td>shmget()</td> </tr> <tr> <td></td> <td>MapViewOfFile()</td> <td>mmap()</td> </tr> <tr> <td><strong>Protection</strong></td> <td>SetFileSecurity()</td> <td>chmod()</td> </tr> <tr> <td></td> <td>InitializeSecurityDescriptor()</td> <td>umask()</td> </tr> <tr> <td></td> <td>SetSecurityDescriptorGroup()</td> <td>chown()</td> </tr> </tbody> </table> A Brief History of Operating Systems First Generation: 1945-1955 (1/3) - No operating system - Vacuum tubes and plugboards ENIAC (Electronic Numerical Integrator And Computer): the first electronic general-purpose computer. First Generation: 1945-1955 (2/3) - Human was the **operator** and **programmer**. - Computer were programmed by physically **re-wiring** it; later, through stored programs (**von Neummann architecture**). Programs written in **machine** or **assembly** language. Problems: 1 - **Serial processing**: users had access to the computer one by one in series. 2 - Users have to write *again and again* the same routines. Second Generation: 1955-1965 (1/3) - Transistors - Mainframes A programmer would first write the program on paper (in FORTRAN or assembly), then punch it on cards. Separation between operators and programmers. - The programmer: prepares her/his job off-line. - The operator: runs the job and delivers a printed output. Problems: - A lot of CPU time is still wasted waiting for I/O instructions to complete. - I/O devices much slower than processor. Third Generation: 1965-1980 (1/2) Integrated Circuits (ICs) [Image of IBM 360 computer] - Multiprogrammed batch systems. - Load two jobs in memory: while one job is waiting for I/O, the processor could switch to the other job. - Expand to three, four or more jobs. - Jobs are kept in main memory at the same time and the CPU is multiplexed among them or multiprogrammed. Fourth Generation: 1980-Present (1/3) Personal Computers (PCs) Fourth Generation: 1980-Present (2/3) - From multiple users back to a **single user**. - **Multitasking** a central feature of modern PC operating systems. - **PC systems** emphasize **user convenience**. Fourth Generation: 1980-Present (3/3) - GNU (GNU's Not Unix!): 1983 - Mac OS: 1984 - Microsoft Windows: 1985 - Linux: 1991 Evolution of Operating Systems A major OS will evolve over time for a number of reasons: - Hardware upgrades - New types of hardware - New services - Fixes Take advantage of hardware upgrades and new types/functions of hardware e.g. paging support or multicore Generations include: - Serial Processing - Simple Batch Systems - Multiprogrammed Batch Systems - Time Sharing Systems Serial Processing Earliest Computers: - **No operating system** - programmers interacted directly with the computer hardware - Computers run from a console with display lights (error messages), toggle switches, some form of input device (punch card, tape), and a printer (for output) - Users have access to the computer in “series” Problems: - **Scheduling time:** - most installations used a hardcopy sign-up sheet to reserve computer time - time allocations could run short or long, resulting in wasted computer time - **Setup time (very time consuming)** - a considerable amount of time was spent just on setting up the program to run Simple Batch Systems - Early computers were very expensive - important to maximize processor utilization - The central idea behind the simple batch-processing scheme: Monitor - Monitor - user no longer has direct access to processor - job is submitted to computer operator who batches them together and places them on an input device - program branches back to the monitor when finished Monitor Point of View - **Resident Monitor** is software always in memory and available for execution - Monitor: scheduling, privileged operations - Users submit jobs to operator - Operator batches jobs together - places them on an input device - Software that controls the running programs - Monitor reads in job and gives control - Monitor controls the sequence of events - Program branches back to monitor when finished (Job returns control to monitor) ![Figure 2.3 Memory Layout for a Resident Monitor](image) Processor Point of View - Processor executes instruction from the memory containing the monitor - Executes the instructions in the user program until it encounters an ending or error condition - “control is passed to a job” means processor is fetching and executing instructions in a user program - “control is returned to the monitor” means that the processor is fetching and executing instructions from the monitor program Job Control Language (JCL) Special type of programming language used to provide instructions to the monitor (compiler, data) - what compiler to use - what data to use $JOB $FTN ... [FORTRAN program] ... $LOAD $RUN ... [data] ... $END Desirable Hardware Features Memory protection for monitor • while the user program is executing, it must not alter the memory area containing the monitor Timer • prevents a job from monopolizing the system Privileged instructions • can only be executed by the monitor Interrupts • gives OS more flexibility in controlling user programs Simple Batch Systems: Modes of Operation User Mode - user program executes in user mode - certain areas of memory are protected from user access - certain instructions may not be executed Kernel Mode - monitor executes in kernel mode - privileged instructions may be executed - protected areas of memory may be accessed Simple Batch System Overhead - Processor time alternates between execution of user programs and execution of the monitor - Sacrifices: - some main memory is now given over to the monitor - some processor time is consumed by the monitor - Despite overhead, the simple batch system improves utilization of the computer In simple batch OS the processor is often idle! - The processor spends a certain amount of time executing, until it reaches an I/O instruction; it must then wait until that I/O instruction concludes before proceeding. Multiprogramming - There must be enough memory to hold the OS (resident monitor) and one user program. - When one job needs to wait for I/O, the processor can switch to the other job, which is likely not waiting for I/O. Multiprogramming - Multiprogramming - also known as multitasking - memory is expanded to hold three, four, or more programs and switch among all of them Multiprogramming - Processor has more than one program to execute - The sequence in which the programs are executed depends on their relative priority and whether they are waiting for I/O - After an interrupt handler completes, control may not return to the program that was executing at the time of the interrupt Multiprogramming Example For a simple batch environment, these jobs will be executed in sequence: Tree jobs comp complete after 30 minutes. For Multiprogramming: these jobs will be executed concurrently. Device Utilization Histograms (a) Uniprogramming (b) Multiprogramming ### Table 2.2 Effects of Multiprogramming on Resource Utilization <table> <thead> <tr> <th></th> <th>Uniprogramming</th> <th>Multiprogramming</th> </tr> </thead> <tbody> <tr> <td>Processor use</td> <td>20%</td> <td>40%</td> </tr> <tr> <td>Memory use</td> <td>33%</td> <td>67%</td> </tr> <tr> <td>Disk use</td> <td>33%</td> <td>67%</td> </tr> <tr> <td>Printer use</td> <td>33%</td> <td>67%</td> </tr> <tr> <td>Elapsed time</td> <td>30 min</td> <td>15 min</td> </tr> <tr> <td>Throughput</td> <td>6 jobs/hr</td> <td>12 jobs/hr</td> </tr> <tr> <td>Mean response time</td> <td>18 min</td> <td>10 min</td> </tr> </tbody> </table> Time-Sharing Systems - For many applications the interaction with users is essential. - Processor time is shared among multiple users - Using multiprogramming to handle multiple interactive jobs - Multiple users simultaneously access the system through terminals, with the OS interleaving the execution of each user program in a short burst or quantum of computation Both batch processing and time sharing use multiprogramming. The key differences are: <table> <thead> <tr> <th>Principal objective</th> <th>Batch Multiprogramming</th> <th>Time Sharing</th> </tr> </thead> <tbody> <tr> <td>Source of directives to operating system</td> <td>Maximize processor use</td> <td>Minimize response time</td> </tr> <tr> <td></td> <td>Job control language commands provided with the job</td> <td>Commands entered at the terminal</td> </tr> </tbody> </table> Table 2.3 Batch Multiprogramming versus Time Sharing Major OS Developments Major Advances - Operating Systems are among the most complex pieces of software ever developed Major advances in development include: - Processes - Memory management - Information protection and security - Scheduling and resource management - System structure It is somewhat more general than job Fundamental to the structure of operating systems Many definitions have been given including A process can be defined as: - a program in execution - an instance of a running program - the entity that can be assigned to, and executed on, a processor - a unit of activity characterized by - a single sequential thread of execution, - a current state, and - an associated set of system resources Three major lines of computer system development created problems in timing and synchronization that contributed to the development: - **Multiprogramming batch operation** - Processor is switched among the various programs residing in main memory - **Time sharing** - Be responsive to the individual user but be able to support many users simultaneously - **Real-time transaction systems** - A number of users are entering queries or updates against a database Causes of Errors - **Improper synchronization** - a program must wait until the data are available in a buffer - improper design of the signaling mechanism can result in loss or duplication - **Failed mutual exclusion** - more than one user or program attempts to make use of a shared resource at the same time - only one routine at a time allowed to perform an update against the file - **Nondeterminate program operation** - program execution is interleaved by the processor when memory is shared - the order in which programs are scheduled may affect their outcome - **Deadlocks** - it is possible for two or more programs to be hung up waiting for each other - may depend on the chance timing of resource allocation and release Components of a Process - A process contains three components: - an executable program - the associated data needed by the program (variables, work space, buffers, etc.) - the execution context (or “process state”) of the program - The execution context is essential: - it is the internal data by which the OS is able to supervise and control the process - includes the contents of the various process registers - includes information such as the priority of the process and whether the process is waiting for the completion of a particular I/O event Process Management - The entire state of the process at any instant is contained in its context. - New features can be designed and incorporated into the OS by expanding the context to include any new information needed to support the feature. Figure 2.8 Typical Process Implementation The OS has **five** principal storage management responsibilities: - Process isolation - Automatic allocation and management - Support of modular programming - Protection and access control - Long-term storage Virtual Memory - A facility that allows programs to address memory from a logical point of view, without regard to the amount of main memory physically available - Conceived to meet the requirement of having multiple user jobs reside in main memory concurrently Paging - Allows processes to be comprised of a number of fixed-size blocks, called pages - Program references a word by means of a virtual address - consists of a page number and an offset within the page - each page may be located anywhere in main memory - Provides for a dynamic mapping between the virtual address used in the program and a real (or physical) address in main memory Virtual Memory Main memory consists of a number of fixed-length frames, each equal to the size of a page. For a program to execute, some or all of its pages must be in main memory. <table> <thead> <tr> <th>A.0</th> <th>A.2</th> </tr> </thead> <tbody> <tr> <td>A.5</td> <td>A.7</td> </tr> <tr> <td>A.9</td> <td></td> </tr> <tr> <td>A.8</td> <td></td> </tr> <tr> <td>B.0</td> <td>B.1</td> </tr> <tr> <td>B.5</td> <td>B.6</td> </tr> </tbody> </table> Secondary memory (disk) can hold many fixed-length pages. A user program consists of some number of pages. Pages for all programs plus the operating system are on disk, as are files. Figure 2.9 Virtual Memory Concepts Virtual Memory Addressing The nature of the threat that concerns an organization will vary greatly depending on the circumstances. The problem involves controlling access to computer systems and the information stored in them. Main issues: - Availability - Confidentiality - Data integrity - Authenticity Scheduling and Resource Management - Key responsibility of an OS is managing resources - Resource allocation policies must consider: - fairness - efficiency - differential responsiveness Key Elements of an Operating System Figure 2.11 Key Elements of an Operating System for Multiprogramming Different Architectural Approaches Demands on operating systems require new ways of organizing the OS Different approaches and design elements have been tried: - Microkernel architecture - Multithreading - Symmetric multiprocessing - Distributed operating systems - Object-oriented design Microkernel Architecture - Assigns only a few essential functions to the kernel: - address spaces - interprocess communication (IPC) - basic scheduling - The approach: - simplifies implementation - provides flexibility - is well suited to a distributed environment Multithreading - Technique in which a process, executing an application, is divided into threads that can run concurrently Thread - dispatchable unit of work - includes a processor context and its own data area to enable subroutine branching - executes sequentially and is interruptible Process - a collection of one or more threads and associated system resources - programmer has greater control over the modularity of the application and the timing of application related events Symmetric Multiprocessing (SMP) - Term that refers to a computer hardware architecture and also to the OS behavior that exploits that architecture - Several processes can run in parallel - Multiple processors are transparent to the user - these processors share same main memory and I/O facilities - all processors can perform the same functions - The OS takes care of scheduling of threads or processes on individual processors and of synchronization among processors SMP Advantages Availability • failure of a single process does not halt the system Performance • more than one process can be running simultaneously, each on a different processor Incremental Growth • performance of a system can be enhanced by adding an additional processor Scaling • vendors can offer a range of products based on the number of processors configured in the system Multi-programming Multi-processing (a) Interleaving (multiprogramming, one processor) (b) Interleaving and overlapping (multiprocessing; two processors) Figure 2.12 Multiprogramming and Multiprocessing **OS Design** **Distributed Operating System** - Provides the illusion of - a single main memory space - single secondary memory space - unified access facilities - State of the art for distributed operating systems lags that of uniprocessor and SMP operating systems **Object-Oriented Design** - Used for adding modular extensions to a small kernel - Enables programmers to customize an operating system without disrupting system integrity - Eases the development of distributed tools and full-blown distributed operating systems Virtual Machines and Virtualization - Virtualization - enables a single PC or server to simultaneously run multiple operating systems or multiple sessions of a single OS - a machine can host numerous applications, including those that run on different operating systems, on a single platform - host operating system can support a number of virtual machines (VM) - each has the characteristics of a particular OS and, in some versions of virtualization, the characteristics of a particular hardware platform. Virtual Memory Concept Figure 2.13 Virtual Memory Concept Virtual Machine Architecture Process perspective: • the machine on which it executes consists of the virtual memory space assigned to the process • the processor registers it may use • the user-level machine instructions it may execute • OS system calls it may invoke for I/O • ABI defines the machine as seen by a process Application perspective: • machine characteristics are specified by high-level language capabilities and OS system library calls • API defines the machine for an application OS perspective: • processes share a file system and other I/O resources • system allocates real memory and I/O resources to the processes • ISA provides the interface between the system and machine Process and System Virtual Machines Figure 2.14 Process and System Virtual Machines Process and System Virtual Machines Figure 2.14 Process and System Virtual Machines Symmetric Multiprocessor OS Considerations - A multiprocessor OS must provide all the functionality of a multiprogramming system plus additional features to accommodate multiple processors - **Key design issues:** <table> <thead> <tr> <th>Simultaneous concurrent processes or threads</th> <th>Scheduling</th> <th>Synchronization</th> <th>Memory management</th> <th>Reliability and fault tolerance</th> </tr> </thead> <tbody> <tr> <td>kernel routines need to be reentrant to allow several processors to execute the same kernel code simultaneously</td> <td>any processor may perform scheduling, which complicates the task of enforcing a scheduling policy</td> <td>with multiple active processes having potential access to shared address spaces or shared I/O resources, care must be taken to provide</td> <td>the reuse of physical pages is the biggest problem of concern</td> <td>the OS should provide graceful degradation in the face of processor failure</td> </tr> </tbody> </table> The design challenge for a many-core multicore system is to efficiently harness the multicore processing power and intelligently manage the substantial on-chip resources efficiently. Potential for parallelism exists at three levels: - Potential for a single application to execute in concurrent processes or threads across multiple cores. - Potential for multiprogramming and multithreaded execution within each processor. - Instruction level parallelism potential for parallelism within each core processor, known as instruction level parallelism within each core processor. Grand Central Dispatch (GCD) - implemented in Mac Os X 10.6 - helps a developer once something has been identified that can be split off into a separate task - thread pool mechanism - allows anonymous functions as a way of specifying tasks Developer must decide what pieces can or should be executed simultaneously or in parallel. Virtual Machine Approach - Allows one or more cores to be dedicated to a particular process and then leave the processor alone to devote its efforts to that process. - Multicore OS could then act as a hypervisor that makes a high-level decision to allocate cores to applications but does little in the way of resource allocation beyond that. Summary - Operating system objectives and functions: - convenience, efficiency, ability to evolve - user/computer interface - resource manager - Evolution: - serial processing, simple batch systems, multiprogrammed batch systems, time sharing systems - Process - Memory management - real address, virtual address - Scheduling and resource management - Multithreading - Symmetric multiprocessing (SMP) - distributed OS - object oriented design
{"Source-Url": "http://www.cse.msu.edu/~forsati/cse410s15/Lectures/Chapter%202.pdf", "len_cl100k_base": 6888, "olmocr-version": "0.1.50", "pdf-total-pages": 92, "total-fallback-pages": 0, "total-input-tokens": 119146, "total-output-tokens": 9737, "length": "2e12", "weborganizer": {"__label__adult": 0.00060272216796875, "__label__art_design": 0.0012493133544921875, "__label__crime_law": 0.0006656646728515625, "__label__education_jobs": 0.038726806640625, "__label__entertainment": 0.00016772747039794922, "__label__fashion_beauty": 0.00033402442932128906, "__label__finance_business": 0.0006747245788574219, "__label__food_dining": 0.0005536079406738281, "__label__games": 0.0014247894287109375, "__label__hardware": 0.0178680419921875, "__label__health": 0.0008692741394042969, "__label__history": 0.0011615753173828125, "__label__home_hobbies": 0.0003578662872314453, "__label__industrial": 0.002105712890625, "__label__literature": 0.0007066726684570312, "__label__politics": 0.0005040168762207031, "__label__religion": 0.0010976791381835938, "__label__science_tech": 0.274658203125, "__label__social_life": 0.0002453327178955078, "__label__software": 0.022796630859375, "__label__software_dev": 0.630859375, "__label__sports_fitness": 0.0005865097045898438, "__label__transportation": 0.0014543533325195312, "__label__travel": 0.00034928321838378906}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 29630, 0.01198]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 29630, 0.55756]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 29630, 0.87412]], "google_gemma-3-12b-it_contains_pii": [[0, 178, false], [178, 320, null], [320, 758, null], [758, 1170, null], [1170, 1271, null], [1271, 1386, null], [1386, 1739, null], [1739, 2048, null], [2048, 2095, null], [2095, 2095, null], [2095, 2263, null], [2263, 2526, null], [2526, 2850, null], [2850, 3165, null], [3165, 3662, null], [3662, 4096, null], [4096, 4186, null], [4186, 4539, null], [4539, 5030, null], [5030, 5046, null], [5046, 5486, null], [5486, 5769, null], [5769, 5919, null], [5919, 6421, null], [6421, 6677, null], [6677, 7155, null], [7155, 8004, null], [8004, 9617, null], [9617, 9654, null], [9654, 9917, null], [9917, 10184, null], [10184, 10339, null], [10339, 10505, null], [10505, 10661, null], [10661, 10793, null], [10793, 10941, null], [10941, 11227, null], [11227, 11291, null], [11291, 11499, null], [11499, 11623, null], [11623, 11654, null], [11654, 11886, null], [11886, 12006, null], [12006, 12659, null], [12659, 13058, null], [13058, 13574, null], [13574, 14003, null], [14003, 14240, null], [14240, 14580, null], [14580, 14902, null], [14902, 15226, null], [15226, 15445, null], [15445, 15667, null], [15667, 15825, null], [15825, 16142, null], [16142, 16348, null], [16348, 16420, null], [16420, 17027, null], [17027, 17395, null], [17395, 18052, null], [18052, 18074, null], [18074, 18338, null], [18338, 18778, null], [18778, 19248, null], [19248, 20000, null], [20000, 20565, null], [20565, 20854, null], [20854, 21065, null], [21065, 21328, null], [21328, 21718, null], [21718, 22219, null], [22219, 22245, null], [22245, 22527, null], [22527, 22721, null], [22721, 22827, null], [22827, 23119, null], [23119, 23398, null], [23398, 23883, null], [23883, 24357, null], [24357, 24743, null], [24743, 24949, null], [24949, 25488, null], [25488, 26007, null], [26007, 26066, null], [26066, 26764, null], [26764, 26849, null], [26849, 26934, null], [26934, 27917, null], [27917, 28495, null], [28495, 28828, null], [28828, 29172, null], [29172, 29630, null]], "google_gemma-3-12b-it_is_public_document": [[0, 178, true], [178, 320, null], [320, 758, null], [758, 1170, null], [1170, 1271, null], [1271, 1386, null], [1386, 1739, null], [1739, 2048, null], [2048, 2095, null], [2095, 2095, null], [2095, 2263, null], [2263, 2526, null], [2526, 2850, null], [2850, 3165, null], [3165, 3662, null], [3662, 4096, null], [4096, 4186, null], [4186, 4539, null], [4539, 5030, null], [5030, 5046, null], [5046, 5486, null], [5486, 5769, null], [5769, 5919, null], [5919, 6421, null], [6421, 6677, null], [6677, 7155, null], [7155, 8004, null], [8004, 9617, null], [9617, 9654, null], [9654, 9917, null], [9917, 10184, null], [10184, 10339, null], [10339, 10505, null], [10505, 10661, null], [10661, 10793, null], [10793, 10941, null], [10941, 11227, null], [11227, 11291, null], [11291, 11499, null], [11499, 11623, null], [11623, 11654, null], [11654, 11886, null], [11886, 12006, null], [12006, 12659, null], [12659, 13058, null], [13058, 13574, null], [13574, 14003, null], [14003, 14240, null], [14240, 14580, null], [14580, 14902, null], [14902, 15226, null], [15226, 15445, null], [15445, 15667, null], [15667, 15825, null], [15825, 16142, null], [16142, 16348, null], [16348, 16420, null], [16420, 17027, null], [17027, 17395, null], [17395, 18052, null], [18052, 18074, null], [18074, 18338, null], [18338, 18778, null], [18778, 19248, null], [19248, 20000, null], [20000, 20565, null], [20565, 20854, null], [20854, 21065, null], [21065, 21328, null], [21328, 21718, null], [21718, 22219, null], [22219, 22245, null], [22245, 22527, null], [22527, 22721, null], [22721, 22827, null], [22827, 23119, null], [23119, 23398, null], [23398, 23883, null], [23883, 24357, null], [24357, 24743, null], [24743, 24949, null], [24949, 25488, null], [25488, 26007, null], [26007, 26066, null], [26066, 26764, null], [26764, 26849, null], [26849, 26934, null], [26934, 27917, null], [27917, 28495, null], [28495, 28828, null], [28828, 29172, null], [29172, 29630, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 29630, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, true], [5000, 29630, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 29630, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 29630, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 29630, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 29630, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 29630, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 29630, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 29630, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 29630, null]], "pdf_page_numbers": [[0, 178, 1], [178, 320, 2], [320, 758, 3], [758, 1170, 4], [1170, 1271, 5], [1271, 1386, 6], [1386, 1739, 7], [1739, 2048, 8], [2048, 2095, 9], [2095, 2095, 10], [2095, 2263, 11], [2263, 2526, 12], [2526, 2850, 13], [2850, 3165, 14], [3165, 3662, 15], [3662, 4096, 16], [4096, 4186, 17], [4186, 4539, 18], [4539, 5030, 19], [5030, 5046, 20], [5046, 5486, 21], [5486, 5769, 22], [5769, 5919, 23], [5919, 6421, 24], [6421, 6677, 25], [6677, 7155, 26], [7155, 8004, 27], [8004, 9617, 28], [9617, 9654, 29], [9654, 9917, 30], [9917, 10184, 31], [10184, 10339, 32], [10339, 10505, 33], [10505, 10661, 34], [10661, 10793, 35], [10793, 10941, 36], [10941, 11227, 37], [11227, 11291, 38], [11291, 11499, 39], [11499, 11623, 40], [11623, 11654, 41], [11654, 11886, 42], [11886, 12006, 43], [12006, 12659, 44], [12659, 13058, 45], [13058, 13574, 46], [13574, 14003, 47], [14003, 14240, 48], [14240, 14580, 49], [14580, 14902, 50], [14902, 15226, 51], [15226, 15445, 52], [15445, 15667, 53], [15667, 15825, 54], [15825, 16142, 55], [16142, 16348, 56], [16348, 16420, 57], [16420, 17027, 58], [17027, 17395, 59], [17395, 18052, 60], [18052, 18074, 61], [18074, 18338, 62], [18338, 18778, 63], [18778, 19248, 64], [19248, 20000, 65], [20000, 20565, 66], [20565, 20854, 67], [20854, 21065, 68], [21065, 21328, 69], [21328, 21718, 70], [21718, 22219, 71], [22219, 22245, 72], [22245, 22527, 73], [22527, 22721, 74], [22721, 22827, 75], [22827, 23119, 76], [23119, 23398, 77], [23398, 23883, 78], [23883, 24357, 79], [24357, 24743, 80], [24743, 24949, 81], [24949, 25488, 82], [25488, 26007, 83], [26007, 26066, 84], [26066, 26764, 85], [26764, 26849, 86], [26849, 26934, 87], [26934, 27917, 88], [27917, 28495, 89], [28495, 28828, 90], [28828, 29172, 91], [29172, 29630, 92]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 29630, 0.09076]]}
olmocr_science_pdfs
2024-11-28
2024-11-28
7be3785ff0b3c8ff1de2dda693fe090abd4295d6
[REMOVED]
{"Source-Url": "https://hal.archives-ouvertes.fr/hal-00498782/file/qosa10-2.pdf", "len_cl100k_base": 7810, "olmocr-version": "0.1.53", "pdf-total-pages": 17, "total-fallback-pages": 0, "total-input-tokens": 39429, "total-output-tokens": 9713, "length": "2e12", "weborganizer": {"__label__adult": 0.0003476142883300781, "__label__art_design": 0.0007529258728027344, "__label__crime_law": 0.0002853870391845703, "__label__education_jobs": 0.0006003379821777344, "__label__entertainment": 5.078315734863281e-05, "__label__fashion_beauty": 0.00013625621795654297, "__label__finance_business": 0.0002343654632568359, "__label__food_dining": 0.0003161430358886719, "__label__games": 0.0003712177276611328, "__label__hardware": 0.0005002021789550781, "__label__health": 0.0003056526184082031, "__label__history": 0.00018131732940673828, "__label__home_hobbies": 6.824731826782227e-05, "__label__industrial": 0.0002968311309814453, "__label__literature": 0.00024259090423583984, "__label__politics": 0.00022280216217041016, "__label__religion": 0.0004134178161621094, "__label__science_tech": 0.00495147705078125, "__label__social_life": 6.258487701416016e-05, "__label__software": 0.0037746429443359375, "__label__software_dev": 0.9853515625, "__label__sports_fitness": 0.0002446174621582031, "__label__transportation": 0.00034332275390625, "__label__travel": 0.0001819133758544922}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 42333, 0.02371]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 42333, 0.52439]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 42333, 0.90326]], "google_gemma-3-12b-it_contains_pii": [[0, 986, false], [986, 3433, null], [3433, 6638, null], [6638, 9707, null], [9707, 11617, null], [11617, 14706, null], [14706, 17708, null], [17708, 20709, null], [20709, 22444, null], [22444, 25156, null], [25156, 26587, null], [26587, 28844, null], [28844, 31581, null], [31581, 33166, null], [33166, 36511, null], [36511, 39432, null], [39432, 42333, null]], "google_gemma-3-12b-it_is_public_document": [[0, 986, true], [986, 3433, null], [3433, 6638, null], [6638, 9707, null], [9707, 11617, null], [11617, 14706, null], [14706, 17708, null], [17708, 20709, null], [20709, 22444, null], [22444, 25156, null], [25156, 26587, null], [26587, 28844, null], [28844, 31581, null], [31581, 33166, null], [33166, 36511, null], [36511, 39432, null], [39432, 42333, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 42333, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 42333, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 42333, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 42333, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 42333, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 42333, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 42333, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 42333, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 42333, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 42333, null]], "pdf_page_numbers": [[0, 986, 1], [986, 3433, 2], [3433, 6638, 3], [6638, 9707, 4], [9707, 11617, 5], [11617, 14706, 6], [14706, 17708, 7], [17708, 20709, 8], [20709, 22444, 9], [22444, 25156, 10], [25156, 26587, 11], [26587, 28844, 12], [28844, 31581, 13], [31581, 33166, 14], [33166, 36511, 15], [36511, 39432, 16], [39432, 42333, 17]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 42333, 0.0]]}
olmocr_science_pdfs
2024-12-09
2024-12-09
059004403839d91e7c44742ec1e434eae720d58e
Towards a Standardised Performance Evaluation Protocol for Cooperative MARL Rihab Gorsane Omayma Mahjoub Ruan de Kock Roland Dubb Siddarth Singh Arnu Pretorius 1InstaDeep 2National School of Computer Science, Tunisia 3University of Cape Town, South Africa Abstract Multi-agent reinforcement learning (MARL) has emerged as a useful approach to solving decentralised decision-making problems at scale. Research in the field has been growing steadily with many breakthrough algorithms proposed in recent years. In this work, we take a closer look at this rapid development with a focus on evaluation methodologies employed across a large body of research in cooperative MARL. By conducting a detailed meta-analysis of prior work, spanning 75 papers accepted for publication from 2016 to 2022, we bring to light worrying trends that put into question the true rate of progress. We further consider these trends in a wider context and take inspiration from single-agent RL literature on similar issues with recommendations that remain applicable to MARL. Combining these recommendations, with novel insights from our analysis, we propose a standardised performance evaluation protocol for cooperative MARL. We argue that such a standard protocol, if widely adopted, would greatly improve the validity and credibility of future research, make replication and reproducibility easier, as well as improve the ability of the field to accurately gauge the rate of progress over time by being able to make sound comparisons across different works. Finally, we release our meta-analysis data publicly on our project website for future research on evaluation accompanied by our open-source evaluation tools repository. 1 Introduction Empirical evaluation methods in single-agent reinforcement learning (RL) have been closely scrutinised in recent years (Islam et al., 2017; Machado et al., 2017; Henderson, 2018; Zhang et al., 2018; Henderson et al., 2018; Colas et al., 2018a, 2019; Chan et al., 2020; Jordan et al., 2020; Engstrom et al., 2020; Agarwal et al., 2022). In this context, the impact of a lack of rigour and methodological standards has already been observed. Fortunately, just as these issues have arisen and been identified, they have also been accompanied by suggested solutions and recommendations from these works. Equal contribution. Corresponding author: r.gorsane@instadeep.com Work done during an internship at InstaDeep. https://sites.google.com/view/marl-standard-protocol https://github.com/instadeepai/marl-eval In this paper, we use the term ”RL” to exclusively refer to single-agent RL, as opposed to RL as a field of study, of which MARL is a subfield. Multi-agent reinforcement learning (MARL) extends RL with capabilities to solve large-scale decentralised decision-making tasks where many agents are expected to coordinate to achieve a shared objective (Foerster, 2018; Oroojlooyjadid and Hajinezhad, 2019; Yang and Wang, 2020). In this cooperative setting, where there is a common goal and rewards are shared between agents, sensible evaluation methodology from the single-agent case often directly translates to the multi-agent case. However, despite MARL being far less developed and entrenched than RL, arguably making adoption of principled evaluation methods easier, the field remains affected by many of the same issues as found in RL. Implementation variance, inconsistent baselines, and insufficient statistical rigour still affect the quality of reported results. Although work specifically addressing these issues in MARL have been rare, there have been recent publications that implicitly observe some of the aforementioned issues and attempt to address their symptoms but arguably not their root cause (Yu et al., 2021; Papoudakis et al., 2021; Hu et al., 2022). These works usually attempt to perform new summaries of performance or look into the code-level optimisations used in the literature to provide insight into the current state of research. In this paper, we argue that to facilitate long-term progress in future research, MARL could benefit from the literature found in RL on evaluation. The highlighted issues and recommendations from RL may serve as a guide towards diagnosing similar issues in MARL, as well as providing scaffolding around which a standardised protocol for evaluation could be developed. In this spirit, we survey key works in RL over the previous decade, each relating to a particular aspect of evaluation, and use these insights to inform potential standards for evaluation in MARL. For each aspect of evaluation considered, we provide a detailed assessment of the corresponding situation in MARL through a meta-analysis of prior work. In more detail, our meta-analysis involved manually annotating MARL evaluation methodologies found in research papers published between 2016 to 2022 from various conferences including NeurIPS, ICML, AAMAS and ICLR, with a focus on deep cooperative MARL (see Figure 1). In total, we collected data from 75 cooperative MARL papers accepted for publication. Although we do not claim our dataset to comprise the entire field of modern deep MARL, to the best of our knowledge, our data includes all popular and recent deep MARL algorithms and methodologies from seminal papers. We believe this dataset is the first of its kind and we have made it publicly available for further analysis. By mining the data on MARL evaluation from prior work, we highlight how certain trends, worrying inconsistencies, poor reporting, a lack of uncertainty estimation, and a general absence of proper standards for evaluation, is plaguing the current state of MARL research, making it difficult to draw sound conclusions from comparative studies. We combine these findings with the earlier issues and recommendations highlighted in the literature on RL evaluation, to propose a standardised performance evaluation protocol for cooperative MARL research. In addition to a standardised protocol for evaluation, we expose trends in the use of benchmark environments and suggest useful standards for environment designers that could further improve the state of evaluation in MARL. We touch upon aspects of environment bias, manipulation, level/map cherry picking as well as scalability and computational considerations. Our recommendations pertain to designer specified standards concerning the use of a particular environment, its agreed upon settings, scenarios and version, as well as improved reporting by authors and preferring the use of environments designed to test generalisation. There are clear parallels between RL and MARL evaluation, especially in the cooperative setting. Therefore, we want to emphasise that our contribution in this work is less focused on innovations in protocol design (of which much can be ported from RL) and more focused on data-driven insights on the current state of MARL research and a proposal of standards for MARL evaluation. Figure 1: Recorded papers by year in the meta-analysis on evaluation methodologies in cooperative MARL. 2 From RL to MARL evaluation: lessons, trends and recommendations In this section, we provide a list of key lessons from RL that are applicable to MARL evaluation. We highlight important issues identified from the literature on RL evaluation, and for each issue, provide an assessment of the corresponding situation and trends in MARL. Finally, we conclude each lesson with recommendations stemming from our analysis and the literature. 2.1 Lesson 1: Know the true source of improvement and report everything Issue in RL – Confounding code-level optimisations and poor reporting: It has been shown empirically that across some RL papers there is considerable variance in the reported results for the same algorithms evaluated on the same environments (Henderson et al., 2018; Jordan et al., 2020). This variance impedes the development of novel algorithmic developments by creating misleading performance comparisons and making direct comparisons of results across papers difficult. Implementation and code-level optimisation differences can have a significant impact on algorithm performance and may act as confounders during performance evaluation (Engstrom et al., 2020; Andrychowicz et al., 2020). It is rare that these implementation and code-level details are reported, or that appropriate ablations are conducted to pinpoint the true source of performance improvement. The situation in MARL – Similar inconsistencies and poor reporting but a promising rise in ablation studies: There already exist some work in MARL showing the effects of specific code-level optimisations on evaluation performance (Hu et al., 2021). Employing different optimisers, exploration schedules, or simply setting the number of rollout processes to be different, can have a significant effect on algorithm performance. To better understand the variance in performance reporting across works in MARL, we focused on QMIX (Rashid et al., 2018), the most popular algorithm in our dataset (as shown in Figure 2 (a)). In Figure 2 (b), we plot the performance of QMIX tested on different maps from the StarCraft multi-agent challenge (SMAC) environment (Samvelyan et al., 2019), a popular benchmark in MARL. On several maps, we find widely different reported performances with large discrepancies across papers. Although it is difficult to pin down the exact source of these differences in reports, we zoom in with our analysis to only consider a single environment, in this case M8M2. We find that some of the variance is explained by differences in the environment version as well as the length of training time, as shown in Figure 2 (c). However, even when both of these aspects are controlled for, as well as any implementation or evaluation details mentioned in each paper, differences in performance are still observed (as seen by comparing orange and blue circles, respectively). This provides evidence that unreported implementation details, or differences in evaluation methodology account for some of the observed variance and act as confounders when comparing performance across papers (similar inconsistencies in other maps are shown in the Appendix). We finally consider studying the explicit attempts in published works at understanding the sources of algorithmic improvement through the use of ablation studies. We find that very few of these studies were performed in the earlier years of MARL (see Figure 2 (d)). However, even though roughly 40% of papers in 2021 still lacked any form of ablation study, we find a promising trend showing that ablation studies have become significantly more prevalent in recent years. **Recommendations** – Report all experimental details, release code and include ablation studies: Henderson et al. (2018) emphasise that for results to be reproducible, it is important that papers report all experimental details. This includes hyperparameters, code-level optimisations, tuning procedures, as well as a precise description of how the evaluation was performed on both the baseline and novel work. It is also important that code be made available to easily replicate findings and stress test claims of general performance improvements. Furthermore, Engstrom et al. (2020) propose that algorithm designers be more rigorous in their analysis of the effects of individual components and how these impact performance through the use of detailed ablation studies. It is important that researchers practice diligence in attributing how the overall performance of algorithms and their underlying algorithmic behavior are affected by different proposed innovations, implementation details and code-level optimisations. In the light of our above analysis, we argue that the situation is no different in MARL, and therefore suggest the field adopt more rigorous reporting and conduct detailed ablation studies of proposed innovations. ### 2.2 Lesson 2: Use standardised statistical tooling for estimating and reporting uncertainty **Issue in RL** – *Results in papers do not take into account uncertainty:* We have discussed how different implementations of the same algorithm with the same set of hyperparameters can lead to drastically different results. However, even under such a high degree of variability, typical methodologies often ignore the uncertainty in their reporting (Colas et al., 2018a, 2019; Jordan et al., 2020; Agarwal et al., 2022). Furthermore, most published results in RL make use of point estimates like the mean or median performance and do not take into account the statistical uncertainty arising from only using a finite number of testing runs. For instance, Agarwal et al. (2022) found that the current norm of using only a few runs to evaluate the performance of an RL algorithm is insufficient and does not account for the variability of the point estimate used. Furthermore, Agarwal et al. (2022) also revealed that the manner in which point estimates are chosen varies between authors. This inconsistency invalidates direct comparison between results across papers. **The situation in MARL** – *A lack of shared standards for uncertainty estimation and concerning omissions in reporting:* In Figure 3 (a)-(c), we investigate the use of statistical aggregation and uncertainty quantification methods in MARL. We find considerable variability in the methods used, with little indication of standardisation. Perhaps more concerning is a complete absence of proper uncertainty quantification from one third of published papers. On a more positive note, we observe an upward trend in the use of standard deviation as an uncertainty measure in recent years, particularly in 2021. Furthermore, it has become fairly standard in MARL to evaluate algorithms at regular intervals during the training phase by conducting a certain number of independent evaluation runs in the environment using the current set of learned parameters. This procedure is then followed for each independent training run and results are aggregated to assess final performance. In our analysis, we find that key aspects of this procedure are regularly omitted during reporting, as shown in Figure 3 (d)-(e). Specifically, in (d), we find many papers omit details on the exact evaluation interval used, and in (e), a similar trend in omission regarding the exact number of independent evaluation runs used. Finally, in Figure 3 (f), we plot the number of independent runs used during training, showing no clear standard. Given the often high computational requirements of MARL research, it is not surprising that most works opt for a low number of independent training runs, however this remains of concern when making statistical claims. **Recommendations** – Standardised statistical tooling and uncertainty estimation including detailed reporting: As mentioned before, the computational requirements in MARL research often make it prohibitively difficult to run many independent experiments to properly quantify uncertainty. One approach to make sound statistical analysis more tractable, is to pool results across different tasks using the bootstrap (Efron, 1992). In particular, for RL, Agarwal et al. (2022) recommend computing stratified bootstrap confidence intervals, where instead of only using the original set of data to calculate confidence intervals, the data is resampled with replacement from $M$ tasks, each having $N$ runs. This process is repeated as many times as needed to approximate the sampling distribution of the statistic being calculated. Furthermore, when making a summary of overall performance across tasks it has been shown that the mean and median are insufficient, the former being dominated by outliers and the latter having higher variance. Instead, Agarwal et al. (2022) propose the use of the interquartile mean (IQM) which is more robust to outlier scores than the mean and more statistically efficient than the median. Finally, Agarwal et al. (2022) propose the use of probability of improvement scores, sample efficiency curves and performance profiles, which are commonly used to compare the performance of optimization algorithms (Dolan and Moré, 2001). These performance profiles are inherently robust to outliers on both ends of the distribution tails and allow for the comparison of relative performance at a glance. In the shared reward setting, where it is only required to track a single return value, we argue that these tools fit the exact needs of cooperative MARL, as they do in RL. Furthermore, in light of our analysis, we strongly recommend a universal standard in the use, and reporting of, evaluation parameters such as the number of independent runs, evaluation frequency, performance metrics and statistical tooling, to make comparisons across different works easier and more fair. 2.3 Lesson 3: Guard against environment misuse and overfitting Issue in RL – Over-tuning algorithms to perform well on a specific environment: As early as 2011 issues with evaluation in RL came to the forefront in the form of environment overfitting. Whiteson et al. (2011) raised the concern that in the context of RL, researchers might over-tune algorithms to perform well on a specific benchmark at the cost of all other potential use cases. More specifically, Whiteson et al. (2011) define environment overfitting in terms of a desired target distribution. When an algorithm performs well in a specific environment but lacks performance over a target distribution of environments, it can be deemed to have overfit that particular environment. The situation in MARL – One environment to rule them all – on the use and misuse of SMAC: The StarCraft multi-agent challenge (SMAC) (Samvelyan et al., 2019) has quickly risen to prominence as a key benchmark for MARL research since it’s release in 2019, rivaled only in use by the multi-agent particle environment (MPE) introduced by Lowe et al. (2017) (see Figure 4 (a)). SMAC and its accompanied MARL framework PyMARL (introduced in the same paper), fulfills several desirable properties for benchmarking: offering multiple maps of various difficulty that test key aspects of MARL algorithms and providing a unified API for running baselines as well as state-of-the-art algorithms on SMAC. Unfortunately, the wide-spread adoption of SMAC has also caused several issues, relating to environment overfitting and cherry picking of results, putting into question the We applaud the authors for making their raw evaluation data publicly available. This data can be found here: https://github.com/oxwhirl/smac. The maps chosen were: 1c3s5z, 2c_vs_64zg, bane_vs_bane, MMM2, 10m_vs_11m, 27m_vs_30m, 5m_vs_6m, 2x3z, 2s_vs_1sc, s5z, 3s_vs_5z, 6h_vs_8z, 3s5z_vs_3s6z and corridor --- We end our investigation into SMAC (and refer the reader to the Appendix for additional discrepancies uncovered), by looking at historical performance trends. In Figure 4 (e), we show the top win rate achieved by an algorithm in a specific year for 14 of the most popular maps used in prior work. We find that by 2021, most of these maps have converged to a win rate close or equal to 100%, while only a few maps are still situated around 80-90%. Given that many of these maps repeatedly feature In this section, we pool together the observations and recommendations from the previous section to provide a standardised performance evaluation protocol for cooperative MARL. We are realistic in our efforts, knowing that a single protocol is unlikely to be applicable to all MARL research. However, echoing recent work on evaluation (Ulmer et al., 2022), we stress that many of the issues highlighted previously stem from a lack of standardisation. Therefore, we believe a default “off-the-shelf” protocol that is able capture most settings, could provide great value to the community. If widely adopted, such a standardised protocol would make it easier and more accurate to compare across different works and remove some of the noise in the signal regarding the true rate of progress in MARL research. A summarised version of our protocol is given in the blue box at the end of this section and a concrete demonstration of its usage can be found in the Appendix. Benchmarks and Baselines. Before giving details on the proposed protocol, we first briefly comment on benchmarks and baselines used in experiments. These choices often depend on the research question of interest, the novel work being proposed and key algorithmic capabilities to be tested. However, as alluded to in our analysis, we recommend that environment designers take full ownership regarding how their environments are to be used for evaluation. For example, if an environment has several available static tasks, the designers should specify a fixed compulsory minimum set for experiments to avoid biased subsampling by authors. It could also be helpful if designers keep track of state-of-the-art (SOTA) performances on tasks from published works and allow authors to submit these for vetting. We also strongly recommend using more than a single environment (e.g. SMAC) and preferring environments that test generalisation. Regarding baselines, we recommend that at minimum the published SOTA contender to novel work should be included. For example, if the novel proposal is a value-based off-policy algorithm for discrete environments, at minimum, it must be compared to the current SOTA value-based off-policy algorithm for discrete environments. Finally, all baselines must be tuned fairly with the same compute budget. Evaluation parameters. In Figure 6, we show the evaluation parameters for the number of evaluation runs, the evaluation interval (top) and the training time (bottom left) used in papers. We find it is most common to use 32 evaluation episodes at every 10000 timesteps (defined as the steps taken by agents when acting in the environment) and to train for 2 million timesteps in total. We note that these numbers are skewed towards earlier years of SMAC evaluation and that recent works have since explored far longer training times. However, we argue that these longer training times are not always justified (e.g. see the bottom right of Figure 6). Furthermore, SMAC is one of the most expensive MARL environments (Appendix A.7 in Papoudakis et al. (2021)) and for the future accessibility of research in terms of scale and for fair comparisons across different works, we recommend the above commonly used values as reasonable starting defaults and support the view put forward by Dodge et al. (2019) that results should be interpreted as a function of the compute budget used. We of course recognise that these evaluation parameters can be very specific to the environment, or task, and again we urge environment designers to play a role in helping the community develop and adopt sensible standards. Performance and uncertainty quantification. To aggregate performance across evaluation intervals, we recommend using the absolute performance metric proposed by Colas et al. (2018b), computed using the best average (over training runs) joint policy found during training. Typically, practitioners checkpoint the best performing policy parameters to use as the final model, therefore it makes sense to do evaluation in a similar way. However, to account for not averaging across different evaluation intervals, Colas et al. (2018b) recommend increasing the number of independent evaluation runs using the best policy by a factor of 10 compared to what was used at other intervals. To quantify uncertainty, we recommend using the mean with 95% confidence intervals (CIs) at each evaluation interval (computed over independent evaluation runs), and when aggregating across tasks within an environment, we recommend using the tools proposed by Agarwal et al. (2022), in particular, the inter-quartile mean (IQM) with 95% stratified Bootstrap CIs. Reporting. We strongly recommend reporting all relevant experimental details including: hyperparameters, code-level optimisations, computational requirements and frameworks used. Taking inspiration from model cards (Mitchell et al., 2019), we provide templates for reporting in the Appendix. Furthermore, we recommend providing experimental results in multiple formats, including plots and tables per task and environment as well as making all raw experimental data and code publicly available for future analysis and easy comparison. Finally, we encourage authors to include detailed ablation studies in their work, so as to be able to accurately attribute sources of improvement. A Standardised Performance Evaluation Protocol for Cooperative MARL **Input:** Environments with tasks $t$ from a set $T$. Algorithms $a \in A$, including baselines and novel work. 1. **Evaluation parameters – defaults** - Number of training timesteps, $T = 2$ million. - Number of independent training runs, $R = 10$ (from Agarwal et al. (2022)) - Number of independent evaluation episodes per interval, $E = 32$. - Evaluation intervals, $i \in \mathbb{Z}$, at every 10000 timesteps. 2. **Performance and uncertainty quantification** 1. Performance metric: Always use returns $G$ (applicable to all environments), and the environment specific metric (e.g. Win rate). 2. Per task evaluation: Compute the mean $G_{at}$ over $E$ episodes at each evaluation interval $i$, where $G_{at}$ is the return of algorithm $a$ on task $t$, with 95% CI, for all $a$. 3. Per environment evaluation: - Compute the normalised absolute return (Colas et al., 2018b) as the mean return of $10 \times E = 320$ evaluation episodes using the best joint policy found during training and normalising the return to be in the range $[0, 1]$ using $(G_{at} - \min(G_t))/(\max(G_t) - \min(G_t))$, where $G_t$ is the return for all algorithms on task $t$. - For each algorithm $a$, form an evaluation matrix with shape $(R, |T|)$ where each entry is the normalised absolute return for a specific training run on a specific task. - Compute the IQM and optimality gap with 95% stratified Bootstrap CIs, probability of improvement scores and performance profiles, to compare the algorithms, using the tools proposed by Agarwal et al. (2022). Sample efficiency curves can be computed by using normalised returns at each evaluation interval. 3. **Reporting** - Experiments: All hyperparameters, code-level optimisations, computational requirements and framework details. - Plots: All task and environment evaluations as well as ablation study results. - Tables: Normalised absolute performance per task with 95% CI for all tasks, IQM with 95% stratified Bootstrap CIs per environment for all environments. - Public repository: Raw evaluation data and code implementations. 4 **Conclusion and future work** In this work, we argue for the power of standardisation. In a fast-growing field such as MARL, it becomes ever more important to be able to dispel illusions of rapid progress, potentially misleading the field and resulting in wasted time and effort. We hope to break the spell by proposing a sensible standardised performance evaluation protocol, motivated in part by the literature on evaluation in RL, as well as by a meta-analysis of prior work in MARL. If widely adopted, such a protocol could make comparisons across different works much faster, easier and more accurate. However, certain aspects of evaluation are better left standardised outside of the control or influence of authors, such as protocols pertaining to the use of benchmark environments. We believe this is an overlooked issue and an important area for future work by the community, and specifically environment designers, to jointly establish better standards and protocols for evaluation and environment use. Finally, we encourage the community to move beyond the use of only one or two environments with static task sets (e.g. MPE and SMAC) and focus more on building algorithms, environments and tools for improving generalisation in MARL. A clear limitation of our work is our focus on the cooperative setting. Interesting works have developed protocols and environments for evaluation in both the competitive and mixed settings (Omidshafiei et al., 2019; Rowland et al., 2019; Leibo et al., 2021). We find this encouraging and argue for similar efforts in the adoption of proposed standards for evaluation. Acknowledgments and Disclosure of Funding The authors would like to kindly thank the following people for useful discussions and feedback on this work: Jonathan Shock, Matthew Morris, Claude Formanek, Asad Jeewa, Kale-ab Tessera, Sinda Ben Salem, Khalil Gorsan Mestiri, Chaima Wichka and Sasha Abramowitz. References
{"Source-Url": "https://proceedings.neurips.cc/paper_files/paper/2022/file/249f73e01f0a2bb6c8d971b565f159a7-Paper-Conference.pdf", "len_cl100k_base": 5887, "olmocr-version": "0.1.53", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 43079, "total-output-tokens": 9298, "length": "2e12", "weborganizer": {"__label__adult": 0.0007257461547851562, "__label__art_design": 0.0007724761962890625, "__label__crime_law": 0.00101470947265625, "__label__education_jobs": 0.003662109375, "__label__entertainment": 0.0003368854522705078, "__label__fashion_beauty": 0.000457763671875, "__label__finance_business": 0.0008592605590820312, "__label__food_dining": 0.000759124755859375, "__label__games": 0.005550384521484375, "__label__hardware": 0.0013103485107421875, "__label__health": 0.00217437744140625, "__label__history": 0.0009322166442871094, "__label__home_hobbies": 0.0002498626708984375, "__label__industrial": 0.0010700225830078125, "__label__literature": 0.0007061958312988281, "__label__politics": 0.0008969306945800781, "__label__religion": 0.0008172988891601562, "__label__science_tech": 0.4521484375, "__label__social_life": 0.0002415180206298828, "__label__software": 0.0079803466796875, "__label__software_dev": 0.5146484375, "__label__sports_fitness": 0.00106048583984375, "__label__transportation": 0.0012521743774414062, "__label__travel": 0.0004723072052001953}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 36527, 0.02419]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 36527, 0.21947]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 36527, 0.88816]], "google_gemma-3-12b-it_contains_pii": [[0, 2750, false], [2750, 7137, null], [7137, 9864, null], [9864, 15195, null], [15195, 18519, null], [18519, 19328, null], [19328, 20295, null], [20295, 24658, null], [24658, 28473, null], [28473, 31749, null], [31749, 35402, null], [35402, 36527, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2750, true], [2750, 7137, null], [7137, 9864, null], [9864, 15195, null], [15195, 18519, null], [18519, 19328, null], [19328, 20295, null], [20295, 24658, null], [24658, 28473, null], [28473, 31749, null], [31749, 35402, null], [35402, 36527, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 36527, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 36527, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 36527, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 36527, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 36527, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 36527, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 36527, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 36527, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 36527, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 36527, null]], "pdf_page_numbers": [[0, 2750, 1], [2750, 7137, 2], [7137, 9864, 3], [9864, 15195, 4], [15195, 18519, 5], [18519, 19328, 6], [19328, 20295, 7], [20295, 24658, 8], [24658, 28473, 9], [28473, 31749, 10], [31749, 35402, 11], [35402, 36527, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 36527, 0.0]]}
olmocr_science_pdfs
2024-12-11
2024-12-11
f4c6e718345725e68a0e6e4f54d13a08fca83eba
NAVIGATION AND MISSION ANALYSIS SOFTWARE FOR THE NEXT GENERATION OF JPL MISSIONS Steven FLANAGAN Todd ELY Jet Propulsion Laboratory, California Institute of Technology 4800 Oak Grove Dr. Pasadena, CA 91109-8099 Steve.N.Flanagan@jpl.nasa.gov ABSTRACT – MONTE (Mission analysis, Operations, and Navigation Toolkit Environment) is a new software system being developed to replace the navigation and trajectory analysis software currently in use at the Jet Propulsion Laboratory (JPL). MONTE will reproduce the existing functionality of the legacy systems and add significant new capabilities for the MONTE users - the mission and navigation analysts in the Navigation and Mission Design Section (Section 312). MONTE will be developed as a single tightly integrated system, in contrast to the multiple disparate software suites currently in use. MONTE is being designed to facilitate a variety of navigation and trajectory tasks in a broad range of contexts, including research and development, analysis and design, and operations. KEYWORDS: Navigation, mission design, operations, MONTE, software, system, trajectory. INTRODUCTION MONTE (Mission analysis and Operational Navigation Toolkit Environment) is a new software system being developed to support trajectory and navigation analysis/design for space missions. MONTE will eventually replace the current navigation and trajectory analysis software systems used by the Navigation and Mission Design Section (Section 312) of the Jet Propulsion Laboratory (JPL). MONTE will have the capabilities of these existing systems, plus add significant new tools for use by mission and navigation analysts. Furthermore, it does so within the framework of a single, integrated system. It has a variety of user interaction modes ranging from traditional command-driven, standalone applications, to a graphics-based interactive computing environment. MONTE is primarily a ground-based system; however, it is likely that future adaptations of MONTE components will be used as embedded parts of a flight system. MONTE supports a variety of navigation and trajectory tasks. Fundamentally, it has been designed and built to be useful in a broad range of contexts, including research and development, analysis and design, and operations. Several examples of how MONTE can be used include, - Plan and design spacecraft trajectories that satisfy mission objectives, • Estimate and control the actual spacecraft trajectories throughout the mission, • Maintain and disseminate knowledge of the spacecraft trajectories, • Provide related information for solar system bodies such as planetary orbits, pole orientations and rotation rates, etc. • Develop new algorithms for trajectory targeting; conduct feasibility studies on new orbit determination techniques, etc. Note that the MONTE system will be capable of supporting missions with multiple spacecraft as well as the more traditional interplanetary mission with only a single spacecraft. It is reasonable to ask whether the expense of developing a new software system such as MONTE is justified at this time. In what respects will MONTE represent an improvement over the existing navigation and mission design software tools? In addition to the significant new functionality that is being added to the Navigation and Mission Design Section's core capabilities, MONTE is also developing a system that adheres to the following principles: • MONTE must be easy to use for both the novice and the seasoned practitioner, • MONTE must be flexible so that it can be easily adapted for use on new navigation and mission design applications, • MONTE must seamlessly integrate the related, yet distinctly different, functionality required by mission designers and navigators, • MONTE must be measurably more stable and easier to maintain in an environment where many and varied missions are the norm, not the exception. MONTE PROJECT OBJECTIVES The fundamental task of the MONTE Project as originally conceived is to functionally replace JPL’s existing legacy navigation software system known as DPTRAJ/ODP. This is to be accomplished through the development of a new software system that will address the known shortcomings of the existing software, as opposed to a line-by-line or function-by-function rewrite of the legacy code. The scope of the MONTE Project has been expanded to encompass Mission Analysis software as well. This includes the legacy Mission Analysis Software Libraries (MASL) and several new software developments either planned or already under way in this area. In replacing these legacy systems, MONTE has the challenge of selecting the architecture that will achieve the most significant improvements in all aspects of the software. In order to accomplish this goal, it is necessary to identify the highest priority objectives for this project. Reduce Life-cycle Cost One of the strongest arguments in favor of pursuing this development effort is that by doing so, it is possible to reduce the overall lifecycle cost associated with maintaining the legacy software. Maintaining the legacy software as robust, reliable software systems that meet the needs of their users is an expensive proposition, in part due to the fact that they are based on aging technology, and also because of the way these systems have evolved over time. Building new software from the ground up is expected to result in a system that is easier, and therefore less expensive, to maintain, without sacrificing functionality. One key element of this plan is to provide accurate and current documentation of software requirements, design, and code for all software components in the MONTE system. Improve Usability Most of the legacy software currently in use provides Command-Line User Interfaces (CLUIs) exclusively. The appropriate application of Graphical User Interfaces (GUIs) will significantly enhance the user-interaction characteristics of the new software. Well-designed and constructed GUIs will make the software more accessible to the novice, without getting in the way of the expert. Standardized GUIs will also make it easier for the Navigation and Mission Design Section or for a flight project to provide officially approved approaches to using the software. It would be inappropriate, however, to assume that GUIs are preferable to CLUIs in all applications. The prospective users of MONTE have repeatedly voiced an interest in having alternatives to GUIs. Therefore, another user-interface goal of MONTE is to provide a common interactive command-line and scripting capability to both Navigation and Mission Analysis users. **Provide Enhanced Functionality** The domains of Navigation and Mission Analysis are dynamic, and it is reasonable to expect that MONTE’s user requirements will change somewhat over time. As a result, it will never be possible to anticipate all potential uses of the software at the time of design and implementation. Many new requirements have come out of the demanding missions attempted by JPL in the years since the legacy software was originally developed. This situation has challenged Section 312’s ability to maintain and extend these software sets. MONTE must address the additional requirements expected based on our present knowledge of the missions in NASA’s roadmap and be able to respond readily to new requirements that cannot be anticipated. This can only be accomplished through the careful design and documentation of an extensible and maintainable software system. **Integrate Mission Analysis and Navigation Software Systems** In spite of the functional overlap between Navigation and Mission Analysis, these two areas have always maintained separate core software libraries at JPL. This has introduced a number of problems, with the two most important being maintenance cost and interoperability. Maintaining two software systems with very similar functional requirements is clearly more expensive than maintaining a single library. Furthermore, it is difficult to find new people with the necessary FORTRAN skills. Finally, it is very common for Mission Analysts to deliver solutions to Navigation Analysts. This is currently a complicated process that can contribute to errors being made in the translation from one software set to another. This situation is unnecessary. Building a single library that can be shared by these two areas will introduce economies and efficiencies that cannot be realized any other way. **KEY HIGH-LEVEL FUNCTIONAL REQUIREMENTS** As mentioned previously, the primary functions of the MONTE system are to analyze and design spacecraft trajectories; estimate and control spacecraft trajectories; and maintain and disseminate knowledge of spacecraft trajectories and related information for solar system bodies. MONTE can be used during all spacecraft mission phases from pre-project status through final mission operations. Furthermore, MONTE can be used for research and technology studies not necessarily associated with a specific mission. A significant feature associated with MONTE is that all of its diverse functionality resides within the context of a single, integrated system. The immediate implication of this is that MONTE is capable of servicing all mission design and navigation functions seamlessly throughout a mission lifecycle. This reduces the potential for error and yields efficiencies that are currently not available with existing mission design and navigation software systems. For example, the models, data, and trajectory products that a mission designer generates during initial design studies are the same products that a navigator can use for initial covariance studies and to define DSN tracking requirements. During operations, the same detailed spacecraft models used for operational navigation support can be used, without modification, for trajectory redesign activities as the need may arise. This seamless operability applies not only to models and data products, but to the MONTE tools, as well. For instance, analysis and design are not restricted to the pre-launch time frame. MONTE tools allow the user to evaluate alternatives for future mission phases while supporting on-going operations for the current mission phase. The same estimation tools used to obtain a trajectory solution based on the latest actual measurements are also used to perform covariance studies using a simulated set of future measurements. Similarly, the same trajectory design tools used to generate a nominal mission trajectory can be used to re-plan or re-optimize remaining future trajectories based on the actual past trajectory history or in response to unexpected perturbations from the nominal. The tasks that MONTE can do fall into the following major functional areas: - **Trajectory and Variations Generation** contains components that generate spacecraft or celestial body trajectories via an analytical formulation or numerical integration of a dynamic model. It also generates the variations of dynamic variables and dynamic model parameter quantities at requested time intervals (i.e., the state transition matrix). - **Trajectory Design and Control** contains components that manipulate trajectories to achieve certain desired conditions via targeting or optimization. This includes maneuver analysis functions for statistical assessment of control events. - **Trajectory Information** contains components for disseminating trajectory knowledge. This includes tools for accessing basic trajectory representations and associated model parameters and for computing numerous geometric quantities that can be derived from the trajectory. - **Measurement Scheduling, Simulation, Variations, and Acquisition** contains components for modeling measurement schedules, simulating measurements, generating measurement variations with respect to dynamic variables and model parameters. There are tools to acquire measurements (via a "real-time" stream, or as a batch file), process them (i.e., sampling and/or filtering, applying calibration corrections, etc), creating derived measurement types and processing them, as well. - **Trajectory and Parameter Estimation** contains components that solve for spacecraft or celestial body trajectories and associated model parameters based on a series of simulated or actual measurements. This includes various types of filtering and smoothing algorithms and tools to manipulate and map state uncertainties and other products of the filtering process. - **Textual and Graphical Data Analysis** contains tools that have significant capabilities to analyze and visualize MONTE generated data. This includes text-based processing (i.e., convenient output forms for viewing and porting data to 3rd party spreadsheet tools) and visualization of output data (and in some cases input data). Almost all navigation and trajectory analysis tasks will have associated visualization techniques that are useful in performing the task or evaluating the results. Selected examples of 2D/3D visualization capabilities include: - Trajectory plots of spacecraft and celestial bodies; - 3-D displays of spacecraft component models; - Coordinate system axes definitions and their relation to other systems; - “Function graphs” of one or more parameters as functions of time or another parameter, e.g. a plot of flight path angle versus magnitude of the B-vector at atmospheric entry interface; - Timelines of measurement opportunities and associated detailed schedules; - Actual and simulated measurement residuals; - Display raw or transformed uncertainties, e.g. a 2D plot of the B-plane error ellipse at closest approach to a target body. When appropriate, the user will have the ability to interact with their specific analysis scenario (i.e., direct changes to parameters and data) via manipulation of information in the graphics. • **Case Management** contains tools for managing team-based mission and navigation analysis and design. They manage user environments, scripts designed for analysis and task automation, data consisting of inputs as well as outputs, coordinating team member activities. It can be thought of as a data and task management function that ties together the previous functional blocks with mission data/results that need to be shared, managed, and configuration controlled. A primary objective of this tool is to ensure data integrity of operational mission products. • **Infrastructure** contains lower-level tools necessary to accomplish the preceding functions. It includes capabilities to process and manage trajectory components, time systems, coordinate systems, mathematics, data management, etc. Of course, there are software tasking capabilities that coordinate the execution of all the functionality, ensuring that processing proceeds as expected and provides the user with requested data/analyses or notifies them of error conditions preventing normal task completion. These functional areas represent a loose partitioning of the MONTE system, hence the idea that MONTE is a toolkit. From the toolkit perspective, there are four primary ways to utilize the MONTE system. MONTE, used as an *interpreter*, enables the user to call functions to do specific mission design and navigation tasks. The MONTE system can also be viewed as a set of *pre-built applications* that seamlessly tie toolkit functions together and enable a user to easily accomplish a complex series of standard tasks. MONTE's scripting capability allows the user to create new *script-based applications* that can integrate functionality from the toolkit layer, pre-built applications, and/or other software developed outside of the MONTE environment. Finally, MONTE can be used as a *software library* to build new compiled applications. **MONTE SOFTWARE DEVELOPMENT APPROACH** MONTE is a large scale, long-term software project that must be developed and maintained by a team in Section 312. The software products of MONTE will be used to design and navigate future JPL missions, and will therefore be classified as “mission critical software”. This implies that a very high degree of reliability is required of the software. Versions of the current JPL navigation software have been in continuous use for nearly 35 years. Clearly, MONTE must plan on being highly robust and maintainable over a long period of time. Several aspects of the MONTE approach to software development that support these requirements are described in more detail in this section. **Formal Software Process** Although there are usually several software development efforts underway at any given time within the Navigation and Mission Design Section, software development is not the primary mission of the Section. Most of the software tasks in the Section are small and informal. This is clearly not appropriate for a project with the size and scope of MONTE. A great deal of effort has gone into providing a clear and stable set of software development guidelines, standard practices, policies, and procedures for the project. This is necessary to ensure that MONTE can demonstrate that the requirements are understood and are being addressed, that the development is being completed on schedule, and that the delivered products are of an appropriate quality. Documented procedures are in place or under development for activities covering the entire software lifecycle, including requirements analysis, software project planning, configuration management, and software quality assurance. **Object-Oriented Design/C++** In order to satisfy the design goals described earlier, MONTE must be a reliable, extensible, and reusable software system. These objectives impose requirements on the system that are not derived from the more obvious and well-understood technical software requirements. Although a comprehensive discussion of the benefits of object-oriented analysis and design is beyond the scope of this paper, it was decided that an object-oriented approach was most likely to succeed in addressing the broad objectives of MONTE. This left several options for software languages. The three given the most serious consideration were Fortran 90, Java, and C++. The vast majority of existing software in Section 312 is written in one of several dialects of Fortran, including Fortran 77, Ratfor, and Fortran 90. As a result, a strong argument could be made for continuing this practice. Fortran 90 is a well-designed language, and high-quality, stable compilers are available for all of the platforms currently in use in the Section. Fortran 90 benefits from the algorithmic roots of Fortran, and is well suited for use in solving many of the highly mathematical problems in Navigation and Mission Design. However, it is important to realize that MONTE is much more than a set of related algorithms. Significant effort will be directed towards developing graphical user-interfaces, which is not one of Fortran 90’s strengths. In addition, it is expected that some components of MONTE will evolve into on-board flight software at some point in the future. Although the current flight software at JPL is written in C, future flight software developments plan to phase in the use of C++. Fortran is not being considered for flight software, and is not supported by any of the on-board platforms used for flight systems. Finally, Fortran programmers are becoming very difficult to find. Fortran is not being taught in many Engineering schools, and very few Computer Science graduates have had any experience with it at all. This is an important limitation, and ultimately contributed to the decision not to use Fortran. This left Java and C++ as viable options. Java is a true object-oriented language, and is gaining popularity rapidly. Many new graduates have only programmed in Java, and are excited about continuing to use it. However, the Java language is still fairly immature, and as a result, the standard is fairly unstable. This could be a very serious problem for a long-term, large-scale project. Also, the performance of Java doesn’t compare very favorably to C or C++. Taken together, these factors eliminated Java as an option. C++ is mature, stable, widely used, fully object-oriented, and has performance characteristics appropriate for MONTE’s applications. **Toolkit Approach** The phrase “Toolkit Approach” is used to describe the practice applied in the MONTE project of developing a large library of reusable software components with very broad capabilities in the functional areas of Navigation and Mission Design. This is an important part of the MONTE architecture, and delivers a number of benefits to the users of MONTE. This approach makes it possible for an analyst to repackage existing functionality to solve new kinds of problems. While this degree of flexibility might not be desirable in an operational scenario, it could be essential to support the wide variety of preliminary studies conducted in the Section. MONTE will make every effort to deliver a standard set of tools that meet the requirements of the Navigation and Mission Design users, but it is unreasonable to expect that MONTE will anticipate all of the ways that the delivered software can be used. Also, it is unavoidable that at some point in the future additional user requirements will be levied on MONTE, possibly to support new classes of missions that are not currently anticipated. The toolkit approach promotes extensibility by providing a framework for adding new functionality to MONTE, without unnecessarily complicating the existing software. This is an important feature for a software system that could potentially be expected to survive for decades. **MONTE ARCHITECTURAL DESIGN** The MONTE system architecture can be best understood by thinking in terms of layers of functionality. As shown in Figure 1 there are four conceptual layers in the MONTE system: the Data Management Layer, the Toolkit Layer, the User Interface Component Layer, and the User Application Layer. The following sections describe the functionality provided by these layers and their roles within the MONTE system. **Data Management Layer** BOA, the MONTE data management system, represents the lowest level of functionality in the MONTE system. In large, complex, object-oriented software systems such as MONTE there is a need for object persistence. Object persistence is the ability for objects (instances of C++ classes) to survive beyond the lifespan of the component or application that created them. This capability directly enables code reuse by allowing applications to use objects that have been created elsewhere in the system. The primary function of BOA is to save and restore C++ objects in a machine portable format. BOA plays an important role in the architecture and use of the MONTE system, and its presence is likely to influence the design of most MONTE subsystems to some extent. As a result, it is important that software designers consider BOA in the design of any new MONTE subsystem, and that individuals responsible for designing major software components within MONTE understand the capabilities and proper uses of BOA. **Toolkit Layer** The core Mission Design and Navigation functionality is provided by the part of MONTE that is labeled the Toolkit Layer in Figure 1. This is a collection of software libraries that can be used together to address a wide range of problems within the target problem domain. These libraries provide many of the capabilities that are fundamental to the work performed in Section 312, including Trajectory Analysis, Measurement Analysis, Coordinate and Time System calculations, Estimation, Optimization, and others. These low-level functional libraries are designed to use the MONTE data management system, and can therefore take advantage of the services provided by BOA. **User Interface Component Layer** The users of MONTE cannot be expected to write a script or a C++ program every time they need to solve a problem. The functionality represented by the Toolkit Layer described above must be organized into applications, and presented to the users in a convenient and straightforward fashion. Towards this end, a collection of user interface components are planned that will facilitate the production of end-user applications based on the Toolkit Layer. The user interface components fall into two categories: Graphical User Interface (GUI) components and Command-line User Interface (CLUI) components. Both styles of interaction are important to the users of MONTE, and must be supported. It is expected that nearly all end-user applications will provide users with a CLUI, and many will provide a GUI as well. **User Application Layer** One of the primary objectives of MONTE, as described above, is to deliver software that is easy to use. This means different things to different people, and can depend on a number of factors. Novice users of an application often find that a GUI is easier to learn to use than a CLUI. The GUI presents the features of the software to the user, making it possible for the user to discover the steps needed to solve a particular problem. Although a well-designed GUI will not unnecessarily impede an expert user, it will usually provide little benefit. In a CLUI-based application, on the other hand, individual commands must be memorized or found in a User Manual. This may be exactly what the expert user desires, but often proves to be frustrating for a novice. Clearly, neither of these solutions is appropriate in all cases. Ultimately, it is reasonable to expect that the majority of MONTE users will fall into the expert category, but there will always be new users that start out as novices. MONTE must strike a balance between ease of use for the novice and for the expert. This will be accomplished by providing a variety of end-user interaction modes. Many applications will be delivered with both graphical and command-line interfaces. In addition, MONTE will provide a scripting capability based on the Python programming language that will allow users to quickly develop prototype solutions to new problems by building on the functionality of the MONTE Toolkit Layer. This scripting capability will be composed of stand-alone scripts that can be run from a Unix prompt, written either by the user or by the MONTE team, and an interactive command-line environment that will provide access to the underlying functionality of the Toolkit Layer. Python is an interpreted language, like Perl, and hence is ideal for rapid prototyping. It is, however, a rigorously designed, full featured, object-oriented language that is easier to learn and understand. Python also has several useful language extensions, including the NumPy numerical extensions (for MATLAB-like functionality), Tk bindings (similar to TCL-Tk), and PyQt bindings for the Qt GUI toolkit. Python has also been designed to integrate easily with C/C++, which makes it possible to provide access to essentially any part of MONTE through a Python interface. CONCLUSIONS In summary, MONTE is a new software system currently being developed to solve a variety of problems in the areas of navigation and trajectory design of space missions. MONTE will extend the functionality of the legacy software, reduce long-term maintenance costs, and provide improved usability to the mission and navigation analysts. These objectives will be accomplished through rigorous analysis of the system requirements, intelligent application of object-oriented technology, a flexible and robust software architecture, and appropriate attention to formal software development process issues. Fig. 1. Logical Structure of the MONTE System ACKNOWLEDGMENTS The research described in this paper was carried out at the Jet Propulsion Laboratory, California Institute of Technology, under a contract with the National Aeronautics and Space Administration. Copyright 2012 California Institute of Technology. Government sponsorship acknowledged.
{"Source-Url": "https://trs.jpl.nasa.gov/bitstream/handle/2014/42884/12-0510_A1b.pdf?isAllowed=y&sequence=1", "len_cl100k_base": 5256, "olmocr-version": "0.1.53", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 19461, "total-output-tokens": 5679, "length": "2e12", "weborganizer": {"__label__adult": 0.0003275871276855469, "__label__art_design": 0.0002925395965576172, "__label__crime_law": 0.00028395652770996094, "__label__education_jobs": 0.001163482666015625, "__label__entertainment": 9.065866470336914e-05, "__label__fashion_beauty": 0.0001785755157470703, "__label__finance_business": 0.0003261566162109375, "__label__food_dining": 0.00042724609375, "__label__games": 0.0008540153503417969, "__label__hardware": 0.002147674560546875, "__label__health": 0.00036978721618652344, "__label__history": 0.0004968643188476562, "__label__home_hobbies": 0.00011861324310302734, "__label__industrial": 0.0008072853088378906, "__label__literature": 0.0002218484878540039, "__label__politics": 0.0002143383026123047, "__label__religion": 0.00045180320739746094, "__label__science_tech": 0.08087158203125, "__label__social_life": 9.578466415405272e-05, "__label__software": 0.0289459228515625, "__label__software_dev": 0.87939453125, "__label__sports_fitness": 0.0003964900970458984, "__label__transportation": 0.001285552978515625, "__label__travel": 0.0002739429473876953}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 28092, 0.00517]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 28092, 0.4796]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 28092, 0.92847]], "google_gemma-3-12b-it_contains_pii": [[0, 2403, false], [2403, 5895, null], [5895, 10128, null], [10128, 13935, null], [13935, 18132, null], [18132, 22205, null], [22205, 26359, null], [26359, 27792, null], [27792, 28092, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2403, true], [2403, 5895, null], [5895, 10128, null], [10128, 13935, null], [13935, 18132, null], [18132, 22205, null], [22205, 26359, null], [26359, 27792, null], [27792, 28092, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 28092, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 28092, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 28092, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 28092, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 28092, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 28092, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 28092, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 28092, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 28092, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 28092, null]], "pdf_page_numbers": [[0, 2403, 1], [2403, 5895, 2], [5895, 10128, 3], [10128, 13935, 4], [13935, 18132, 5], [18132, 22205, 6], [22205, 26359, 7], [26359, 27792, 8], [27792, 28092, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 28092, 0.0]]}
olmocr_science_pdfs
2024-12-07
2024-12-07
2756f5e28503ef297f0d2ae89acb5443ed8cb776
CSC2/455 Software Analysis and Improvement Abstract Interpretation - II Sreepathi Pai March 29, 2023 URCS Outline Introduction A Tiny Language and Its Semantics To be continued ... Introduction A Tiny Language and Its Semantics To be continued ... We learnt about program analysis tools beyond iterative dataflow analysis. Abstract Interpretation - Maps concrete states of programs to abstract states - Abstract states belong to an abstract domain: signs, intervals, convex polyhedra, ... - Define transfer functions to convert pre-condition (input) states to post-condition (output) states - Union for alternate paths - Widen for loops This lecture: - Concrete Semantics for a small language A note on the presentation - This lecture defines a number of formal concepts and is notation-heavy. - I also provide an equivalent formal notation in (Python) code to hopefully make it easier. Introduction A Tiny Language and Its Semantics To be continued ... A Tiny Language: Grammar \[ n \in \mathbb{V} \] \[ x \in \mathbb{X} \] \[ \circ ::= + | - | \ast | \ldots \] \[ \otimes ::= < | \leq | > | \equiv | \ldots \] - \( n \) is a set of concrete values, here we shall treat \( \mathbb{V} = \mathbb{Z} \) - All values are integers - \( x \) is the name of a variable. The set \( \mathbb{X} \) contains all variable names. - \( \circ \) represents arithmetic binary operators - \( \otimes \) represents boolean binary operators A Tiny Language: Expressions \[ E ::= n \mid x \mid E \circ E \] \[ B ::= x \otimes n \] - An arithmetic expression $E$ is: - a number, or - a variable name, - or a binary expression - A boolean expression $B$ is: - a variable, - a boolean operator - a constant $n$ from typing import Union from typing_extensions import Literal BinaryOps = Literal['+', '-', '*', '/'] ComparisonOps = Literal['<', '>', '==', '<=', '>=', '!='] Scalar = int # restrict Scalars to ints in this implementation class Node(object): pass class Var(Node): def __init__(self, name: str): self.name = name def __str__(self): return self.name Expr = Union[Scalar, Var, 'BinOp'] - This is Python 3 augmented with types - Union stands for a union type Nothing special here, each component of the grammar is stored in the respective AST nodes I’m eliding implementations of `__str__`, indicated by ‘...' Commands in the language \[ C ::= \] skip | \( C; C \) | \( x := E \) | \( \text{input}(x) \) | \( \text{if}(B)\{C\} \text{ else } \{C\} \) | \( \text{while}(B)\{C\} \) \[ P ::= C \] class Cmd(Node): pass class Skip(Cmd): def __init__(self): pass class Seq(Cmd): def __init__(self, cmd0: Cmd, cmd1: Cmd): self.cmd0 = cmd0 self.cmd1 = cmd1 class Assign(Cmd): def __init__(self, left: Var, right: Expr): self.left = left self.right = right class Input(Cmd): def __init__(self, var: Var): self.var = var def __str__(self): return f"input({self.var})" class IfThenElse(Cmd): def __init__(self, cond: BoolExpr, then_: Cmd, else_: Cmd): self.cond = cond self.then_ = then_ self.else_ = else_ class While(Cmd): def __init__(self, cond: BoolExpr, body: Cmd): self.cond = cond self.body = body class Program(Node): def __init__(self, cmd: Cmd): self.program = cmd Representing Programs if(x > 7) { y := (x - 7) } else { y := (7 - x) } can be represented using the AST as: x = Var('x') y = Var('y') t = Program(IfThenElse(BoolExpr('>', x, 7), Assign(y, BinOp('-', x, 7)), Assign(y, BinOp('-', 7, x)) ) To execute programs represented as ASTs, we need the following: - **Storage/Memory**: to track values of variables - **Semantics**: to express what each command does, usually mathematical - Denotational semantics ("input/output" semantics) - Operational semantics - Axiomatic semantics - and many others... \[ M = X \rightarrow V \] - A store (from storage) is a map/function from variables to values. - We'll represent it as (assuming \( X = \{x, y\} \): \[ m = \{x \rightarrow 3, y \rightarrow 4\} \] - Store (or memory) \( m \) maps \( x \) to 3 and \( y \) to 4. - So, \( m(x) = 3 \), and \( m(y) = 4 \) from typing import Dict, List # using str instead of Var, with Var.name as the key. # This is accidental. Memory = Dict[str, int] x = Var('x') y = Var('y') m = {x.name: 3, y.name: 4} print(m[x.name]) print(m[y.name]) The semantics of an expression $E$ depend on the memory store $m$. We use $\llbracket E \rrbracket(m)$ to denote its semantics. We’ll define $\llbracket E \rrbracket(m)$ over its grammar as: \[ \llbracket n \rrbracket(m) = n \\ \llbracket x \rrbracket(m) = m(x) \\ \llbracket E_0 \odot E_1 \rrbracket(m) = f_\odot(\llbracket E_0 \rrbracket(m), \llbracket E_1 \rrbracket(m)) \] Here $f_\odot$ is the function that implements $\odot$, for example: - $f_+(a, b) = a + b$ def f_binop(op: BinaryOps, left: Scalar, right: Scalar) -> Scalar: if op == '+': return left + right elif op == '-': return left - right elif op == '*': return left * right elif op == '/': return left // right else: raise NotImplementedError(f"Unknown operator: {op}") def evaluate_Expr(E: Expr, m: Memory) -> Scalar: if isinstance(E, Scalar): return E elif isinstance(E, Var): return m[E.name] elif isinstance(E, BinOp): return f_binop(E.op, evaluate_Expr(E.left, m), evaluate_Expr(E.right, m)) Let $\mathbb{B}$ be the set \{true, false\} The semantics of a boolean expression is then $[B] : M \rightarrow \mathbb{B}$ $$[x \otimes n](m) = f_{\otimes}(m(x), n)$$ which can be expressed in Python as: ```python def f_cmpop(op: ComparisonOps, left: Scalar, right: Scalar) -> bool: if op == '<': return left < right elif op == '>': return left > right ... def evaluate_BoolExpr(B: BoolExpr, m: Memory) -> bool: return f_cmpop(B.op, m[B.left.name], B.right) ``` Semantics of other commands - Both $[E]$ and $[B]$ are building blocks for the semantics of other commands. - While they were defined on a single memory store $m$, we’re going to define the semantics for commands on a set of memory states $M$. - So, $m \in M$, and $M \in \mathcal{P}(M)$. - Where $\mathcal{P}(M)$ denotes the powerset of memory stores. - This way, our semantics for commands $[\cdot]\mathcal{P}$ will convert a set of input states to a set of output states. [C]_{\mathcal{P}} : \wp(M) \rightarrow \wp(M) [skip]_{\mathcal{P}}(M) = M [C_0; C_1]_{\mathcal{P}}(M) = [C_1]_{\mathcal{P}}([C_0]_{\mathcal{P}}(M)) [x := E]_{\mathcal{P}}(M) = \{ m[x \mapsto [E](m)] \mid m \in M \} [input(x)]_{\mathcal{P}}(M) = \{ m[x \mapsto n] \mid m \in M, n \in \mathbb{V} \} - The notation \( m[x \mapsto n] \) is a memory update, it creates a new store identical to \( m \) except that \( x \) is updated to \( n \) - \( \text{input}(x) \) updates variable \( x \) with a non-deterministic value \( n \) def evaluate_Cmd(C: Cmd, M: List[Memory]) -> List[Memory]: def update_memories(var, value_lambda): out = [] for m in M: m_out = dict(m) m_out[var] = value_lambda(m) out.append(m_out) return out if isinstance(C, Skip): return M elif isinstance(C, Program): return evaluate_Cmd(C.program, M) elif isinstance(C, Assign): return update_memories(C.left.name, lambda m: evaluate.Expr(C.right, m)) elif isinstance(C, Input): n = random.randint(0, 100) # could be anything, actually return update_memories(C.var.name, lambda _: n) elif isinstance(C, Seq): return evaluate_Cmd(C.cmd1, evaluate_Cmd(C.cmd0, M)) ... - I’ve chosen $M$ to be a list of memories (recall Memory is a Dict[str, int]) Example of using `evaluate_Cmd` ```python x = Var('x') y = Var('y') m1 = {x.name: 3, y.name: 4} m2 = {x.name: 5, y.name: 6} M_in = [m1, m2] M_out = evaluate_Cmd(Assign(x, 7), M_in) # M_out = [{'x': 7, 'y': 4}, {'x': 7, 'y': 3}] ``` \[ [\text{if}(B)\{C_0\} \text{ else } \{C_1\}]_{P}(M) = ? \] - \(C_0\) (the code executing when \(B\) is true) must only operate on \(m \in M\) where \([B](m)\) evaluates to true. - \(C_1\) (the code executing when \(B\) is false) must only operate on \(m \in M\) where \([B](m)\) evaluates to false. - Define a filter function \(F_B(M)\) such that \[ F_B(M) = \{ m \in M \mid [B](m) = \text{true} \} \] - Note: \(F_{\neg B}\) will give us the memories where \(B\) is false. \[ \text{Find stores where } B \text{ is true, evaluate } C_0 \text{ over them} \] \[ \text{Find stores where } B \text{ is false, evaluate } C_1 \text{ over them} \] \[ \text{Combine the two results using } \cup \] def filter_memory(B: BoolExpr, M: List[Memory], res = True) -> List[Memory]: out = [m for m in M if evaluate_BoolExpr(B, m) == res] return list(out) def evaluate_Cmd(C: Cmd, M: List[Memory]) -> List[Memory]: ... elif isinstance(C, IfThenElse): then_memory = evaluate_Cmd(C.then_, filter_memory(C.cond, M)) else_memory = evaluate_Cmd(C.else_, filter_memory(C.cond, M, res = False)) return union_memories(then_memory, else_memory) ... def union_memories(M0: List[Memory], M1: List[Memory]) -> List[Memory]: # this implementation is, of course, ridiculous # convert everything to sets M0_set = set([frozenset(m.items()) for m in M0]) M1_set = set([frozenset(m.items()) for m in M1]) M_set = M0_set.union(M1_set) # convert back to lists of dicts return list([dict(m) for m in M_set]) Semantics for While - #1 \[ [\text{while}(B)\{C\}]_P(M) \] - \( B \) must be true in \( m \in M \) to execute \( C \) once - \( ([C]_P \circ F_B)(M) \) - Executing \( C \) twice is similar: - \( ([C]_P \circ F_B)\(([C]_P \circ F_B)(M)\) \) - Let \( F \) be \( [C]_P \circ F_B \), then execution \( i \) times is represented as - \( F^i(M) \), i.e. \( F(F(F(M))) \) for \( i = 3 \) - If the loop executes \( i \) times and exits, the memory stores are: - \( M_i = F_{\neg B}(F^i(M)) \), because \( B \) must be false when we exit the loop Semantics for While - #2 - Let \( M_i = \mathcal{F}_{\neg B}(F^i(M)) \) represent executions of the loop body exactly \( i \) times, \( i \geq 0 \) - Then we can define the semantics of those \( i \) executions as: \[ \bigcup_{i \geq 0} M_i = \bigcup_{i \geq 0} \mathcal{F}_{\neg B}(F^i(M)) = \mathcal{F}_{\neg B}(\bigcup_{i \geq 0} F^i(M)) \] \[ \left[ \text{while}(B)\{C\} \right]_P(M) = \mathcal{F}_{\neg B}(\bigcup_{i \geq 0} (\left[ C \right]_P \circ \mathcal{F}_B)^i(M)) \] - The semantics of a non-terminating loop are undefined. def evaluate_Cmd(C: Cmd, M: List[Memory]) -> List[Memory]: ... elif isinstance(C, While): # L0 out = [m for m in M] # copy all input states pre_iter_memories = filter_memory(C.cond, out) accum: List[Memory] = [] while len(pre_iter_memories): after_iter_memories = evaluate_Cmd(C.body, pre_iter_memories) accum = union_memories(accum, after_iter_memories) # only keep memories where the condition is true pre_iter_memories = filter_memory(C.cond, after_iter_memories) # This computes L0 U (L1 U L2...) and retains only those # memory states where the loop has terminated. out = filter_memory(C.cond, union_memories(out, accum), res=False) return out Example of While execution \[ \text{while}(x < 7) \{ y := (y + 1); x := (x + 1) \} \] \[ \begin{align*} \text{START} & \quad \{x: 4, y: 0\}, \{x: 5, y: 0\}, \{x: 8, y: 0\} \\ \text{pre:} & \quad \{x: 4, y: 0\}, \{x: 5, y: 0\} \\ \text{after:} & \quad \{x: 5, y: 1\}, \{x: 6, y: 1\} \\ \text{accum:} & \quad \{x: 5, y: 1\}, \{x: 6, y: 1\} \\ \text{pre:} & \quad \{x: 5, y: 1\}, \{x: 6, y: 1\} \\ \text{after:} & \quad \{x: 6, y: 2\}, \{x: 7, y: 2\} \\ \text{accum:} & \quad \{x: 5, y: 1\}, \{x: 6, y: 1\}, \{x: 7, y: 2\}, \{x: 6, y: 2\} \\ \text{pre:} & \quad \{x: 6, y: 2\} \\ \text{after:} & \quad \{x: 7, y: 3\} \\ \text{accum:} & \quad \{x: 7, y: 3\}, \{x: 6, y: 2\}, \{x: 5, y: 1\}, \{x: 6, y: 1\}, \{x: 7, y: 2\} \\ \text{END} & \quad \{x: 7, y: 3\}, \{x: 7, y: 2\}, \{x: 8, y: 0\} \end{align*} \] Wrapping up the semantics - $[[C]_{\mathcal{P}}(\emptyset)] = \emptyset$ - Starting from an empty set of states leads to an empty set of states - Key ideas: - Grammar $\rightarrow$ AST - AST $\rightarrow$ Semantics - Semantics $\rightarrow$ Interpreter Introduction A Tiny Language and Its Semantics To be continued ... Abstraction, and building an abstract interpreter This lecture was based on material from Chapter 3 in Rival and Yi You can find the Python code on GitHub - This lecture covered tinyast.py and sem.py
{"Source-Url": "https://www.cs.rochester.edu/u/sree/courses/csc-255-455/spring-2023/static/ai.pdf", "len_cl100k_base": 4259, "olmocr-version": "0.1.49", "pdf-total-pages": 33, "total-fallback-pages": 0, "total-input-tokens": 49283, "total-output-tokens": 5761, "length": "2e12", "weborganizer": {"__label__adult": 0.000385284423828125, "__label__art_design": 0.0002713203430175781, "__label__crime_law": 0.0002340078353881836, "__label__education_jobs": 0.0014581680297851562, "__label__entertainment": 6.937980651855469e-05, "__label__fashion_beauty": 0.00012600421905517578, "__label__finance_business": 0.00013494491577148438, "__label__food_dining": 0.00047087669372558594, "__label__games": 0.0004749298095703125, "__label__hardware": 0.0006113052368164062, "__label__health": 0.0003969669342041016, "__label__history": 0.00017178058624267578, "__label__home_hobbies": 0.00011736154556274414, "__label__industrial": 0.0003919601440429687, "__label__literature": 0.00030040740966796875, "__label__politics": 0.00025177001953125, "__label__religion": 0.0004401206970214844, "__label__science_tech": 0.0040130615234375, "__label__social_life": 0.00013399124145507812, "__label__software": 0.0026378631591796875, "__label__software_dev": 0.98583984375, "__label__sports_fitness": 0.00034165382385253906, "__label__transportation": 0.0005407333374023438, "__label__travel": 0.00020265579223632812}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 12974, 0.0104]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 12974, 0.78377]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 12974, 0.58773]], "google_gemma-3-12b-it_contains_pii": [[0, 109, false], [109, 187, null], [187, 256, null], [256, 704, null], [704, 899, null], [899, 968, null], [968, 1441, null], [1441, 1722, null], [1722, 2215, null], [2215, 2367, null], [2367, 2564, null], [2564, 3384, null], [3384, 3641, null], [3641, 3957, null], [3957, 4265, null], [4265, 4486, null], [4486, 4959, null], [4959, 5598, null], [5598, 6097, null], [6097, 6577, null], [6577, 7111, null], [7111, 7964, null], [7964, 8201, null], [8201, 8679, null], [8679, 8895, null], [8895, 9755, null], [9755, 10303, null], [10303, 10844, null], [10844, 11625, null], [11625, 12438, null], [12438, 12701, null], [12701, 12770, null], [12770, 12974, null]], "google_gemma-3-12b-it_is_public_document": [[0, 109, true], [109, 187, null], [187, 256, null], [256, 704, null], [704, 899, null], [899, 968, null], [968, 1441, null], [1441, 1722, null], [1722, 2215, null], [2215, 2367, null], [2367, 2564, null], [2564, 3384, null], [3384, 3641, null], [3641, 3957, null], [3957, 4265, null], [4265, 4486, null], [4486, 4959, null], [4959, 5598, null], [5598, 6097, null], [6097, 6577, null], [6577, 7111, null], [7111, 7964, null], [7964, 8201, null], [8201, 8679, null], [8679, 8895, null], [8895, 9755, null], [9755, 10303, null], [10303, 10844, null], [10844, 11625, null], [11625, 12438, null], [12438, 12701, null], [12701, 12770, null], [12770, 12974, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 12974, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 12974, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 12974, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 12974, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 12974, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 12974, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 12974, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 12974, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 12974, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 12974, null]], "pdf_page_numbers": [[0, 109, 1], [109, 187, 2], [187, 256, 3], [256, 704, 4], [704, 899, 5], [899, 968, 6], [968, 1441, 7], [1441, 1722, 8], [1722, 2215, 9], [2215, 2367, 10], [2367, 2564, 11], [2564, 3384, 12], [3384, 3641, 13], [3641, 3957, 14], [3957, 4265, 15], [4265, 4486, 16], [4486, 4959, 17], [4959, 5598, 18], [5598, 6097, 19], [6097, 6577, 20], [6577, 7111, 21], [7111, 7964, 22], [7964, 8201, 23], [8201, 8679, 24], [8679, 8895, 25], [8895, 9755, 26], [9755, 10303, 27], [10303, 10844, 28], [10844, 11625, 29], [11625, 12438, 30], [12438, 12701, 31], [12701, 12770, 32], [12770, 12974, 33]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 12974, 0.0]]}
olmocr_science_pdfs
2024-11-27
2024-11-27
7905fe090fea49bc59e8e4209e6c87041880c939
Source Code Comment Classification Artificial Intelligence Cole Sutyak cps46@zips.uakron.edu Follow this and additional works at: https://ideaexchange.uakron.edu/honors_research_projects Part of the Artificial Intelligence and Robotics Commons, Programming Languages and Compilers Commons, and the Software Engineering Commons Please take a moment to share how this work helps you through this survey. Your feedback will be important as we plan further development of our repository. Recommended Citation https://ideaexchange.uakron.edu/honors_research_projects/1308 This Dissertation/Thesis is brought to you for free and open access by The Dr. Gary B. and Pamela S. Williams Honors College at IdeaExchange@UAkron, the institutional repository of The University of Akron in Akron, Ohio, USA. It has been accepted for inclusion in Williams Honors College, Honors Research Projects by an authorized administrator of IdeaExchange@UAkron. For more information, please contact mjon@uakron.edu, uapress@uakron.edu. Source Code Comment Classification Artificial Intelligence Cole Sutyak Williams Honors College ABSTRACT Source code comment classification is an important problem for future machine learning solutions. In particular, supervised machine learning solutions that have largely subjective data labels but are difficult to obtain the labels for. Machine learning problems are problems largely because of a lack of data. In machine learning solutions, it is better to have a large amount of mediocre data than it is to have a small amount of good data. While the mediocre data might not produce the best accuracy, it produces the best results because there is much more to learn from the problem. In this project, data was collected from student comment code in computer science classes. This data was then sorted based on various tools in order to create automated source code classification. Various data categorization and sorting methods were explored, ultimately resulting in a process where assigned letter grade was used as a sorting label. Using python, CommentLabeler, and SortAndUnique tools were developed in order to automate the manual source code labeling process. State retention and error checking were also features that were added to streamline the process further. The most important takeaway from this experience was that the amount of data is much more important than quality. In fact, mediocre data will provide better results with regard to machine learning because there is room for improvement and it proves machine learning as a solution. # TABLE OF CONTENTS <table> <thead> <tr> <th>Section</th> <th>Page</th> </tr> </thead> <tbody> <tr> <td>I. Introduction</td> <td>1</td> </tr> <tr> <td>II. Background</td> <td>2</td> </tr> <tr> <td>III. Design</td> <td>5</td> </tr> <tr> <td>IV. Implementation</td> <td>7</td> </tr> <tr> <td>A. Data Source</td> <td>7</td> </tr> <tr> <td>B. Labeling</td> <td>8</td> </tr> <tr> <td>V. Results</td> <td>11</td> </tr> <tr> <td>VI. Conclusion</td> <td>12</td> </tr> <tr> <td>VII. Future Work</td> <td>13</td> </tr> <tr> <td>VIII. Bibliography</td> <td>14</td> </tr> </tbody> </table> INTRODUCTION The classification of comments in source code is a time-consuming and laborious process if done manually. However, this task is essential to effectively managing data. The purpose of this project was to classify comments in source code using machine learning. The ultimate goal of this research was intentionally open-ended to allow for the exploration of multiple routes, applications, and solutions. The majority of the work was in the field of software engineering rather than researching potential methods to complete this task. The majority of the time spent on the project was spent in the development of a functional tool that could successfully classify source code and would improve as the result of machine learning. Therefore, the end result of this research project was a developed tool rather than definitive solutions to specific applications for this tool. BACKGROUND Following a conversation with Dr. Collard regarding potential project ideas as well as a personal interest inventory that I had conducted, Dr. Collard suggested that I take a look at a paper written by Kallis et al. entitled “Ticket Tagger: Machine Learning Driven Issue Classification.” This research project described a novel approach to the prioritization of comment code via machine learning. This interesting approach led to further conversations with Dr. Collard and the development of my proposal to create some form of AI in order to classify comment code. Following up with extensive research, I have not located any comment code text classification AI using deep learning. However, a similar approach to this project was found using Java was done by Luca Pascarella, Magiel Bruntink, and Alberto Bacchelli as explained in their paper, “Classifying Code Comments in Java Software Systems.” In this approach, they use supervised machine learning testing two different classes of supervised classification methods: probabilistic classifiers such as naive Bayes or naive Bayes Multinomial, and decision tree algorithms such as J48 and random forest. Their approach largely mirrors this project because Fasttext is an expansion and optimization of the decision tree algorithm. However, while their work has to do with comment classification, their classification is vastly different. Their comment classification is explicitly concerned with the purpose of the comment, while this project is concerned with overall comment grade or health. A comment grade, or health, is a general scoring of a code comment. Research projects performed by Tenny as well as Woodfield et al., indicate that code comments are integral for code readability. However, these studies fall short when deciding the question, what makes a comment good? A large part of this project was spent on this specific question. For the purposes of this project, a good comment is defined as one that most efficiently completes a comment’s purpose. This definition creates another question, what is a comment’s purpose? This nuance could be debated, however for the scope of this project, the comment’s purpose is “to make it easier for people to understand the code” This definition was obtained from research conducted by Yang et al. as reported in their paper, “A survey on research of code comment.” This may seem intuitive, but it is a more advanced problem than it appears considering the code classification AI must label a comment good or bad based on these two disputed definitions. In summary, a good comment is one that most efficiently “makes it easier for people to understand the code.” However, this definition has the potential to be quite subjective, varying from person to person and as a result, another problem is created. With this in mind, it is important to abstract the code classification AI will function based on the definition of what a good comment is. Expanding on this premise there are often many comments which are necessary to the code base that aren’t classified as good. One example of this is commented-out code. Commented-out code can provide a real benefit to code libraries that need examples of implementations or code lines that are frequently hot swapped. Examples of implementations could theoretically aid in understanding the code. This makes it, by one definition, potentially a good code comment, but for the simplicity of this project, since most comments that include this strategy do not aid in helping the reader understand the code, it is not categorized as such. Both of these examples of commented-out code are generally against proper coding practices, and while, by definition, they can theoretically be good comments, they are generally not, therefore the decision was made to omit these comments from the data. Another problem with labeling a comment based on this definition is comment context. The comments obtained for this project oftentimes did not have enough context to be labeled good or bad. The context, in this case, being the code surrounding the comments. The tools used for obtaining the comment data stripped all code from the comment, so some comments could be mislabeled because of lack of context. For example, if there were a comment such as “sets x to the area of a triangle”, and this had no relevance, meaning that the comment was not close to any x variable, or worse, x was not being set to the area of a triangle, then by definition, x is a bad comment. But without context “sets x to the area of a triangle” is a good comment because it efficiently explains to the reader what is in that comment section of code. DESIGN Once the background information was assimilated and a focus for the project had been established, it was time to make design decisions. All code for this project was developed in Python. This language was chosen because of the ease of using multiple libraries using pip. Pip is a package management system for installing and managing python. Prior to making the decision to utilize python, other options were explored, including C++ and C#. Although C# does not support Fasttext natively, it is a very robust and powerful language for developing windows applications in particular. However, this was not optimal for this project because it was decided in the early stages of development to go against the idea of creating a windows application. The reason is because much research and development would need to be done on best practices for a windows application which would defer the focus from the actual project. There were two remaining choices, C++ and Python, both of which are languages that Fasttext explore natively. C++ was ultimately decided against, not because C++ is a bad language but because, in this case, Python is better. Python is better because of pip. Pip is a package-management system written in python for python that allows for easy installation and management of python packages. Installing C++ packages is not extremely complex, but with respect to research and development, python is much more suited to the job. Python’s package manager allows the user to install and manage multiple complex packages quickly and seamlessly. This is more suited for this research project because multiple packages could be installed and tested to find optimal solutions. In hindsight, C++ might have been a better choice because the focus of this project shifted from a solution explorer, to a software engineering one. The tool used in this project was a python fast text classifier, “Fasttext”. Fasttext is a library for learning word embeddings and, more importantly in this case, text classification. Fasttext was created by Facebook’s AI Research lab (FAIR) and has been shown to be on par in terms of accuracy with more complex solutions such as deep learning classifiers, as reported by Joulin et al. in their article, “Bag of Tricks for Efficient Text Classification.” Developing a unique deep learning application for this problem was also a solution explored. If the goal of this project is to find the most efficient solution to text classification of code comments, there is no real benefit in using deep learning models over Fasttext. This is because while deep learning models often are on par with Fasttext in terms of accuracy, they suffer in two main categories, complexity and speed. In the paper “Bag of Tricks for Efficient Text Classification” by Armand Joulin, Edouard Grave, Piotr Bojanowski, and Tomas Mikolov, they show multiple cases in which their Fasttext classifier is on par in terms of accuracy to other deep learning models. And while accuracy is virtually the same among both text classification solutions, Fasttext drastically outperforms deep learning solutions in terms of training speed. Oftentimes while a deep learning solution takes hours, a Fasttext one takes seconds. Fasttext is also a robust and maintained library that is fully implemented with python pip, so implementing it is extremely simple, whereas the complexity of creating a deep learning model for this problem would be beyond the scope of this research project. IMPLEMENTATION Data Source For all machine learning problems getting mass amounts of data is a crucial step for accuracy. For supervised learning problems, oftentimes getting the data is not challenging; it is labeling the data that provides a hurdle. This project was no exception. I have come to understand that the best machine learning solutions are often ones in which mass amounts of data are easily obtained, often automatically, and then labeled. Keeping this in mind, the data for this project was obtained with the assistance of Dr. Collard. He was able to provide student-created comments from projects in his classes. This type of data was beneficial because the comments were created by students so there was a healthy mix of both good and bad comments. However, this data source was not without drawbacks. The first of which was that since the data was all for assignments, the students were commenting on the same bodies of code. This meant that a lot of the data was nearly identical or default comments that were left by the professor himself. This presented a drawback because the comment classifier would pick up a word or phrase that is frequently used for a good or bad comment and might automatically mislabel it because of that word or phrase. In one perspective, this could be beneficial in this case because largely the comments that were written by the professor and thus were generally good comments. This means that this data could potentially be all labeled good and help train the system. However, to preserve data integrity it was decided to create a solution to this drawback rather than ignore it. The solution to this problem was quite simple, to get rid of duplicate comments. Getting comments in this way also caused another drawback. Because the comments were assignments given by the professor, oftentimes, comments were instructional. This means that the comments were instructions to tell the students how to do the assignment. The solution to this problem was not as simple and was more time consuming as well. It required the manual omission of this type of data. **Labeling** The main challenge, after gathering the data, was to obtain labels for the data. Fasttext does offer unsupervised learning options for text classification, but since the content of the comments will never feature whether it is a bad comment (unless if the comment were to literally say “this is a bad comment”), this method is not appropriate. With this in mind, there were two approaches utilized to obtain labels for the project. The first method was to manually label data on a three-point scale. One being good, two being bad, and three being omitted comments. The comments labeled three were either commented-out code or comments that required more context to be labeled. This solution was not only short lived, but it was generally bad. The problem with this solution was that there was so much subjectivity to the “good” comment that inconsistency in data labeling was often rampant, creating many mislabeled comments. On top of that, getting enough labeled comment data was extremely time consuming. In an attempt to streamline this process, a python script was created to automate this as much as possible. This tool was eventually developed into a full shell tool. The two main features of this shell tool that aided in comment labeling was the SortAndUnique and CommentLabeler tools. The SortAndUnique tool was created to solve the problem of data repetition as listed above and was not initially intended to solve this problem. This tool sorted the data and then ran a unique function that omits any repeating comments. The data was sorted to make it easier to run the unique function. It is easier to run the unique function on sorted data because an unsorted unique function would need to check the whole list for every line thus making it an extremely costly $O(n^2)$ algorithm. While the sorted unique algorithm utilizes quicksort, which is a $O(n \log n)$ algorithm and then it would need a unique function step which would be $O(m)$, so the final runtime of the algorithm would be $O(n \log n \times m)$. This tool made it easier to manually classify data because when the data was sorted like phrases were all grouped together. Meaning multiple blocks of good and bad comments were generally grouped together, making labeling conceptually easier to comprehend. The other python script was the CommentLabeler. This was a tool developed for this project to label comments efficiently. This tool automatically prompts the user with comments to be labeled using the command line. This tool provides three main functions, error handling, state retention, and automatic prompting. The user defines the potential labels in a config file, and if the user does not enter a proper label, the tool does not label that comment and pre-prompts the user with it; this is to prevent user error and preserve data integrity. Another function the tool provides is state retention; when the user is finished commenting, and they are not finished with the file, they are able to exit the tool, and it will automatically save the state in which the user was at so that they can resume where they left off. The last main feature provided is automatic prompting; the user is automatically prompted with each comment in the data set one after the other every time they label a comment. This tool is simple in concept, but it goes a long way. To see why this initial solution was not optimal, it is necessary to observe the dataset. The dataset used for this project was 30,000 comments, and after sorting was 5,000 comments. Hypothetically, if it were to take someone an average of 30 seconds to discern a good or bad comment, to label all 5,000 comments, it would take that person 150,000 seconds or ~41 hours to completely label the data set. If that person were to attempt to label the full data set, it would take them ~6x longer. So, with this information, this solution is bad mainly because it is not scalable. Good machine learning problems are ones that have easily scalable data and label solutions. The best machine learning problems are ones that have automatically scalable data and label solutions. The main and final solution found in this project for data labeling was utilizing another portion of the data, the grade of the assignment itself. Instead of manually labeling the data on a three-point scale, we used a typical grading scale (A, B, C,D, F) with “A” being the highest and “F” being the lowest. The labels for the data would be from the assigned grades. This solution was not without its drawbacks though, while it was a much more scalable solution, it also still required a certain amount of manual labeling in that the professor had to look up the grades and label those students’ code comments appropriately. This could be done semi automatically as opposed to the other solution, which was nearly completely manual. This solution provided ~2600 labeled comments as opposed to the manual solution, which provided ~500. This solution also has the problem that the grading scale does not necessarily determine whether or not the students' comments are “good” or “bad” based on the previously established definitions. This also raises another question, should the comment classification AI just label the comments “good” or “bad” or should it label it on some sort of spectrum? This project focused on a spectrum identical to that of the grading scale. The best comments were Labeled A, and the worst were labeled F using the semi-automatically generated data from the assignment. RESULTS As expected, the manually labeled comments produced poor results. At several stages of labeling the data, a fasttext model was run on manually labeled test data and it performed poorly. Since there was so little labeled data, and the data variation was so small (the data variation was small because all comments are labeled in order and the data is sorted), fasttext chose the category that was used the most, in this case one. The accuracy of this was manually measured on 100 comments and was found to be 64%. However, this accuracy was largely due to most of the comments being good comments. If this was run on 50 bad comments and 50 good comments, the accuracy drops to 57%, and considering good and bad comments are 50-50 split, it is just slightly better than guessing. The graded comments produced a much better result; however, with more data, the accuracy could be increased. To measure accuracy, 100 comments were taken from the test data set and manually labeled, 50 good comments and 50 bad comments were used. They were then run through Fasttext, and if they were labeled A or B, they were good, and if they were C, D, or F, they were bad. The accuracy of this was then measured with respect to how often these two matched. This produced a result of 71%, which was much better than expected. CONCLUSION This project presented a great opportunity to explore machine learning in a practical manner. It was an interesting way for me to explore my concentration interests within my major to be able to implement a practical solution that could be helpful. The project itself was very engaging. Despite the pitfalls of quantity and quality of data and methodology, I was able to arrive at worthwhile solutions that will help to create opportunities for future growth. The most important conclusion of this is that it is better to have a large amount of mediocre data than it is to have a small amount of good data for machine learning solutions, in particular Fasttext solutions. This is because it provides room for improvement which is the purpose of machine learning. The field of AI and machine learning is quite expansive, and the opportunity to develop cutting-edge technology in this area is only on the surface. I look forward to continuing to develop strategies within this realm. FUTURE WORK A great deal of future work could be done with respect to this project. Since it would be possible to skip the intermediary step of determining accuracy using A-B and automatically convert the labels to 1-2 based on the A B = 1 and C D and F = 2 scale, efficiency and potentially accuracy would be improved. Obtaining more data would be a huge help to accuracy. As is generally accepted, the larger the sample size, the better the results. With this in mind, the more classification data that is available, the better the results will be. One possibility for obtaining more data in the labeled form would be to get data from multiple professors. Another possibility for gathering mass amounts of unlabeled data would be to create a scraper tool to scrape GitHub or another mass code base and extract the comments from there. Testing out Fasttext unsupervised models would also be interesting to see the classifications Fasttext comes up with. This would especially be true if this method were used on the potential scraper tool, as mentioned earlier. Lastly, a deep learning model could be used instead of Fasttext. It would be interesting to see how a traditional deep learning model would compare to Fasttext in terms of accuracy. In this way, the optimal process could be determined for future applications.
{"Source-Url": "https://ideaexchange.uakron.edu/cgi/viewcontent.cgi?article=2686&context=honors_research_projects", "len_cl100k_base": 4695, "olmocr-version": "0.1.53", "pdf-total-pages": 18, "total-fallback-pages": 0, "total-input-tokens": 32536, "total-output-tokens": 5921, "length": "2e12", "weborganizer": {"__label__adult": 0.0003941059112548828, "__label__art_design": 0.0004091262817382813, "__label__crime_law": 0.0003771781921386719, "__label__education_jobs": 0.003679275512695313, "__label__entertainment": 7.37309455871582e-05, "__label__fashion_beauty": 0.00018608570098876953, "__label__finance_business": 0.00019407272338867188, "__label__food_dining": 0.00039839744567871094, "__label__games": 0.0005168914794921875, "__label__hardware": 0.000629425048828125, "__label__health": 0.0005450248718261719, "__label__history": 0.0002071857452392578, "__label__home_hobbies": 0.00010895729064941406, "__label__industrial": 0.00030684471130371094, "__label__literature": 0.0003662109375, "__label__politics": 0.0002455711364746094, "__label__religion": 0.0003871917724609375, "__label__science_tech": 0.0159912109375, "__label__social_life": 0.0001780986785888672, "__label__software": 0.00601959228515625, "__label__software_dev": 0.9677734375, "__label__sports_fitness": 0.00031495094299316406, "__label__transportation": 0.0004210472106933594, "__label__travel": 0.00018155574798583984}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 25013, 0.02267]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 25013, 0.40841]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 25013, 0.96189]], "google_gemma-3-12b-it_contains_pii": [[0, 1156, false], [1156, 1252, null], [1252, 2718, null], [2718, 3171, null], [3171, 4057, null], [4057, 5968, null], [5968, 7996, null], [7996, 8739, null], [8739, 10674, null], [10674, 12233, null], [12233, 14122, null], [14122, 16013, null], [16013, 18170, null], [18170, 19867, null], [19867, 21184, null], [21184, 22178, null], [22178, 23505, null], [23505, 25013, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1156, true], [1156, 1252, null], [1252, 2718, null], [2718, 3171, null], [3171, 4057, null], [4057, 5968, null], [5968, 7996, null], [7996, 8739, null], [8739, 10674, null], [10674, 12233, null], [12233, 14122, null], [14122, 16013, null], [16013, 18170, null], [18170, 19867, null], [19867, 21184, null], [21184, 22178, null], [22178, 23505, null], [23505, 25013, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 25013, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 25013, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 25013, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 25013, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 25013, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 25013, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 25013, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 25013, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 25013, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 25013, null]], "pdf_page_numbers": [[0, 1156, 1], [1156, 1252, 2], [1252, 2718, 3], [2718, 3171, 4], [3171, 4057, 5], [4057, 5968, 6], [5968, 7996, 7], [7996, 8739, 8], [8739, 10674, 9], [10674, 12233, 10], [12233, 14122, 11], [14122, 16013, 12], [16013, 18170, 13], [18170, 19867, 14], [19867, 21184, 15], [21184, 22178, 16], [22178, 23505, 17], [23505, 25013, 18]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 25013, 0.14634]]}
olmocr_science_pdfs
2024-12-04
2024-12-04
752a7044f261ac0b059f369d7e66fecff70aff56
Investigating the Feasibility of Open Development of Operations Support Solutions C.R. Gallen, J. S. Reeve University of Southampton Hampshire, England {cg02r, jsr}@ecs.soton.ac.uk Abstract The telecommunications Operations Support Systems supply chain must address many stakeholders: R&D, Product and Requirements Management, Purchasing, Systems Integration, Systems Administration and Users. While the management of next generation networks and services poses significant technical challenges, the present supply chain, market configuration, and business practices of the OSS community are an obstacle to rapid innovation. Forums for open development could potentially provide a medium to shorten this supply chain for the deployment of workable systems. This paper discusses the potential benefits and barriers to the open development of OSS for the telecommunications industry. It proposes the use of action research to execute a feasibility study into the open development of OSS software solutions within an industry wide Open OSS project. Keywords 1 Introduction In recent years the phenomena of open source and collaborative development between organisations has delivered some spectacular successes such as LINUX and Apache and aroused considerable interest in the software community. The telecoms industry has historically been very conservative in its approach to software development. As a result, it can be argued that the industry has been slow to benefit from software trends originating in other industries. Our research interest concerns whether open source development can provide an alternative mechanism for the telecoms industry to solve network management problems. For our purposes, the Wall Street Journal has coined a simple definition of open source software which avoids an obfuscated discussion on the nature of software licensing; Open-source programs share programming instructions usually kept secret in commercial software. Such programs are created and improved by global groups of programmers and users. [1] Ramande’s ‘The Cathedral and The Bazaar’. [2] is perhaps the most famous challenge to the notion that only closed development techniques can deliver good quality software. However a growing community of other researchers have been actively investigating the viability and benefits of open software as an alternative to COTS (Custom Off The Shelf) solutions [3,4,5,6,7,8,9] It is significant, though, that as far as we can tell, none of these groups are focusing on the potential for Open Source in the Telecoms Operations Support System (OSS) environment. We consider that open source and collaborative development could have significant implications for the telecommunications industry if a community was established for the development of open OSS Software. In order to test this assertion, we believe a cross industry action research pilot project needs to be established for the purpose of delivering a useful OSS solution using collaborative / open source techniques. This would then act as a vehicle for researching the viability of this approach for wider OSS software development. The remainder of this paper is organized as follows. First we discuss some of the reasons why OSS development continues to be a major issue within the Telecommunications industry. Then we analyse where we think collaborative development might help. Next we describe the Open OSS project. Finally we conclude and present directions for future work. 2 The OSS Development Problem 2.1 The Market for Operations Support Systems OSS Observer’s study of the OSS market [10] reveals that the global spending on Operational Support Systems within the telecoms industry is around $30 billion dollars per year (about 3% of total telecoms revenue) with about 2/3 of this being spent on custom developed systems and 1/3 on COTS software. Some 200,000 IT professionals are employed globally by service provider IT departments, many of whom are working on internally developed solutions. The majority of the $10 billion dollars COTS OSS market is accounted for by only the top 100 service providers and when deployed by these service providers the COTS products are often heavily modified before use. Against this background, it can be seen that the lion’s share of OSS development activity in the telecoms industry is still done internally by service providers. Over the last 20 years, COTS solutions have made significant inroads but these solutions still only account for 1/3 of global OSS software development. OSS Observer [11] further reports that in developing countries such as India, Indonesia and Vietnam, low labour rates limit the commercial OSS opportunities for global OSS ISVs. In many of these countries, alternative low cost software solutions have emerged because operators are unwilling or unable to afford the price of the applications used by operators in the West. These solutions are often supplied internally or from other emerging countries; a fact evidenced by several TM Forum Catalyst projects which have showcased non-mainstream capabilities originating in the CIS or India. Global market surveys do not necessarily reflect the contribution these solutions make because they are internal or low budget. In the developed world users of OSS systems can be characterised in three tiers. In the primary tier are the large national and translational incumbents many of which are privatised PTTs. In the secondary tier are smaller alternative operators who mostly compete with the primary tier in the high value business market. In the third tier are niche players who target very specific opportunities – often adding value on top of the wholesale infrastructure of the incumbents. A simple characterisation of these tiers is given in Table 1. In general the market for telecoms OSS systems is a relatively small pool compared to other markets for commercial software such as e-business. This is evidenced by the fact that the Telemangement Forum, which is the premier industry body supporting Service Provider OSS standardisation, has only 370 corporate members including suppliers. <table> <thead> <tr> <th>Market</th> <th>Internal R&amp;D</th> <th>Product Purchasing</th> <th>Other factors</th> </tr> </thead> <tbody> <tr> <td>1st Tier</td> <td>• Significant Internal R&amp;D&lt;br&gt;• Historically used internal solutions&lt;br&gt;• Big integration &amp; support teams</td> <td>• May use set of ‘best in Class’ COTS products&lt;br&gt;• Will modify selected products extensively&lt;br&gt;• Often do own integration</td> <td>• Have a historical legacy of 100’s of systems to integrate with new services</td> </tr> <tr> <td>2nd Tier (AO)</td> <td>• Limited or no R&amp;D.</td> <td>• Will use set of ‘best in Class’ COTS products&lt;br&gt;• Will spend on products but not on R&amp;D&lt;br&gt;• Often partner with large SIs for integration</td> <td>• Finding they have created a legacy architecture through hasty start-up purchasing decisions</td> </tr> <tr> <td>3rd Tier (Niche)</td> <td>• No R&amp;D but will use any pragmatic solution that works.</td> <td>• Tend to use enterprise solutions&lt;br&gt;• Open to pragmatic open source or free solutions&lt;br&gt;• Very flexible approach&lt;br&gt;• Limited capital spend</td> <td>• Niche markets can be highly profitable with flexible bespoke solutions not easily offered by large SP’s</td> </tr> <tr> <td>Emerging Markets</td> <td>• May internally develop since labour is cheap vs. COTS</td> <td>• Often purchase locally or in a lo-cost market because they cannot afford Tier 1 solutions.</td> <td>• Have clever staff able to create local workable solutions.</td> </tr> </tbody> </table> Despite the overall reduction in spending due to the burst of the ‘dot.com bubble’, the first and second tier customers continue to represent a cosy market for their incumbent OSS suppliers due to the high barriers to entry and the stranglehold OSS systems on the service providers’ internal operations. The cost of replacing any one of these systems is too prohibitive for most telecoms operators to consider and although emerging suppliers would very much like to address this market, they cannot easily offer a value proposition which would justify the 2.2 The Role of Standards Standards have always played a significant role in Telecommunications product development. However the rate of change in the industry has required a move from the paper standards development processes originally followed by the PTTs through the CCITT towards less bureaucratic mechanisms pioneered by the IETF which require working implementations before a standard is accepted [12]. Increasingly standards bodies such as the DMTF are promoting the use of open source to both develop and promote standards [13]. The very nature of the network equipment market requires a commitment to interoperability through standardised interfaces. As a result, it would be very unusual today to find new network equipment introduced by a vendor which did not interoperate at least at a basic level with other network equipment from its first day of introduction. Unfortunately, the same level of commitment to interoperability does not exist with respect to standardisation of components within the OSS space. Every OSS component follows a different design pattern and requires specific staff training in its use. Integration requires a detailed and difficult mapping of functionality between components. The time to integrate any solution increases exponentially with the number of systems because each component’s interfaces have to be considered separately and not as part of a pre-integrated framework. Historically a number approaches have emerged to try and address these issues. Firstly, over the years many attempts have been made to simplify OSS integration using public standards (TMN, OSI, TINA-C to name a few) but none have had sufficient market adoption to guarantee component interoperability without significant integration work. Secondly, larger vendors have attempted to create OSS frameworks (such as TeMIP or OpenViews etc) to simplify integration of third party ‘plug-in’ components. These frameworks are proprietary and again, the lack of critical mass has prevented clear de-facto standards from emerging across the industry. Finally, as a stop-gap, the larger system integrators have promised to considerably reduce the integration time for their customers by making the prior investment of building their own reference OSS architectures using pre-integrated components from different OSS vendors. This significant investment is hard for smaller integrators to emulate but the benefit of this approach breaks down when customers go beyond vanilla solutions or require localised integration to legacy systems. Lately there has been a realisation that the telecoms OSS market alone does not have the volume to drive its own software standards. This is reflected in the thinking behind Telemanagement Forum’s Next Generation Operations Support System (NGOSS) [14]. NGOSS specifies a framework for OSS integration which can bridge legacy OSS technologies with the new component development standards reaching critical mass in the enterprise world (i.e. J2EE, .NET or SOA... and web services). Similar thinking drives OSS/J [15], an open standard initiated by SUN for implementing NGOSS compliant solutions leveraging J2EE [16]. If these new standards reached critical mass, they would potentially represent a significant market discontinuity. Firstly they would allow proven low-cost components from the enterprise world to be easily integrated into the OSS environment. Secondly, they would represent a lowering of the barrier to entry for non-incumbent component vendors – effectively commoditising parts of the OSS market. And thirdly, they could provide a framework for some of the service providers’ currently huge internal investment in software development to be shared across the Telecommunications industry. It is in harnessing this last possibility, by encouraging internal development groups to work to emerging common architectural standards, that there exists the potential for an industry wide open solution development initiative. 2.3 The Operations Systems Gridlock Commentators such as Lee and Ben Natan [17] would observe that one of the biggest costs and roadblocks to telecoms agility is the current industry-standard OSS suite. A major headache in the introduction of even a simple new service is the management of the supply chain to orchestrate the changes required across multiple OSS products. Each COTS OSS component has its own commercially driven roadmap which guides the core development of the product. Large service providers can demand product customisations in order to meet the needs of the solutions offered to their customers. Unfortunately, despite many promises (often made in good faith), there is no guarantee that any customisations will be forwards compatible with the next release of the product or that the product will actually follow the original roadmap outlined by the vendor. Thus the Service Provider needs to spend a great deal of energy managing the roadmaps of his selected COTS product vendors in order to try and fulfil a long term plan. An additional problem has been caused by the current market configuration. The various COTS systems currently available have traditionally been designed to fit a particular purchasing and marketing strategy which emerged to support early OSS standards. The ITU Telecommunications Management hierarchy [18] provided a useful nomenclature over the last 20 years for specifying systems in the Element , Network and Service Management and the Business Support Systems layers. However its use has had the unfortunate side effect of creating a market where the most established products have been packaged to represent components described in this telecommunications hierarchy. The early standards never considered modern enterprise concepts such as separate work flows running across components and the fact that the same components might be required to manage services across multiple network technologies. While the TMN nomenclature remains useful, it is too rigid a model to think about the realities of today’s very complex process flows in a telecoms infrastructure. Thus it can be argued that this has created two market problems. Firstly, the Tier 1 operators have chosen a set of products for specific purposes and are unwilling to let these products be developed into areas beyond their core functionality. Secondly, the Tier 1 software vendors have made a huge investment in establishing product brands for products which map onto the legacy view of telecommunications management and are unwilling to un-bundle the functionality into separate components in order to better match the needs of their customers. Nobody wants to give up ‘functionality footprint’ to a competitor. In effect we have a market gridlock which makes it very difficult to establish the viability of a next generation solution in the face of so many long term investment decisions and vested interests in maintaining the status quo. 2.4 A Summary of the problem In summary, OSS Software development represents a significant and rising cost to the Telecommunications industry. A very high proportion of OSS development is currently done in-house by service providers - presumably because they cannot find or cannot afford suitable software in pre-built COTS products. COTS products still only account for 1/3 of the OSS software procurement activity and where large service providers purchase COTS solutions, they invariably modify them significantly before deployment. The fact that the current set of COTS solutions do not seem to meet all the needs of most service providers suggests that the current structure of the industry and the packaging of COTS components make it very hard for service providers to create useful solutions without additional development. There seems to be a fundamental problem with the current market approach to managing requirements across the solution space. Although the potential benefits of emerging standards such as NGOSS and OSS/J are great, the reality is that the industry remains to be convinced that these are the right approach. There is an urgent need for more proof points to convince the industry to adopt these standards. If a component approach using NGOSS and OSS/J could be demonstrated to work as a means to enable open development of useful components ‘by the industry and for the industry’, it could also lead to a significantly more efficient use of the service providers internal development resources. We now turn to considering how shared open component development across the industry might be achieved. 3 Open OSS – A feasibility study into Open Source OSS 3.1 The potential benefits of open development The software industry has woken up to the potential of open source and several commentators are proposing best practise for open source development. [19,20,21]. Martin Fink the Director of open source projects at Hewlett Packard has written on the commercial opportunities of open source [22]. He sees open source as a tool to help the industry create better solutions to common problems. On a philosophical level, objections have been raised to open source on the grounds that it will kill innovation in the software industry since it is being used as a way to market ‘failed software products’[23]. However this ignores the fact that the business model relies not on software sales but on services. By feeding and watering the plant, many people get to harvest the fruit. In a recent UK survey, into the perception of open source software by Chief Information Officers [24], 16% of the CIOs surveyed said they were actively looking at open source solutions now. This suggests that there is a growing enterprise awareness of the potential value of open source solutions. The telecommunications community has been traditionally more sceptical but a number of service providers are becoming interested in exploring the potential of open source alternatives to internal development. A 2001 Eurescom project suggested a number of benefits could be derived from open source in the Telecoms industry[25,26]. A number of equipment vendors have identified similar potential benefits of open source as a means to simplify the problem of mapping vendor specific equipment functions to a more generic OSS infrastructure. This is one of the drivers behind the Ericsson, Motorola, NEC, Nokia and Siemens Co-operative Open OSS Project [27]. Academia now appears as the second major source of open source software after independent developer communities [28]. Open source could also provide a mechanism for academia to share work with commercial partners allowing more brain power to be applied to the OSS problem. 3.2 Open Development and the COTS Vendors The creation of an Open Source OSS project could be viewed as a threat to the incumbent ISVs. However, we would rather position this project as an opportunity for the Telecoms OSS industry. Much of the attention given to the phenomenon of open source software has focused on the economic issues related to free software licensing, rather than on the value of open development techniques as a means to develop useful components for an industry. We wish therefore to find a way to test whether open development could be used effectively in the Telecommunications industry to prove the value of emerging management standards and potentially to create useful components for the industry. Enterprise management standards such as those from the DMTF are already being implemented in open source and are moving into the enterprise mainstream. Harvard professor, Clayton Christensen has identified that Open Source represents a Disruptive Technology [29,30]. Initially open source products are low specification but they can bring to the market simpler and more affordable products that allow a whole new population of people to begin using them. However because the open source innovation trajectory is so steep, what begins a simple application can ultimately intersect with the mainstream. The danger is that ignoring the enterprise approach to development could later leave the incumbent Telecoms OSS vendors struggling to catch up. Conversely, NGOSS envisages a framework providing common services to a variety of OSS components. Most COTS OSS products in production today contain duplicated functions which represent a cost to maintain and which are generally done better by mainstream enterprise solutions. A common framework of services could allow OSS COTS vendors to concentrate on exploiting their lead in their high value IPR which addresses telecoms niche functionality such as alarm collation or SLA management while avoiding wasted effort on ‘vanilla’ functionality. This project seeks to explore what that common set of services might be and if possible explore implementing these services in Open Source. ### 3.3 Open OSS Project Objectives The two pillars of the proposed Open OSS project are the exploration of open source / free software development techniques combined with the promotion of emerging Network Management standards across the telecommunications industry. By this means we hope to demonstrate to the industry the value of the emerging standards and of new ways of doing business. The basic premise of the Open OSS project is that the telecommunications industry needs to modify its competitive behaviour in order to co-operate in developing solutions which meet the common base needs of the industry. A mechanism is required to allow the OSS supply chain to be collapsed across the organisational boundaries between blue sky researchers, equipment vendors, OSS vendors, systems integrators and service providers. The need for co-operation across the industry has already been recognised by the Telemanagement Forum in that they sponsor a number of ‘Catalyst’ projects on a 6 monthly basis as a means for vendors and service providers to produce ‘proofs of concept’ of NGOSS principles for the industry. Strassner considers the use of industry based Catalyst projects an essential part of the process of developing and proving NGOSS standards [31]. However to date, implementing a Catalyst has involved taking a selection of industry standard COTS systems, integrating them using NGOSS interfaces (usually OSS/J) and demonstrating them managing a pilot network or service. Few artefacts or reports on the project are made publicly available. Further more, it is very difficult for the industry or academia to reproduce these experiments without access to the software products which were used in the demonstration. Although limited, the Catalysts do provide value because many of the participants in the Catalysts are also participants in the NGOSS and OSS/J standardisation process and there is a route for detailed technical feedback into the standards. However there would be great value in being able to create an open environment in which many more players could participate in evaluating the emerging technology. The hope is that the Open OSS project will make it possible for researchers to more easily build a reference solution demonstrating NGOSS principles. ### 3.4 Initiating the Project Unlike many academic research activities the Open OSS project is being designed explicitly to facilitate industry collaboration in creating common OSS components. The research objective is to investigate whether this sort of collaboration can produce more effective industry OSS solutions than the more traditional OSS acquisition and product management processes. This may be thought of as a second order research objective which runs in parallel with and provides additional proof points for the core research supporting the development of the NGOSS standards. The contribution this project makes towards adoption of the standards will be one success factor by which it should be measured. To be successful, this project will first require that an industry collaboration is set up with clear benchmarks for success. Open development implies that the parties can choose to participate or not and the motivation for participating will be different in each case. In a successful project it is thus vital that the aspirations of all the participating parties are well understood and clearly addressed by the project. This includes understanding the motivation of individuals who may be champions of the project within their employers organisations. Chapman and Ward have suggested that a key factor in successfully managing the risks associated with a collaborative project is an understanding of the motivations of the stakeholders involved [32]. We have used part of their motivation framework to categorise the generic motivations of the various stakeholders in an open source OSS project. The results of having discussed this project with a number of potential stakeholders are summarised in Table 2. Table 2: Motivation Analysis - applied to Open OSS project <table> <thead> <tr> <th>Who: Service Providers</th> <th>Why (motives)</th> <th>What (design)</th> <th>Potential Risks</th> </tr> </thead> </table> | More effective spending on OSS SW | Lower cost alternative to COTS solutions | • Litigation issues - ‘Viral licences’. • Lack of commercial support model • Organisational resistance open SW • Lack of suitable components | | Better requirements management and roadmap control | • Lack of credible lead architects to represent SP’s to developers • No guaranteed open source roadmap • Loss of OSS competitive advantage | | Industry Development of OSS components | • some partners ‘free-ride’ • One user left supporting component | | Reduced integration costs | Promote emerging OSS framework integration standards | • Standards not sufficiently mature • Interim design not in standards • Standards never widely adopted | | Encourage COTS OSS componentisation | • Project not taken seriously by COTS vendors | | Rapid development using MDA-like tools | • Tools immature - significant re-working needed later on | | Reduced Ops costs | Reduce specialist staff training needs | • Chosen technologies never reach wide industry acceptance. | |--------------------------|---------------|---------------|-----------------| | Thought leadership | Promoting capabilities in Open Source and OSS frameworks | • Integrator fails to generate industry thought leadership • Project failure creates negative impact | | Develop services to deliver Next Gen OSS | Processes for NGOSS component Selection, Assembly Deployment | • NGOSS / OSS/J solutions gain limited market acceptance • Conflict if SI is perceived as competing with COTS vendors | Who: COTS ISV and Middleware Vendors <table> <thead> <tr> <th>Why (motives)</th> <th>What (design)</th> <th>Potential Risks</th> </tr> </thead> </table> | Concentrate on core R&D | create a commons of non core technologies | • commons not adopted by industry • commons does not support differentiating features | | Market OSS middleware | NGOSS / OSS/J proof points & components | • Conflict if middleware vendor is perceived as competing with COTS | **Who:** Academia <table> <thead> <tr> <th>Why (motives)</th> <th>What (design)</th> <th>Potential Risks</th> </tr> </thead> </table> | Closer industry contact | Building a project which acts as a “living laboratory” for research consortia | • Potential disputes over IPR exploitation • Potential conflict over wider publication of research results | | Apply OSS to other problems | Manage advanced web services / Grid etc | • Other industries create own solutions and don’t see value of telecoms OSS | **Who:** Individual developers / Students <table> <thead> <tr> <th>Why (motives)</th> <th>What (design)</th> <th>Potential Risks</th> </tr> </thead> </table> | Increase job interest and employability | • Avoid orphan skills • Raise job profile • Make current development job easier | • Project doesn’t deliver value to employee’s business • Individual stuck on ‘maintenance’ vs. new design • Too much churn in community membership | As with any product solution, an open source solution will need marketing to gain a viable user base. Fink [22] considers it very important that the project is launched effectively otherwise it is unlikely to reach a critical mass of developers and users. It will be necessary to ensure that potential collaborators and end users are well informed and able to participate usefully in the project from day one. This will require commitment to building a viable community and also that clear attention is given to the ‘marketing mix’ of the project as outlined in Table 3. **Table 3:** A marketing mix evaluation of open OSS project requirements <table> <thead> <tr> <th>Mix</th> <th>Evaluators question</th> <th>Requirement</th> </tr> </thead> <tbody> <tr> <td>Price</td> <td>Does open development reduce the cost through solution life</td> <td>Trial projects must provide reduced cost ownership proof points</td> </tr> <tr> <td>Promotion</td> <td>Does open source provide a differentiating market channel</td> <td>Marketing to ensure high industry visibility (use co-marketing etc)</td> </tr> <tr> <td>Place</td> <td>Where can the solution be obtained?</td> <td>Need a well known place (web site) to find the work</td> </tr> <tr> <td>People</td> <td>Are a credible development team working on the solution?</td> <td>Need a governance model which links respected industry players.</td> </tr> <tr> <td>Physical Evidence</td> <td>Process</td> <td>Open development Process/Culture</td> </tr> <tr> <td>Physical Goods (Product)</td> <td>Can the packaged solution be easily obtained and used?</td> <td>Packaging/distribution (web download) easing solution use. Initial release to be well documented and fit for purpose.</td> </tr> <tr> <td>Services</td> <td>Are there sufficient services for the solution?</td> <td>Need support mechanisms – web logs, FAQ’s and ultimately a commercial support offering.</td> </tr> </tbody> </table> Open Source projects are often characterised as having no strict plans, open code access and external developers. However we would argue that this describes projects once they have reached equilibrium. Even then, there is usually a tacit understanding of a roadmap among the core architects even if this is not published. Fink believes one of the major reasons why Open Source projects fail is that they release code too early and they do not have an architecture which makes it easy for others to contribute, citing this as a major issue in the early launch of the Mozilla project by Netscape. He believes that a key requirement for success is that the first code released is relatively bug free and can be easily understood and used by others. Therefore it is important to ensure that the open OSS project has a strong core team and coherent architecture before it is put in the public domain. Additionally, the solution should leverage successful Open Source components which are already established in the market place. 3.5 Research Philosophy and Strategy Telecommunications Network and Service Management, rightly understood, is both a Technical and a Business discipline. Too often research in this field has been technology led to the extent that while elegant solutions have been created, they have been of limited practical value because they were developed with an incomplete understanding of the broad systems, organisation and business environment. A significant factor in the success of a network management system is an appreciation of the motivation, skills and psychology of those who are being asked to use the systems to manage the service. The Open OSS project is about determining whether a particular approach to solution development will work in the Telecommunications industry. Consequently the research will draw on business and engineering analyses of the problem. However the key factor in this research is that rather than simply observe the industry, we wish to use this research to actually catalyse a change in the way the industry does business. In order to do this we will actively be seeking significant industry partners whose participation will create an opportunity for change within the industry. Finding these partners will of course be a difficult and risky challenge. **Table 4:** Open OSS as an Action Research Project <table> <thead> <tr> <th>Action Research Qualities</th> <th>Open OSS Implications</th> </tr> </thead> <tbody> <tr> <td>1. Change Management</td> <td>Open OSS should change industry attitude to collaborative development</td> </tr> <tr> <td>The purpose of action research is the management of a change</td> <td></td> </tr> <tr> <td>2. Practitioner Involvement</td> <td>Open OSS should seek to build an open project with users in the SP community.</td> </tr> <tr> <td>Action research seeks practitioners involvement in the research</td> <td></td> </tr> <tr> <td>3. Generalised Implications</td> <td>Open OSS should seek to generalise the results across the Telecoms industry.</td> </tr> <tr> <td>Action research should have implications beyond immediate project</td> <td></td> </tr> </tbody> </table> The underlying research strategy for this project will therefore be that of Action Research as discussed by Saunders [33]. Action Research is a strategy whereby the researcher is not an inert observer but actively involved in a project to bring about change. Table 4 illustrates what this means for Open OSS. In practice this means that all of the technical research undertaken must be informed by and tested against the realities of industry. 3.6 The Open OSS Project Outline The Open OSS initiative is initially planned with a life of three years beginning in Q3 2004. The first deliverable from the initiative will be a Telemanagement World Catalyst proof of concept in May 2005. Details of deliverables and participants can be reviewed in the Project Charter [34]. ![Open OSS Test Bed Components](image_url) **Figure 1: Open OSS Test Bed Components** In the long term, the project will lead to a simple Telecoms OSS reference architecture and test environment as outlined in Figure 1. In this diagram the NGOSS I/F represents the NGOSS contract[35]. In practice in the first instance, this will be implemented using OSS/J interfaces, on the understanding that OSS/J already represents a technology specific implementation of NGOSS [16]. The test environment will be available to the industry as an aid to the adoption of NGOSS and OSS/J. In addition the project will produce training collateral and worked examples to assist with the uptake of the NGOSS methodology and lifecycle[36]. It is also intended that the test environment will be available for other research activities. One early example of this is the intention to leverage the test environment to assist a sister catalyst project exploring the use of MDA tools to deliver NGOSS[37] 4 Conclusions We have characterised how the problems within the current OSS market slow the innovation of next generation OSS solutions. We have described how open development of NGOSS solutions could facilitate change in the OSS market landscape and make an important contribution to the rapid adoption of NGOSS by industry practitioners. The first deliverable of the Open OSS project will be a ‘Catalyst’ proof of concept involving industrial and academic partners to be demonstrated at Telemanagement World in May 2005. The partners are currently planning the next stage of the project which will expand the community towards an open source model. Acknowledgments We would like to thank BT and Invocom for their sponsorship of this project. References
{"Source-Url": "https://eprints.soton.ac.uk/260378/1/pid53127.pdf", "len_cl100k_base": 6945, "olmocr-version": "0.1.50", "pdf-total-pages": 14, "total-fallback-pages": 0, "total-input-tokens": 32303, "total-output-tokens": 8747, "length": "2e12", "weborganizer": {"__label__adult": 0.0005369186401367188, "__label__art_design": 0.0003762245178222656, "__label__crime_law": 0.0006337165832519531, "__label__education_jobs": 0.0028362274169921875, "__label__entertainment": 0.0001194477081298828, "__label__fashion_beauty": 0.00025153160095214844, "__label__finance_business": 0.00992584228515625, "__label__food_dining": 0.0003712177276611328, "__label__games": 0.0008692741394042969, "__label__hardware": 0.00795745849609375, "__label__health": 0.0006313323974609375, "__label__history": 0.00047135353088378906, "__label__home_hobbies": 0.00015461444854736328, "__label__industrial": 0.0025119781494140625, "__label__literature": 0.0002639293670654297, "__label__politics": 0.0005483627319335938, "__label__religion": 0.00043392181396484375, "__label__science_tech": 0.12158203125, "__label__social_life": 0.00011664628982543944, "__label__software": 0.031585693359375, "__label__software_dev": 0.81494140625, "__label__sports_fitness": 0.00036263465881347656, "__label__transportation": 0.002155303955078125, "__label__travel": 0.00026488304138183594}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 40378, 0.02083]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 40378, 0.14705]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 40378, 0.91631]], "google_gemma-3-12b-it_contains_pii": [[0, 1987, false], [1987, 5146, null], [5146, 8562, null], [8562, 11576, null], [11576, 14824, null], [14824, 17910, null], [17910, 21112, null], [21112, 24280, null], [24280, 27294, null], [27294, 30370, null], [30370, 33531, null], [33531, 35370, null], [35370, 37760, null], [37760, 40378, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1987, true], [1987, 5146, null], [5146, 8562, null], [8562, 11576, null], [11576, 14824, null], [14824, 17910, null], [17910, 21112, null], [21112, 24280, null], [24280, 27294, null], [27294, 30370, null], [30370, 33531, null], [33531, 35370, null], [35370, 37760, null], [37760, 40378, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 40378, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 40378, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 40378, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 40378, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 40378, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 40378, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 40378, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 40378, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 40378, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 40378, null]], "pdf_page_numbers": [[0, 1987, 1], [1987, 5146, 2], [5146, 8562, 3], [8562, 11576, 4], [11576, 14824, 5], [14824, 17910, 6], [17910, 21112, 7], [21112, 24280, 8], [24280, 27294, 9], [27294, 30370, 10], [30370, 33531, 11], [33531, 35370, 12], [35370, 37760, 13], [37760, 40378, 14]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 40378, 0.19895]]}
olmocr_science_pdfs
2024-12-01
2024-12-01
a2bb0af6c5d0ec23dc43a3a99deee5b9c9981418
[REMOVED]
{"Source-Url": "https://www.hivestreaming.com/wp-content/uploads/2015/02/DTL.pdf", "len_cl100k_base": 7478, "olmocr-version": "0.1.49", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 38900, "total-output-tokens": 9085, "length": "2e12", "weborganizer": {"__label__adult": 0.0005345344543457031, "__label__art_design": 0.0003209114074707031, "__label__crime_law": 0.000545501708984375, "__label__education_jobs": 0.00036787986755371094, "__label__entertainment": 0.00026035308837890625, "__label__fashion_beauty": 0.000202178955078125, "__label__finance_business": 0.0004215240478515625, "__label__food_dining": 0.0005202293395996094, "__label__games": 0.0013589859008789062, "__label__hardware": 0.003337860107421875, "__label__health": 0.0008740425109863281, "__label__history": 0.0004901885986328125, "__label__home_hobbies": 9.042024612426758e-05, "__label__industrial": 0.0007739067077636719, "__label__literature": 0.00032401084899902344, "__label__politics": 0.0005745887756347656, "__label__religion": 0.0005812644958496094, "__label__science_tech": 0.2342529296875, "__label__social_life": 0.00014483928680419922, "__label__software": 0.0433349609375, "__label__software_dev": 0.70751953125, "__label__sports_fitness": 0.0006461143493652344, "__label__transportation": 0.0020751953125, "__label__travel": 0.0004620552062988281}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 36242, 0.03145]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 36242, 0.28755]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 36242, 0.90477]], "google_gemma-3-12b-it_contains_pii": [[0, 2768, false], [2768, 5894, null], [5894, 9084, null], [9084, 11240, null], [11240, 14322, null], [14322, 17502, null], [17502, 20531, null], [20531, 22824, null], [22824, 25364, null], [25364, 27415, null], [27415, 29365, null], [29365, 30651, null], [30651, 32094, null], [32094, 33147, null], [33147, 36242, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2768, true], [2768, 5894, null], [5894, 9084, null], [9084, 11240, null], [11240, 14322, null], [14322, 17502, null], [17502, 20531, null], [20531, 22824, null], [22824, 25364, null], [25364, 27415, null], [27415, 29365, null], [29365, 30651, null], [30651, 32094, null], [32094, 33147, null], [33147, 36242, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 36242, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 36242, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 36242, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 36242, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 36242, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 36242, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 36242, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 36242, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 36242, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 36242, null]], "pdf_page_numbers": [[0, 2768, 1], [2768, 5894, 2], [5894, 9084, 3], [9084, 11240, 4], [11240, 14322, 5], [14322, 17502, 6], [17502, 20531, 7], [20531, 22824, 8], [22824, 25364, 9], [25364, 27415, 10], [27415, 29365, 11], [29365, 30651, 12], [30651, 32094, 13], [32094, 33147, 14], [33147, 36242, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 36242, 0.03468]]}
olmocr_science_pdfs
2024-11-25
2024-11-25
65d09cc7c0fae9328efd15c1e048a074d590b33e
1 Overview In this lecture, we consider the string matching problem - finding some or all places in a text where the query string occurs as a substring. From the perspective of a one-shot approach, we can solve string matching in $O(|T|)$ time, where $|T|$ is the size of our text. This purely algorithmic approach has been studied extensively in the papers by Knuth-Morris-Pratt [6], Boyer-Moore [1], and Rabin-Karp [4]. However, we entertain the possibility that multiple queries will be made to the same text. This motivates the development of data structures that preprocess the text to allow for more efficient queries. We will show how to construct, use, and analyze these string data structures. 2 Predecessor Problem Before we get to string matching we will solve an easier problem which is necessary to solve string matching. This is the predecessor problem among strings. Assume we have $k$ strings, $T_1, T_2, ..., T_k$ and the query is: given some pattern $P$, we would like to know where $P$ fits among the $k$ strings in lexicographical order. More specifically we would like to know the predecessor of $P$ among the $k$ strings, according to the lexicographical order of the strings. Using our already developed data structures for this problem is not efficient as strings can be quite long and comparing strings is slow. So we need to use some other data structure that takes into account this fact. 2.1 Tries and Compressed Tries To solve the predecessor problem we will use a structure called a trie. A trie is a rooted tree where each child branch is labeled with letters in the alphabet $\Sigma$. We will consider any node $v$ to store a string which represents the concatenation of all branch labels on the path from the root $r$ to the $v$. More specifically given a path of increasing depth $p = r, v_1, v_2, ..., v$ from the root $r$ to a node $v$, the string stored at node $v_i$ is the concatenation of the string stored in $v_{i-1}$ with the letter stored on the branch $v_{i-1}v_i$. We will denote the strings stored in the leaves of the trie as words, and the strings stored in all other nodes as prefixes. The root $r$ represents the empty string. We order the child branches of every node alphabetically from left to right. Note that the fan-out of any node is at most $|\Sigma|$. Also an inorder traversal of the trie outputs the stored strings in sorted order. It is common practice to terminate strings with a special character $ \notin \Sigma $, so that we can distinguish a prefix from a word. The example trie in Figure 1 stores the four words ana$, ann$,anna$, and anne$. If we assign only one letter per edge, we are not taking full advantage of the trie’s tree structure. It is more useful to consider compact or compressed tries, tries where we remove the one letter per edge constraint, and contract non-branching paths by concatenating the letters on these paths. In this way, every node branches out, and every node traversed represents a choice between two different words. The compressed trie that corresponds to our example trie is also shown in Figure 1. ![Trie and Compacted Trie Examples](image) **Figure 1: Trie and Compacted Trie Examples** ### 2.2 Solving the Predecessor Problem We will store our $k$ strings $T_1, T_2, ..., T_k$ in a trie data structure as presented above. Given a query string $P$, in order to find its predecessor we walk down the trie from the root, following the child branches. At some point we either fall off the tree or reach a leaf. If we reach a leaf then we are done, because the pattern $P$ matches one of our words exactly. If we fall off the three then the predecessor is the maximum string stored in the tree immediately to the left of where we fell off. For example if we search for the word $anb$ in the tree if Figure 1, we fall of the tree after we traverse branches $a$ and $n$ downward. Then $b$ is between branches $a$ and $n$ of the node where we fell of, and the predecessor is the maximum string stored in the subtree following branch $a$. For every node $v$ of the trie we will store the maximum string in the subtree defined by $v$. Then, to allow fast predecessor queries we need a way to store every node of the trie, that allows both fast traversals of edges (going down the tree) and fast predecessor queries within the node. ### 2.3 Trie Node Representation Depending on the way in which we choose to store a node in the trie, we will get various query time and space bounds. #### 2.3.1 Array We can store every node of the trie as an array of size $|\Sigma|$, where each cell in the array represents one branch. In this case following a down branch takes $O(1)$ time. To find the predecessor within an array, we simply precompute all possible $|\Sigma|$ queries and store them. Thus, predecessor queries within a node also take $O(1)$ time. Unfortunately, the space used for every node is $O(|\Sigma|)$, so the lexicographical total space used is $O(|T||\Sigma|)$, where $|T|$ is the number of nodes in the trie $|T_1| + |T_2| + ... + |T_k|$. The total query time is $O(|P|)$. #### 2.3.2 Binary Search Tree We can store a trie node as a binary search tree. More specifically, we store the branches of a node in a binary search tree. This will reduce the total space of the trie to $O(|T|)$, but will increase the query time to $O(|P| \log \Sigma)$. #### 2.3.3 Hash Table Using a hash table for each node gives us an $O(|T|)$ space trie with $O(P)$ query time. Unfortunately with hashing we can only do exact searches, as hashes don’t support predecessor. #### 2.3.4 Van Emde Boas To support predecessor queries we can use a Van Emde Boas data structure to store each node of the trie. With this total space used to store the trie is $O(|T|)$ and query time is $O(P \log \log \Sigma)$. #### 2.3.5 Weight Balanced BST We will store the children of the node $v$ in a weight balanced binary search tree, where the weight of each child $x$ is equal to the total number of descendant leaves in subtree $x$. To construct such a tree we split the children of node $v$ in two, such that the number of descendant leaves of the children on the left is as close as possible to the number of descendant leaves of the children to the right. We then recurse on the children on the left and on the children on the right. To support predecessor searches in this new tree, we can label each edge $e$ of the constructed tree with the maximum edge label corresponding to some child $x$ of $v$, in the subtree determined by following $e$. To better understand this construction look at Figure 2. **Lemma 1.** In a trie where we store each node as a weight balanced BST as above, a search takes $O(P + \log k)$ time. *Proof.* We will prove this by showing that at every edge followed in the tree, we either advance one letter in $P$ or we decrease the number of candidate $T_i$’s by $1/3$. Assume that in our traversal we are at node $y$ in the weight balanced BST representing node $x$ in the trie. Consider all trie children $c_1, c_2, ..., c_m$ of node $x$ present in $y$’s subtree. Let $D$ be the total number of descendant leaves of $c_1, c_2, ..., c_m$. If the number of descendant leaves of any child $c_i$ is at most $D/3$ then following the next edge from $y$ reduces the number of candidate leaves decreases by at least $1/3$. Otherwise, there is some child $c_i$ that has at least $D/3$ descendants. Then from the construction of the weight balanced BST, $c_i$ has to be at most a grandchild of $y$. Then, by following the next two edges, we either move to node $c_i$ in the trie, in which case we advance one letter in $P$, or we don’t move do node $c_i$ in which case we reduce the number of potential leaves by $1/3$. Note that $k$ is the number of strings stored in the trie. Even though our data structure achieves $O(P + \log k)$ query time, we would however like to achieve $O(P + \log |\Sigma|)$ time, to make query time independent of the number of strings in the trie. We can do this by using indirection and leaf trimming, similar to what we used to solve the level ancestor problem in constant time and linear space. We will trim the tree by cutting edges below all maximally deep nodes that have at least $|\Sigma|$ descendant leaves. We will thus get a top tree, which has at most $|T|/|\Sigma|$ leaves and thus at most $|T|/|\Sigma|$ branching nodes. On this tree we can store trie nodes using arrays, to get linear query and $O(T)$ space. Note that we can only store arrays for the branching nodes and leaves, as there may be more nodes than \(|T|/|\Sigma|\). But for the non-branching nodes we can simply store a pointer to the next node, or use the compressed trie from the start instead. The bottom trees have less than \(|\Sigma|\) descendant leaves, which means we can store trie nodes using weight balanced BSTs, which use linear space, but now have \(O(P + \log \Sigma)\) query time since there are less than \(\Sigma\) leaves. In total we get a data structure with \(O(T)\) space and \(O(P + \log \Sigma)\) query time. Another data structure that obtains these bounds is the suffix trays [9]. 3 Suffix Trees A suffix tree is a compressed trie built on all \(|T|\) suffixes of \(T\), with \$ appended. For example, if our text is the string \(T = \text{banana}\$, then our suffix tree will be built on \{banana\$, anana\$, nana\$, ana\$, na\$, a\$.\} The suffix starting at the \(i\)th index is denoted \(T[i:]\). For a non-leaf node of the suffix tree, define the letter depth of the node as the length of the prefix stored in the node. Storing strings on the edges and in the nodes is potentially very costly in terms of space. For example, if all of the characters in our text are different, storage space is quadratic in the size of the text. To decrease storage space of the suffix tree to \(O(|T|)\), we can replace the strings on each edge by the indices of its first and last character, and omit the strings stored in each node. We lose no information, as we are just removing some redundancies. 3.1 Applications Suffix trees are versatile data structures that have myriad applications to string matching and related problems: 3.1.1 String Matching To solve the string matching problem, note that a substring of \(T\) is simply a prefix of a suffix of \(T\). Therefore, to find a pattern \(P\), we walk down the tree, following the edge that corresponds to the next set of characters in \(P\). Eventually, if the pattern matches, we will reach a node \(v\) that stores \(P\). Finally, report all the leaves beneath \(v\), as each leaf represents a different occurrence. There is a unique way to walk down the tree, since every edge in the fan out of some node must have a distinct first letter. The runtime of a search, however, depends on how the nodes are stored. If the nodes are stored as a hash table, this method achieves \(O(P)\) time. Using trays, we can achieve \(O(P + \log \Sigma)\), and using a hash table and a van Emde Boas structure, we can achieve \(O(P + \log \log \Sigma)\) time. These last two results are useful because they preserve the sorted order of the nodes, where a hash table does not preserve sorting. 3.1.2 First \(k\) Occurrences Instead of reporting all matching subsequences of \(T\), we can report the first \(k\) occurrences of \(P\) in only \(O(k)\) additional time. To do this, add a pointer from each node to its leftmost descendant leaf, and then connect all the leaves via a linked list. Then, to determine the first $k$ occurrences, perform a search as above, and then simply follow pointers to find the first $k$ leaves that match that pattern. ### 3.1.3 Counting Occurrences In this variant of the string matching problem, we must find the number of times the pattern $P$ appears in the text. However, we can simply store in every node the size of the subtree at that node. ### 3.1.4 Longest Repeating Substring To find the longest repeated substring, we look for the branching node with maximum letter depth. We can do this in $O(T)$ time. Suppose instead we are given two indices $i$ and $j$, and we want to know the longest common prefix of $T[i:]$ and $T[j:]$. This is simply an LCA query, which from L15 can be accomplished in $O(1)$ time. ### 3.1.5 All occurrences of $T[i:j]$ When the pattern $P$ is a known substring of the text $T$, we can interpret the problem as a LA query: We’d like to find the $(j - i)$th ancestor of the leaf for $T[i:]$. We must be careful because the edges do not have unit length, so we must interpret the edges as weighted, by the number of characters that are compressed onto that edge. We must make a few modifications to the LA data structure from L15 to account for the weighted edges. We store the nodes in the long path/ladder DS of L15 in a van Emde Boas predecessor DS, which uses $O(\lg \lg T)$ space. Additionally, we can’t afford the lookup tables at the bottom of the DS from L15. Instead, we answer queries on the bottom trees in the indirection by using a ladder decomposition. This requires $O(\lg \lg n)$ ladders, to reach height $O(\lg n)$. Then, we only need to run a predecessor query on the last ladder. This gives us $O(\lg \lg T)$ query and $O(T)$ space. This result is due to Abbott, Baran, Demaine and others in Spring 2005’s 6.897 course. ### 3.1.6 Multiple Documents When there are multiple texts in question, we can concatenate them with $\$_1, \$_2, ..., \$_n$. Whenever we see a $\$_i$, we trim below it to make it a leaf and save space. Then to find the longest common substring, we look for the node with the maximum letter depth with greater than one distinct $\$ below. To count the number of documents containing a pattern $P$, simply store at each node the number of distinct $\$ signs as a descendant of that node. ### 3.1.7 Document Retrieval We can find $d$ distinct documents $T_i$ containing a pattern $P$ in only an additional $O(d)$ time, for a total of $O(P + d)$. This is ideal, because if $P$ occurs an astronomical number of times in one document, and only once or twice in a second document, a more naive algorithm could spend time finding every occurrence of $P$ when the result will only be 2 documents. This DS, due to Muthukrishnan [8], will avoid that problem. To do this, augment the data structure by having each $S_i$ store the leaf number of the previous $S_i$. Then, suppose we have searched for the pattern $P$ and come to the node $v$. Suppose the leaf descendants of $v$ are numbered $l$ through $n$. So, we want the first occurrence of $S_i$ in the range $[l, n]$, for each $i$. With the augmentation, this is equivalent to looking for the $S_i$ whose stored value is $< l$, because this indicates that the previous $S_i$ is outside of the interval $[l, n]$. We can solve this problem with an RMQ query from L15. Find the minimum in $O(1)$ time. Suppose the minimum is found at position $m$. Then, if the stored value of that leaf is $< l$, that is an answer, so output that the pattern occurs in document $i$. Then, recurse on the remaining intervals, $[l, m-1]$ and $[m+1, n]$. Thus, each additional output we want can be found in $O(1)$ time, and we can stop any time we want. 4 Suffix Arrays Suffix trees are powerful data structures with applications in fields such as computational biology, data compression, and text editing. However, a suffix array, which contains most of the information in a suffix tree, is a simpler and more compact data structure for many applications. The only drawback of a suffix array is that it is less intuitive and less natural as a representation. In this section, we define suffix arrays, show that suffix arrays are in some sense equivalent to suffix trees, and provide a fast algorithm for building suffix arrays. 4.1 Example Let us store the suffixes of a text $T$ in lexicographical order in an intermediate array. Then the suffix array is the array that stores the index corresponding to each suffix. For example, if our text is $banana\$, the intermediate array is $[s, a, na, ana,banana,na,na,ana]$ and the suffix array is $[6,5,3,1,0,4,2]$, as in Figure 2. Since suffixes are ordered lexicographically, we can use binary search to search for a pattern $P$ in $O(|P|\log |T|)$ time. We can compute the length of the longest common prefix between neighboring entries of the inter- mediate array. If we store these lengths in an array, we get what is called the LCP array. This is illustrated in Figure 3. These LCP arrays can be constructed in $O(|T|)$ time, a result due to Kasai et al [5]. In the example above, the LCP array constructed from the intermediate array is $[0,1,3,0,0,2]$. Using LCP arrays, we can improve pattern searching in suffix arrays to $O(|P| + \log |T|)$. 4.2 Suffix Arrays and Suffix Trees To motivate the construction of a suffix array and a LCP array, note that a suffix array stores the leaves of the corresponding suffix tree, and the LCP array provides information about the height of internal nodes, as seen in Figure 2. Our aim now is to show that suffix trees can be transformed into suffix arrays in linear time and vice versa. To formalize this intuition, we use Cartesian Trees from L15. To build a Cartesian tree, store the minimum over all LCP array entries at the root of the Cartesian tree, and recurse on the remaining array pieces. For a concrete example, see Figure 3 below. 4.2.1 From Suffix Trees to Suffix Arrays To transform a suffix tree into a suffix array, we simply run an in-order traversal of the suffix tree. As noted earlier, this process returns all suffixes in alphabetical order. 4.2.2 From Suffix Arrays to Suffix Trees To transform a suffix array back into a suffix tree, create a Cartesian tree from the LCP array associated to the suffix array. Unlike in L15, use all minima at the root. The numbers stored in the nodes of the Cartesian tree are the letter depths of the internal nodes! Hence, if we insert the entries of the suffix array in order into the Cartesian tree as leaves, we recover the suffix tree. In fact, we are rewarded with an augmented suffix tree with information about the letter depths. From L15, this construction is possible in linear time. 5 DC3 Algorithm for Building Suffix Arrays Here, we give a description of the DC3 (Difference Cover 3) divide and conquer algorithm for building a suffix array in \(O(|T| + \text{sort}(\Sigma))\) time. We closely follow the exposition of the paper by Karkkainen-Sanders-Burkhardt [3] that originally proposed the DC3 algorithm. Because we can create suffix trees from suffix arrays in linear time, a consequence of DC3 is that we can create suffix trees in linear time, a result shown independently of DC3 by Farach [2], McCreight [7], Ukkonen [10], and Weiner [11] 1. Sort the alphabet \(\Sigma\). We can use any sorting algorithm, leading to the \(O(\text{sort}(\Sigma))\) term. 2. Replace each letter in the text with its rank among the letters in the text. Note that the rank of the letter depends on the text. For example, if the text contains only one letter, no matter what letter it is, it will be replaced by 1. This operation is safe, because it does not change any relations we are interested in. We also guarantee that the size of the alphabet being used is no larger than the size of the text (in cases where the alphabet is excessively large), by ignoring unused alphabets. 3. Divide the text \(T\) into 3 parts and package triples of letters into \textit{megaletters}. More formally, form \( T_0, T_1, \) and \( T_2 \) as follows: \[ T_0 = \langle (T[3i], T[3i + 1], T[3i + 2]) \rangle \quad \text{for} \quad i = 0, 1, 2, \ldots \\ T_1 = \langle (T[3i + 1], T[3i + 2], T[3i + 3]) \rangle \quad \text{for} \quad i = 0, 1, 2, \ldots \\ T_2 = \langle (T[3i + 2], T[3i + 3], T[3i + 4]) \rangle \quad \text{for} \quad i = 0, 1, 2, \ldots \] Note that \( T_i \)'s are just texts with \( n/3 \) letters of a new alphabet \( \Sigma^3 \). Our text size has become a third of the original, while the alphabet size has cubed. 4. Recurse on \( < T_0, T_1 > \), the concatenation of \( T_0 \) and \( T_1 \). Since our new alphabet is of cubic size, and our original alphabet is pre-sorted, radix-sorting the new alphabet only takes linear time. When this recursive call returns, we have all the suffixes of \( T_0 \) and \( T_1 \) sorted in a suffix array. Then all we need is to sort the suffixes of \( T_2 \), and to merge them with the old suffixes to get suffixes of \( T \), because \[ \text{Suffixes}(T) \cong \text{Suffixes}(T_0) \cup \text{Suffixes}(T_1) \cup \text{Suffixes}(T_2) \] If we can do this sorting and merging in linear time, we get a recursion formula \( T(n) = T(2/3n) + O(n) \), which gives linear time. 5. Sort suffixes of \( T_2 \) using radix sort. This is straight forward to do once we note that \[ T_2[i :] \cong T[3i + 2 :] \cong (T[3i + 2], T[3i + 3 :]) \cong (T[3i + 2], T_0[i + 1 :]). \] The logic here is that once we rewrite \( T_2[i :] \) in terms of \( T \), we can pull off the first letter of the suffix and pair it with the remainder. We end up with something where the index \( 3i + 3 \) corresponds with the start of a triplet in \( T_0 \), specifically, \( T_0[i + 1] \), which we already have in sorted order from our recursive call. Thus, we can radix sort on two coordinates, the triplet \( T_0[i + 1] \) and then the single alphabet \( T[3i + 2] \), both of which we know the sorted orders of. This way, we get \( T_2[i :] \) in sorted order. Specifically, the radix sort is just on two coordinates, where the second coordinate is already sorted. 6. Merge the sorted suffixes of \( T_0, T_1, \) and \( T_2 \) using standard linear merging. The only problem is finding a way to compare suffixes in constant time. Remember that suffixes of \( T_0 \) and \( T_1 \) are already sorted together, so comparing a suffix from \( T_0 \) and a suffix from \( T_1 \) takes constant time. To compare against a suffix from \( T_2 \), we will once again decompose it to get a suffix from either \( T_0 \) or \( T_1 \). There are two cases: - Comparing \( T_0 \) against \( T_2 \): \[ \begin{align*} T_0[i :] & \quad \text{vs} \quad T_2[j :] \\ \cong & \quad T[3i :] \quad \text{vs} \quad T[3j + 2 :] \\ \cong & \quad (T[3i], T[3i + 1 :]) \quad \text{vs} \quad (T[3j + 2], T[3j + 3 :]) \\ \cong & \quad (T[3i], T_1[i :]) \quad \text{vs} \quad (T[3j + 2], T_0[j + 1 :]) \end{align*} \] So we just compare the first letter and then, if needed, compare already sorted suffixes of \( T_0 \) and \( T_1 \). • Comparing $T_1$ against $T_2$: \[ T_1[i:] \text{ vs } T_2[j:] \\ \cong T[3i+1:] \text{ vs } T[3j+2:] \\ \cong (T[3i+1], T[3i+2], T[3i+3:]) \text{ vs } (T[3j+2], T[3j+3], T[3j+4:]) \\ \cong (T[3i+1], T[3i+2], T_0[i+1:]) \text{ vs } (T[3j+2], T[3j+3], T_1[j+1:]) \] So we can do likewise by first comparing the two letters in front, and then comparing already sorted suffixes of $T_0$ and $T_1$ if necessary. References
{"Source-Url": "https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-851-advanced-data-structures-spring-2012/calendar-and-notes/MIT6_851S12_L16.pdf", "len_cl100k_base": 6141, "olmocr-version": "0.1.50", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 61482, "total-output-tokens": 7398, "length": "2e12", "weborganizer": {"__label__adult": 0.0004291534423828125, "__label__art_design": 0.0004191398620605469, "__label__crime_law": 0.0005421638488769531, "__label__education_jobs": 0.0014810562133789062, "__label__entertainment": 0.00013244152069091797, "__label__fashion_beauty": 0.00022614002227783203, "__label__finance_business": 0.00022482872009277344, "__label__food_dining": 0.00047850608825683594, "__label__games": 0.00086212158203125, "__label__hardware": 0.0014286041259765625, "__label__health": 0.0009145736694335938, "__label__history": 0.0004014968872070313, "__label__home_hobbies": 0.00017893314361572266, "__label__industrial": 0.0006251335144042969, "__label__literature": 0.0005602836608886719, "__label__politics": 0.0003681182861328125, "__label__religion": 0.0007090568542480469, "__label__science_tech": 0.136962890625, "__label__social_life": 0.00015115737915039062, "__label__software": 0.00894927978515625, "__label__software_dev": 0.84228515625, "__label__sports_fitness": 0.0004448890686035156, "__label__transportation": 0.0008006095886230469, "__label__travel": 0.0002491474151611328}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 24619, 0.03602]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 24619, 0.69999]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 24619, 0.86093]], "google_gemma-3-12b-it_contains_pii": [[0, 2395, false], [2395, 4055, null], [4055, 6240, null], [6240, 8570, null], [8570, 11445, null], [11445, 14048, null], [14048, 16758, null], [16758, 17398, null], [17398, 19513, null], [19513, 22580, null], [22580, 24619, null], [24619, 24619, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2395, true], [2395, 4055, null], [4055, 6240, null], [6240, 8570, null], [8570, 11445, null], [11445, 14048, null], [14048, 16758, null], [16758, 17398, null], [17398, 19513, null], [19513, 22580, null], [22580, 24619, null], [24619, 24619, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 24619, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 24619, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 24619, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 24619, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 24619, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 24619, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 24619, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 24619, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 24619, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 24619, null]], "pdf_page_numbers": [[0, 2395, 1], [2395, 4055, 2], [4055, 6240, 3], [6240, 8570, 4], [8570, 11445, 5], [11445, 14048, 6], [14048, 16758, 7], [16758, 17398, 8], [17398, 19513, 9], [19513, 22580, 10], [22580, 24619, 11], [24619, 24619, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 24619, 0.0]]}
olmocr_science_pdfs
2024-11-28
2024-11-28
5a38bd487da96fc3035938e10ed7303b90b960ef
Overview The availability of geo-spatial data sets is exploding. New satellites, aerial platforms, video feeds, GPS tagged digital photos, and traditional GIS information dramatically increase across the globe. These raw materials need to dynamically processed, combined and correlated to generate value added information products to answer a wide range of questions. OMAR™ is a web based system for archival, retrieval, processing, and distribution of geo-spatial assets. Satellite and aerial images, vector sets, UAV video sets, as well as user generated tags and reference items can be searched and manipulated with the system. Searching can be performed on the basis of location, time, or any combination of the stored metadata. OMAR™ is unique in its ability to dynamically process raw materials and create value added products on the fly. Imagery is ortho-rectified, precision terrain corrected, and histogram stretched on demand. OMAR™ can combine, fuse, or chip areas of interest according to the users needs. Geospatial assets can then be manipulated, viewed, and processed to provide a wide range of value added products. The value added products will be delivered through several mechanisms: - Generated product distributed through ftp or email (planned) - Results generated with a simple browser interface - Open standards and interfaces (OGC WMS, WFS, WCS, tiling services) OMAR™ is under active development through US Government funding. OSSIM and OMAR™ development is being funded by a number of intelligence and defense agencies in including the Department of Defense, the National Reconnaissance Office, and the National Geospatial Intelligence Agency. While there are plugin modules that are classified, the OSSIM project is managed and maintained on the internet in an unclassified environment. OMAR™ integrates several open source software solutions to provide an online dynamic processing solution. OpenLayers, PostGIS/Postgres, GRAILS, and OSSIM are a few of the technologies that are used in the development. OMAR™ is part of the OSSIM open source software baseline hosted at http://www.ossim.org. OSSIM is one of the founding projects of the OSGeo Foundation http://www.osgeo.org. The Open Source Business Model OMAR™ is an open source solution trademarked by RadiantBlue Technologies Inc. It is part of the OSSIM open source software baseline. Since 1999, OSSIM has evolved through US Government funding from the Defense and Intelligence communities. Throughout that period, the core development team has worked in a number of different companies while maintaining a close collaborative relationship. The combined OSSIM team has supported a number of different customers. As a result, OSSIM is now deployed in a number of critical government and commercial applications. Over time, a number of solutions and applications have evolved out of the core libraries. Solutions include command line applications, the ImageLinker prototyping tool, ossimPlanet for 3D visualization and collaboration, and OMAR™ for online geospatial management and production. OSSIM has been supported by a number of government agencies through the funding of professional development services. Typically, an agency will hire OSSIM developers to add functionality and meet agency requirements through the use of OSSIM solutions. One of the demonstrated advantages of an open source approach has been frictionless collaboration between all of the projects and contributors. Government customers rapidly become converts to this model as they begin to inherit and apply improvements that were funded from other agencies and projects. All participants share in the benefits when they contribute with funding support. The advantages of an open source software approach is becoming evident within the US Government. Recent changes in policy and acquisition practices have spread the adoption of these practices. Successful projects such as OMAR™ and OSSIM are providing useful solutions as projects and programs evaluate this approach. The open source software business model is supported through professional services within the US Federal government. Various agencies are funding professional services to extend and support OMAR™, OSSIM and other OSS geo-spatial technologies. OMAR™ is a COTs solution consisting of open source software. Source code is delivered with the solution, collaboration between agencies and contractors on the baseline is actively encouraged and supported. Open source solutions and support is being implemented across all levels of the government enterprise. RadiantBlue Technologies Inc. provides professional services and support for the OSSIM baseline and the OMAR™ solution. OMAR™ is currently being funded for operational transition. The software team will deliver the first operationally configured release before the end of 2010. This document will summarize the capabilities for OMAR™ as well as plans for near term development. --- 1 OSS solutions are considered COTs within the FAR OMAR™ Capabilities The relational database and geospatial processing capabilities allow rapid generation of value added information products from raw information. Delivery of this processed information can take the form of generated products, web browser views, or on demand web based services. OMAR™’s rapid cataloging and provisioning capabilities rapidly locate, process, and distributed value added products across the enterprise. OMAR™ can automatically detect, ingest, and process when new geospatial assets arrive in any of the monitored repositories. While there are a number of systems that can discover and distribute geospatial assets - this system is unique in its ability to process those assets into derivative products and services on demand. The included OSSIM geo-spatial processing engine can construct image chains that define the functions, parameters, and conversions that are needed to read, re-project, and process the original geospatial assets into value added derivative products and services. Current installations of OMAR™ are managing millions of imagery and video files. The system is being used to find and rapidly view geospatial assets from multiple repositories. A few of the existing features of OMAR™ 1.8 are: **Discovery and Online viewing of imagery and video** National and commercial imagery as well as UAV Predator video is being ingested, stored and viewed in the system. Online browsing of imagery is provided by OpenLayers and OSSIM, playback of video clips is currently provided by an external streaming service. **Searching based on location, acquisition time, and metadata** Interfaces with the embedded PostGIS/Postgres relational database provide the ability to select assets based on location, time, or any of the values in the metadata. In national systems this includes sensor types, target identifiers, and various collection criteria. **OGC Web Mapping Service (WMS)** WMS Services are currently provided by embedded MapServer functionality. The WMS interface coupled with the background OSSIM processing enables products and views to be composed on demand. **OGC Web Feature Service (WFS)** Initial WFS support is provided through MapServer and OpenLayers. This support will be streamlined and enhanced in future releases. **Native file access (OSSIM/GDAL)** OSSIM and GDAL provide support for a wide array of native geospatial formats. These libraries can provide file format conversion and allow assets to be reference and used without intermediate conversion. Commercial and national sensor are supported. **On demand ortho-rectification** The OSSIM library provides on the fly reprojection and ortho-rectification for the output. Satellite and aerial images are processed through OSSIM sensor models to map projected products. **On demand precision terrain correction** Rigorous and RPC sensor models apply precision terrain correction to DTED, SRTM or raster elevation data sets that are referenced to the system. **Dynamic Image Chain processing (processing templates)** OSSIM creates complex products from ‘spec’ files. The spec files define the parameters and processing steps needed to build a product. These image chains are being used in OMAR™ to define processing and views based on demand. Future development will store user defined processes in the database for custom products. **Mosaic and Fusion capabilities** Multi-image mosaics and fusions are being produced by the OMAR™ system in pre-defined image chains. New services and variations will be exposed in the future. **Format Conversion** OSSIM and GDAL can provide file format conversion services. The user interface needs to be extended to expose this for user generated products. **KML Layer addition** A recent addition was made in the staging process to automatically add <filename_root>.kml as an additional layer. **Time Bar** A time bar widget has been added to the interface to provide for the rapid selection of date/time criteria for returned results. **Re-projection and Datum Shifting Services** OSSIM dynamically re-projects data into geographic views. User selectable map projections and datums needs to be exposed through the user interface. The underlying conversion process already exists. **Area of Interest cropping (chipping)** User defined areas of interest can be identified through the WMS interfaces. The underlying architecture has the ability to generate area of interest products and services for interfaces with external systems and user requests. Much of the current development work is focused on exposing existing processing capabilities through the user interface, defining and implementing services, and developing targeted image chains for specific functionality. ![OMAR™ web interface](image-url) **Figure 3** The OMAR™ web interface for searching for geo-spatial assets. The administrator has the ability to add new tags and criteria to the search panel shown on the left. OMAR™ Walkthrough Access through the system is authenticated through a user login. LDAP authentication is currently in development. Roles and privileges are granted based on the results. The current version of OMAR™ support two levels - users and administrators. ![OMAR™ initial interface for browsing and searching](image) *Figure 4 OMAR™ initial interface for browsing and searching* Typically, the user will search for geospatial assets through by selecting a geographic area of interest and filtering by acquisition date, sensor type, target identifiers, or any combination of the meta data tags that are stored in the internal database. Figure 5 The imagery search web interface provides a map that the user can pan or zoom to select a desired area of interest. Zooming the map to particular area of interest will reveal outlines of data sets that are available in the system. Figure 6 The user can then select the Area of Interest mode and draw a selection rectangle over the desired area for search. Additionally, the fields in the left panel can be filled to further filter the search for data. A number of parameters are available for search criteria. The user can manually enter center and corner coordinates, acquisition time and date parameters or values for any of the metadata tags. In many government applications this will include sensor ids, target identifiers, sensor types, or resolution criteria. When the search button is pressed the results are displayed. Figure 7. Configurable metadata parameters and overviews of the data assets are displayed. Clicking on the overview thumbnail will allow interactive viewing of the full data set. The following sequence demonstrates interactive zooming and panning into a satellite image of Baghdad. Behind the scenes OSSIM is processing the raw file through a sensor model, cropping and zooming into the image, and enhancing the image with histogram stretching and sharpening. ![Image of Baghdad satellite image] Figure 8 Roaming, Panning and Zooming is accomplished interactively. The underlying image is being projected through a sensor model, orthorectified, precision terrain corrected and histogram stretched on the fly. UAV Video OMAR™ also can process UAV Predator feeds. These feeds can be searched, selected and played back through the web browser. OMAR™ is able to extract and parse the metadata from Motion Imagery Standards Board (MISB) compliant video streams. Missions, acquisition dates and times, platform and center of interest coordinates are used to populate the internal database and position the data for geographic searches. Figure 9 Ground tracks of UAV feeds are calculated and displayed from the metadata stream. Users can filter based on time, location, and mission. Figure 10 Video Search results and metadata Additional Interfaces OMAR™ supports SOA interfaces and has a defined application interface (API) that currently serves other systems. For example, the Core system requests image chips that are subsequently wrapped as KML for Google Earth. RSS feed mechanisms are available to provide user alerts when new data is processed. The OGC WMS interfaces can serve imagery into desktop tools. Initial work has commenced in supporting mobile devices such as the iphone and ipad. There are several modes of operations for use with Google Earth™. Individual images through KML links Individual videos through placemarks and play back - Last 10 images in the view - Last 10 videos in the view - Most recent image coverage - Most recent video coverage OMAR™ calculates and feeds the Google Earth™ OMAR layer. Architecture Overview OMAR™ is an integration of several successful open source software projects to provide an enterprise solution for geospatial data management, production, and distribution. Defense and Intelligence agencies of the US government have provided funding to support OMAR™ and the underlying OSSIM software libraries. Through this support the OSSIM development team have been employed through a number of collaborating projects. ![OMAR System Architecture](image) *Figure 12 Overview of the system architecture for OMAR™* Summary Interest in OMAR™ is gaining across a number of agencies and it will soon evolve to a formal government project. Maintaining OSSIM as an unclassified open source project on the internet has been key to its success and its ability to collaborate across a number of separate government projects. The OSSIM team is always looking for additional contributors, developers, and users. Additional information can be found at [http://www.ossim.org](http://www.ossim.org). OSSIM is one of the founding projects of the OSGeo Foundation [http://www.osgeo.org](http://www.osgeo.org). Frequently Asked Questions. Where does OMAR™ get its data from? OMAR™ can stage from a number of file repositories and can automatically check those directories for new data sets. A path to each file that is staged is automatically entered into the database. Supporting files such as reduced resolution sets and histograms are generated in place or in a specified cache. Is OMAR™ a client or a server? OMAR™ is best thought of as a web server that contains a spatially enabled relational database and a geospatial processing engine that can create new products out of raw materials. Users interface with the OMAR™ system through a browser, SOA compliant services, or the OMAR™ API. How does OMAR™ deliver products to users? “Products” are generated based on user input with the internal OSSIM geospatial processing engine. The resulting files are created on local storage within the OMAR™ file system. Future enhancements - provide email notifications to the user with embedded links for file retrieval - push the file to a predetermined location based on the setting in the users preference followed by completion email. Currently implemented on CSTARs. “Services” are available through standard SOAP service mechanisms. How does OMAR™ ingest data? An OMAR™ stager is included in the system. Repositories are traversed seeking geospatial files that are not currently loaded in the relational database. Once the files are encountered supporting files are generated including reduced resolution data sets, thumbnails, screen views, and histogram files. The internal metadata is then stored in the relational database along with a file path back to the original file. Can OMAR™ work over low bandwidth to disadvantaged users? Does OMAR™ support JPIP streaming? The browser interface only sends the pixels that need to be displayed at the client end. Remote disadvantaged users can roam and zoom into multiple gigabyte files over connection paths with limited bandwidth. The underlying OSSIM library supports the Kakadu Jpeg 2000 format. Future plans are to support JPIP streaming from OMAR™ using this plugin. The current implementation only requires a client side browser. Does OMAR™ comply with open standards and interfaces? OMAR™ is an open source software project that implements most of the existing open source and geospatial interface standards. This includes OGC Web Mapping Services (WMS) and Web Feature Services (WFS). Is OMAR™ mature and stable? OMAR™ is being funded for operational transition, it is currently a prototype implementation with exposure to users and large data repositories. It is currently being tested in several classified and unclassified locations. The first operational baseline will be delivered to the TriWan project before he end of 2010. What is required to install OMAR™? Proper set up and configuration of the various components shown below along with the OMAR™ management system. The team is constantly striving to streamline the installation process, today installations typically require professional support from the development team. Current work is focused on encapsulating the configuration in a virtual machine for Redhat or SUSE Linux based systems. What are some of the major components bundled into OMAR™? - Postgres/PostGIS - Apache web server and Tomcat - Groovy/Grails/ Java - OpenLayers - MapServer - OSSIM Is OMAR™ unclassified? The software for OMAR™ is unclassified with one exception. The internal OSSIM libraries provide a plugin architecture that allows functionality to be added at runtime. The OSSIM team separately maintains a classified plugin to handle US National classified formats for NITF and TFRD. The rest of the OMAR™ baseline is developed in an unclassified environment using the internet. Are there plans to interface with other data management systems? The development team is currently considering mechanisms that allow the user to view metadata and footprints of data stored in remote systems. The user would then request staging of this remote data triggering a background process to pull the data forward, ingest it into the repository, and provide notification back to the end user. Once the source data is stored in the OMAR™ repository the user could remotely interact with it. Does OMAR™ provide SOA compliant services? Yes, OMAR™ uses SOAP to provide compliant services. What are some examples of custom products that can be created with OMAR™? - Pan sharpened multi-spectral - Terrain shaded products - Blue/Red change detection - Precision terrain corrected areas of interest - Chipping services - Metadata query services What is the OMAR™ development status? OMAR™ is currently deployed on the Large Data JCTD, the Washington Innovation Center, and the CSTARs commercial ground station in Miami. The development team is currently being funded by an intelligence agency to provide development support and operational transition for the software baseline. The first operational release, version 1.8.6 will be promoted in Jan 2011. A release with enhanced functionality, synchronizing the enhanced functionality will be available in mid 2011. A limited operational capability at the Unclassified, SIPRNET, JWICs, and SI/TK levels is planned. **Can OMAR™ support Predator video?** Yes, OMAR™ follows the Motion Imagery Standards Board (MISB) interfaces and can parse, stage and stream predator video streams. Predator feeds have an embedded KLV data stream that provides metadata on the collection. This includes the sensor and target position. Using this data the video clips are geocoded and can be queried by time and location. Internal logic in the OMAR™ system selects appropriate frames for thumbnail overviews. The clips can be downloaded or streamed back across the web to the user. **Can OMAR™ Scale?** Yes, OMAR™ is developed on laptops and typically installed on individual PCs or Servers. The Large Data JCTD is an example of an enterprise level configuration with the workload spread over several servers. The OSSIM production engine is MPI enabled for parallel processing, the software is tuned for multi-threaded access. OSSIM uses a tiled imagery structure that can sequence processing across multiple machines and processes. See the OMAR™ Scaling paper for more detail. **What are the government rights?** The OMAR™ solution is a trademark of RadiantBlue Technologies Inc. composed of open source software technologies. The software is delivered with an LGPL software licensing allowing the government to freely distribute and modify the software. RadiantBlue provides professional services and support to the baseline and manages the central repository. Other contractors and developers are active contributors. The core repository is located at [www.ossim.org](http://www.ossim.org) as part of the OSSIM software distribution. **Has OMAR™ been through any reviews, has it been approved for classified use?** Yes, the OSSIM baseline and the OMAR™ solution are approved through the SERF process. Other evaluations include NRO AS&T classified accuracy assessments, NIMA CELTIC reviews, OSGeo Foundation incubation process and audit, RDEC-IC evaluation. **Does OMAR™ require the Large Data Infiniband WAN architecture?** OMAR™ requires fast back end access to the data that it processes and serves. The Infiniband WAN architecture provides a geographically distributed architecture with high performance remote access. This type of infrastructure allows a single instance of OMAR™ to index and serve data from remote locations on the network. Alternatively, OMAR™ instances can be placed where the data resides with LAN file system access or local file access on the same machine. Therefore, Infiniband WAN is not required for OMAR™, but is the leading implementation for high performance remote file access. The following diagrams illustrate potential deployments for the system: The Large Data Infiniband WAN provides a global file system and supercomputing derived distributed performance that makes remote data appear to be local. One OMAR™ instance can effectively manage multiple remote data repositories. This is the architecture used on the Large Data JCTD and the TriWan system in the laboratories. An OMAR™ instance can be established on each data store. Future plans include adding a federated search capability to linked instances of OMAR™. Finally, OMAR™ can simply be installed on a remote server, personal computer or laptop serving up data that is stored on the machine. Methods are currently being investigated for allowing users to identify and stage external data sets for subsequent web based manipulation and viewing. ## Version History <table> <thead> <tr> <th>Version</th> <th>Date</th> <th>Comments</th> </tr> </thead> <tbody> <tr> <td>1.0</td> <td>15 Feb 2009</td> <td>Initial DRAFT</td> </tr> <tr> <td>1.1</td> <td>25 Feb 2009</td> <td>Minor editing, added FAQ</td> </tr> <tr> <td>1.2</td> <td>7 Mar 2009</td> <td>Scaling FAQ</td> </tr> <tr> <td>1.3</td> <td>19 May 2009</td> <td>Added kml layer and date/time widget description</td> </tr> <tr> <td>1.4</td> <td>6 Oct 2010</td> <td>Updated images, status, and FAQs</td> </tr> </tbody> </table> For additional information, contact: Mark Lucas mlucas@radiantblue.com (321) 473-4309 office (321) 266-1475 cell
{"Source-Url": "http://download.osgeo.org/livedvd/data/ossim/docs/pdfs/OMAR_WhitePaper.pdf", "len_cl100k_base": 4864, "olmocr-version": "0.1.53", "pdf-total-pages": 17, "total-fallback-pages": 0, "total-input-tokens": 28995, "total-output-tokens": 5530, "length": "2e12", "weborganizer": {"__label__adult": 0.0003082752227783203, "__label__art_design": 0.0005903244018554688, "__label__crime_law": 0.0007038116455078125, "__label__education_jobs": 0.0006513595581054688, "__label__entertainment": 0.00013053417205810547, "__label__fashion_beauty": 0.0002092123031616211, "__label__finance_business": 0.0007963180541992188, "__label__food_dining": 0.0003235340118408203, "__label__games": 0.0006418228149414062, "__label__hardware": 0.0030727386474609375, "__label__health": 0.00025963783264160156, "__label__history": 0.0008721351623535156, "__label__home_hobbies": 0.00012254714965820312, "__label__industrial": 0.0013227462768554688, "__label__literature": 0.0001779794692993164, "__label__politics": 0.000530242919921875, "__label__religion": 0.00039076805114746094, "__label__science_tech": 0.1568603515625, "__label__social_life": 9.775161743164062e-05, "__label__software": 0.1134033203125, "__label__software_dev": 0.716796875, "__label__sports_fitness": 0.0003070831298828125, "__label__transportation": 0.0009207725524902344, "__label__travel": 0.0003445148468017578}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 24064, 0.01168]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 24064, 0.12512]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 24064, 0.90645]], "google_gemma-3-12b-it_contains_pii": [[0, 2213, false], [2213, 5030, null], [5030, 6231, null], [6231, 8891, null], [8891, 9985, null], [9985, 10631, null], [10631, 10999, null], [10999, 11652, null], [11652, 12184, null], [12184, 12799, null], [12799, 13602, null], [13602, 14725, null], [14725, 17517, null], [17517, 19796, null], [19796, 22645, null], [22645, 23406, null], [23406, 24064, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2213, true], [2213, 5030, null], [5030, 6231, null], [6231, 8891, null], [8891, 9985, null], [9985, 10631, null], [10631, 10999, null], [10999, 11652, null], [11652, 12184, null], [12184, 12799, null], [12799, 13602, null], [13602, 14725, null], [14725, 17517, null], [17517, 19796, null], [19796, 22645, null], [22645, 23406, null], [23406, 24064, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 24064, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 24064, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 24064, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 24064, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 24064, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 24064, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 24064, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 24064, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 24064, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 24064, null]], "pdf_page_numbers": [[0, 2213, 1], [2213, 5030, 2], [5030, 6231, 3], [6231, 8891, 4], [8891, 9985, 5], [9985, 10631, 6], [10631, 10999, 7], [10999, 11652, 8], [11652, 12184, 9], [12184, 12799, 10], [12799, 13602, 11], [13602, 14725, 12], [14725, 17517, 13], [17517, 19796, 14], [19796, 22645, 15], [22645, 23406, 16], [23406, 24064, 17]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 24064, 0.04268]]}
olmocr_science_pdfs
2024-12-07
2024-12-07
5366b4b153f26aa009e46f55431fa53f4817420b
Citation for published version DOI https://doi.org/10.1145/2505305.2505317 Link to record in KAR https://kar.kent.ac.uk/42310/ Document Version UNSPECIFIED Towards Property-Based Testing of RESTful Web Services Pablo Lamela Seijas University of Kent Canterbury, UK P.Lamela-Seijas@kent.ac.uk Huiqing Li University of Kent Canterbury, UK H.Li@kent.ac.uk Simon Thompson University of Kent Canterbury, UK S.J.Thompson@kent.ac.uk ABSTRACT Developing APIs as Web Services over HTTP implies adding an extra layer to software, compared to the ones that we would need to develop an API distributed as, for example, a library. This additional layer must be included in testing too, but this implies that the software under test has an additional complexity due both to the need to use an intermediate protocol in tests and to the need to test compliance with the constraints imposed by that protocol: in this case the constraints defined by the REST architectural style. On the other hand, these requirements are common to all the Web Services, and because of that, we should be able to abstract this aspect of the testing model so that we can reuse it in testing any Web Service. In this paper, as a first step towards automating the testing of Web Services over HTTP, we describe a practical mechanism and model for testing RESTful Web Services without side effects and give an example of how we successfully adapted that mechanism to test two different existing Web Services: Storage Room by Thriventures and Google Tasks by Google. For this task we have used Erlang together with state machine models in the property-based testing tool Quviq QuickCheck, implemented using the states module. 1. INTRODUCTION In order for software to be testable, it needs to have clearly defined interfaces. When testing Web Services we get two advantages inherently: - Web Services have a clear interface by definition. - The interfaces for Web Services are language-independent. Because of this we do not need to know in which language they are written, under which operating system they are running, or where in the world they are deployed. But because we have a protocol in the middle (usually HTTP), the number and complexity of tests needed are higher than would be in the case that we just had to call the functions of a traditional library because: - We must test the constraints of the protocol supporting access to the services; in our case this is the REST architecture implemented over HTTP. - We have to use sockets or other intermediate libraries which add complexity to the tests. - Web Services are usually exposed to a more hostile environment – the internet – so they need to be tested for safety against malformed or maliciously constructed requests. Nevertheless, since Web Services – and in particular REST Web Services [8] – usually follow a series of conventions, it should be possible to create a framework that abstracts the parts of the testing model which are applicable to all Web Services. This way we would not have to develop tests from scratch for each project but, instead, it would be sufficient to adapt the framework to each set of particular requirements. As a first step and in an attempt to find those commonalities, we have developed a simple property-based test model that represents an idealised model of a REST Web Service (Section 3), and we have adapted this model to test two existing Web Services claimed to follow the REST principles: Storage Room [22] and Google Tasks [9]. (Section 4). Despite the fact that our approach has only been applied on a small scale, and that we did not find any actual bugs, the exercise has allowed us to learn behaviours of the target systems that were different to those that we were expecting beforehand, thus giving us a broader understanding of their functionality. Furthermore, we achieved this in a non-intrusive way, by issuing a total of less than 5000 requests to each of the services and spreading them out in time so that they would not perceptibly diminish the availability of the Web Services. The contributions of this paper are: - A base model to test side-effect-free REST Web Services. • A technique to adapt the model to specific scenarios. • Two examples that illustrate the model and technique applied to two existing Web Services. 2. RELATED WORK The Web Services tested in this paper return and expect resources in JavaScript Object Notation (JSON) [11]. JSON is becoming popular and is often used where XML was used before, or in conjunction with XML. JSON is a lightweight format used for data exchange that is characterised by being a subset of the JavaScript language. This property makes it easy for web browsers to parse. In Section 6 we will talk a bit more about JSON and we will address the issue of randomly generating valid JSON input data for the use in testing. QuickCheck was originally a tool created for Haskell [6] that uses random generated data as input for testing functions. Functions are fed with random inputs and the tool checks that the outputs comply with the appropriate post-conditions. Because at the time of initial development Haskell had a small industrial community, a new version of QuickCheck was developed for Erlang and it is currently being maintained by Quviq AB [10]. In turn, the latter QuickCheck inspired the creation of a similar but open-source tool called PropEr, which further explores the integration with Erlang type specifications [18]. Versions of QuickCheck have also been developed for other languages, notably Java [20]. Quviq’s QuickCheck provides some specific tools that simplify the generation of input data for certain scenarios. It is the case of the modules statem and fsm. The module fsm allows the interface under test to be described by a finite state machine, where transitions represent calls to the interface. QuickCheck can use these descriptions to generate sequences of commands that comply with the given state machine. The module statem works in a similar way but it does not require a state machine to be defined, relying instead on a single “control state” with a mutable “data” state value, preconditions, and postconditions. The work described in this paper is the result of using a QuickCheck statem – in the style described by Castro and Arts to test database intensive applications [3] – to the particular case of REST Web Services. We also show briefly how we can abstract the approach in order to use the module fsm for the same purpose, (Section 5). In the past, other approaches have been used to test REST Web Services, like is the case of the tool Test-the-rest [4]. These approaches usually rely on unit testing in contrast to ours, which consists in property-based testing. There is also some work on testing and verification of the RESTfulness of Web Services that focuses on the general REST principles such as connectedness [5] and temporal constraints [13]. On the other hand, property-based testing has been used to test SOAP (non-restful) Web Services in an automatic way before. In [14] Lampropoulos and Sagonas show a way to create properties to test SOAP services by using WSDL descriptors. Their method generates a set of simple properties without the need of human intervention, and then they use this properties as a template for writing more complex ones. Nevertheless, despite the fact that WSDL descriptors are a de facto standard for SOAP Web Services, they are rarely present in REST Web Services. For this reason we use a different approach for the elaboration of generators. Haskell QuickCheck has also been used for SOAP Web Service testing [23], and automatic approaches for testing non-restful Web Services using both FSMs [1] and EFSMs [12] have been described in several places. Finally, Lastres in [15] has also used QuickCheck statem to test a REST Web Service (Wriaki) in a property-based way. The method we use in this paper is quite similar to this approach although here we focus on generalising the common aspects of REST Web Services. 3. THE REST MODEL The principles of the REST architecture [8] reflect the original principles behind the HTTP protocol. Because REST is a radical new perspective, which has been highly influential, the terms ‘REST’ and ‘RESTful’ have become over-used buzzwords, and despite that fact that the original principles identified by Fielding [8] are clear and unambiguous, there is controversy about what is and isn’t a RESTful system in practice; see Fielding’s blog post REST APIs must be hypertext-driven [21] for a particular example of controversy. Introducing the model According to the REST philosophy, each resource must have a permanent Uniform Resource Identifier (URI) that identifies a resource globally [2] and which must be unique and persistent. In conformance with the HTTP protocol, • whenever we want to retrieve a resource we must use the method GET; • when we want to add a new resource we must use the method POST; • when we want to remove a resource we must use the method DELETE; and • when we want to modify a resource we must use the method PUT. No assumptions must be made about the location of resources since it should be possible to find them by following hyperlinks from a base URI [19]. With this assumption in mind we can model a collection of resources in a similar way to how we would model a database table: each entry of the collection would correspond to a row in the database table and GET would correspond to SELECT, INSERT would correspond to POST, UPDATE would correspond to PUT, and DELETE would correspond to DELETE. Our collection will have a defined URI. For example (where we use ‘.’ to elide part of the initial segment of the URIs): http://restsrv...collections/book_collection Based on the URI for the collection, there will be a URI where we can POST new entries and GET the list of existing entries. For example: http://restsr...collections/book_collection/entries And all the entries in the collection will follow a common pattern. For example: http ... book_collection/entries/Cinderella http ... book_collection/entries/Hansel_and_Gretel http ... book_collection/entries/Snow_White ... In our model we can then define five operations, four based on the HTTP actions, and a fifth to list an entire set of resources. Note that list() uses the same HTTP action as get(), namely GET. The reason we do not use the same method for both is that list() is used for resources of the type "collection", and get() is used for the rest of resources. list() will extract the list of entries in the collection while get() will return the resource as a black box. The facade must be adapted for each particular implementation and by separating both behaviours we can keep a more general get() while list() is more specific. The functions of the model We now show the proposed Erlang functions of the model and how they would map with their equivalents in HTTP. They are presented in the form: function(Parameter1, ..., ParameterN) -> Result In this example, the titles of the books are used as keys, but in real systems keys would usually be just hashes. The values are strings containing the JSON representation of the information of the book but they could also be any string: get(Key) -> Entry - Retrieves the entry with key Key. For example: get("Cinderella") -> " { title: 'Cinderella'; author: 'Charles Perrault' } " would be implemented as a GET call to the URL where the entry with key Key is stored: GET .../book_collection/entries/Cinderella delete("Cinderella") -> ok would be implemented as a DELETE call to the URL where the entry with key Key is stored: DELETE .../book_collection/entries/Cinderella post(Entry) -> Key - Adds the entry Entry to the collection, and returns the key used to store it. For example: post(" { title: 'Cinderella'; author: 'Charles Perrault' ... }) " -> "Cinderella" would be implemented as a POST call to the URL of the entries of the collection: POST .../book_collection/entries { ... title: 'Cinderella'; author: 'Charles Perrault' ... } put(Key, PartialEntry) -> ok - Modifies the entry with key Key to include the fields in PartialEntry. For example: put("Cinderella", " { author: 'Brothers Grimm' } " ) -> ok It is implemented as a PUT call to the URL where the entry with key Key is stored: PUT .../book_collection/entries/Cinderella { author: 'Brothers Grimm' } list() -> [{Key, Value}] - Returns a list with all the pairs of keys and entries in the collection, (in our implementation, a list of tuples). For example: list() -> [{ "Cinderella", "{title: ... }"}, { "Hansel_and_Gretel", "{title: ... }"}, ... { "Snow_White", "{title: ... }"}] It is implemented as a GET call to the URL of the entries of the collection: GET .../book_collection/entries Using the model In order to guide the design of our initial test model before trying it in the real services, we implemented the previous model as an Erlang gen_server with a dictionary (module dict) as storage. In this implementation, the post method returns a long hexadecimal hash, and the entries were assumed to be arbitrary Erlang terms. Whenever an entry is deleted, it is no longer accessible via get, list or put. Also, whenever any method is used with a key that is not in the dictionary, the tuple {error, not_found} is returned. This is illustrated in the example execution below: ``` 1> model:start_link(). {ok,<0.33.0>} 2> HashCinderella = model:post("Cinderella"). {ok, "Cinderella"} 3> model:list(). {{"fe3d73ebe0045732f200d90b", "Cinderella"}} 4> model:get(HashCinderella). {ok, "Cinderella"} ``` In order to test our model we used QuickCheck and described by Laura Castro and Thomas Arts in [3], but this time, we used the new grouped version of statem instead of the ungrouped one. The ungrouped version uses the same function for each aspect of the test model, because of that, all the preconditions, all the postconditions, etc. have to be together in the code. By contrast, in the new grouped version, we can put together all the functions corresponding to the same method, for example, the precondition of the GET method can go together with the postcondition of the GET method, which makes the test model more readable. The code of the test model module is given in Appendix A. The function model:comment_gen() returns a QuickCheck generator of a valid entry, (details are explained in Section 6). The user-defined type listset, is equivalent to a normal set but also provides a function to access its elements by index, because of this, by using listsets, it is much easier and efficient to retrieve a random element, (the function modelutil:rnd_from_listset_gen/1, returns a generator that produces a list with a random element of the specified listset). ``` Invariant/1 is a function that is called before and after any command is executed. Our invariant function calls the method listset() and checks that the hashes of the resources match the hashes we have stored in our model. This way we try to ensure that the model and the Web Service are always on the same page. ``` 4. TESTING REAL WEB SERVICES Storage Room [22] is an engine that provides you with an online database. It has an administration web site that allows you to define the structure of the database and it provides you with a RESTful API with the typical queries that databases have. Google Tasks [9] is a simple web application that allows you to keep several lists of tasks and subtasks, it integrates with GMail and Google Calendar, and it allows you to set due dates and to mark tasks as done. It provides a RESTful API with roughly the same functionality than the normal web version. Both Google Tasks and Storage Room were services in production phase at the time of the experiment. In addition, the amount of requests we can make to the Web Services are limited in both cases. Because of this, we introduced a delay of half a second between requests and limited the amount of test cases produced by QuickCheck to 30. A typical API call to insert an object into Storage Room would look similar to the one shown in Figure 1. We can easily apply the test model of our model to Storage Room by making a facade as shown in Figure 2. But when running QuickCheck we get back the error below. ``` Shrinking............(11 times) {{set,\{var,5\},\{call,dbtest,post,\{{struct,\{ENTRY_1\}\}}\}}, {set,\{var,7\},\{call,dbtest,delete,\{{\{\{\},\{\},\{\},\{\}\}\}\}\}}, {set,\{var,11\},\{call,dbtest,get,\{{\{\},\{\},\{\},\{\}\}\}\}}} dbtest:post(\{\{\},\{\},\{\},\{\}\}) -> "5190fa9b0f66027a4900046e" dbtest:delete("5190fa9b0f66027a4900046e") -> ok dbtest:get("5190fa9b0f66027a4900046e") -> ok, \{struct,\{ENTRY_1\}\}\} ``` Reason: {postcondition, false} Indeed, if in Storage Room we POST an object, then we DELETE it and finally we GET it, we still obtain the object back. The behaviour discovered goes against our first intuitions about the behaviour of REST Web Services, and it could be seen as a bug. But having set this behaviour on purpose would make sense in some cases. This result could as well have been caused by an unknown intermediate server acting as a cache between the server and the client: we checked this by appending a random and innocuous extra parameter to the end of the URL and it was not the case, the server was still returning the object. The set of principles on which the web relies also says that queries do not necessarily have to be answered in the order in which they are made. It could be the case that we issued a GET query before a DELETE query but the server sees the DELETE before; and we may not want the GET query to fail because of that. This reasons could justify the behaviour. Moreover, if disk space is not a problem, for data security reasons it may not be desirable to allow users to really delete data. Also, the usual intuition promoted by most GUIs is that when you delete something it goes to the recycle bin. Klein and Namjoshi, in their formalization of RESTful behavior [13], also contemplate this delay in the execution of the DELETE communication as a reasonable variation on RESTful HTTP properties. Storage Room has in fact a meta-attribute called trash, which tells us whether the object has already been deleted or not. In addition, we were able to check that the parent container object was also updated and it did not return any of the hashes corresponding to the children that were already deleted. Later we found the same behaviour in Google Tasks, the latter has an attribute called deleted. We updated the test module to reflect the behaviour discovered in last section, (see Appendix B). And this time the 30 test cases passed without problems. The fixed tests worked with Google Tasks without any change to the dbtest module. 5. **FINITE STATE MACHINE** We can implement a test model for this model by using the fsm module from QuickCheck which has some advantages over statem. For example, if we use the fsm module, then QuickCheck will try to ensure that the visits to each state are balanced so that the random tests generated reach all the functionalities evenly. In the FSM model, we consider the following states, where ‘normal’ entries are those that are not ‘trashed’. - **EC** - Empty & Canonical - No entries are stored, (nor trashed, nor normal). - **NC** - Non-empty & Canonical - Entries are stored, but none is trashed. - **NN** - Non-empty & Non-canonical - There are both trashed and normal entries stored. - **EN** - Empty & Non-canonical - There are entries but they are all trashed. The four original REST methods were divided according to their possible different behaviours and an extra one was added: - **POST** - Creates a new entry. Client POST return "51113a390f66021f7d0019bc" Storage Room POST return { entry: { title: "Little Red Riding Hood", author: { url: "50f2f9640f660277e0001b88" }, isbn: "9780836249019" } } Facade Model Figure 2: Representation of model and facade over Storage Room - **post_first** - Creates the first normal entry. - **post_norm** - Creates an additional normal entry. - **GET** - Retrieves an existing entry. - **get_norm** - Retrieves a normal entry. - **get_del** - Retrieves a trashed entry. - **DELETE** - Trashes an existing entry. - **del_last** - Trashes the last remaining normal entry. - **del_norm** - Trashes one of several remaining normal entries. - **del_del** - Tries to trash an already trashed entry, (does nothing). - **PUT** - Modifies an existing entry. - **put_del** - Modifies a trashed entry. - **put_norm** - Modifies a normal entry. - **empty_trash** - Removes definitely all the trashed entries. This command is not an API method neither in Storage Room neither in Google Tasks, but we decided to add it to our model for completion. 6. GENERATORS Input to Web Services consists in most of the cases of XML or JSON structures. In recent years JSON has been gaining popularity and it seems to be slowly replacing XML in a growing number of scenarios. JSON is a format with similar functionality to XML, but JSON objects can also be interpreted as pure JavaScript. This property makes it very easy and efficient to parse by web browsers. Its syntax basically consists of nested dictionaries (represented with curly brackets), arrays (represented with square brackets), and the basic primitives of type boolean, number, string, and null [7]. During the early stages of this experiment, we used the same object as input for all the tests, which made things easier; but in the final version, we used several randomly generated objects to get a better coverage of the target systems. In order to achieve this, we made generic generators out of our example objects. To illustrate this, we will use a more complex type of object than the books: `CommentOnABook`. Our original example object was similar to the one shown in Figure 4. In order to make a QuickCheck generator out of a JSON structure we could use strings with pieces of JSON and use Erlang to put them together. We could also use the Erlang representation of JSON and then encode the composition. But perhaps the most readable way to mix QuickCheck generators and JSON is to add annotations as template languages like PHP or JSP do with HTML, so we decided to label attributes with tags in the JSON itself. These tags specify which kind of generator should be placed where, and which parameters could be omitted as shown in Figure 5. We have also considered the possibility of creating a hybrid language combining JSON and Erlang or Erlang’s symbolic representation, but creating a new language is always a delicate task and by using our simple solution we could reuse existing parsing libraries, which was enough for our approach. We leave the creation of an advanced JSON template language for future work. Once we have defined the JSON template, we can programmatically parse it and replace its tags with QuickCheck generators. To parse the JSON structures we used mochijson2 from MochiWeb project [17]. For example, we replaced nonempty_string() with the following generator: ```erlang nonempty_string_gen() -> ?LET(String, [choose(33, 126)|list(choose(32, 126))], list_to_binary(String)); ``` This way we only generate visible standard ASCII characters. Some manual tests showed that Storage Room is implemented to consider that empty strings do not fulfill the mandatory parameter constraint. That is also the reason why we add a single character at the beginning, and why we do not allow the “white space” (ASCII code 32) for that character. For bool() we just used the bool() generator provided by QuickCheck. Alternatively, in their paper about automatic WSDL-guided testing [14], Lampropoulos and Sagonas present a quite convenient and flexible method to build custom generators for XML. A similar approach could be used for JSON and it would probably be more appropriate for the ultimate goal... of developing a framework to automate the testing of REST Web Services, since it fits a broader range of scenarios. Nevertheless, for this scenario, our simpler ad hoc approach was enough. Finally, lists or dictionaries that have parameters with the optional() tag, are replaced by generators that randomly remove some or all of the parameters tagged as optional(), (or none of them). Note that, in the case of dictionaries, parameters only have their value tagged. If we tagged both key and value we could have several parameters with the same key. See for example the incorrect JSON structure shown in Figure 6. This would not make sense in JSON because dictionaries are made to be accessed by key. 7. KNOWN LIMITATIONS The current approach still involves a lot of manual work that could probably be automated in the future. It is also not very extensive, since we only tested single collections and we did not cover dependencies between different collections or between parameters inside the same entry. Dependencies should not be a problem for any particular project, but they are a more complex subject when speaking about a generalisation for any REST Web Service. The self-imposed limitation to 30 tests was necessary in this scenario, due to the use of foreign Web Services. This amount of tests is much smaller than the 100 that QuickCheck uses by default. Even with such a small number of tests, we where able to use QuickCheck with our technique to find out that our preconceived initial model did not match the systems under test. Nevertheless, for cases where the tester has access to an appropriate testing environment, this number can be increased just by changing a constant in the test model. 8. FUTURE WORK The obvious next step would be to automate this process further. However, there are also a number of lateral improvements that would be useful, as well as those mentioned in the previous section. For example, a common framework could include tools to focus on common bugs that are already well known: buffer overruns, problems with encoding, problems with character escaping, pages without authentication mechanism, code injection. CRUD (Create, Read, Update and Delete) [16] is the acronym for database-like behaviour. REST is not CRUD. The POST method may have side effects or may not create a resource with an URL of its own. Future work should be focused in automating the modelling of this side effects. Nevertheless, most of the examples of REST Web Services that we have found in fact exhibit substantial CRUD-like behaviour. Because of this we envision a broader automated framework that may instantiate versions of this model adapted in some way to test different CRUD parts of Web Services and will fill the gaps by linking the CRUD parts and extending them by using a high-level model representing the side effects that go beyond the CRUD model. 9. CONCLUSION In this paper we have contributed with a practical example of the application of QuickCheck to REST Web Services without side effects, with a technique to adapt this model to specific scenarios, and with an example of how we used the model to learn about the real implementation of the two Web Services we tested which differed from our preconceived mental model of them. Hopefully this approach will be useful as a first step towards the automation of testing of REST web services. We are grateful to the European Commission for their support for of work via the collaborative project PROWESS, http://www.prowess-project.eu/, grant number 317820. We also wish to thank the anonymous reviewers of this work for the Erlang Workshop 2013 for their detailed and thought-provoking comments. 10. REFERENCES APPENDIX A. TEST MODEL -module(dbtest). -include_lib("eqc/include/eqc.hrl"). -include_lib("eqc/include/eqc_statem.hrl"). -compile(export_all). -record(state, {keys = listset:new(), dict = dict:new()}). initial_state() -> #state{}. invariant(S) -> Local = element(1, lists:unzip( idict:to_list(S#state.dict)), Remote = element(1, lists:unzip(list())), lists:sort(Local) =:= lists:sort(Remote). get_command(State) -> {call, ?MODULE, get, [oneof([modelutil:hash_gen()| modelutil:rnd_from_listset_gen( State#state.keys))], comment_gen())}. get_pre(_State) -> true. get_pre(State, _Args) -> true. get_next(State, _Value, _Args) -> State. get_post(State, [Key], Res) -> is_substruct( case dict:is_key(Key, State#state.dict) of true -> {ok, dict:fetch(Key, State#state.dict)}; false -> {error, not_found} end, Res). post_command(_State) -> {call, ?MODULE, post, [comment_gen()]}, post_pre(_State) -> true. post_pre(State, _Args) -> true. post_next(State#state(keys = Keys, dict = Dict) = State, _Var, [Value]) -> State#state( keys = listset:insert(Key, Keys), dict = dict:store(Key, Value, Dict) ) post_post(State, _Args, Res) when is_list(Res) -> true. put_command(State) -> {call, ?MODULE, put, [oneof([modelutil:hash_gen()| modelutil:rnd_from_listset_gen( State#state.keys))], comment_gen())}. put_pre(_State) -> true. put_pre(State, _Args) -> true. put_next(State#state(dict = Dict) = State, _Var, [Key, Value]) -> case dict:is_key(Key, State#state.dict) of true -> {ok, dict:fetch(Key, State#state.dict)}; false -> {error, not_found} end, Res). post_post(_State, _Args, Res) when is_list(Res) -> true. delete_command(State) -> {call, ?MODULE, delete, [oneof([modelutil:hash_gen()| modelutil:rnd_from_listset_gen( State#state.keys))]}. delete_pre(_State) -> true. delete_pre(State, _Args) -> true. delete_next(State#state(dict = Dict) = State, _Var, [Key]) -> State#{ dict = dict:erase(Key, Dict) }. delete_post#{state{dict = Dict}, [Key], Res} -> case dict:is_key(Key, Dict) of true -> ok; false -> {error, not_found} end =:= Res. weight(_S, get) -> 2; weight(_S, post) -> 1; weight(_S, put) -> 1; weight(_S, delete) -> 1; weight(_S, _Cmd) -> 1. prop_db() -> ?FORALL(Cmds, commands(?MODULE), begin {H, S, Res} = run_commands(?MODULE, Cmds), clean_up(S#state.dict), pretty_commands(?MODULE, Cmds, {H, S, Res}, Res == ok) end). % Interface selection % ============= check_prop() -> model:start_link(), eqc:quickcheck(eqc:numtests(1000, prop_db())), model:stop(). % Commands get(Key) -> model:get(Key). post(Value) -> model:post(Value). put(Key, Value) -> model:put(Key, Value). delete(Key) -> model:delete(Key). list() -> model:list(). comment_gen() -> model:comment_gen(). B. FIXES TO THE MODEL -module(dbtest). #include_lib("eqc/include/eqc.hrl"). #include_lib("eqc/include/eqc_statem.hrl"). -compile(export_all). -record(state, {keys = listset:new(), dict = dict:new(), nodeldict = dict:new()}). initial_state() -> #state{}. invariant(S) -> Local = element(1, lists:unzip(dict:to_list(S#state.dict))), Remote = element(1, lists:unzip(list())), lists:sort(Local) =:= lists:sort(Remote). get_command(State) -> {call, ?MODULE, get, [oneof([modelutil:hash_gen()| modelutil:rnd_from_listset_gen( State#state.keys)])] }. get_pre(_State) -> true. get_pre(_State, _Args) -> true. get_next(State, _Value, _Args) -> State. get_post(State, [Key], Res) -> is_substruct( case dict:is_key(Key, State#state.nodeldict) of true -> {ok, dict:fetch(Key, State#state.nodeldict)}, false -> {error, not_found} end, Res). post_command(_State) -> {call, ?MODULE, post, [comment_gen()]}. post_pre(_State) -> true. post_next(#state{keys = Keys, dict = Dict} = State, Var, [Value]) -> State#state{ keys = listset:insert(Var, Keys), dict = dict:store(Var, Value, Dict) }. post_post(_State, _Args, Res) when is_list(Res) -> true. put_command(State) -> {call, ?MODULE, put, [oneof([modelutil:hash_gen()| modelutil:rnd_from_listset_gen(State#state.keys)], comment_gen())]}. put_pre(_State) -> true. put_next(#state{dict = Dict, nodeldict = NoDelDict} = State, _Var, [Key, Value]) -> case dict:is_key(Key, Dict) of true -> State#state{ dict = dict:store(Key, Value, Dict), nodeldict = dict:store(Key, Value, NoDelDict) }; false -> case dict:is_key(Key, NoDelDict) of true -> State#state{ nodeldict = dict:store(Key, Value, NoDelDict) }; false -> State end end. put_post(State, [Key, _], Res) -> is_substruct(case dict:is_key(Key, State#state.nodeldict) of true -> ok; false -> {error, not_found} end, Res). delete_command(_State) -> {call, ?MODULE, delete, [oneof([modelutil:hash_gen()| modelutil:rnd_from_listset_gen(State#state.keys)])]}. true -> Tail; false -> [Head|sub_if_substruct(Tail, Element)] end. clean_up(Keys) -> clean_up_aux( element(1, lists:unzip(dict:to_list(Keys)))) clean_up Aux([],) -> ok; clean_up Aux([H|T]) -> ok = delete(eval(H)), clean_up Aux(T), [] = list(). %%% Interface selection %%% =============== check_prop() -> model:start_link(), eqc:quickcheck(eqc:numtests(1000, prop_db())), model:stop(). %%% Commands get(Key) -> model:get(Key). post(Value) -> model:post(Value). put(Key, Value) -> model:put(Key, Value). delete(Key) -> model:delete(Key). list() -> model:list(). comment_gen() -> model:comment_gen().
{"Source-Url": "https://kar.kent.ac.uk/42310/1/srtest.pdf", "len_cl100k_base": 7803, "olmocr-version": "0.1.49", "pdf-total-pages": 13, "total-fallback-pages": 0, "total-input-tokens": 38215, "total-output-tokens": 9424, "length": "2e12", "weborganizer": {"__label__adult": 0.0003457069396972656, "__label__art_design": 0.0003237724304199219, "__label__crime_law": 0.00023293495178222656, "__label__education_jobs": 0.0004220008850097656, "__label__entertainment": 6.115436553955078e-05, "__label__fashion_beauty": 0.00014281272888183594, "__label__finance_business": 0.00015807151794433594, "__label__food_dining": 0.00035309791564941406, "__label__games": 0.00031375885009765625, "__label__hardware": 0.00057220458984375, "__label__health": 0.00045609474182128906, "__label__history": 0.00019109249114990232, "__label__home_hobbies": 6.783008575439453e-05, "__label__industrial": 0.00024628639221191406, "__label__literature": 0.0002593994140625, "__label__politics": 0.00019788742065429688, "__label__religion": 0.0003795623779296875, "__label__science_tech": 0.0105743408203125, "__label__social_life": 9.644031524658204e-05, "__label__software": 0.005527496337890625, "__label__software_dev": 0.97802734375, "__label__sports_fitness": 0.00025343894958496094, "__label__transportation": 0.0003631114959716797, "__label__travel": 0.00021839141845703125}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 35377, 0.01436]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 35377, 0.56941]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 35377, 0.87542]], "google_gemma-3-12b-it_contains_pii": [[0, 502, false], [502, 4539, null], [4539, 10146, null], [10146, 13255, null], [13255, 17829, null], [17829, 20198, null], [20198, 22800, null], [22800, 24471, null], [24471, 29559, null], [29559, 31854, null], [31854, 33507, null], [33507, 34753, null], [34753, 35377, null]], "google_gemma-3-12b-it_is_public_document": [[0, 502, true], [502, 4539, null], [4539, 10146, null], [10146, 13255, null], [13255, 17829, null], [17829, 20198, null], [20198, 22800, null], [22800, 24471, null], [24471, 29559, null], [29559, 31854, null], [31854, 33507, null], [33507, 34753, null], [34753, 35377, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 35377, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 35377, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 35377, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 35377, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 35377, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 35377, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 35377, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 35377, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 35377, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 35377, null]], "pdf_page_numbers": [[0, 502, 1], [502, 4539, 2], [4539, 10146, 3], [10146, 13255, 4], [13255, 17829, 5], [17829, 20198, 6], [20198, 22800, 7], [22800, 24471, 8], [24471, 29559, 9], [29559, 31854, 10], [31854, 33507, 11], [33507, 34753, 12], [34753, 35377, 13]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 35377, 0.0]]}
olmocr_science_pdfs
2024-11-24
2024-11-24
02a2bc7e96b4abe11199ab86535fd18039c5471c
[REMOVED]
{"Source-Url": "http://pcgbook.com/wp-content/uploads/chapter04.pdf", "len_cl100k_base": 7933, "olmocr-version": "0.1.49", "pdf-total-pages": 16, "total-fallback-pages": 0, "total-input-tokens": 36923, "total-output-tokens": 9526, "length": "2e12", "weborganizer": {"__label__adult": 0.0012950897216796875, "__label__art_design": 0.00594329833984375, "__label__crime_law": 0.0011386871337890625, "__label__education_jobs": 0.0030269622802734375, "__label__entertainment": 0.00095367431640625, "__label__fashion_beauty": 0.0009136199951171876, "__label__finance_business": 0.0007677078247070312, "__label__food_dining": 0.0013093948364257812, "__label__games": 0.109375, "__label__hardware": 0.0027027130126953125, "__label__health": 0.001308441162109375, "__label__history": 0.003116607666015625, "__label__home_hobbies": 0.0005488395690917969, "__label__industrial": 0.0015802383422851562, "__label__literature": 0.0015687942504882812, "__label__politics": 0.0008301734924316406, "__label__religion": 0.0016765594482421875, "__label__science_tech": 0.276611328125, "__label__social_life": 0.00023877620697021484, "__label__software": 0.0199737548828125, "__label__software_dev": 0.56103515625, "__label__sports_fitness": 0.0016927719116210938, "__label__transportation": 0.0015201568603515625, "__label__travel": 0.0011005401611328125}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 41333, 0.01871]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 41333, 0.83545]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 41333, 0.92583]], "google_gemma-3-12b-it_contains_pii": [[0, 2102, false], [2102, 5264, null], [5264, 8112, null], [8112, 11117, null], [11117, 14162, null], [14162, 17342, null], [17342, 19717, null], [19717, 22866, null], [22866, 25523, null], [25523, 28708, null], [28708, 31481, null], [31481, 34472, null], [34472, 36105, null], [36105, 37006, null], [37006, 39647, null], [39647, 41333, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2102, true], [2102, 5264, null], [5264, 8112, null], [8112, 11117, null], [11117, 14162, null], [14162, 17342, null], [17342, 19717, null], [19717, 22866, null], [22866, 25523, null], [25523, 28708, null], [28708, 31481, null], [31481, 34472, null], [34472, 36105, null], [36105, 37006, null], [37006, 39647, null], [39647, 41333, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 41333, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 41333, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 41333, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 41333, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 41333, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 41333, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 41333, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 41333, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 41333, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 41333, null]], "pdf_page_numbers": [[0, 2102, 1], [2102, 5264, 2], [5264, 8112, 3], [8112, 11117, 4], [11117, 14162, 5], [14162, 17342, 6], [17342, 19717, 7], [19717, 22866, 8], [22866, 25523, 9], [25523, 28708, 10], [28708, 31481, 11], [31481, 34472, 12], [34472, 36105, 13], [36105, 37006, 14], [37006, 39647, 15], [39647, 41333, 16]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 41333, 0.0]]}
olmocr_science_pdfs
2024-11-25
2024-11-25
8ce2bc91334f9f63809adedd2eb4febf062ed0ef
Swift Essentials Swift is a new and powerful programming language that represents an essential new programming tool for iOS and OSX applications and builds upon the power of Objective-C while streamlining the developer experience. Swift Essentials is a fast-paced, practical guide showing you the quickest way to put Swift to work in the real world. It guides you concisely through the basics of syntax and development before pushing ahead to explore Swift’s higher features through practical programming projects. By the end of the book, you will be able to use Xcode’s graphical interface builder, create interactive applications, and communicate with network services. Who this book is written for Whether you are a seasoned Objective-C developer or new to the Xcode platform, Swift Essentials will provide you with all you need to know to get started with the language. Prior experience with iOS development is not necessary, but will be helpful to get the most out of the book. What you will learn from this book - Explore the nuts and bolts of the Swift syntax - Test Swift code interactively with the REPL - Display graphics with QuickLook in the Swift playground - Present data in master-detail applications - Use the Swift storyboard to manage multi-screen applications - Create graphical UIViews with Swift - Parse JSON and XML data from network sources - Build a standalone iOS application from start to finish In this package, you will find: - The author biography - A preview chapter from the book, Chapter 2 “Playing with Swift” - A synopsis of the book’s content - More information on Swift Essentials About the Author Dr Alex Blewitt has over 20 years of experience in Objective-C and has been using Apple frameworks since NeXTSTEP 3.0. He upgraded his NeXTstation for a TiBook when Apple released Mac OS X in 2001 and has been developing on it ever since. Alex currently works for a financial company in London and writes for the online technology news site InfoQ. He has authored two other books for Packt Publishing. He also has a number of apps on the App Store through Bandlem Limited. When he's not working on technology and the weather is nice, he likes to go flying from the nearby Cranfield airport. Alex writes regularly on his blog http://alblue.bandlem.com as well tweets regularly on Twitter, @alblue. Acknowledgments This book would not have been possible without the ongoing love and support of my wife, Amy, who has helped me through the highs and lows of life. She gave me the freedom to work during the many late nights and weekends that it takes to produce a book and its associated code repository. She truly is the gem of my life. I'd also like to thank my parents, Ann and Derek, for their encouragement and support during my formative years. It was their work ethics that allowed me to start my career in technology as a teenager and to incorporate my first company before I was 25. I'd also like to congratulate them on their 50th wedding anniversary in 2015, and I look forward to reaching this milestone with Amy. Thanks is due especially to the reviewers of the book, Nate Cook, James Robert, Arvid Gerstmann, and Anil Varghese, who provided excellent feedback on the contents of this book during development and caught many errors in both the text and code. Any remaining errors are my own. I'd also like to thank CodeClub, with whom I have been volunteering to teach young children how to code, and Akeley Wood, for allowing me to be a part of it. I hope both Sam and Holly enjoy it as much as I do. Finally, I'd like to thank Ben Moseley and Eren Kotan who introduced me to NeXT in the first place and set my career going on a twenty-year journey to this book. Swift Essentials *Swift Essentials* provides an overview of the Swift language and the tooling necessary to write iOS applications. From simple Swift commands on the command line to interactively testing graphical content in the Playground editor, the Swift language and syntax is introduced by examples. The book also introduces end-to-end iOS application development by showing you how a simple iOS application can be created, followed by how to use storyboards and custom views to build a more complex networked application. The book concludes by providing a worked example from scratch that builds up a GitHub repository browser. **What This Book Covers** *Chapter 1, Exploring Swift*, presents the Swift read-evaluate-print-loop (REPL) and introduces the Swift language through examples on standard data types, functions, and looping. *Chapter 2, Playing with Swift*, demonstrates Swift Playgrounds as a means to interactively play with the Swift code and obtain graphical results. It also introduces the playground format and shows how playgrounds can be created automatically from Markdown and AsciiDoc files. *Chapter 3, Creating an iOS Swift App*, shows you how to create and test an iOS application built in Swift using Xcode, along with an overview of the Swift classes, protocols, and enums. *Chapter 4, Storyboard Applications with Swift and iOS*, introduces the concept of Storyboards as a means to create a multiscreen iOS application and shows how views in Interface Builder can be wired to Swift outlets and actions. *Chapter 5, Creating Custom Views in Swift*, covers custom views in Swift using custom table views, laying out nested views, drawing custom graphics, and layered animations. *Chapter 6, Parsing Networked Data*, demonstrates how Swift can talk to networked services, using both HTTP and custom stream-based protocols. *Chapter 7, Building a Repository Browser*, uses the techniques described in this book to build a repository browser that can display information about users' GitHub repositories. *Appendix* provides additional references and resources to continue learning about Swift. Playing with Swift Xcode ships with both a command line interpreter (covered in Chapter 1, Exploring Swift) and a graphical interface called **playground** that can be used to prototype and test Swift code snippets. Code typed into the playground is compiled and executed interactively, which permits a fluid style of development. In addition, the user interface can present a graphical view of variables as well as a timeline, which can show how loops are executed. Finally, playgrounds can mix and match code and documentation, leading to the possibility of providing example code as playgrounds and using playgrounds to learn how to use existing APIs and frameworks. This chapter will present the following topics: - How to create a playground - Displaying values in the timeline - Presenting objects with Quick Look - Running asynchronous code - Using playground live documentation - Generating playgrounds with Markdown and Asciidoc - Limitations of playgrounds Playing with Swift Getting started with playgrounds When Xcode is started, a welcome screen is shown with various options, including the ability to create a playground. Playgrounds can also be created from the File | New | Playground menu. Creating a playground Using either the Xcode welcome screen (which can be opened by navigating to Window | Welcome to Xcode) or navigating to File | New | Playground, create MyPlayground in a suitable location targeting iOS. Creating the playground on the Desktop will allow easy access to test Swift code, but it can be located anywhere on the filesystem. Playgrounds can be targeted either towards OS X applications or towards iOS applications. This can be configured when the playground is created, or by switching to the Utilities view by navigating to View | Utilities | Show File Inspector or pressing Command + Option + 1 and changing the dropdown from OS X to iOS or vice versa. When initially created, the playground will have a code snippet that looks as follows: ```swift // Playground - noun: a place where people can play import UIKit var str = "Hello, playground" ``` Playgrounds targeting OS X will read `import Cocoa instead.` On the right-hand side, a column will show the value of the code when each line is executed. In the previous example, the word **Hello, playgr...** is seen, which is the result of the string assignment. By grabbing the vertical divider between the Swift code and the output, the output can be resized to show the full text message: Alternatively, by moving the mouse over the right-hand side of the playground, the **Quick Look** icon (the eye symbol) will appear; if clicked on, a pop-up box will show the full details: Playing with Swift Viewing the console output The console output can be viewed on the right-hand side by opening the Assistant Editor. This can be opened by pressing Command + Option + Enter or by navigating to View | Assistant Editor | Show Assistant Editor. This will show the result of any println statements executed in the code. Add a simple for loop to the playground and show the Assistant Editor: ```swift for i in 1...12 { println("I is \(i)") } ``` The output is shown on the right-hand side: The assistant editor can be configured to be displayed in different locations, such as at the bottom, or stacked horizontally or vertically by navigating to the View | Assistant Editor menu. Viewing the timeline The timeline shows what other values are displayed as a result of executing the code. In the case of the print loop shown previously, the output was displayed as **Console Output** in the timeline. However, it is possible to use the playground to inspect the value of an expression on a line, without having to display it directly. In addition, results can be graphed to show how the values change over time. Add another line above the `println` statement to calculate the result of executing an expression, `(i-6)*(i-7)`, and store it in a variable, `j`: ```swift for i in 1...12 { var j = (i-7) * (i-6) println("I is \(i)") } ``` On the line next to the variable definition, click on the add variable history symbol (+), which is in the right-hand column (visible when the mouse moves over that area). After it is clicked on, it will change to a (o) symbol and display the graph on the right-hand side. The same can be done for the `println` statement as well: Playing with Swift The slider at the bottom, indicated by the red tick mark, can be used to slide the vertical bar to see the exact value at certain points: ```swift for i in 1...12 { var j = (i-7) * (i-6) var k = i println("I is \(i)") } ``` When the slider is dragged, both values will be shown at the same time. To show several values at once, use additional variables to hold the values and display them in the timeline as well: ```swift for i in 1...12 { var j = (i-7) * (i-6) var k = i println("I is \(i)") } ``` When the slider is dragged, both values will be shown at the same time. Displaying objects with QuickLook The playground timeline can display objects as well as numbers and simple strings. It is possible to load and view images in a playground using classes such as UIImage (or NSImage on OS X). These are known as QuickLook supported objects, and by default include: - Strings (attributed and unattributed) - Views - Class and struct types (members are shown) - Colors It is possible to build support for custom types in Swift, by implementing a debugQuickLookObject method that returns a graphical view of the data. Showing colored labels To show a colored label, a color needs to be obtained first. When building against iOS, this will be UIColor; but when building against OS X, it will be NSColor. The methods and types are largely equivalent between the two, but this chapter will focus on the iOS types. A color can be acquired with an initializer or by using one of the predefined colors that are exposed in Swift using methods: ```swift import UIKit // AppKit for OS X let blue = UIColor.blueColor() // NSColor.blueColor() for OS X ``` The color can be used in a UILabel, which displays a text string in a particular size and color. The UILabel needs a size, which is represented by a CGRect, and can be defined with an x and y position along with a width and height. The x and y positions are not relevant for playgrounds and so can be left as zero: ```swift let size = CGRect(x:0,y:0,width:200,height:100) let label = UILabel(frame:size) // NSLabel for OS X ``` Finally, the text needs to be displayed in blue and with a larger font size: ```swift label.text = str // from the first line of the code label.textColor = blue label.font = UIFont.systemFontOfSize(24) // NSFont for OS X ``` When the playground is run, the color and font are shown in the timeline and available for quick view. Even though the same UILabel instance is being shown, the timeline and the QuickLook values show a snapshot of the state of the object at each point, making it easy to see what has happened between changes. ```swift var str = "Hello, playground" for i in 1...12 { var j = (i-7) * (i-6) var k = i println("I is \(i)\) } let blue = UIColor. blueColor() let size = CGRect(x:0,y:0,width:200,height:100) let label = UILabel(frame:size) label.text = str label.textAlignment = NSTextAlignment.center label.textColor = blue label.font = UIFont. systemFont(ofSize:24) ``` **Showing images** Images can be created and loaded into a playground using the UIImage constructor (or NSImage on OS X). Both take a named argument, which is used to find an image with the given name from the playground's Resources folder. To download a logo, open Terminal.app and run the following commands: ``` $ mkdir MyPlayground.playground/Resources $ curl http://alblue.bandlem.com/images/AlexHeadshotLeft.png > MyPlayground.playground/Resources/logo.png ``` An image can now be loaded in Swift with: ```swift let logo = UIImage(named:"logo") ``` The location of the Resources associated with a playground can be seen in the File Inspector utilities view, which can be opened by pressing Command + Option + 1. The loaded image can be displayed using QuickLook or by adding it to the value history: It is possible to use a URL to acquire an image by creating an NSURL with NSURL(string: "http://..."), then loading the contents of the URL with NSData(contentsOfURL:), and finally using UIImage(data:) to convert it to an image. However, as Swift will keep re-executing the code over and over again, the URL will be hit multiple times in a single debugging session without caching. It is recommended that NSData(contentsOfURL:) and similar networking classes be avoided in playgrounds. Advanced techniques The playground has its own framework, XCPlayground, which can be used to perform certain tasks. For example, individual values can be captured during loops for later analysis. It also permits asynchronous code to continue to execute once the playground has finished running. Capturing values explicitly It is possible to explicitly add values to the timeline by importing the XCPlayground framework and calling XCPCaptureValue with a value that should be displayed in the timeline. This takes an identifier, which is used both as the title and for group-related data values in the same series. When the value history button is selected, it essentially inserts a call to XCPCaptureValue with the value of the expression as the identifier. For example, to add the logo to the timeline automatically: ``` import XCPlayground XCPCaptureValue("logo", logo) ``` ``` let label = UILabel(frame: size) label.textColor = blue label.font = UIFont.systemFont(ofSize: 24) let logo = UIImage(named: "logo") import XCPlayground XCPCaptureValue("logo", logo) ``` It is possible to use an identifier to group the data that is being shown in a loop with the identifier representing categories of the values. For example, to display a list of all even and odd numbers between 1 and 6, the following code could be used: ```swift for n in 1...6 { if n % 2 == 0 { XCPCaptureValue("even", n) XCPCaptureValue("odd", 0) } else { XCPCaptureValue("odd", n) XCPCaptureValue("even", 0) } } ``` The result, when executed, will look as follows: ![Graph showing even and odd numbers between 1 and 6] [45] Running asynchronous code By default, when the execution hits the bottom of the playground, the execution stops. In most cases, this is desirable, but when asynchronous code is involved, execution might need to run even if the main code has finished executing. This might be the case if networking data is involved or if there are multiple tasks whose results need to be synchronized. For example, wrapping the previous even/odd split in an asynchronous call will result in no data being displayed: ```swift dispatch_async(dispatch_get_main_queue()) { for n in 1...6 { // as before } } ``` This uses one of Swift's language features: the `dispatch_async` method is actually a two-argument method that takes a queue and a block type. However, if the last argument is a block type, then it can be represented as a trailing closure rather than an argument. To allow the playground to continue executing after reaching the bottom, add the following call: ```swift XCPSetExecutionShouldContinueIndefinitely() ``` Although this suggests that the execution will run forever, it is limited to 30 seconds of runtime, or whatever is the value displayed at the bottom-right corner of the screen. This timeout can be changed by typing in a new value or using the + and − buttons to increase/decrease time by one second. Playgrounds and documentation Playgrounds can contain a mix of code and documentation. This allows a set of code samples and explanations to be mixed in with the playground itself. Although there is no way of using Xcode to add sections in the UI at present, the playground itself is an XML file that can be edited using an external text editor such as TextEdit.app. Learning with playgrounds As playgrounds can contain a mixture of code and documentation, it makes them an ideal format for viewing annotated code snippets. In fact, Apple's Swift Tour book can be opened as a playground file. Xcode documentation can be searched by navigating to the **Help | Documentation and API Reference** menu, or by pressing **Command + Shift + 0**. In the search field that is presented, type **Swift Tour** and then select the first result. The Swift Tour book should be presented in Xcode's help system: A link to download and open the documentation as a playground is given in the first section; if this is downloaded, it can be opened in Xcode as a standalone playground. This provides the same information, but allows the code examples to be dynamic and show the results in the window: A key advantage of learning through playground-based documentation is that the code can be experimented with. In the **Simple Values** section of the documentation, where `myVariable` is assigned, the right-hand side of the playground shows the values. If the literal numbers are changed, the new values will be recalculated and shown on the right-hand side. Some examples are presented solely in playground form; for example, the Balloons demo, which was used in the introduction of Swift in the WWDC 2014 keynote, is downloadable as a playground from https://developer.apple.com/swift/resources/. ![Note that the Balloons playground requires OS X 10.10 and Xcode 6.1 to run.] ### Understanding the playground format A playground is an OS X **bundle**, which means that it is a directory that looks like a single file. If a playground is selected either in `TextEdit.app` or in `Finder`, then it looks like a regular file: ![Under the covers, it is actually a directory:] ``` $ ls -F MyPlayground.playground/ ``` Inside the directory, there are a number of files: ``` $ ls -1 MyPlayground.playground/* MyPlayground.playground/Resources MyPlayground.playground/contents.xcplayground MyPlayground.playground/section-1.swift MyPlayground.playground/timeline.xctimeline ``` The files are as follows: - The Resources directory, which was created earlier to hold the logo image - The contents.xcplayground file, which is an XML table of contents of the files that make up the playground - The section-1.swift file, which is the Swift file created by default when a new playground is created, and contains the code that is typed in for any new playground content - The timeline.xctimeline file, which is an automatically generated file containing timestamps of execution, which the runtime generates when executing a Swift file and the timeline is open The table of contents file defines which runtime environment is being targeted (for example, iOS or OS X), a list of sections, and a reference to the timeline file: ```xml <playground version='3.0' sdk='iphonesimulator'> <sections> <code source-file-name='section-1.swift'/> </sections> <timeline fileName='timeline.xctimeline'/> </playground> ``` This file can be edited to add new sections, provided that it is not open in Xcode at the same time. An Xcode playground directory is deleted and recreated whenever changes are made in Xcode. Any Terminal.app windows open in that directory will no longer show any files. As a result, using external tools and editing the files in place might result in changes being lost. In addition, if you are using ancient versions of control systems, such as SVN and CVS, you might find your version control metadata being wiped out between saves. Xcode ships with the industry standard Git version control system, which should be preferred instead. Adding a new documentation section To add a new documentation section, ensure that the playground is not open in Xcode and then edit the contents.xcplayground file. The file itself can be opened by right-clicking on the playground in Finder and choosing Show Package Contents: This will open up a new Finder window, with the contents displayed as a top-level set of elements. The individual files can then be opened for editing by right-clicking on the contents.xcplayground file, choosing Open With | Other..., and selecting an application, such as TextEdit.app. Alternatively, the file can be edited from the command line using an editor such as pico, vi, or emacs. Although there are few technology debates more contentious than whether vi or emacs is better, the recommended advice is to learn how to be productive in at least one of them. Like learning to touch-type, being productive in a command-line editor is something that will pay dividends in the future if the initial learning challenge can be overcome. For those who don't have time, pico (also known as nano) can be a useful tool in command-line situations, and the on-screen help makes it easier to learn to use. Note that the carat symbol (^) means control, so ^X means Control + X. Playing with Swift To add a new documentation section, create a directory called Documentation, and inside it, create a file called hello.html. The HTML file is an HTML5 document, with a declaration and a body. A minimal file looks like: ```html <!DOCTYPE html> <html> <body> <h1>Welcome to Swift Playground</h1> </body> </html> ``` The content needs to be added to the table of contents (contents.xcplayground) in order to display it in the playground itself, by adding a documentation element under the sections element: ```xml <playground version='3.0' sdk='iphonesimulator'> <sections> <code source-file-name='section-1.swift'/> <documentation relative-path='hello.html'/> </sections> </playground> ``` The relative-path attribute is relative to the Documentation directory. ``` All content in the Documentation directory is copied between saves in the timeline and can be used to store other text content such as CSS files. Binary content, including images, should be stored in the Resources directory. ``` When viewed as a playground, the content will be shown in the same window as the documentation: If the content is truncated in the window, then a horizontal rule can be added at the bottom with `<hr/>`, or the documentation can be styled, as shown in the next section. ### Styling the documentation As the documentation is written in HTML, it is possible to style it using CSS. For example, the background of the documentation is transparent, which results in the text overlapping both the margins as well as the output. To add a style sheet to the documentation, create a file called `stylesheet.css` in the `Documentation` directory and add the following content: ```css body { background-color: white } ``` To add the style sheet to the HTML file, add a style sheet link reference to the `head` element in `hello.html`: ```html <head> <link rel="stylesheet" type="text/css" href="stylesheet.css"/> </head> ``` Now when the playground is opened, the text will have a solid white background and will not be obscured by the margins: ![Welcome to Swift Playground](image) Adding resources to a playground Images and other resources can also be added to a playground. Resources need to be added to a directory called Resources, which is copied as is between different versions of the playground. To add an image to the document, create a Resources folder and then insert an image. For example, earlier in this chapter, an image was downloaded by using the following commands: $ mkdir MyPlayground.playground/Resources $ curl http://alblue.bandlem.com/images/AlexHeadshotLeft.png > MyPlayground.playground/Resources/logo.png The image can then be referred to in the documentation using an img tag and a relative path from the Documentation directory: ```html <img src="../Resources/logo.png" alt="Logo"/> ``` Other supported resources (such as JPEG and GIF) can be added to the Resources folder as well. It is also possible to add other content (such as a ZIP file of examples) to the Resources folder and provide hyperlinks from the documentation to the resource files. ```html <a href="../Resources/AlexBlewitt.vcf">Download contact card</a> ``` Additional entries in the header The previous example showed the minimum amount of content required for playground documentation. However, there are other meta elements that can be added to the document that have specific purposes and which might be found in other playground examples on the internet. Here is a more comprehensive example of using meta elements: ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"/> <link rel="stylesheet" type="text/css" href="stylesheet.css"/> <title>Welcome to Swift Playground</title> <meta name="xcode-display" content="render"/> <meta name="apple-mobile-web-app-capable" content="yes"/> <meta name="viewport" content="width=device-width,maximum-scale=1.0"/> </head> ``` In this example, the document is declared as being written in English (`lang="en"` on the `html` element) and in the UTF-8 character set. The `<meta charset="utf-8"/>` should always be the first element in the HTML head section, and the UTF-8 encoding should always be preferred for writing documents. If this is missed, it will default to a different encoding, such as ISO-8859-1, which can lead to strange characters appearing. Always use UTF-8 for writing HTML documents. The `link` and `title` are standard HTML elements that associate the style sheet (from before) and the title of the document. The title is not displayed in Xcode, but it can be shown if the HTML document is opened in a browser instead. As the documentation is reusable between playgrounds and the web, it makes sense to give it a sensible title. The `link` should be the second element after the `charset` definition. In fact, all externally linked resources—such as style sheets and scripts—should occur near the top of the document. This allows the HTML parser to initiate the download of external resources as soon as possible. This also includes the HTML5 `prefetch` link type, which is not supported in Safari or playground at the time of writing. The `meta` tags are instructions to Safari to render it in different ways (Safari is the web engine that is used to present the documentation content in playground). Safari-specific `meta` tags are described at https://developer.apple.com/library/safari/documentation/Applications/Reference/SafariHTMLRef/Articles/MetaTags.html and include the following: - The `xcode-display=render` meta tag, which indicates that Xcode should show the content of the document instead of the HTML source code when opening in Xcode - The `apple-mobile-web-app-capable=yes` meta tag, which indicates that Safari should show this fullscreen if necessary when running on a mobile device - The `viewport=width=device-width,maximum-scale=1.0` meta tag, which allows the document body to be resized to fit the user’s viewable area without scaling Generating playgrounds automatically The format of the playground files are well known, and several utilities have been created to generate playgrounds from documentation formats, such as Markdown or AsciiDoc. These are text-based documentation formats that provide a standard means to generate output documents, particularly HTML-based ones. Markdown Markdown (a word play on markup) was created to provide a standard syntax to generate web page documentation with links and references in a plain text format. More information about Markdown can be found at the home page (http://daringfireball.net/projects/markdown/), and more about the standardization of Markdown into CommonMark (used by StackOverflow, GitHub, Reddit, and others) can be found at http://commonmark.org. Embedding code in documentation is fairly common in Markdown. The file is treated as a top-level document, with sections to separate out the documentation and the code blocks. In CommonMark, these are separated with back ticks (````), often with the name of the language to add different script rendering types: ```swift println("Welcome to Swift") ``` Other text and other blocks can follow below. The most popular tool for converting Markdown/CommonMark documents into playgrounds (at the time of writing) is Jason Sandmeyer's swift-playground-builder at https://github.com/jas/swift-playground-builder/. The tool uses Node to execute JavaScript and can be installed using the npm install -g swift-playground-builder command. Both Node and npm can be installed from http://nodejs.org. Once installed, documents can be translated using playground --platform ios --destination outdir --stylesheet stylesheet.css. If code samples should not be editable, then the --no-refresh argument should be added. AsciiDoc AsciiDoc is similar in intent to Markdown, except that it can render to more backends than just HTML5. AsciiDoc is growing in popularity for documenting code, primarily because the standard is much more well defined than Markdown is. The de facto standard translation tool for AsciiDoc is written in Ruby and can be installed using the `sudo gem install asciidoctor` command. Code blocks in AsciiDoc are represented by a [source] block. For Swift, this will be [source, swift]. The block starts and ends with two hyphens (--): ```swift println("Welcome to Swift") ``` Other text and other code blocks can follow below --. AsciiDoc files typically use the ad extension, and the ad2play tool can be installed from James Carlson's repository at https://github.com/jxxcarlson/ad2play. Saving the preceding example as example.ad and running ad2play example.ad will result in the generation of the example.playground file. Limitations of playgrounds Although playgrounds can be very powerful for interacting with code, there are some limitations that are worth being aware of. There is no debugging support in the playground. It is not possible to add a breakpoint and use the debugger and find out what the values are. Given that the UI allows tracking values—and that it's very easy to add new lines with just the value to be tracked—this is not much of a hardship. Other limitations of playgrounds include: - Only the simulator can be used for the execution of iOS-based playgrounds. This prevents the use of hardware-specific features that might only be present on a device. The performance of playground scripts is mainly driven based on how many lines are executed and how much output is saved by the debugger. It should not be used to test the performance of performance-sensitive code. Although the playground is well suited to present user interface components, it cannot be used for user input. Anything requiring entitlements (such as in-app purchases or access to iCloud) is not possible in playground at the time of writing. Note that while earlier releases of playground did not support custom frameworks, Xcode 6.1 permits frameworks to be loaded into playground, provided that the framework is built and marked as `public` and that it is in the same workspace as the playground. Summary This chapter presented playgrounds, an innovative way of running Swift code with graphical representations of values and introspection of running code. Both expressions and the timeline were presented as a way of showing the state of the program at any time, as well as graphically inspecting objects using QuickLook. The XCPlayground framework can also be used to record specific values and allow asynchronous code to be executed. Being able to mix code and documentation into the same playground is also a great way of showing what functions exist, and how to create self-documenting playgrounds was presented. In addition, tools for the creation of such playgrounds using either AsciiDoc or Markdown (CommonMark) were introduced. The next chapter will look at how to create an iOS application with Swift. Where to buy this book You can buy Swift Essentials from the Packt Publishing website. Alternatively, you can buy the book from Amazon, BN.com, Computer Manuals and most internet book retailers. Click here for ordering and shipping details.
{"Source-Url": "http://cdn.oreillystatic.com/oreilly/booksamplers/packt/9781784396701_Sample.pdf", "len_cl100k_base": 7346, "olmocr-version": "0.1.53", "pdf-total-pages": 29, "total-fallback-pages": 0, "total-input-tokens": 51694, "total-output-tokens": 8743, "length": "2e12", "weborganizer": {"__label__adult": 0.0004279613494873047, "__label__art_design": 0.00025463104248046875, "__label__crime_law": 0.0001462697982788086, "__label__education_jobs": 0.0007381439208984375, "__label__entertainment": 7.027387619018555e-05, "__label__fashion_beauty": 0.00015044212341308594, "__label__finance_business": 0.00013828277587890625, "__label__food_dining": 0.0003559589385986328, "__label__games": 0.000492095947265625, "__label__hardware": 0.0005555152893066406, "__label__health": 0.00020134449005126953, "__label__history": 0.00014448165893554688, "__label__home_hobbies": 7.510185241699219e-05, "__label__industrial": 0.0002002716064453125, "__label__literature": 0.00035119056701660156, "__label__politics": 0.00011670589447021484, "__label__religion": 0.0003619194030761719, "__label__science_tech": 0.00115203857421875, "__label__social_life": 8.851289749145508e-05, "__label__software": 0.00418853759765625, "__label__software_dev": 0.9892578125, "__label__sports_fitness": 0.00024700164794921875, "__label__transportation": 0.00029969215393066406, "__label__travel": 0.00018405914306640625}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 34295, 0.00873]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 34295, 0.57913]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 34295, 0.90204]], "google_gemma-3-12b-it_contains_pii": [[0, 1503, false], [1503, 2417, null], [2417, 3798, null], [3798, 5931, null], [5931, 6901, null], [6901, 7831, null], [7831, 8612, null], [8612, 9316, null], [9316, 10312, null], [10312, 10933, null], [10933, 12670, null], [12670, 13834, null], [13834, 14663, null], [14663, 15738, null], [15738, 16312, null], [16312, 17643, null], [17643, 18239, null], [18239, 18828, null], [18828, 20107, null], [20107, 21684, null], [21684, 22938, null], [22938, 24067, null], [24067, 25058, null], [25058, 26882, null], [26882, 28939, null], [28939, 30721, null], [30721, 32516, null], [32516, 34055, null], [34055, 34295, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1503, true], [1503, 2417, null], [2417, 3798, null], [3798, 5931, null], [5931, 6901, null], [6901, 7831, null], [7831, 8612, null], [8612, 9316, null], [9316, 10312, null], [10312, 10933, null], [10933, 12670, null], [12670, 13834, null], [13834, 14663, null], [14663, 15738, null], [15738, 16312, null], [16312, 17643, null], [17643, 18239, null], [18239, 18828, null], [18828, 20107, null], [20107, 21684, null], [21684, 22938, null], [22938, 24067, null], [24067, 25058, null], [25058, 26882, null], [26882, 28939, null], [28939, 30721, null], [30721, 32516, null], [32516, 34055, null], [34055, 34295, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 34295, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 34295, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 34295, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 34295, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 34295, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 34295, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 34295, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 34295, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 34295, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, true], [5000, 34295, null]], "pdf_page_numbers": [[0, 1503, 1], [1503, 2417, 2], [2417, 3798, 3], [3798, 5931, 4], [5931, 6901, 5], [6901, 7831, 6], [7831, 8612, 7], [8612, 9316, 8], [9316, 10312, 9], [10312, 10933, 10], [10933, 12670, 11], [12670, 13834, 12], [13834, 14663, 13], [14663, 15738, 14], [15738, 16312, 15], [16312, 17643, 16], [17643, 18239, 17], [18239, 18828, 18], [18828, 20107, 19], [20107, 21684, 20], [21684, 22938, 21], [22938, 24067, 22], [24067, 25058, 23], [25058, 26882, 24], [26882, 28939, 25], [28939, 30721, 26], [30721, 32516, 27], [32516, 34055, 28], [34055, 34295, 29]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 34295, 0.0]]}
olmocr_science_pdfs
2024-12-10
2024-12-10
81217b863570c8bd54aa24ab3aee015923564aae
The evolution of CACSD tools-a software engineering perspective Ravn, Ole; Szymkat, Maciej Published in: IEEE Symposium on Computer-Aided Control System Design Link to article, DOI: 10.1109/CACSD.1992.274428 Publication date: 1992 Document Version Publisher's PDF, also known as Version of record Citation (APA): The Evolution of CACSD Tools - A Software Engineering Perspective Ole Ravn, Institute of Automatic Control Systems, Technical University of Denmark, Building 326, DK-2800 Lyngby, Denmark Maciej Szymkat, Institute of Automatics, Academy of Mining and Metallurgy, al. Mickiewicza 30, 30-059 Cracow, Poland. Abstract The paper presents the earlier evolution of CACSD tools in an software engineering perspective. A model of the design process is presented as the basis for principles and requirements of future CACSD tools. Combinability, interfacing in memory and an open workspace is seen as important new concepts in CACSD. Some points are made about the problem of "buy or make" when new software is required. The idea of "buy and make" is put forward. Emphasis is put on the time perspective and the life cycle of the software. 1 Introduction Starting in the late fifties and early sixties computers available to control system designers were not very powerful, nor very easy to program or interact with. Features of software packages for Computer Aided Control Engineering have been determined by the commonly available computer technology at that time. They were used to automate difficult numerical calculations such as FFT. Most of the work done to design a controller was still done manually. During the sixties batch-operation of large computers became commonly available and made it feasible to use computers for tasks such as calculation of frequency responses, time responses, root loci and simulation. These programs were made at departments and universities all over the world as there were no commercial programs available. The resulting programs and libraries were in many cases incompatible what made it difficult to reuse data in other programs. LINPACK and EISPACK were introduced in the mid-seventies providing well-tested solutions to various numerical problems. They became the basis for more specialized libraries for solving control problems. The designer still had to write the main program and this was often a difficult task as data structures had to be adjusted. Debugging was also difficult. The introduction of terminal-access to mainframe computers made it possible to make interactive programs which could perform many different tasks, analysis, design and simulation on data from the same program. A number of commercial programs of this kind emerged in the seventies. These programs were often very large and at the same time difficult to extend. Many designers still found it easier write their own software. In 1981 MATLAB was introduced. The formula of MATLAB is relatively simple: MATLAB := LINPACK/EISPACK + Command interpreter + Graphics MATLAB solved many of the compatibility and software development problems. The control system designer may access through MATLAB many tools that can be used in the design process. It is normally not as time consuming to make the necessary specific software for solving a problem in MATLAB as before. However MATLAB has certain limitations, too. One being the simple data structure (i.e. a complex matrix), another being the large number of m-files. A number of 300-400 m-files is easily reached when using some of the extra tool-boxes in MATLAB. It can be more difficult to find the m-file that solves the problem than writing a new one. This implies that some data-management system with more advanced typing and a tool-management system is needed. A number of packages with features similar to MATLAB and better interface has emerged, but none has gained the same wide use as MATLAB. The introduction of workstation and the extended availability of powerful graphics computers has made it possible to meet new objectives. A number of graphical interfaces embedding MATLAB and some simulation package has emerged. These packages hide the MATLAB interface and provide some sort of graphical front-end as well as some data management. However this is often accomplished at the expense of the easy extendability that characterizes MATLAB. Mathworks has introduced a package called SIMULAB which extends MATLAB with a non linear simulation tool while preserving the design and analysis capabilities of MATLAB. This is a step in the direction of more integrated environments. Recently Integrated Systems Inc has introduced a new environment called Xmath featuring an object oriented approach to CACSD tools. We would like to draw special attention to those aspects of CACSD tools development which can be addressed from the point of view of software engineering. The computer science perspective is certainly needed to understand the role of such factors as program portability, reusability or extendability. It should be emphasized that the implementational issues do not cover the whole software development cycle. In what follows it will be assumed that the functional specification of the software requirements is already given, what means in the context of CACSD, that the design strategy, algorithms to be used, user interaction requirements are predefined in the conceptual phase of the design process. The typical practical problems arising at the implementation stage are following: - should the commercially available software be acquired? - should some algorithms be coded, who should do it and how? - should the available tools be used in a wider framework and what platform should be used for the integration? It is important to say here that it would be naive to expect that some general answers for these questions could be given. Each particular situation has its own context and the feasible solutions have to take it into account. The aim of this contribution is to identify factors which constitute this context and essentially influence the software project development. There are not many publications taking software engineering point of view on CACSD, just to mention here [2], [21] only. Certainly it is much more attractive to write how the "ideal tool" should look like, than to report why this or that project turned out to be unsuccessful. On the other hand in the field of the CACSD software we meet a very rapid "depreciation" process, the programs and packages written five years ago, may look today quite obsolete just because of the fast changes in user-interfaces and software development tools available at the moment, and it may seem that it is not very much worthy to deal with the "old program" any more. What we found very important is that some time perspective is necessary to assess to whole software development project. The preferred solution for the implementation of the CACSD software is acquiring the existing commercially available products. If it is possible to find the product which is compatible with the available hardware and software resources, which fits well to the design requirements, which is reliable and well supported by the vendor, assures good portability for expected future applications, there is no doubt that the solution of this kind will probably be the most cost-efficient. Unfortunately, almost never all these conditions are fully satisfied and it is quite acceptable if only some adoption or integration is needed. Two remarks are here in turn. Although, it is generally not advisable to write anew the "original" code for matrix manipulation or nonlinear simulation, there may exist situations when some reasonably small improvements in the already available software may be attractive, because the user does not have to change his habits and waste time for training to adopt the new tool. The second remark concerns some potential drawbacks of acquiring the ready-made software which may include: - Lack of reliable software quality measurement tools — the use of existing benchmarks, c.f. [7], [17], is hardly sufficient for comprehensive assessment, - hidden limitations — meaning a kind of the "closedness" of the tool concept that may make it useless for future applications, - dependence on the vendors development policy — e.g. the lack of future support for new hardware and system software platforms. It may be proved on many examples that vendors of successful software products in the product-oriented (not user-oriented) software market try to use their monopolist-like position, simply because they do not have enough incentives for the substantial improvement of their products, they introduce not much different new versions just to keep the user in a kind of trap. The distributed users (user groups) cannot force the real changes. The only positive thing here is the competition among the leading vendors. 2 CACSD and scientific and engineering computing Let us invoke the early definition of CACSD cited in c.f. [20] the use of digital computers as primary tool during the modelling, identification, analysis and design phase of control engineering and think if it should be today updated. How many other tools of control system design are used — e.g. paper and pencil, pocket calculator? If we separate the conceptual phase belonging rather to mathematical control theory domain, there is almost no other tools except for computers, unless we do not exclude the use of data acquisition cards with AC/DC converters, analog simulators and maybe some more electronic equipment used for prototype installations. This is why there is a strong feeling that the computers are now a standard tools for control design and that there is nothing special about it. Even more, computers have overwhelmed the whole control engineering and that is why it seems to be more appropriate now to talk about the Computer Aided Engineering. Certainly, there are some specific problems that solely concern the man-machine interaction, the use of human and "artificial" intelligence in the control design process, which are very much specific to CACSD, see the inspiring paper [13]. In some way, they also relate to the software development process. It is important to note here that these problems are in some sense common to other engineering disciplines. The interesting view from that perspective is presented in [10]. It is well known that CACSD software is only the part of wider class of computer software supporting the so called science and engineering computing. This class is the second to data processing computing in terms of general use of computers, where the software engineering methodology is already well established. What we are witnessing in recent years is that also in the scientific/engineering software there is a product-oriented software technology with a typical market containing specialized companies (the software vendors) and clients (the software users). However, so far there was little said on specific scientific/engineering software development paradigm. May be the reason is the extremely fast "software depreciation" in that area. This may be explained also by the fact that the driving force of the technological progress in the computer domain is surely the hardware which doubles its (installed) capacities more or less every 2-3 years, the software can hardly keep this pace, with doubling time of 6-12 years, the whole computing paradigm concerning the way of the use of computer technology in other fields is much slower with very rough estimate of 15-25 years doubling time. The author of [4], see the technology comparison table on p. 94, claims that this process is caused by the modularity in the design and reusability of independent components used in the hardware development, but not in the software development where the new tools were introduced without increasing the units of modularity, what had to result in exponential growth in hardware technology, but only arithmetic growth in software technology. It may be a good explanation but one has to remember also that software is a secondary factor in the computer technology and it is very hard if not impossible to predict how the future developments in hardware could affect the software. Anyway it is good to keep in mind this general time perspective. The whole thing is here surely oversimplified because it is of course unrealistic to treat the software as the one group, neglecting its diversification into system level software, general purpose programming languages, specialized packages and environments, and application programs, similarly the hardware is not a homogeneous object. 3 The Structure of the Design Process It is not feasible just to automate analysis methods any more. A look at the structure of the design process for controller design gives insight to objectives that could be pursued in future CACSD packages. The design process for a control system is very complex. Some work has been done to model this process in a CACSD framework, c.f. [13]. The model presented below is a simplified model which only has a fraction of the possible interactions. Many more cross-interactions are present but for the purpose of pointing out possible objectives for CACE systems this model is sufficient. The implementation aspect of controller design is not addressed with this model. The model is shown in figure 1. The model contains 5 phases. The first phase to be entered when the design process starts is the problem description and goal generation phase. In this phase the definition of the design goal is generated and the control problem is specified. The second state is the modelling phase. Often a linear model in an appropriate domain will be generated during this phase. In phase 3 the model is analyzed using analysis tools to generate a controller structure. The parameters of this controller structure is calculated during phase 4, called the design phase. The performance of the system with the generated controller is then compared with the design goals. If the goals are met the process stops, if the goals are not met an iteration is performed, making the designer go through one or more of the previous phases again, changing some parameters. The first phase of the design process is normally performed by the designer without computer based tools. The control system designer is often faced with a control problem generated by decisions taken by others. Therefore this phase in often not explicitly performed when the process is started, but if the goals can not be met the designer may have to change the design goals. The modelling phase of the design process is seldom considered when describing new analysis or design algorithms. A model in an appropriate domain is used as the starting point. For real systems the modelling phase can be quite difficult, especially when the performance of the system is to be optimal. Many computer based tools are available to assist the control system designer in phase 3, the analysis phase, and some tools have been made for phase 4, the design phase (e.g MATLAB). However, these tool are linear in the sense that they transform an input such as a model description in some domain to some performance related measure. The designer is then faced with the problem of evaluating the measure with respect to the specified goals and performing the iteration if necessary. The task of evaluating a design is normally quite complicated and if the design goals are not met it is normally not obvious which actions are best to be taken. This task is not easily done using current CACE systems. The designer has to perform the iteration himself and determine whether or not the selected design criterion has improved. 4 CACSD Objectives The objectives described briefly here are Integration, Extendability and Design Actions Support. Integration is seen as the possibility to integrate different basic software packages such as MATLAB, ACSL, etc. in a way that enables the designer to use the tool best suited for the task without having to go from one model representation to another. The use of currently established software standards in CACE enables the designer to take advantage of new features available in these packages. Further, it should be possible to integrate new packages into the system in a similar way. By integrating these different basic tools the mental leaps that are normally required when going from one tool to another are reduced thus enabling the designer to have a wider variety of tools available. Extendability is seen as the being able to extend the current selection of tools with new ones in a simple manner and use these tools in a similar way as the build-in ones. The new tools should be build from already existing tools in the system. Using the model of the design process as a basis some objective for designer support in CACSD system can be formulated. Some form of data and tool management system should be provided, the iteration and evaluation phases of the design model should be supported. User Support is essential especially when the iterative nature of the design process is taken into account. The user should have tools available for evaluation of the design and analysis results and for doing the iteration. Concepts such as dynamical data access, the concept of analysis results seen as views on the object in question are described in greater detail in [15] and [16]. The user should also have easy access to change to one or more alternate models of the system or alternate controllers. Like in a deck of cards the top card will describe the current system but this card can easily be flipped to evaluate an alternative design or the current design on a more complex model of the system. 5 Software engineering view on the implementation process The fundamental concept of the software engineering is the project life-cycle, c.f. e.g. [22]. We do not want to recall here the more detailed description of this concept limiting ourselves just to saying that there exist at least three kinds of project life-cycles: - information system life-cycle — starting from formulation of user requirements, going through analysis, design, hardware and software development, installation to the maintenance phase, - software life-cycle — starting when software product is conceived and ending when software product is no longer available for use, - software development cycle — beginning when a software product is approved to develop (improve or maintain) and ending when it is brought to the operational status. The implementation itself is only one phase within the software development cycle, following the analysis phase. It contains the following stages: - program specification — program functional specification, data structures description and user-interface requirements, - program coding — using top-down or bottom-up approaches, prototyping etc., - program testing — including debugging and other methods of program quality assurance. In parallel to all these stages program documentation process should proceed. For finding the feasible solution of the software project certain factors creating the actual context of the implementation have to be identified in the preceding analysis phase. From the point of view of CACSD requirements, such factors include: - the purpose of the program — training, research, industrial application, - the type of the user — casual, professional, undefined, - technical requirements — the needed response time, the preferred interaction type etc. The factors important from the point of view of project management are: - the estimated project size — number of code lines, number of terminals etc., - available hardware resources — mainframes, workstations, PC's, data acquisition systems etc., - available software resources — previously acquired libraries, packages, the earlier developed code etc., - available financial resources. The analysis should result in the answer for the question — who and how will contribute to the project during the software implementation phase. There are at least three groups involved in the typical CACSD software project life-cycle. Their relations are presented below. - ALGORITHM DESIGNERS. Background: Applied mathematics, control theory. Objectives: Generality of abstract formulation, correctness of the design approach. - SOFTWARE DEVELOPERS. Background: Computer science, software engineering. Objectives: System performance, efficiency, reliability, testability. - END USERS. Background: Control engineering, process control. Objectives: Specific design problem solution. The real problems appear during the implementation because of the difference of backgrounds and objectives of all the mentioned groups. The increasing specialization is the price which has to be paid for the technological progress. The current software technology makes it almost impossible for the control engineer to write a full-grown commercial quality software product. Although it is regrettable, the more efficient the new software technologies are the more knowledge is required to use them in program implementation, however it does not have to mean that the more knowledge is required to use the final product. It is out of question now that commercial software development is a matter of specialized software companies hiring professional programmers rather than small control research groups. On the other hand, these groups are able to make a substantial progress in the algorithmic development and many products which were later successfully commercialized were born in academic centers. There are different possible ways out. One of them is the so called concurrent engineering aiming at the integration of the various teams around the common project goal. The other is creation of the software development environments which will be standardized and integrated enough to allow the non-professional or semi-professional to make the effective use of it. At the moment, generally the gap between the users and software developers has to be accepted as a given fact which cannot be neglected c.f. [11]. 6 Developing the original CACSD software There exist situations when developing the original CACSD may occur preferable. They may concern specific training programs or educational minitools. Sometimes the need for this kind of development may be caused by the lack of software fitting to the configuration of the available resources. A special category are the programs which have to protect the proprietary solutions of the user organization, or other type of the intellectual property, from the possible competition. The last but not least are the products which are planned to be commercialized. The basic requirement for medium to large size projects is the professional programmers team work. It is very important that inside the team are both algorithm specialists, software developers and "representative" users. It is completely clear that projects of that scale cannot be successful if they are not well managed. As far the coding is concerned, there exist well established software engineering methodologies supporting both productivity and quality of programming. Just to recall, the basic principles are: - **modularity** — the internal design of each program component should be organized in such way that it does not depend on the internal design of any other component, - **conciseness** — the code should be clear and easy to understand at least by other members of the programming team, - **structured approach** — large programs should be decomposed into manageable size parts with well-defined relationships, - **testability** — the program components should be easy to be independently tested and debugged. All the structural languages like C or Pascal and object-based languages like Ada or Modula-2 do support the programming styles emphasizing the above properties. The basic concept used in structural programming is the procedure (function) with data structures hierarchy a bit in the background. There are two extremes in structural programming — the use of "pure" functions with no external dependencies and the whole interface in arguments, and the use of functions "parameterized" by the global variables. The first solution may be very inconvenient, but the second is certainly "less structural" and in fact may break the modularity principle, and result in the code which will be completely not reusable, i.e. when it comes to upgrading or integration with another environment the large parts of the program will have to be reorganized if not rewritten. The above contradiction seems to be resolved in the recently rapidly developing object-oriented programming technology. The basic concept here is the object possessing its own data (its state) which are protected (hidden) from the unauthorized use, and its own code, similarly to the classical procedure. The object-oriented approach enhances such programming mechanisms as: - **data abstraction** — expressing the separation of the program design concepts from the implementation details, hidden (encapsulated) in the objects, - **inheritance** — allowing to define new object types (classes) on the basis of already defined more general object types by specializing it, i.e. specifying the differences. The "good style" of object-oriented programs should assure a high level of potential code reusability, c.f. [12]. The object-oriented languages provide certain mechanisms increasing program expressiveness like automatic dynamic memory management, polymorphism — allowing context dependent meaning of certain programming constructs and late binding — postponing some code processing from the compile-time to the run-time what may significantly increase program flexibility. There is one more property advocating for the object-oriented approach. It turns out that the way the designer thinks on the model of some reality is itself oriented on objects rather than on functions, c.f. [4], [10]. The recent rapid development of the object oriented languages like C++, Objective C, Smalltalk 80, CLOS and others, reflects the importance of the problem of code reusability. At the moment high expectations accompany the introduction of the new kind of tool, called class libraries, both of general and specialized application, c.f. [3], [8]. They offer a kind of "reusable software components" — a self-contained pieces of code to be used in user applications, allowing the programmer to concentrate on higher level abstractions (e.g. matrices, vectors) and formulate the algorithm in their expressive language, with virtually no loss in the run-time efficiency. It is hard to overemphasize the role of the object oriented programming technology as the programming productivity tool. There have been already reported certain object-oriented programming applications in the field of CACSD, c.f. [1], [14], [9], but the real "software revolution", c.f. [5] is still to come. ### 7 CACSD software integration However, as it was said previously, the acquiring of the ready-made tools is mostly preferable, the typically chosen alternative is adopting available tools to the given application. This is caused by the fact that problems solved in the design practice are rarely "standard", there are always certain their properties which require specific algorithmic improvements or specializations etc. In this way the problem of CACSD tools extensibility is raised. Let us begin with single tool extensibility problem on the MATLAB example, to show what kind of limitations are met here. The MATLAB concept of the programming environment conforms to the traditional, horizontally divided software architecture, see Figure 2. ![Figure 2: Horizontally divided software architecture.](image) In the lower level we have internal MATLAB functions, in the higher level Toolbox libraries, and user scripts and functions on top. This architecture is quite logical but suffers from the serious drawbacks. First, the user files are interpreted, or semi-compiled and that degrades their run-time efficiency (there is a "way-out" by constructing executable equivalents, but it is far from being automated and the "ease-of-use" is rather problematic). Second, the user files does not have the "equal access" to program workspace (except for global variables, and interpreted "eval" mechanism). And third, the user cannot construct (and use in MATLAB) other data types than those supported by MATLAB. These limitations are simply consequences of the MATLAB program architecture concept and would be very hard to overcome in "evolutionary way". The newly introduced Xmath tool which is functionally equivalent to MATLAB, uses the object-oriented programming to cope with the extensibility problems. It offers more rich collection of the elementary data types together with some object creating capabilities (e.g. list) in MathScript — the Xmath's programming language. According to [9], linked user-functions and callable user-interface will be soon available and as contrasted to MAT- LAB vendors policy, the specification of this interface is planned to be published. If general user defined objects to be used within the Xmath workspace also were available, this environment could become a general platform for CACSD tool integration. Now, it is too early to make such predictions. A lot of effort was already devoted into creation of multi-tool integrated CACSD environments. However, they may be useful in proprietary settings, there is a common feeling that there is a small hope for making them portable. There also any unanswered questions concerning the concepts of multi-tool integrated environments. Should the integration be model-data or tool-methods oriented? Should it possess a common "integrated" user-interface or should it rely on separate tools’ user-interfaces? [15], [16] and [1], but it seems to be too early for definitive answers. Although, it is commonly agreed that the evolution of the software systems definitely tends towards the reusable component architecture, see Figure 3, both vertically and horizontally divided, with system components ("glue code") supporting the communication (data exchange?) between the components belonging to the given software level. So far, one of the successful steps in this direction is the X-Window system. It is quite probable that the true integration of high level tools is only possible if their lower level components fit well. As long there is no clear accepted standard for the dynamical (run-time) exchange of the structured data (objects) between separate programs, all the integrating attempts are more or less temporary. Some progress in the creation of first programming systems supplying both object-based programming languages and object abstraction at the operating system level has been already made, c.f. [6]. These kind of systems enable objects to be maintained, managed and used most efficiently, and what seems to be very important from the point of view of CACSD tools integration, they support object sharing by independent programs, users etc. Although, the methods of communication (object interaction) are being developed, the new challenge emerges, i.e. the standardization of the objects used in the area of CACSD. 8 Conclusion The software engineering perspective on CACSD tools is described together with some of the background of early CACSD tools. A simple model of the design process has been presented and two areas not easily handled using current CACSD packages are pointed out. They are the evaluation phase and the iteration in the design model. The objectives of integration and extendability and the features of user support for the iteration are described. Taking a software engineering approach some guidelines of developing original CACSD software and the problems of software integration are presented. The problems concerning information system, software life-time and software development cycle are treated and the inherent problem of the different objectives of algorithm designers, software developers and end users is outlined. The importance of current trends in software architecture (object sharing, dynamic data exchange etc.) is pointed out. References Figure 3: Reusable software component architecture. ![Diagram of Component1 and Component2 with glue code](image)
{"Source-Url": "https://backend.orbit.dtu.dk/ws/files/4503365/Ravn.pdf", "len_cl100k_base": 6130, "olmocr-version": "0.1.48", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 25678, "total-output-tokens": 7977, "length": "2e12", "weborganizer": {"__label__adult": 0.00028228759765625, "__label__art_design": 0.0003733634948730469, "__label__crime_law": 0.0002694129943847656, "__label__education_jobs": 0.0006113052368164062, "__label__entertainment": 4.4286251068115234e-05, "__label__fashion_beauty": 0.00012731552124023438, "__label__finance_business": 0.00025343894958496094, "__label__food_dining": 0.00028204917907714844, "__label__games": 0.00051116943359375, "__label__hardware": 0.0012950897216796875, "__label__health": 0.0003764629364013672, "__label__history": 0.00018846988677978516, "__label__home_hobbies": 9.41157341003418e-05, "__label__industrial": 0.0007562637329101562, "__label__literature": 0.00014960765838623047, "__label__politics": 0.00019180774688720703, "__label__religion": 0.0003497600555419922, "__label__science_tech": 0.027984619140625, "__label__social_life": 5.2094459533691406e-05, "__label__software": 0.00830841064453125, "__label__software_dev": 0.95654296875, "__label__sports_fitness": 0.0003216266632080078, "__label__transportation": 0.0006747245788574219, "__label__travel": 0.00014662742614746094}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 36524, 0.02903]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 36524, 0.65713]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 36524, 0.93369]], "google_gemma-3-12b-it_contains_pii": [[0, 537, false], [537, 5634, null], [5634, 12141, null], [12141, 18042, null], [18042, 23296, null], [23296, 29412, null], [29412, 34970, null], [34970, 36524, null]], "google_gemma-3-12b-it_is_public_document": [[0, 537, true], [537, 5634, null], [5634, 12141, null], [12141, 18042, null], [18042, 23296, null], [23296, 29412, null], [29412, 34970, null], [34970, 36524, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 36524, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 36524, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 36524, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 36524, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 36524, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 36524, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 36524, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 36524, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 36524, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 36524, null]], "pdf_page_numbers": [[0, 537, 1], [537, 5634, 2], [5634, 12141, 3], [12141, 18042, 4], [18042, 23296, 5], [23296, 29412, 6], [29412, 34970, 7], [34970, 36524, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 36524, 0.0]]}
olmocr_science_pdfs
2024-11-23
2024-11-23
25c3a4abfe0742ac0d6685dd1c03c2fa9fa4c28f
This is the accepted version of the paper. This version of the publication may differ from the final published version. Permanent repository link: https://openaccess.city.ac.uk/id/eprint/14291/ Link to published version: Copyright: City Research Online aims to make research outputs of City, University of London available to a wider audience. Copyright and Moral Rights remain with the author(s) and/or copyright holders. URLs from City Research Online may be freely distributed and linked to. Reuse: Copies of full items can be used for personal research or study, educational, or not-for-profit purposes without prior permission or charge. Provided that the authors, title and full bibliographic details are credited, a hyperlink and/or URL is given for the original metadata page and the content is not changed in any way. Abstract—In the UK, in emergency situations, health professionals rely on patients to provide information about their medical history. However, in some cases patients may not remember their medication, long term illnesses or allergies, or be able to communicate this information. As a national on-line integrated patient record system has not yet been established, this paper introduces an on-going project ‘MyCare Card’ abbreviated as MyC² which aims to design and implement a patient held electronic health record device and corresponding user interface software. Index Terms — e-Health Systems, m-Health Systems, Telemedicine Systems I. INTRODUCTION In many areas of health care in the UK, particularly emergency care, health professionals rely on patients to provide information about their medical history. However, reliable information may be difficult to acquire from patients who are unwell, confused, or have communication difficulties. It has been suggested that patients taking responsibility for their records would improve safety [1]. Although previous studies have shown positive attitudes towards patient held records [2-3] and patient held electronic records [4], there is still much to learn about users’ views on these. Patient held, paper based records related to maternity and child health have been used effectively for a number of years [2-3], yet this practice has not been adopted by other parts of the health service. An electronic form of patient held records was successfully trialled in the UK, between 1989-1992 [4] where over 13,000 patients were provided with smart cards containing health information that only they and health professionals treating them were able to access. The results showed that the majority of participants were in favour of having the cards [4]. However, their use was not continued, as the technology available at the time limited its wider feasibility. To date, few studies have identified the design requirements for patient held health records in the UK, such as the preferred form of device, methods of data entry, access rights or the information content, and compared these requirements to those of health professionals. Those emergent requirements were used in this project to produce a prototype system (records media and access software) which is being continuously evaluated and re-factoried in agile development style. The system code name utilised in this project is MyCare. An agile development style has been used in this research in preference to the more traditional waterfall style approach [5]. As this project is aimed to design and implement a system, which will be intuitive and transparent for a non-technical user, the development had to be focused on the end-user interface and not on the internal communication and database formats. Thus, the software Graphical User Interface (GUI) has been developed first. Initially it is tied to the simple and unencrypted data format directly supported by the selected programming language and environment (see Section II). The class and module levels separation of the GUI from the data interface code allows the internal data presentation to be freely restructured while changing the GUI structure and controls types under technically sketchy and continuously changing user requirements. When firm decisions are made about the functionality of the software’s user interface more sophisticated and secure internal data formats may be defined in the form of a data-base type and structure standard. MyCare health record device development is split in two subprojects: MyCare Card – medical records storage media development; and MyCare Card Browser – GUI and database software which will allow card owners and health professionals to view and edit where appropriate information stored on the MyCare Card. This paper presents the details of the conducted UK survey aiming to collect attitudes to electronic patient health records and report on the ongoing development of the MyCare system which includes the GUI, data base, and records storage device. Also, justification for all software development tools used for this project is discussed. II. METHODS AND MATERIALS A. Establishing initial user requirements In order to establish the end user requirements of the system, two ‘similar’ questionnaire surveys were designed to collect attitudes, to patient held records and requirements for an electronic patient held record device, from the public and health professionals. The questions were based on material derived from a preliminary literature review, five focus groups (with a total number of 25 participants) and interviews with ten health care professionals. The first part of each questionnaire asked participants to supply demographic information to check that the sample included participants with a wide range of demographic characteristics. Participants were then asked about their experiences of using patient held records. Following this, a brief description of the proposed patient held record device was given and participants asked questions about using this. Over 500 participants took part in the survey. Approximately half of these were members of the public and half were health care professionals. For the public survey, participants had to be sixteen years or older. Convenience sampling was used to include customers in pharmacies across the UK. These included participants from a range of ethnic backgrounds and social classes. Members of the public who had problems with their eyesight or English literacy were assisted to complete the questionnaire. The age of the respondents ranged from 17-89, with a mean age of 45 years. 43% were male and around two thirds of white European origin. Just over a quarter considered themselves to have long term health problems. 13% had used some form of patient held health records, and these were mainly maternity records. Focus groups were held for groups of people who were unable to participate in the survey. One of the groups consisted of people who did not speak English and their views were included using the services of an interpreter. Another group of disabled participants were unable to write and so would not have been able to complete a questionnaire. Groups of elderly people, teenagers, health care professionals and those with long term health problems explored the questionnaire items in more detail than was possible during the survey. Ethical clearance was obtained to consult health care professionals. These were drawn from doctors, nurses, ambulance staff, pharmacists, physiotherapists, occupational therapists and other health professionals. Quota sampling was used in order to achieve similar numbers of individuals from each professional group. Data was collected in different areas of the UK in order to include participants from different geographical locations and working environments. 260 questionnaires were completed by health care professionals. 39% were male, 79% of white European origin and over half were under the age of forty. Data was collected from five professional groups: doctors (14%), nurses (23%), ambulance staff (23%), pharmacists (20%) and others (20%). Approximately half of this group had used some form of patient held health record, and cited the major benefit of doing so as being access to health information. Answers from the two surveys were coded and entered into separate databases for the public and professional surveys. The analysis used the Statistical Package for the Social Sciences (SPSS). Open ended questions were thematically analyzed to establish the main themes from the responses, with content analysis used to establish the most common responses. The results were used to derive an initial set of development requirements for the user interface software, the date which needed to be stored and the preferred storage device. When initial development requirements became available, software tool chain, programmatic libraries and development model were selected. Bug tracking and source code version control systems were also established. B. Open Source development model To reduce the cost of development and to minimize its dependency on the major computer systems manufacturers, Open Source software tools and programmatic libraries were used. As MyCare is a community driven type of project, the selection of Open Source development model\(^1\) will enhance its dissemination and perhaps its wide acceptance by a large international community. Therefore, MyCare project may achieve the maximum development performance under the Open Source development model. C. Programming language, environment and GUI toolkit Python programming language [6-8] has been utilised in this project as a major language, run-time environment and common algorithms infrastructure. The reason why Python has been selected for this project is because it is a dynamic object-oriented programming language that can be used for many kinds of software development tasks. It offers strong support for integration with other languages and tools, and comes with extensive standard libraries [6]. wxPython was used as a primary GUI toolkit. C++ programming language was selected for security-related and low-level access algorithms implementation. SWIG (Simplified Wrapper and Interface Generator) is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages including Python. SWIG was chosen in this project to join low-level C++ code components with a high level Python code. Python library py2exe and the Windows programs installation packages builder named Inno Setup were utilised to make software distribution packages familiar to Windows users. The flexibility of the Python language makes wxPython much easier to develop than its C++ counterpart, while the native C++ code of wxWidgets gives the Python GUI both the speed and native look and feel it would otherwise lack. Thus, the MyCare system aims to be user-friendly, Open Source and community driven, easily extendable, cross-platform, portable, stable and secure. The tool chain described above allows the MyCare project to achieve its aims within reasonable timeframes. D. Media type selection According to the survey (see Section II.B) smart card type of media was preferred over other proposed devices such as USB sticks, key fobs, jewellery and devices linked to a mo- \(^1\) Decision on code licensing has not been made yet. The main considered option is GNU General Public License version. bile phone. **Smart cards advantages:** common and widely accepted. **Smart cards disadvantages:** small memory (mainly designed to store ID and security keys) which will only allow a limited number of medical records; slow data read/write rate; requires an external card reader for every computer type, and a card reader device driver installation; requires card browser installation (Administrator access); only Windows OS can be supported with the available resources and timing (due to the different driver requirements in different OSes). **USB sticks disadvantages:** less common; not widely accepted and trusted. **USB sticks advantages:** large memory (4GB and above – future-proof, enough to store full MRI scans for example); high read/write speed; does not require external card reader for most computer types (including PDAs); does not require card browser installation (no Administrator access required); most of the modern OSes can be supported (all Windows versions, Mac OS and Linux, i.e. those supported by Python/wxWidgets). Additionally if the smart cards approach was taken, it would require the MyCare Card reader device, the firmware for the reader, the firmware for the card, the card reader Windows driver and the middle-ware which connects the driver and the MyCare Card Browser software. All of these will limit the usability and ultimately portability of the final system. With a USB stick none of the above is required apart from the Card Browser software. The media interfacing infrastructure is already supported on every computer/mobile device with the USB bus and modern OS. Considering the advantages and disadvantages of traditional smart cards and modern USB sticks, the use of USB sticks is preferable. However, given the public’s preference for a smart card, a compromise had to be found between the two types of data storage. Going back to the end-user survey it seemed that the major perceived difference between the devices was the shape and style, i.e. it had nothing to do with the storage capacity, cost, connection type, or communication protocol. Thus, as a compromise a USB card design shown in Fig. 1 was chosen which combines the advantages of both. ### III. Results **A. Establishing data types specification** 85% of the public said they would find an electronic patient held medical record device useful, especially if they were too ill to give information to a health professional. Positive comments from the focus group participants included, ‘Patient records seem to be a good way forward in both giving patients responsibility and ensuring information is passed on.’ Another said, ‘Well, I’m allergic to penicillin and if I ever had to go into hospital and was unconscious and didn’t have anything with me, they wouldn’t know I was allergic to penicillin and they would probably give me penicillin.’ Several of the participants who had problems understanding English felt that a device would be particularly helpful for them. The most common concern for the public was the possibility of unauthorized people gaining access to the information, which was indicated by 64% of the survey participants. Subsequent focus groups explored concerns about data security. Participants suggested features which could be incorporated into the design in order to improve data security such as the encryption of data and use of personal identification numbers. There was also support for the device having an access log that recorded who had accessed and/ or altered the information. Approximately half of this group had used some form of patient held health record, and cited the major benefit of doing so as being access to health information. The concerns of this group related to inaccuracy of information (74%), loss of records by the patients (80%) and unauthorized access (75%). Some 94% of the health professionals said they would find a patient held record useful and, in this case, the most common reason was to overcome communication problems. Regarding the types of information that should be stored on the device, most of the members of the public surveyed thought that current medication, name, allergies, blood group and long term conditions should be included and that all health professionals should be able to access these items. However, over three quarters also agreed that access to other information should depend on the role of the health care professional. For health care professionals the most important pieces of information to be held on the device related to allergies, current medication, name, long term conditions, age, major health problems in the past and next of kin. The majority of these participants thought that all health professionals should be able to access the most important pieces of information. Again, the majority of participants supported the use of a restricted access system, where the viewing of certain pieces of information was restricted to particular groups of professionals. **B. Files and modules structure** Based on preliminary data types and storage media specifications and end- user expectation, an initial test version of the MyCare Card Browser software has been implemented. The source code directories tree listing of the software is shown in Lst. 1. Lst. 1. MyCare Card Browser software directories tree ``` src └─cards └─data └─gui └─containers └─dec1 └─media └─samples └─samples └─controls └─dec1 └─media └─samples └─media └─samples ``` Directories marked with ‘*’ are Python packages. Root directory `src` contains the program main executable script `mycare.py` and `mc.py` module with binder classes, which join wxWidgets standard GUI controls classes and classes contained in `gui/controls` directory with the data access code contained in `data` directory. The `src` directory also contains `security.py` module, which currently contains simple classes representing user authentication and security management functionality. In future versions of the software those classes will be converted into proxies for the more advanced analogue classes, implemented in C++. The `gui` directory contains `evt.py` module with wxWidgets events declarations and `helper.py` module with common algorithms, such as warning or error messages pop-ups. `gui/containers` directory contains modules with classes for components acting as containers for the components displaying and editing medical data. Classes for displaying and editing components are contained in `gui/controls` directory. Apart from the container and control apparent roles separation there is another significant difference between these directories: all modules contained in the `controls` directory only depend on Python and wxPython libraries’ modules; while modules in the `containers` directory also depend on `mc.py` module in the source tree root. In the current version, the `data` directory contains the `model.py` module with the data structure model definition, and modules with classes which provide data save, load and individual fields access functionality through the common class interface. In further development the same interface will be used to access the proxy class for the C++ code which will provide access to the data stored on the MyCare Card. C. GUI model gui/containers/dec1 and gui/controls/dec1 directories contain modules, automatically generated from interface declaration XML files with GUI components presentation and layout descriptions. Interface declaration XML files are currently handled by the wxGlade GUI designer and stored in its native wxg file format. In further development, wxWidgets native xrc resources file format will be used together with dynamic loading (parsing) instead of the current-ly utilized static code generation. Interface declaration classes in `dec1` directories are extended with corresponding GUI logic and parametrically controlled functionality in modules contained in `gui/containers` and `gui/controls` directories. This extension is done by inheritance, constructors overloading and defining new event handlers. Such approach allows us to separate GUI presentation, GUI logic and GUI content code parts and already proved its efficiency. Example of a typical MyCare Card Browser screen in its current version is shown in Fig. 2. D. Data-flow model Module `mc.py` which defines binder classes can be considered as the MyCare Card Browser engine. GUI and data classes binding is based on the idea of multiple inheritance and Run Time Type Information (RTTI), natively supported by Python. The key methods code of the core classes in the `mc.py` is shown in Lst. 2. Lst. 2. Key methods of the Card Browser engine core classes. ```python class DataControl: def __init__(self): self.dataPath = None self._accessLevelPath = None self._logRec = None def UpdateControlFromData(self): raise NotImplementedError() def SetDataPath(self, value): self.dataPath = \ self._dataPath = value def SetAccessLevelPath(self, value): self._accessLevelPath = \ self._dataPath = value def SetLogRec(self, value): class DataViewControl(DataControl): def __init__(self): DataControl.__init__(self) self.dataFormatter = FormatNone def SetDataFormatter(self, value): self._dataFormatter = value class DataEditControl(DataControl): def __init__(self): DataControl.__init__(self) def UpdateDataFromControl(self): raise NotImplementedeError() ``` Fig. 2: MyCare Card Browser GUI screen example. class DaPanel(wx.Panel): def __init__(self, *args, **kwargs): wx.Panel.__init__(self, *args, **kwargs) # Update all Data Aware controls # when their panel is shown self.Bind(wx.EVT_SHOW, self.OnShow) def UpdateControlsFromData(self): for ctrl in self.GetChildren(): if isinstance(ctrl, DataControl): ctrl.UpdateControlFromData() def OnShow(self, event): if not event.GetShow(): return evtsrc = event.GetEventObject() if isinstance(evtsrc, DaPanel): evtsrc.UpdateControlsFromData() When GUI control has to be “data aware” and to view or to edit certain fields of the data structure, it simply inherits from the “normal” wxWidgets control and from either DataViewControl or DataEditControl. Such inherited class must only overload UpdateControlFromData() function if it is a view control, and in case if it is an edit control, it must also overload UpdateDataFromControl(). DataControl:::_dataPath instance variable defines path to the data represented by the control. DataControl:::_accessLevelPath defines path to the data record, which represents access level to the data represented by the control. DataControl:::_logRec instance variable defines data access log message which identifies accessed data field in a human readable format. When a new instance of the “data aware” control is constructed, all the above mentioned variables have to be assigned using SetDataPath(), SetAccessLevelPath() and SetLogRec() member functions of the DataControl class. All “data aware” controls have to have “data aware” containers (i.e. parent windows). In the current version of the software only DaPanel container type is supported. It is inherited from the wx.Panel. There are two major advantages of the described approach: firstly the association between data path and “data aware” controls can be defined during controls classes instances construction, instead of maintaining a separate associations file; and secondly the container classes automatically “know” from RTTI request (isinstance() called from DaPanel:::OnShow()) which contained controls must be updated when a show event occurs. The first advantage also allows defining data path and controls associations from some wxWidgets GUI designers, which support extra properties setting or defining new design-time components. The latter significantly simplifies development by joining GUI layout definition with data path allocations. IV. CONCLUSION AND FURTHER WORK The initial survey results have been used to draw up a list of user requirements that was used to produce 3D and physical design models of MyCare Cards and Card Browser software. In terms of GUI and data structure design, initial development cycles have led to a working software prototype which has been further evaluated in terms of its aesthetics, ease of use and the ease with which different levels of access can be associated with different types of information. The research highlights that the initial barriers to the use of electronic health record devices will be the security of information. In the proposed system, data can only be accessed using a personal identification number, and will only include information that the individual is willing to enter and share with others. A similar level of authentication will be required by health professionals to read it and, therefore, such fears appear to be exaggerated from a computing perspective. Additionally the device will be independent of centrally held records, so will not provide a route in to more sensitive information. The developed MyCare Card Browser classes interfaces allow the embedding of the user authentication and data encryption algorithms minimizing the potential for fraudulent use of devices that have been reported as lost or stolen. The current version of the MyCare Card Browser source, its corresponding tool chain, revision control and issue tracking web-systems represent a flexible and extendable software infrastructure which will be used as a platform in the final stage of the MyCare project development. Future stages of the research will entail the development of more detailed usage scenarios, MyCare Card prototype development, testing of the device and evaluation of the usability of the MyCare Card Browser interface. The final stage of the research will use the experiences of the project as a starting point for a series of dissemination activities across the UK, which will broaden discussion of the personal and shared responsibilities for health care. REFERENCES More information on MyCare project and Card Browser source code is available at http://mycare.webfactional.com
{"Source-Url": "https://openaccess.city.ac.uk/id/eprint/14291/1/ITAB%202009%20print%20final.pdf", "len_cl100k_base": 4940, "olmocr-version": "0.1.53", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 23675, "total-output-tokens": 5736, "length": "2e12", "weborganizer": {"__label__adult": 0.0021076202392578125, "__label__art_design": 0.000935077667236328, "__label__crime_law": 0.0019197463989257812, "__label__education_jobs": 0.006683349609375, "__label__entertainment": 0.00015151500701904297, "__label__fashion_beauty": 0.0009059906005859376, "__label__finance_business": 0.0008287429809570312, "__label__food_dining": 0.0026760101318359375, "__label__games": 0.00164031982421875, "__label__hardware": 0.00740814208984375, "__label__health": 0.335693359375, "__label__history": 0.0008149147033691406, "__label__home_hobbies": 0.000644683837890625, "__label__industrial": 0.0010166168212890625, "__label__literature": 0.0008053779602050781, "__label__politics": 0.0009355545043945312, "__label__religion": 0.0012559890747070312, "__label__science_tech": 0.06939697265625, "__label__social_life": 0.0004839897155761719, "__label__software": 0.01430511474609375, "__label__software_dev": 0.544921875, "__label__sports_fitness": 0.0022602081298828125, "__label__transportation": 0.0016603469848632812, "__label__travel": 0.0006909370422363281}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27041, 0.00675]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27041, 0.54408]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27041, 0.93116]], "google_gemma-3-12b-it_contains_pii": [[0, 1150, false], [1150, 1150, null], [1150, 5748, null], [5748, 11733, null], [11733, 16931, null], [16931, 21379, null], [21379, 27041, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1150, true], [1150, 1150, null], [1150, 5748, null], [5748, 11733, null], [11733, 16931, null], [16931, 21379, null], [21379, 27041, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 27041, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27041, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27041, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27041, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27041, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27041, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27041, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27041, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27041, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27041, null]], "pdf_page_numbers": [[0, 1150, 1], [1150, 1150, 2], [1150, 5748, 3], [5748, 11733, 4], [11733, 16931, 5], [16931, 21379, 6], [21379, 27041, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27041, 0.0]]}
olmocr_science_pdfs
2024-12-10
2024-12-10
ddebe2a505cb9333bb2b84a8c37f041685c7b3a6
Logic Model Checking: What is it about? - The Basic Method - General Remarks - Motivating Examples Automata and Logic - Finite State Automata - Büchi Automata - Something on Logic and Automata - Implications in Model Checking - Automata Products Model Checking Algorithm - Preliminaries - The Algorithm Final Remarks - Something on Automata Logic Model Checking (1) - Model checking is a technique for verifying finite-state concurrent systems - Theoretically speaking, model checking consists of the following tasks: - Modeling the system - It may require the use of abstraction - Often using some kind of automaton - Specifying the properties the design must satisfy - It is impossible to determine all the properties the systems should satisfy - Often using some kind of temporal logic - Verifying that the system satisfies its specification - In case of a negative result: error trace - An error trace may be product of a specification error (false negative) Logic Model Checking (2) The application of model checking in a design project typically consists of the following steps: 1. Choose the properties (correctness requirements) critical to the design 2. Build a verification model guided by the above correctness requirements - The model should be as smallest as possible - It should, however, capture everything which is relevant to the properties to be verified 3. Select the appropriate verification method based on the model and the properties 4. Refine the verification model and correctness requirements until all correctness concerns are adequately satisfied The main causes of combinatorial complexity in SPIN/Promela are: - The number of and size of buffered channels - The number of asynchronous processes --- The Basic Method There are different model checking techniques. We will use SPIN which is based on the automata-theoretic approach: - **System:** \( \mathcal{L}(S) \) (the set of possible behaviors of S) - **Property:** \( \mathcal{L}(P) \) (the set of valid/desirable behaviors) - Prove that \( \mathcal{L}(S) \subseteq \mathcal{L}(P) \) (everything possible is valid) - **Method** - Let \( \overline{\mathcal{L}(P)} \) be the language \( \Sigma^\omega \ \setminus \ \mathcal{L}(P) \) of words not accepted by \( P \) - Prove \( \mathcal{L}(S) \cap \overline{\mathcal{L}(P)} = \emptyset \) - There is no accepted word by \( S \) disallowed by \( P \) This will be clear at the end of the talk, .... I hope --- Scope of the Method - Logic model checkers (LMC) are suitable for concurrent and multi-threading finite state systems - Some of the errors LMC may catch: - Deadlocks (two or more competing processes are waiting for the other to finish, and thus neither ever does) - Livelocks (two or more processes continually change their state in response to changes in the other processes) - Starvation (a process is perpetually denied access to necessary resources) - Priority and locking problems - Race conditions (attempting to perform two or more operations at the same time, which must be done in the proper sequence in order to be done correctly) - Resource allocation problems - Dead code (unreachable code) - Violation of certain system bounds - Logic problems: e.g, temporal relations A Bit of History The following diagram shows the evolution of the theoretical foundations of LMC: 1936: First theory on computability, e.g., Turing machines 1940-50: The first computers are built 1955: Early work on tense logics (predecessors of LTL) 1955: Early work on software crisis and software engineering 1958: LTL (linear temporal logic) for system verification 1964: Edsger Dijkstra's paper on Guarded Command Languages 1968: Two terms introduced: software crisis and software engineering 1975: Amir Pnueli introduces linear temporal logic for system verification 1976: Pnueli's seminal paper on temporal logic for system verification 1976-1979: First experiments with reachability analyzers (e.g., Jan Hajek: 'Approver') 1978: Tony Hoare's paper on Communicating Sequential Processes 1980: Earliest predecessor of Spin: 'Pan' (Bell Labs) 1989: Spin version 0 verification of class of $\mathcal{A}$-regular properties 1993: BDDs and the SMV model checker (Ken McMillan, CMU) 1995: Partial order reduction in Spin. LTL conversion in Spin. (Doron Peled) 2001: Support for embedded C code in Spin version 4.0 2003:標量 first search mode added to Spin version 4.1 The two most popular logic model checking systems today: - Spin: an explicit state LTL model checker based on automata theoretic verification method targeting software verification (asynchronous systems) - SMV: a symbolic CTL model checker targeting hardware circuit verification (synchronous systems) On Correctness (reminder) - A system is correct if it meets its design requirements. - There is no notion of “absolute” correctness: It is always w.r.t. a given specification - Getting the properties (requirements) right is as important as getting the model of the system right - Examples of correctness requirements - A system should not deadlock - No process should starve another - Fairness assumptions - E.g., an infinite often enabled process should be executed infinitely often - Causal relations - E.g., each time a request is send, and acknowledgment must be received Building Verification Models - Statements about system design and system requirement must be separated - One formalism for specifying behavior (system design) - Another formalism for specifying system requirements (correctness properties) - The two types of statements define a verification model - A model checker can now - Check that the behavior specification (the design) is logically consistent with the requirement specification (the desired properties) Distributed Algorithms Two asynchronous processes may be easily get blocked when competing for a shared resource in real-life conflicts ultimately get resolved by human judgment. Computers, though, must be able to resolve it with fixed algorithms. Thread Interleaving - The number of possible thread interleavings is... - 3! = 3 · 2 · 1 = 6 - 3! = 3 · 2 · 1 = 6 - 3! = 3 · 2 · 1 = 6 - 3! = 3 · 2 · 1 = 6 - Total: 3! · 3! · 3! = 1,680 possible executions. - Are all these executions okay? - Can we check them all? Should we check them all? - In classic system testing, how many would normally be checked? A Small Multi-threaded Program ```c int x, y, z; int *p, *q, *r; int **a; thread_1(void) /* initialize p, q, and r */ { p = &x; q = &y; z = &r; } thread_2(void) /* swap contents of x and y */ { r = *p; *p = *q; *q = r; } thread_3(void) /* access z via a and p */ { a = &p; *a = z; **a = 12; } ``` A Simpler Example - Consider two 2-state automata: - Representing two asynchronous processes - One can print an arbitrary number of '0' digits, or stop. - The other can print an arbitrary number of '1' digits, or stop. - How many different combined executions are there? I.e., how many different binary numbers can be printed? How would one test that this system does what we think it does? **Finite State Automata** **Definition** A finite state automaton is a tuple \( (S, s_0, L, F, T) \), where - \( S \) is a finite set of states - \( s_0 \in S \) is a distinguished initial state - \( L \) is a finite set of labels (symbols) - \( F \subseteq S \) is the set of final states - \( T \subseteq S \times L \times S \) is the transition relation, connecting states in \( S \) We will, in general, follow Holzmann’s notation: \( A.S \) denotes the state \( S \) of automaton \( A \), \( A.T \) denotes the transition relation \( T \) of \( A \), and so on. If understood from the context, we will avoid the use of \( A._. \) **Example** The above automaton may be interpreted as a Process Scheduler: - \( A.S: \{ s_0, s_1, s_2, s_3, s_4 \} \) - \( A.L = \{ \alpha_0, \alpha_1, \alpha_2, \alpha_3, \alpha_4, \alpha_5 \} \) - \( A.F = \{ s_4 \} \) - \( A.T = \{ (s_0, \alpha_0, s_1), (s_1, \alpha_1, s_2), \ldots \} \) **Determinism vs non-determinism** A finite state automaton \( A = (S, s_0, L, F, T) \) is deterministic iff \[ \forall s \forall l, ((s, l, s') \in A.T \land (s, l, s'') \in A.T) \implies s' \equiv s'' \] I.e., the destination state of a transition is uniquely determined by the source state and the transition label. An automaton is called non-deterministic if it does not have this property. **Example:** The automaton corresponding to the process scheduler is deterministic. Definition of a Run A run of a finite state automaton $A = (S, s_0, L, F)$ is an ordered and possibly infinite set of transitions (a sequence) from $T$ $$\sigma = \{(s_0, l_0, s_1), (s_1, l_1, s_2), \ldots\}$$ such that $$\forall i, i \geq 0 \cdot (s_i, l_i, s_{i+1}) \in T$$ Each run corresponds to a state sequence in $S$ and a word in $L$ Example: A state sequence from a run: $\{idle, ready, \{execute, waiting\}^*\}$ The corresponding word in $L$: $\{start, run, \{block, unblock\}^*\}$ Remarks: - A single state sequence may correspond to more than one word - For non-deterministic automata, the same word may correspond to different state sequences Language Accepted by an Automaton The language $L(A)$ of automaton $A = (S, s_0, L, F, T)$ is the set of words in $A$ that correspond to the set of all the accepting runs of $A$ Notice that there can be infinitely many words in the language of even a small finite state automaton Example: A characterization of the complete language of automaton $A$ (an infinite set of words): $\{start, run, \{pre-empt, run\}^*, \{block, unblock\}^*, \text{stop}\}$ The shortest word in the language: $\{start, run, \text{stop}\}$ Reasoning about Runs **sample property:** “if first $p$ becomes true and then later $q$ becomes true, then $r$ can no longer become true” **interpretation:** $\overline{p} \cup \overline{q} \rightarrow \overline{r}$ **correctness claim:** it is an error if in a run we see first $p$ then $q$ and then $r$ this property is easily expressed with the standard definition of acceptance **reaching this state constitutes a complete match of the pattern that specifies the correctness violation** Reasoning about *Infinite* Runs *a classic liveness property:* “if $p$ then eventually $q$” **interpreted:** $\forall i : s_i \rightarrow s_{i+1}$ **error** **correctness claim:** it is an error if in a run we see first $p$ then $q$ and then $r$ this property can only be violated by an infinite run… the standard notion of acceptance applies only to finite runs… We need, thus, to extend the notion of run, acceptance, … Büchi Acceptance - An infinite run is often called an $\omega$-run (“omega run”) - An acceptance property for $\omega$-runs are called $\omega$-acceptance and can be defined in different ways - The so-called Büchi, Müller, Rabin, Streett, etc, acceptance conditions - We adopt here the introduced by Büchi (1960) **Definition** An accepting $\omega$-run of finite state automaton $A = (S, s_0, L, F, T)$ is an infinite run $\sigma$ such that $$\exists i \geq 0, (s_{i-1}, l_{i-1}, s_i) \in \sigma \cdot s_i \in L \land s_i \in \sigma^\omega$$ i.e., at least one state in $A, F$ is visited infinitely often. Automata with the above acceptance condition are called Büchi automata Büchi Automata **Example** an accepting $\omega$-run for this automaton: $\{ \text{idle, ready, \{execute, ready\}*} \}$ the corresponding $\omega$-word: $\{ \text{start, run, \{pre-empt, run\}}* \}$ the $\omega$-language of an automaton is the set of all $\omega$-words accepted Generalized Büchi Automata Definition A generalized Büchi automaton is an automaton \( A = (S, s_0, L, F, T) \), where \( F \subseteq \wp(S) \) (\( F = \{ f_1, \ldots, f_n \} \) and \( f_i \subseteq S \)). A run \( \sigma \) of \( A \) is accepting if \[ \text{for each } f_i \in F, \text{inf}(\sigma) \cap f_i \neq \emptyset. \] - A generalized Büchi Automaton differs from a Büchi Automaton by allowing multiple accepting sets instead of only one - Generalized Büchi automata are not more expressive than usual Büchi automata The Stutter Extension Rule Definition The stutter extension of a finite run \( \sigma \) with final state \( s_n \), is the \( \omega \)-run \[ \sigma (s_n, \varepsilon, s_n)^\omega \] Example run: \{ idle, ready, execute, waiting, execute, [end,]* \} word: \{ start, run, block, unblock, stop, \( \varepsilon \)* \} LTL (reminder) Semantics Definition An LTL formula \( \varphi \) holds for an \( \omega \)-run \( \sigma \), written \( \sigma \models \varphi \) if: - \( \sigma \models \varphi \) iff \( \sigma_0 \models \varphi \) when \( \varphi \in \text{Prop} \) (Propositional formula) - \( \sigma \models \neg \varphi \) iff \( \sigma \not\models \varphi \) - \( \sigma \models \varphi \lor \psi \) iff \( \sigma \models \varphi \) or \( \sigma \models \psi \) - \( \sigma \models [\varphi] \) iff \( \sigma[k] \models \varphi \) for all \( k \geq 0 \) - \( \sigma \models [\varphi] \) iff \( \sigma[k] \models \varphi \) for some \( k \geq 0 \) - \( \sigma \models [\varphi] \) iff \( \sigma[1] \models \varphi \) - \( \sigma \models \varphi U \psi \) iff \( \sigma[k] \models \psi \) for some \( k \geq 0 \), and \( \sigma[i] \models \varphi \) for every \( i \) such that \( 0 \leq i < k \) - \( \sigma \models \varphi R \psi \) iff for every \( j \geq 0 \) - if \( \sigma[j] \not\models \varphi \) for every \( i < j \) then \( \sigma[j] \models \psi \) From Kripke Structures to Büchi Automata LTL formulas can be interpreted on sets of infinite runs of Kripke structures. We recall the definition (slightly different from previous lecture) **Definition** A *Kripke structure* \( M \) is a four-tuple \( (W, R, W_0, V) \) where - \( W \) is a finite non-empty set of states (worlds) - \( R \subseteq W \times W \) is a total accessibility relation between states (transition relation) - \( W_0 \subseteq W \) is the set of starting states - \( V : W \rightarrow \wp(\mathcal{AP}) \) is a map labeling each state with a set of propositional variables A *path in* \( M \) is an infinite sequence \( \sigma = w_0, w_1, w_2, \ldots \) of worlds such that for every \( i \geq 0 \), \( w_i R w_{i+1} \). One can think of a path as an infinite branch in a tree corresponding to the unwind of the Kripke structure. --- From Kripke Structures to Büchi Automata **Example** A Kripke structure (whose only infinite run is a model to \( \Box q \) and \( \Box \Diamond p \), for instance): \[ \begin{array}{c} \rightarrow \\ \text{s}_0 \\ \{p, q\} \\ \rightarrow \\ \text{s}_1 \\ \{q\} \end{array} \] The corresponding Büchi Automaton: \[ \begin{array}{c} \rightarrow \\ \text{i} \\ \leftarrow \\ \{p,q\} \\ \rightarrow \\ \text{s}_0 \\ \leftarrow \\ \{q\} \\ \rightarrow \\ \text{s}_1 \\ \leftarrow \\ \{p,q\} \end{array} \] --- From Logic to Automata For any LTL formula \( \psi \) there exists a Büchi automaton that accepts precisely those runs for which the formula \( \psi \) is satisfied. **Example:** The formula \( \Diamond \Box p \) corresponds to the following nondeterministic Büchi automaton: \[ \begin{array}{c} \rightarrow \\ \text{s}_0 \\ \leftarrow \\ \text{true} \\ \rightarrow \\ \text{s}_1 \\ \leftarrow \\ \text{p} \end{array} \] We will see the algorithm next lecture... For the moment, believe me that it is indeed the case. Omega-regular Properties - something not expressible in pure LTL: - (p) can hold after an even number of execution steps, but never holds after an odd number of steps - ❱ X (p) certainly does not capture it: \[ \text{(p) must hold after an even number of execution steps, but never after an odd number of steps) } \] - \[ p \land \Diamond \Box (p) \land \Box (\Box (p) \to \Box \Diamond !p) \land \Box (\Diamond !p \to \Box !p) \] does not capture it either (because now p must always hold after all even steps): - this formula expresses it correctly Expressiveness - modal \( \mu \)-calculus - \( \omega \)-tree automata - \( \omega \)-word automata - Büchi automata - CTL - CTL* Implications in Model Checking - At the beginning we said that the automata-based model checking method was based on the following check: \[ \mathcal{L}(S) \cap \overline{\mathcal{L}(P)} = \emptyset \] where \( S \) is a model of the system and \( P \) of the property So, the following Büchi automata’s \textit{decidable} properties are important for model checking - Language emptiness: are there any accepting runs? - Language intersection: are there any run accepted by 2 or more automata? - Language complementation Implements in Model Checking In theory: - The system is represented as a Büchi automaton \( A \) - The automaton corresponds to the asynchronous product of automata \( A_1, \ldots, A_n \) (representing the asynchronous processes) \[ A = \bigotimes_{i=1}^{n} A_i \] - The property is originally given as an LTL formula \( \psi \) - The property \( \psi \) is translated into a Büchi automaton \( B \) - We perform the following check: \[ \mathcal{L}(A) \cap \overline{\mathcal{L}(B)} = \emptyset \] But... complementing a Büchi automaton is difficult! \[ ^1 \text{Alternatively, the property can be given directly as a Büchi automaton} \] Implications in Model Checking In practice (e.g., in SPIN) we want to avoid automata complementation: - Assume $A$ as before - The negation of the property $\psi$ is automatically translated into a Büchi automaton $\overline{B}$ (since $L(\overline{B}) \equiv L(B)$) - By making the synchronous product of $A$ and $\overline{B}$ ($B \otimes A$) we can check whether the system satisfies the property $L(A) \cap L(\overline{B}) = \emptyset$ - If the intersection is empty, the property $\psi$ holds for $A$ - Otherwise, use an accepted word of the nonempty intersection as a counterexample Asynchronous Product Example - Assume two non-terminating asynchronous processes $A_1$ and $A_2$: - $A_1$ tests whether the value of a variable $x$ is even, in which case updates it to $3x + 1$ - $A_2$ tests whether the value of a variable $x$ is odd, in which case updates it to $x/2$ - Let $\psi$ the following property: $\square \diamond (x \geq 4)$ - The negation of the formula is: $\diamond \square (x < 4)$ Question: Given an initial value for $x$, does the property hold? Asynchronous Product Definition The asynchronous product $\prod$ of a finite set of finite automata $A_1, \ldots, A_n$ is a new finite state automaton $A = (S, s_0, L, T, F)$ where: - $A, S$ is the Cartesian product $A_1 \times A_2 \times \ldots \times A_n, S$ - $A, s_0$ is the $n$-tuple $(A_1, s_0, A_2, s_0, \ldots, A_n, s_0)$ - $A, L$ is the union set $A_1, L \cup A_2, L \cup \ldots \cup A_n, L$ - $A, T$ is the set of tuples $(((x_1, \ldots, x_n), l, (y_1, \ldots, y_n))$ such that $\exists i, 1 \leq i \leq n, (x_i, l, y_i) \in A_i, T$ and $\forall j, 1 \leq j \leq n, j \neq i \implies (x_j \equiv y_j)$ - $A, F$ contains those states from $A, S$ that satisfy $\forall (A_1, s, A_2, s, \ldots, A_n, s) \in A, F, \exists i, 1 \leq i \leq n, A_i, s \in A_i, F$ Asynchronous Product Example <table> <thead> <tr> <th>$A_1$</th> <th>$A_2$</th> </tr> </thead> <tbody> <tr> <td>$s_0$</td> <td>$s_0$</td> </tr> <tr> <td>$(x \equiv 2)$</td> <td>$x = 3x + 1$</td> </tr> <tr> <td>$x = x/2$</td> <td>$x &lt; 4$</td> </tr> </tbody> </table> <table> <thead> <tr> <th>$B$</th> </tr> </thead> <tbody> <tr> <td>$s_0$</td> </tr> <tr> <td>$(x \equiv 2)$</td> </tr> <tr> <td>$x = 3x + 1$</td> </tr> <tr> <td>$x = x/2$</td> </tr> <tr> <td>$x &lt; 4$</td> </tr> </tbody> </table> An unreachable state under Promela interpretation of statement (label) semantics. We can also "expand" the automaton into a pure automaton, without variables. Asynchronous Product Example ![Asynchronous Product Diagram](image) Synchronous Product Definition The **synchronous product** $\otimes$ of a finite set of two finite automata $P$ and $B$ is a new finite state automaton $A = (S, s_0, L, T, F)$ where: - $A.S$ is the Cartesian product $P'.S \times B.S$ where $P'$ is the stutter closure of $P$ - A self-loop labeled with $\varepsilon$ is attached to every state in $P$ without outgoing transitions in $P.T$ - $A.L$ is the set of pairs $(l_1, l_2)$ such that $l_1 \in P'.L$ and $l_2 \in B.L$ - $A.T$ is the set of pairs $(t_1, t_2)$ such that $t_1 \in P'.T$ and $t_2 \in B.T$ - $A.F$ is the set of pairs $(s_1, s_2)$ such that $s_1 \in P'.F$ or $s_2 \in B.F$ Remarks - Not all the states in $A.S$ are necessary reachable from $A.s_0$ - Their reachability depends on the semantics given to the labels in $A.L$ (the interpretation of the labels depends on Promela semantics as we'll see in a future lecture) - The transitions in the product automaton are the transitions from the component automata arranged such that only one of the components automata can execute at a time - This gives an interleaving semantics of the processes - Promela has also rendez-vous synchronization (A special global variable has to be set) - Some transitions may synchronize by sending and receiving a message - For hardware verification, the asynchronous product is defined differently: each of the components with enabled transitions is making a transition (simultaneously) Synchronous Product Example ![Synchronous Product Diagram](image) Synchronous Product Remarks - We require the stutter-closure of \( P \) since \( P \) is a finite state automaton (the asynchronous product of the processes automata) and \( B \) is a standard Büchi automaton obtained form a LTL formula. - Not all the states in \( A.S \) or \( A.F \) are necessary reachable from \( A.s_0 \). - The main difference between asynchronous and synchronous products are on the definitions of \( L \) and \( T \) – In a synchronous product: - The transitions correspond to joint transitions of the component automata. - The labels are pairs: the combination of the two labels of the original transitions in the component automata. - In general \( P \otimes B \neq B \otimes P \), but given that in SPIN \( B \) is particular kind of automaton (labels are state properties, not actions), we have then \( P \otimes B \equiv B \otimes P \). Strongly-connected Components Example - Strongly-connected subsets: \( S = \{s_0, s_1\}, \quad S' = \{s_1, s_3, s_4\}, \quad S'' = \{s_0, s_1, s_3, s_4\} \) - Strongly-connected components: Only \( S'' = \{s_0, s_1, s_3, s_4\} \) Strongly-connected Components Definition A subset \( S' \subseteq S \) in a directed graph is strongly-connected if there is a path between any pair of nodes in \( S' \), passing only through nodes in \( S' \). A strongly-connected component (SCC) is a maximal set of such nodes, i.e. it is not possible to add any node to that set and still maintain strong connectivity. Checking Emptiness - Let \( \sigma \) be an accepting run of a Büchi automaton \( A = (S, s_0, L, T, \bar{F}) \) - Since \( S \) is finite, there is some suffix \( \sigma' \) of \( \sigma \) s.t. every state on \( \sigma' \) is reachable from any other state on \( \sigma' \). - I.e., the states on \( \sigma' \) are contained in a SCC of the graph of \( A \). - This component is reachable from an initial state and contains an accepting state. - Thus, checking non-emptiness of \( L(A) \) is equivalent to finding a SCC in the graph of \( A \) that is reachable from an initial state and contains an accepting state. - There are different algorithms for finding SCC. E.g.: - Tarjan’s version of the depth-first search (DFS) algorithm - SPIN nested depth-first search algorithm - If the language \( L(A) \) is non-empty, then there is a counterexample which can be represented in a finite way. - It is ultimately periodic, i.e., it is of the form \( \sigma_1 \sigma_2^\omega \), where \( \sigma_1 \) and \( \sigma_2 \) are finite sequences. Model Checking Algorithm Let $A$ be the automaton specifying the system and $\overline{B}$ the automaton corresponding to the negation of the property $\psi$. 1. Construct the intersection automaton $C = A \cap \overline{B}$ 2. Apply an algorithm to find SCCs reachable from the initial states of $C$ 3. If none of the SCCs found contains an accepting state, the model $A$ satisfies the property/specification $\psi$ 4. Otherwise, - Take one strongly-connected component $SC$ of $C$ - Construct a path $\sigma_1$ from an initial state of $C$ to some accepting state $s$ of $SC$ - Construct a cycle from $s$ and back to itself (such cycle exists since $SC$ is a strongly-connected component) - Let $\sigma_2$ be such cycle, excluding its first state $s$ - Announce that $\sigma_1\sigma_2\omega$ is a counterexample that is accepted by $A$, but it is not allowed by the property/specification $\psi$ Kripke Structures and Büchi Automata Observation - In Peled’s book “Software Reliability Methods” the definition of a Büchi automaton is very similar to our Kripke structure, with the addition of acceptance states - There is a labeling of the states associating to each state a set of subsets of propositions (instead of having the propositions as transition labels) - We have chosen to define Büchi Automata in the way we did since this definition is compatible with the implementation of SPIN - It was taken from Holzmann’s book “The SPIN Model Checker” Further Reading - The first two parts of this lecture were mainly based on Chap. 6 of Holzmann's book “The SPIN Model Checker” - Automata products: Appendix A - The 3rd part was taken from Peled's book For next lecture (29.03.2006): Read Chap. 6 of Peled's book, mainly section 6.8 on translating LTL into Automata - We will see how to apply the algorithm to an example
{"Source-Url": "https://www.uio.no/studier/emner/matnat/ifi/INF5140/v07/undervisningsmateriale/6-LMC-Foundations-4p.pdf", "len_cl100k_base": 7468, "olmocr-version": "0.1.42", "pdf-total-pages": 14, "total-fallback-pages": 0, "total-input-tokens": 50328, "total-output-tokens": 8469, "length": "2e12", "weborganizer": {"__label__adult": 0.0004661083221435547, "__label__art_design": 0.0004837512969970703, "__label__crime_law": 0.0005974769592285156, "__label__education_jobs": 0.0008907318115234375, "__label__entertainment": 0.00010591745376586914, "__label__fashion_beauty": 0.0002137422561645508, "__label__finance_business": 0.0002415180206298828, "__label__food_dining": 0.0005578994750976562, "__label__games": 0.0014448165893554688, "__label__hardware": 0.0016078948974609375, "__label__health": 0.0007600784301757812, "__label__history": 0.0003185272216796875, "__label__home_hobbies": 0.00016295909881591797, "__label__industrial": 0.0008649826049804688, "__label__literature": 0.00043082237243652344, "__label__politics": 0.0004394054412841797, "__label__religion": 0.0007791519165039062, "__label__science_tech": 0.07952880859375, "__label__social_life": 0.00010991096496582033, "__label__software": 0.005214691162109375, "__label__software_dev": 0.90283203125, "__label__sports_fitness": 0.00048279762268066406, "__label__transportation": 0.0009975433349609375, "__label__travel": 0.00022912025451660156}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 25608, 0.0132]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 25608, 0.72473]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 25608, 0.80129]], "google_gemma-3-12b-it_contains_pii": [[0, 997, false], [997, 3296, null], [3296, 5830, null], [5830, 7168, null], [7168, 8587, null], [8587, 9774, null], [9774, 11682, null], [11682, 13586, null], [13586, 15487, null], [15487, 17380, null], [17380, 19632, null], [19632, 21218, null], [21218, 23760, null], [23760, 25608, null]], "google_gemma-3-12b-it_is_public_document": [[0, 997, true], [997, 3296, null], [3296, 5830, null], [5830, 7168, null], [7168, 8587, null], [8587, 9774, null], [9774, 11682, null], [11682, 13586, null], [13586, 15487, null], [15487, 17380, null], [17380, 19632, null], [19632, 21218, null], [21218, 23760, null], [23760, 25608, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 25608, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 25608, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 25608, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 25608, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 25608, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 25608, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 25608, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 25608, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 25608, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 25608, null]], "pdf_page_numbers": [[0, 997, 1], [997, 3296, 2], [3296, 5830, 3], [5830, 7168, 4], [7168, 8587, 5], [8587, 9774, 6], [9774, 11682, 7], [11682, 13586, 8], [13586, 15487, 9], [15487, 17380, 10], [17380, 19632, 11], [19632, 21218, 12], [21218, 23760, 13], [23760, 25608, 14]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 25608, 0.02637]]}
olmocr_science_pdfs
2024-11-22
2024-11-22
739141d79c0ff9a25fa81e7704de9e2fa1a4d2ca
EXTENDING DQL WITH RECURSIVE FACILITIES Marta Burzańska¹, Przemysław Krukowski¹, Piotr Wiśniewski¹ ¹Faculty of Mathematics and Computer Science, Nicolaus Copernicus University in Torun KEY WORDS: ORM, PHP, Doctrine, recursive queries, CTE. ABSTRACT: Object Relational Mappings reduce a gap between Relational Databases and programming languages. However, only the simplest operations are covered by the ORM frameworks. Most facilities provided by DBMSs are not usable via ORM. Among such features are recursive queries, introduced in SQL:99 standard. This paper presents integration of Recursive Common Table Expressions with Doctrine Query Language - a part of Doctrine ORM framework for PHP. 1. INTRODUCTION Hierarchical and graph structures can be found everywhere. Real-world examples are: bill-of-material, employee hierarchy, network of roads between cities. Commonly used version control systems represent direct acyclic graphs in which a single "checkin" can have from zero (the initial "checkin") to multiple parents (predecessors). To search through such structures, when the length of the search path is unknown - we need recursion. When building database application we may either use user defined stored server-side recursive functions, emulate recursion by sending database requests in each step of recursion, or utilize built-in recursive queries. Our intuition tells us that usually it would be best to use recursive queries, mainly due to DBMS's built-in optimization techniques. However, not all DBMSs implement recursive queries, despite their introduction in SQL:99 standard. What is more, each DBMS that supports recursive queries differs in their implementation from the standard schema [1]. Let us return to the problems of building database application. Nowadays, most applications are developed in an object-oriented language, but their backend is a relational database [1]. To improve the process of an application development, a common practice is to use Object-Relational Mapping (ORM). Programmers, that decide to use a popular external library gain time needed to write their own non-standard methods of data handling. They also get a tool that has been through-out tested by a number of users, which significantly increases safety and often results in improvements to memory management and query processing speed. However, the main benefit of the usage of ORM libraries is the speed of code development and code portability between different DBMSs. Examples of the most popular ORM solutions are: Hibernate (Java) [2], Django Models (Python) Unfortunately, they do not offer full capabilities of a professional DBMS. Most ORM frameworks provide additional data management capabilities through an alternative object query language. Usually it is similar to SQL, however it references objects and not records nor cells, and its data types are derived from the host language and not from a database. Examples of such a language are HQL (Hibernate Query Language) in Hibernate library and DQL (Doctrine Query Language) in Doctrine ORM. While those languages extend the base functionality of an ORM, they still lack the support for more advanced SQL language functionalities, including recursive queries. In this paper we discuss an extension of the Doctrine Query Language with a new functionality - hierarchical data handling and processing of recursive queries. This is not a trivial issue. The solution must reflect the spirit of ORM - one notation unchanged regardless of the choice of the underlying DBMS. However, although the standard of recursive CTEs has been formulated over a dozen years ago, not all DBMSs implement them. Moreover, as we have already mentioned, various implementations may differ significantly from each other. The initial prototype introducing the concept of server-side recursion into a HQL language was presented in [7]. It added support for recursive Connect By queries available in the Oracle database. This paper extends previous studies with the support for recursive common table expressions (RCTE) and recursive queries emulator, based on the unrolling of queries algorithm, designed for DBMSs not supporting recursive CTE. We have chosen Doctrine Project for our experiments based, among many other aspects, on PHP's popularity and Doctrine Project's specific design. It is a set of libraries expanding the functionality of PHP that allows for integration with relational and non-relational DBMSs. It splits its functionality between different layers of abstraction, which makes it easy to create a unified solution regardless of the differences between various DBMSs. One of its layers - the Database Abstraction Layer (DBAL) is specifically designed for quick implementation of database communication mechanisms for database. A programmer may utilize to connect and work with a database which does not have an appropriate PDO library, while maintaining uniform approach to data handling. An important element of the Doctrine ORM framework is its object-oriented query language DQL, built in resemblance to SQL. It does not refer to tables or records, but to the objects and relationships that link them. Doctrine is able to convert DQL query to a query in the SQL dialect of the currently connected DBMS. This paper makes the following contributions: - we propose an extension to DQL with recursive common table expression functionality, - recursive queries computation method that allows applications to run such queries even if underlying DBMS does not support them, - proof-of-concept implementation of this extension with experimental results that prove the robustness of our idea. This paper is organized as follows. In Section 2 we discuss querying recursive data structures using RCTE expressions. Section 3 describes the design of the proposed extension to DQL. In Section 4 we discuss recursive query emulation based on query unrolling. Section 5 reports the details of the performance evaluation of our prototype implementation. Section 6 concludes. 2. RECURSIVE QUERIES The research presented in this paper focuses on the problem of processing graph and hierarchical data structures. There is an abundance of real-life problems associated with such structures among which are: finding the communication links between two cities or finding routes based on information provided by the GPS systems, processing championships' scoreboards, corporate hierarchy or bill-of-material. The first DBMS implementing recursive queries was Oracle (version 2). They were based on the Connect by statement and were used to recursively filter out rows in a selected (only one) table. Alternative version of a recursive query, based on common table expressions, has been introduced in 1997 in IBM's DB2 database. Their version has been added to the SQL standard ANSI SQL:99. This version has the following syntax: WITH [RECURSIVE] cte_name [(column list)] AS ( seed_query UNION ALL recursion_query) outer_query For example, to traverse a bill-of-material structure we may utilize the following query: WITH RECURSIVE included_parts (sub_part, part, quantity) AS ( SELECT sub_part, part, quantity FROM parts WHERE part = 'our_product' UNION ALL SELECT p.sub_part, p.part, p.quantity FROM included_parts pr, parts p WHERE p.part = pr.sub_part ) SELECT sub_part, SUM(quantity) as total_quantity FROM included_parts GROUP BY sub_part Using this method one may traverse any hierarchical data without the a priori knowledge about the depth of the tree. This task is impossible to accomplish with the use of multiple subqueries or joins. And even with the knowledge about this tree's depth such queries quickly become gigantic and hard to maintain. The use of the recursive queries aids in gathering various data (like the tree's depth) in an organized fashion. Nowadays most relational DBMSs implement RCTEs (despite the implementational differences). Even Oracle, which for many years provided recursion through the Connect By statement, implements RCTE construct. However, there is still a number of popular systems, like MySQL or MariaDB, which do not support such queries. 3. EXTENDING DQL WITH RECURSIVE CTE As mentioned earlier, the DQL language does not support recursion. In order to query recursive data we have to write code fragments in DQL and process them using PHP's recursive functions or loops. This paper adds support for recursive queries by making modifications to the Doctrine ORM library. Those modifications however, maintain backward compatibility with the basic version of the system - they do not affect the behaviour of queries other than RCTE. We have added the following rules to the DQL grammar: ``` RecursiveStatement ::= RecursiveClause RecursiveBody SelectStatement RecursiveClause ::= "WITH RECURSIVE " \ RecursiveFunctionName"(" \ {RecursiveFunctionArguments} ") AS " RecursiveBody ::= ( NonRecursiveTerm "UNION" | \ "UNION ALL" RecursiveTerm ) NonRecursiveTerm ::= SelectStatement RecursiveTerm ::= SelectStatement RecursiveFunctionPathExpression ::= \ RecursiveFunctionName "." \ IdentificationVariable [ "." StateField ] ``` In the basic DQL grammar the initial non-terminal symbol is "QueryLanguage", which may be substituted with one of three non-terminal symbols depending on the first encountered keyword in a query: - SelectStatement for SELECT keyword - UpdateStatement for UPDATE keyword - DeleteStatement for DELETE keyword Here we have added a new non-terminal symbol "RecursiveStatement" replacing QueryLanguage symbol when lexer encounters the "WITH" keyword. The above-mentioned grammar rules regarding RecursiveStatement result in the following recursive query usage: ``` WITH RECURSIVE functionName(argument1, argument2...) AS ( /*seed query*/ SELECT valueList FROM aliasDefinitions [WHERE...] [GROUP BY ...] [HAVING ...] [ORDER BY...] UNION [ALL] /*recursive query*/ SELECT valueList FROM aliasDefinitions [WHERE...] [GROUP BY ...] [HAVING ...] [ORDER BY...] ) /*outer query*/ SELECT valueList FROM aliasDefinitions [WHERE...] [GROUP BY ...] [HAVING ...] [ORDER BY...] ``` We have decided upon a form similar to its counterpart in SQL for several reasons. First of all, this form is clear - every step of recursive query processing is defined separately. In addition, one of the main features of the DQL is its similarity to SQL. In order to be consistent with the DQL ideology, we have to keep our construct compatible with the underlying SQL query. At the same time the authors were unanimous about the fact that the preservation of the RCTE structure will make it easier for developers to work with those queries as they will be able to express directly their knowledge of SQL and the intended purpose of the query. We have decided to limit the structure to one base clause and one recursive clause, although some databases allow certain deviations from this rules. Changes to the DBAL (Database Abstraction Layer) library responsible for communication with DBMSs are fairly small. They take into account the syntactic differences between database dialects and that for the MySQL the emulator of recursive queries (discussed in the next section) should be launched. For this purpose we have prepared the interface Doctrine\DBAL\Platforms\RecursivePlatform: ```php namespace Doctrine\DBAL\Platforms; interface RecursivePlatform { public function withClause(); } ``` This interface is implemented by the database-specific classes (eg. Doctrine\DBAL\Platforms\OraclePlatform). Another problem was DQL's path expression restrictions. Such a path expression can contain only a single nesting (one dot). So it is not allowed to reference fields of a subobject: “c.parent.id”. For the purposes of handling recursive queries, this functionality has been changed. However, for paths that start with the alias pointing to the objects mapped in the Doctrine ORM, the double nesting is still not allowed. The modified path expression may reference the recursive function and its arguments, which may be both scalar values and mapped objects. Argument types of a recursive function are determined by the types of variables declared in the FROM clauses in seed and recursive subqueries. In the following exemplary query, both seed and recursive parts of the WITH query determine the type of the "d" variable introduced in the query's heading: ```sql WITH RECURSIVE cat(d) AS ( SELECT c FROM Entity\Category c WHERE c.id = 1 UNION ALL SELECT cr FROM Entity\Category cr, cat WHERE cr.parent = cat.d.id ) SELECT cat.d FROM cat ``` 4. **RECURSIVE QUERIES EMULATOR** For the purpose of DBMSs that do not support recursive queries, we have created an emulator unrolling a recursive query to the linear form of multiple queries sent to the database server in a loop managed from within PHP. The emulator class (Doctrine\ORM\Query\RecursiveEmulator) performs the task of a recursive DQL query execution in three steps: 1) evaluation of non-recursive subquery 2) evaluation of the recursive subquery 3) evaluation of the main query. Before launching the emulator's “execute()” function the following steps have already been conducted: 1) DQL query lexical analysis (Doctrine\ORM\Query\Lexer) 2) DQL query syntax and semantic analysis (Doctrine\ORM\Query\Parser). As a result of these steps, we obtain an AST (Abstract Syntax Tree) processed using three instances of the parser and three instances of the Doctrine\ORM\Query\SqlWalker containing the respective arrays of data created as a result of running the query. The most important of these arrays is the “recursiveArgumentsData”. It should be noted that the final process of the conversion of the AST to an SQL query was not conducted. Calling the “walkRecursiveStatement()” method from the “SqlWalker” class would produce a full recursive SQL query, not necessarily supported by the intended database system. Therefore, during the emulation only a partial replacement of certain parts of AST is performed, following the procedure described below. First the object of the Doctrine\ORM\Query\SqlWalker class changes the seed subquery of the With Recursive construct with an SQL Select query. What follows is this query's execution and retrieval of its results. At this stage the SqlWalker already knows the number and the types of the arguments of the DQL recursive query by analysing the objects from the SELECT clause of the seed query. We also know the relationships between DQL function arguments, SQL function arguments and the expressions from the SELECT clause of the seed query. Those data are passed to the emulator, which then may generate “on-the-fly” a mapping between a temporary table object and a temporary table within the relational DBMS. The fact that the DBMS may refer to the temporary table through a SQL query has certain consequences. An array in PHP that stores operating data in a recursive step, must have its counterpart in the database system. Therefore the emulator, after processing non-recursive part of the query, receives information about the types of the arguments of the recursive function, and therefore also about the temporary table types. Thus, the next step is to form a suitable mapping table between the temporary PHP object and the temporary table in the database. This results in the creation of the instance of a Doctrine\ORM\Query\RecursiveEmulator\TemporaryTable type, which uses this mapping. Entering, changing, or deleting data in a PHP array maintained in this object also results in making appropriate changes in the temporary table in the database. In addition to both temporary structures, an instance of Doctrine\ORM\Query\RecursiveEmulator\Table is created. It gathers all the results produced in every recursive step. It is not linked to any structure in the database. Third step is the translation of the recursive part of the DQL’s RCTE statement into a single SQL SELECT query. In this new query we may find references the recursive function and its arguments. Therefore, the temporary table has been named reflecting the name of the function, and its column were named reflecting the function arguments' names. Also, the types of the columns match the types of arguments calculated by the SQL query, and “guessed” by the “MetadataGuesser” object. The SQL query will access the data stored in the temporary table. Both in the first and in the second step, if the seed and the recursive subquery are joined using “UNION” keyword, recurring results are removed from both the temporary array of results and the working temporary table. In the case of “UNION ALL” - they will be saved. The fourth and final execution step is the processing of the outer Select query. Its result is stored using the Doctrine\ORM\Query\RecursiveEmulator\TemporaryTable object. Up to this point, all calculated data are stored in temporary tables of the relational DBMS. After the final query execution and results’ retrieval, temporary tables and PHP arrays are removed to release the name of the recursive function and free resources. 5. PERFORMANCE In this section we will show how the proposed solution affects the hierarchical data processing speed. Tests were performed on a desktop class computer. The tests were repeated many times, and presented results are the average values. The prototypes were tested on two open-source database management systems MySQL and PostgreSQL, and on a selected popular commercial system, which we shall denote DBMS X. For each DBMS the tests were conducted with the same sets of data. The results for each DBMS are gathered in separate tables. In conducted tests the size of recursive data ranges from a few to 65,000 records. This set clearly shows the benefits of the proposed solutions for DBMSs implementing recursive queries. For each DBMS the results are summarized in corresponding tables. The first column shows the number of records in the tree, the second column the tree depth, the third column the execution time of naive data querying (i.e. every result becomes a source for a new query executed in a loop). The fourth column presents the recursive query execution time – for PostgreSQL and DBMS X databases, whereas for the MySQL the results of the recursive query emulation algorithm from Section 3. Column 5 shows the rate of acceleration resulting from the use of the recursive queries technique. **Table 1 Results for MySQL database** <table> <thead> <tr> <th>Rec qty</th> <th>Tree depth</th> <th>Naive</th> <th>Recursion</th> <th>Ratio</th> </tr> </thead> <tbody> <tr> <td>15</td> <td>4</td> <td>0.018 s</td> <td>0.06 s</td> <td>333 %</td> </tr> <tr> <td>156</td> <td>4</td> <td>0.055 s</td> <td>0.13 s</td> <td>236 %</td> </tr> <tr> <td>16276</td> <td>4</td> <td>4.8 s</td> <td>5.26 s</td> <td>110 %</td> </tr> <tr> <td>255</td> <td>8</td> <td>0.08 s</td> <td>0.21 s</td> <td>263 %</td> </tr> <tr> <td>8191</td> <td>13</td> <td>3.06 s</td> <td>2.36 s</td> <td>77 %</td> </tr> <tr> <td>65535</td> <td>16</td> <td>27.7 s</td> <td>24.1 s</td> <td>87 %</td> </tr> </tbody> </table> These tests show that in the case of a DBMS not supporting RCTEs, the unrolling of recursion brings little effect for larger data and slows down the parsing of the small data sets. More tests on using the recursive query unrolling can be found in [8]. The results for the PostgreSQL database, which supports recursive queries, present as following: **Table 2 Results for PostgreSQL database** <table> <thead> <tr> <th>Rec qty</th> <th>Tree depth</th> <th>Naive</th> <th>Recursion</th> <th>Ratio</th> </tr> </thead> <tbody> <tr> <td>15</td> <td>4</td> <td>0.02 s</td> <td>0.08 s</td> <td>400 %</td> </tr> <tr> <td>156</td> <td>4</td> <td>0.11 s</td> <td>0.11 s</td> <td>100 %</td> </tr> <tr> <td>16276</td> <td>4</td> <td>11.8 s</td> <td>1.89 s</td> <td>16 %</td> </tr> <tr> <td>255</td> <td>8</td> <td>0.23 s</td> <td>0.08 s</td> <td>35 %</td> </tr> <tr> <td>8191</td> <td>13</td> <td>8.67 s</td> <td>0.73 s</td> <td>8 %</td> </tr> </tbody> </table> In PostgreSQL using recursion results in an important initial overhead, but soon with the increase in the size of the data we witness the increase in efficiency, which stabilizes at bigger data sets with a tenfold acceleration. Table 3 Results for DBMS X <table> <thead> <tr> <th>Rec qty</th> <th>Tree depth</th> <th>Naive</th> <th>Recursion</th> <th>Ratio</th> </tr> </thead> <tbody> <tr> <td>15</td> <td>4</td> <td>0.08 s</td> <td>0.07 s</td> <td>87 %</td> </tr> <tr> <td>156</td> <td>4</td> <td>0.11 s</td> <td>0.11 s</td> <td>100 %</td> </tr> <tr> <td>16276</td> <td>4</td> <td>15.2 s</td> <td>1.76 s</td> <td>11 %</td> </tr> <tr> <td>255</td> <td>8</td> <td>0.29 s</td> <td>0.10 s</td> <td>34 %</td> </tr> <tr> <td>8191</td> <td>13</td> <td>7.37 s</td> <td>0.85 s</td> <td>11 %</td> </tr> <tr> <td>65535</td> <td>16</td> <td>62.0 s</td> <td>11.3 s</td> <td>18 %</td> </tr> </tbody> </table> In DBMS X the test results were similar to PostgreSQL, what allows us to assume that similar results would be obtained for other DBMSs implementing recursive CTEs. An interesting observation independent of the DBMS is the fact that the execution times seem to be insensitive to the depth of the hierarchical structures. Everywhere the results for the tree that contains 16,000 nodes with the depth of 4 were much slower than the time results for the query searching through 8000 nodes in the tree of the depth of 13. 6. CONCLUSIONS AND RELATED WORK In this paper we have presented a proposal to extend DQL with recursive facilities based on SQL:99 Recursive Common Table Expressions. We have also presented the method of emulating such queries for Database Management Systems that do not support them. In order to encourage potential users we implemented a prototype mapper module that processes DQL queries enriched with WITH RECURSIVE clause. The result of performance tests conducted for this prototype emphasize the value of the proposed improvement. Compared to naive 3GL code we can achieve orders of magnitude improvement using our solution. Test have also shown that recursive queries are usually, but not always, the best choice for DBMSs that support them. Also our prototype requires the least modifications to the Doctrine framework. For the DBMSs that do not support recursive queries we provide the emulator to uphold one of the main postulates of the Doctrine ORM. According to it, each DQL query should be properly executed in each supported relational DBMS and return identical results. Unfortunately the costs of emulation (temporary table size, multiple requests to the database during recursive query execution) significantly impact the benefits of the usage of recursive queries. On the other hand the usage of recursive queries in comparison to emulator in DBMSs supporting RCTE gave significantly better execution times, mainly due to elimination of multiple database requests and better utilization of database built-in optimization methods. This paper concludes the research conducted in the field of providing a programmer with benefits of recursive queries. Other research topics dealt with Oracle’s Connect by constructs [7], enhancing different ORMs with RCTE supports [9,10], unrolling of recursive queries to support DBMSs without RCTE support [8], and benefits of utilizing... recursion in different cases [11,12] and with different data sets. We have also studied efficiency of execution of recursive queries in different DBMSs [1]. Interestingly, during the time the research took place we have witnessed growing demand for recursive query support [13,15] and enhancement of ORM capabilities [14]. Not only more DBMS support RCTEs than initially, but also SQL Alchemy ORM [16] implemented support for such queries in 2012 whereas our corresponding work dated 2010. Thus, we may conclude, that the research in this field was beneficial. LITERATURE 5. Active Records, http://api.rubyonrails.org/classes/ActiveRecord/Base.html
{"Source-Url": "https://journals.umcs.pl/ai/article/download/3522/pdf", "len_cl100k_base": 5319, "olmocr-version": "0.1.53", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 25960, "total-output-tokens": 6315, "length": "2e12", "weborganizer": {"__label__adult": 0.0002999305725097656, "__label__art_design": 0.00020956993103027344, "__label__crime_law": 0.0002741813659667969, "__label__education_jobs": 0.0005602836608886719, "__label__entertainment": 4.363059997558594e-05, "__label__fashion_beauty": 0.0001118183135986328, "__label__finance_business": 0.00015878677368164062, "__label__food_dining": 0.0002803802490234375, "__label__games": 0.0002980232238769531, "__label__hardware": 0.0005145072937011719, "__label__health": 0.00041794776916503906, "__label__history": 0.00016355514526367188, "__label__home_hobbies": 6.467103958129883e-05, "__label__industrial": 0.0002741813659667969, "__label__literature": 0.0001742839813232422, "__label__politics": 0.00014829635620117188, "__label__religion": 0.0003457069396972656, "__label__science_tech": 0.01116943359375, "__label__social_life": 7.218122482299805e-05, "__label__software": 0.00714111328125, "__label__software_dev": 0.9765625, "__label__sports_fitness": 0.00018584728240966797, "__label__transportation": 0.0003256797790527344, "__label__travel": 0.0001614093780517578}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 25744, 0.03691]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 25744, 0.41146]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 25744, 0.88601]], "google_gemma-3-12b-it_contains_pii": [[0, 2580, false], [2580, 5915, null], [5915, 8387, null], [8387, 10597, null], [10597, 13147, null], [13147, 16715, null], [16715, 19745, null], [19745, 22840, null], [22840, 25744, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2580, true], [2580, 5915, null], [5915, 8387, null], [8387, 10597, null], [10597, 13147, null], [13147, 16715, null], [16715, 19745, null], [19745, 22840, null], [22840, 25744, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 25744, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 25744, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 25744, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 25744, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 25744, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 25744, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 25744, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 25744, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 25744, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 25744, null]], "pdf_page_numbers": [[0, 2580, 1], [2580, 5915, 2], [5915, 8387, 3], [8387, 10597, 4], [10597, 13147, 5], [13147, 16715, 6], [16715, 19745, 7], [19745, 22840, 8], [22840, 25744, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 25744, 0.14744]]}
olmocr_science_pdfs
2024-12-09
2024-12-09
443460b21696a17503799325ebf03a0ac3e43920
1999 A Dimensionality Model Approach to Testing and Improving Software Robustness Jiantao Pan Carnegie Mellon University Philip Koopman Carnegie Mellon University Daniel Siewiorek Carnegie Mellon University Follow this and additional works at: http://repository.cmu.edu/isr Abstract - Software robustness problems may hinder the use of Commercial Off-The-Shelf (COTS) software modules and legacy software modules in mission-critical and safety-critical applications. This research focuses on hardening COTS and legacy software modules against robustness failures triggered by exceptional inputs. An automated approach is presented that is capable of identifying the triggers of the robustness failures. A fault model – the Dimensionality Model – is used to guide analysis. An experiment is described which demonstrates the feasibility of automating the process of analyzing failure causes and hardening against certain data types in POSIX function calls, for example, NULL pointer values and scalar data types such as INT and FLOAT. The final goal of this research is to provide users a tool to harden COTS and legacy software modules automatically. I. INTRODUCTION The robustness of a software component is a measure of how it functions in the presence of exceptional inputs or stressful environmental conditions [10]. Software robustness is gaining more and more significance among application developers. The reasons are three-fold: First, our lives are becoming more "computerized". Traditional analog devices are being replaced by their cheaper digital counterparts. The use of micro-controllers is growing in automobiles, airplanes, weapons, medical devices, consumer products, etc. New services based on computerized facilities are also emerging. Hence, more and more aspects of our life are dependent on software. Second, in order to cut development cost and time, application developers are being pressured to use Commercial Off-The-Shelf (COTS) software modules or legacy software components to assemble applications [1][2]. Often, COTS software components are optimized for cost or performance, and have not been specifically designed to operate in mission-critical or application-critical systems. COTS components may function correctly under normal conditions, but they may crash, hang or exhibit other robustness failures when exceptional or unspecified conditions occur. Third, robustness may not have been a design priority in COTS software. With the shortening of software product cycles and shrinking of profit margins, development cost is becoming a dominant concern along with time-to-market. High performance and new functionality, as opposed to robustness, are often given first priority. A particular source of robustness problems is exceptional inputs. As many as two-thirds of system crashes might be caused by exception-handling failures. Decades ago, the Apollo 11 Lunar Lander computer rebooted three times... due to exceptional operating conditions, nearly causing an aborted mission. More recently, the maiden flight of the Ariane 5 rocket failed, with an estimated loss of $500 million, due to an improperly handled exception in the software of the dual-redundant on-board control computer [3]. There is every indication that exception handling will continue to be a problem in critical applications, and may well become a serious problem in everyday computing as well. To make matters worse, the trend to using COTS software may mean that a lack of source code or detailed specifications will make improving robustness of systems even more challenging than it has been in the past with custom-written software. The goal of the Ballista project (http://www.ices.cmu.edu/ballista) is automatic hardening of COTS and legacy software modules against exceptional inputs that cause robustness problems. There are three major steps toward achieving this goal: automated robustness testing, automated failure analysis, and automated protection code generation. Automated robustness testing has already been accomplished [2][9]. Additionally, a Dimensionality Model [11] has shown that more than 80% of the robustness failures found in the 15 POSIX compliant operating systems we have tested are caused an exceptional value on only a single parameter. In this paper we introduce an analysis method guided by the Dimensionality Model that can pinpoint the triggers for robustness failures automatically. Additionally, we show that automated protection code generation is feasible for at least some exceptional parameter values. Experiments have proven successful in analyzing and hardening against NULL pointer values and exceptional scalar values for integers and floating-point numbers. II. BACKGROUND Historically, limited effort has been devoted to understanding software robustness. Research in software robustness focuses on testing methods and fault-injection techniques. Both approaches are combined in the work presented here. Black-box testing [4] assumes only inputs and outputs are accessible for the unit under test. There is no need to know the code structure and execution paths. In addition to tests for validating the module’s functional correctness, a significant portion are “dirty tests”, which consist of combinations of valid and invalid inputs, in order to stimulate abnormal behaviors in the software module. The AETG system [6] uses a combinatorial testing method. Based on programmer experience that faults caused by interactions of parameter values are relatively rare, AETG uses the minimum number of test cases to cover test for parameters singly, in pairs, and in small tuples. Fault-injection is another way to elicit software robustness problems. Faults and exceptional values are injected into the module under test. A more robust software module can withstand more and longer “attacks” before breaking down or gracefully degrading. Because in most cases the testing domain is infinite, randomly generated values are used to probe the module. Examples include CRASHME [14], CMU-Crashme [13], and Fuzz [7]. The randomness of these approaches and their dependence on concurrent execution of many tests makes any robustness failures that are found difficult to reproduce and isolate. The Xept [8] project at Bell Labs has developed an instrumentation tool to intercept library function calls to link in error detection and error recovery code. It provides a language to write specifications for interception and handling code for functions, and an object-code instrumentation tool, called Xmangler, to link application code with error detection and error recovery code. Although not focused on automated code generation technique, Xept provides a convenient framework and proves that a software wrapper can be used to intercept library function calls in object code. III. TOWARD AUTOMATIC ROBUSTNESS HARDENING Our goal is to automate the process of testing and hardening COTS and legacy software modules against robustness failures triggered by exceptional inputs. The process works as follows: 1. Test the software module using normal and exceptional inputs. 2. Analyze the test results; identify the corresponding parameter(s), and exceptional value(s) that trigger robustness failures. 3. Generate protection wrapper code to guard against the exceptional values that caused robustness failures. 4. Link the protection wrapper code to the module being hardened. While Bell Labs has developed methods [8] for the linking stage, technological advances are required in the first three steps. The second step is important to bridge the gap between the testing results and protection code generation. Once the exceptional parameters have been identified, protection code can be generated to check for these parameter values. **Automated Robustness Testing** A full-scale, web-based client-server testing engine [9] has been developed for automated robustness testing at the API level. It has the ability to test 233 POSIX system calls specified in standard POSIX.1b. [5] Test cases are predefined in the template file. User programs can also be tested, provided that the parameter data types are recognized by the server. Users can define their own data types and test cases to expand the testing capability by writing a template for each new data type. Test instances are generated using a combinatorial method. The CRASH scale [2] is used to measure the severity of the robustness failures. The testing method and the CRASH scale metric are described in the remainder of this section. **The Combinatorial Testing Method** A combinatorial testing methodology is used to generate tests. As an example, testing of the POSIX function call `read` is shown in Figure 1. The system call `read` accepts three parameters, `fd` file descriptor, `char *buffer`, and `int size`. The testing harness maintains a test data template file containing all the test cases defined for each data type. During testing, the harness will generate all possible combinations of the parameters from the template file. In this example, there are a total of 3120 possible combinations of the test values for the three parameters, so 3120 actual tests can be executed to exercise this function. A single combination is tested at a time, with necessary setup and tear down of the environment performed individually for each test. To achieve scalability, the test cases are defined per data type rather than for each function. New functions can be easily tested if the data types have already been defined. To test all 233 POSIX calls, only 20 data types are needed. **The CRASH Scale Metric** In general we categorize the test responses into passes and fails. When an appropriate error code is returned, the test case is considered a “Pass”. Failures are categorized by a scale called “CRASH”, which stands for Catastrophic, Restart, Abort, Silent and Hindering. Catastrophic failures refer to failures that can cause the whole system to stop functioning, requiring rebooting the machine. Restart failures mean that the process hangs, requiring intervention such as killing the test task. Restart failures are detected by a watchdog timer process. Abort failures refer to the abnormal termination of the tester process (i.e., core dumps in UNIX operating systems). Silent failures are false successes, which means that a success is returned when actually an error code should have been. Hindering failures mean returning incorrect error codes. In this study Restart and Abort failures are the initial targets. Automated Failure Analysis We seek an automated approach for analyzing the patterns of test responses to determine which parameter values cause failures. Ideally, the analyzer algorithm should also provide guidance to the testing engine. 1.1 million data points gathered from Ballista robustness testing on 15 POSIX API implementations1 in UNIX operating systems have been analyzed. Based on this analysis, a Dimensionality Model method [11] has been developed to guide the code generation process. The remainder of the section describes the Failure Analysis process. The Dimensionality Model [11] The idea of dimensionality is illustrated by two definitions. - **Parameter dimensionality:** Consider a software module \( f \), taking a list of arguments \((x_1, x_2, \ldots)\). The parameter dimensionality is defined as the number of arguments taken by the software module. For example, the POSIX function `read(file_des, buffer, bytes_to_read)` takes three parameters, so its parameter dimensionality is three. - **Robustness failure dimensionality:** Given a particular set of parameter values that cause a robustness failure, the number of the parameters that actually contributes to the failure is defined as the robustness failure dimensionality. For example, suppose that \( f(x_1, x_2, x_3) \) fails when \( x_1 = \text{NULL} \), regardless of the values of \( x_2 \) and \( x_3 \) (both normal and exceptional). In this case the NULL value of parameter \( x_1 \) is the only contributing factor to the failures. So all the failures where \( x_1 = \text{NULL} \) would be 1-dimensional failures. It is obvious that the failure dimensionality cannot exceed the parameter dimensionality. In the example of `read(file_des, buffer, bytes_to_read)`, an invalid `file_des` may trigger 1-dimensional failures, if the function does not check to prevent invalid `file_des` values. It is also possible that if `bytes_to_read` is greater than `buffer` (length), we can expect 2-dimensional failures, since both of the parameter values contribute to the failures. Note that it is possible for a specific failure to belong to both a high- and low-dimensionality failure set. In such cases, we can count that failure as having the lowest possible dimensionality. In other words, for our measurements the lower dimensionality characteristic prevails. Experimental results in POSIX API testing show that 1-dimensional failures are the most common failures encountered, accounting for more than 80% of the overall failure rate. This means that if we only choose to protect 1-dimensional failures, we can lower the overall system robustness testing failure rate by 80%. Automatic Identification of Fault Dimensionality Robustness failure dimensionality indicates the number of concurrent triggers required to activate a particular robustness failure. If we could automate the process of determining robustness failure dimensionality, we would be able to know the exceptional parameter values that are responsible for observed failures. This is an important step toward automatic hardening. While intuitively parameter dimensionality is the number of parameters accepted by the function, robustness failure dimensionality is not immediately obvious for functions with parameter dimensionality higher than one. However, the dimensionality can be revealed by the pattern of the robustness responses observed during testing. As an example, 1 Includes QNX 4.22, QNX 4.24, FreeBSD 2.2.5, NetBSD 1.3, SunOS 4.1.3, Digital Unix 3.2, Digital Unix 4.0, SunOS 5.5, IRIX 5.3, HP-UX B.10.20, IRIX 6.2, LINUX 2.0.18, LynxOS 2.4.0, HP-UX A.09.05, AIX 4.1. Figure 2 shows the robustness response pattern of the function `fprintf(FP, STR)` in HP-UX B.10.20. This function prints the string pointed to by `STR` to the file pointed to by `FP`. Each number along the axes represents an index to an actual test value. For example, number 9 on axis `FP` represents test case `NEG_VALUE` (an integer value of negative one). A circle means the test fails at the combination of the parameters at the point, exhibiting a robustness failure. A dot means the test passes. The test responses form patterns. In the column `FP(index)=9`, all the tests fail regardless of the value of `STR`. We can not be 100% sure that all this column of robustness failures are 1-dimensional, caused by an exceptional value of `FP=NEG_VALUE`, because we did not test all possible values that `STR` can have (and this is not possible). However, we can still conclude that the failures in the column of `FP=NEG_VALUE` is 1-dimensional, since it is unlikely that all eight values coincidentally would give the same behavior, given that `STR` has both good and exceptional values. Furthermore, we know that if we write protection code to check this single exceptional input of `FP=NEG_VALUE`, we can effectively guard against this column of exceptional values, including the other infinite possible `STR` values not covered in the testing space. The other four points at (2,5), (2,6), (5,5), (5,6) are 2-dimensional failures. To protect against them, both parameters need to be checked. In general, for n-dimensional failures, n parameters must be checked to protect against them. More generally, 1-dimensional failures will form a line in a 2-D graph, as shown in Figure 2. They will form a plane in a 3-D graph. 2-dimensional failures will form single or clustered circles in a 2-D graph, and lines in a 3-D graph. This process of identifying dimensionality information from combinatorial testing response patterns can be effectively automated. If test cases are properly defined, the Analyzer does not need any specific knowledge of the semantic information of the function, the function name under test, data types or the test case values. ### Automated Protection Code Generation For integer, floating-point data types and NULL pointers, value checking is sufficient to detect exceptional values. Therefore, the process of protection code generation for these data types is straightforward. After the dimensionality information is revealed and the exceptional values found, value comparison statements against these exceptional values are generated and plugged into a skeleton wrapper program. Any call to the target function to be protected is redirected to the wrapper. This call redirection can be achieved using a tool such as Xmangler [8]. ### IV. EXPERIMENTAL RESULTS In the experiment, we have implemented 1-dimensional failure hardening for integer, floating-point, and NULL pointer data values. We selected NULL pointer in our experimental study on an intuitive basis. NULL pointers are one of the most commonly encountered of exceptional inputs and are easily overlooked. While processing the data gathered in POSIX API testing, the extraordinarily high failure rate of NULL drew immediate attention. We estimate that the overall test result will be 10% better if the POSIX implementations add NULL pointer checking. To be specific, 82.5% of tests involving a NULL file pointers and 46.0% of tests involving NULL buffer pointers cause robustness problems. As an example of how easily NULL pointers can arise, Figure 3(a) shows a user program module myread.c. It opens a file and tries to read a character from the file. Since the program does not check for the existence of the file and necessary access permissions, there are potential robustness problems if the access rights are violated. For example, if the file does not exist, the user will see a core dump after getting the first output message, as shown in Figure 3(b). The failure depicted in Figure 3 happens because the validity of the file pointer is not properly checked by POSIX function fgetc(). To protect the program against this failure, function fgetc() is tested by the Ballista robustness testing suite. The robustness failures related to file pointer are found in the test result file, shown in Table 1. In Table 1, the first column shows the testing results, considering only Abort failures (core dumps). The second column shows the return value if the test passes, or -1 if the test fails. The third column shows the combinations of the parameter values of each test case. In this example, only one parameter is accepted, which is fpxx. fpxx is the equivalent name for data type file pointer, or FILE *. The test value of fpxx is composed of three orthogonal attributes called “dials” (because one can imagine spinning various dials to create combinations of such attributes): Existence, Access mode, and Access permissions. We then perform a dimensionality analysis on the failure data file. It is obvious that all the three failures are 1-dimensional, caused by invalid parameter value fpxx_NOTEXIST. In <table> <thead> <tr> <th>Result</th> <th>Return</th> <th>Parameters</th> </tr> </thead> <tbody> <tr> <td>Pass</td> <td>9</td> <td>fpxx_EXIST fpxx_APPEND fpxx_NOPERMISSIONS</td> </tr> <tr> <td>Pass</td> <td>9</td> <td>fpxx_CLOSED fpxx_READ fpxx_NOPERMISSIONS</td> </tr> <tr> <td>Abort</td> <td>-1</td> <td>fpxx_NOTEXIST fpxx_WRITE fpxx_NOPERMISSIONS</td> </tr> <tr> <td>Pass</td> <td>0</td> <td>fpxx_EXIST fpxx_READ fpxx_NOPERMISSIONS</td> </tr> <tr> <td>Pass</td> <td>9</td> <td>fpxx_CLOSED fpxx_APPEND fpxx_NOPERMISSIONS</td> </tr> <tr> <td>Pass</td> <td>9</td> <td>fpxx_CLOSED fpxx_WRITE fpxx_NOPERMISSIONS</td> </tr> <tr> <td>Abort</td> <td>-1</td> <td>fpxx_NOTEXIST fpxx_APPEND fpxx_NOPERMISSIONS</td> </tr> <tr> <td>Pass</td> <td>9</td> <td>fpxx_EXIST fpxx_WRITE fpxx_NOPERMISSIONS</td> </tr> <tr> <td>Abort</td> <td>-1</td> <td>fpxx_NOTEXIST fpxx_READ fpxx_NOPERMISSIONS</td> </tr> </tbody> </table> Table 1. Test result file for fgetc() the Ballista test suite, this is the denotation for a non-existent file, equivalent to a NULL file pointer. The analyzer comes to this conclusion by sorting the testing results by parameter value \texttt{fpxx\_NOTEXIST} and observing that a NULL value always results in a test failure. The actual code segment in the template file that generates the test cases for \texttt{fpxx} is shown in Figure 4. For the case of \texttt{fpxx\_NOTEXIST}, the value is equivalent to a NULL file pointer. Based on this knowledge, we can generate protection code guarding against this value. In this case, a checking statement will be sufficient to intercept the NULL file pointer causing the failure. The generated header file for \texttt{fgetc} is shown in Figure 5. The call \texttt{h\_fgetc()} is the hardened version of \texttt{fgetc()} with embedded NULL file pointer checking. Using the Xmangler tool, we will be able to redirect call instances from \texttt{fgetc()} to \texttt{h\_fgetc()} without user intervention. In this experiment we do not yet have the Xmangler tool [8] available, so we manually change all instances of \texttt{fgetc()} to \texttt{h\_fgetc()} in the template file. ```c /*Common Include Files*/ ...... /*User defined Include Files*/ ...... void Check1Dparam1(FILE* param1){ ...... FILE* _theVariable; char fileMode; int fd; ...... /*NOTEXIST*/ _theVariable=NULL; if(param1 == _theVariable){ puts("Dangerous 1-Dimensional parameter value detected\n"); exit(DEFAULT_RVAL); } }/*Check1Dparam1*/ int h_fgetc(FILE* param1){ Check1Dparam1(param1); return fgetc( param1); } #endif /*__HARDENED_FGETC__*/ ``` **Figure 5. Generated protection file for fgetc()** user source file to finish the last linking phase. To verify the effectiveness of the generated protection file for `fgetc()`, we first tested it again using the Ballista testing suite. As expected, the above three robustness failures are replaced by successes with error return code 99. Second, we compile this header file together with the user function shown in Figure 3(a). As shown in Figure 6, the exceptional inputs are captured. The function returns with a warning message. In the experiment, the hardened version of `fgetc()` simply turns Abort failures into a default error return code. To achieve more flexibility, we can provide more options before exiting. For example, for resource related problems, retrying the task sometimes can fix the problem. Process migration can keep a long-running task from aborting when facing resource contention. Garbage collection or disk de-fragmentation can also be launched at some point if a problem is related to memory or disk resources. For the parameter values that are not in the testing database, or are ambiguous, checkpoint-rollback procedure can be called to save and restore system state. ``` Reading data file Dangerous 1-Dimensional parameter value detected ``` Figure 6. Output of the user program after hardening V. FUTURE WORK Although the experimental results to date are successful and promising, the following aspects should be considered to make the process more practical for hardening generic user software. - Scale the hardening capability to encompass more data types. Simple data types are probably easier to protect than complex parameters such as data structures. The challenge is to protect these complex data types while avoiding false alarms. - Implement random sampling to increase dimensionality analysis confidence. Because the Failure Analyzer bases its conclusion purely on the test response pattern, validation testing by random sampling before reaching a conclusion will increase prediction accuracy and avoid at least some false alarms. - Adopt the Xmangler tool introduced in [8]. Using this tool, we will be able to protect COTS modules at the object code level. No source code is required to harden a module. - Add on user-defined hooks to direct exceptional input value handling to user functions. VI. CONCLUSIONS The objective of this research is to explore the possibility of generating robustness failure protection code automatically. We have been successful in achieving limited results for integers, floating point numbers, and `NULL` pointer values. This proves that automatic protection code generation for COTS software is feasible. It remains to be seen to what extent it can be generalized to other data types. A template-based protection code generation methodology directed by the Dimensionality Model is discussed in detail. Protection code generation includes four phases: detection, diagnosis, protection code generation and linking. This paper puts emphasis on the automation of diagnosis and protection code generation phases. The Dimensionality Model is used in the diagnosis phase to pinpoint the trigger for a failure. The result is utilized by the code generator to effectively generate protection code. The cost and development time of software could be significantly reduced if there were a widely used component industry. [1] Automatic robustness hardening might enable more people to use commercial software modules for mission critical applications and safety critical applications, and to reuse legacy software modules for new and existing applications. Although there are many factors that must be addressed in using a COTS software component approach, automated robustness hardening may be one technique that helps developers reduce design costs and improve time to market while producing a robust system. ACKNOWLEDGEMENT This research was sponsored by DARPA ITO under contract DABT 63-96-C-0064. REFERENCES
{"Source-Url": "http://repository.cmu.edu/cgi/viewcontent.cgi?article=1700&context=isr", "len_cl100k_base": 5491, "olmocr-version": "0.1.50", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 27381, "total-output-tokens": 6653, "length": "2e12", "weborganizer": {"__label__adult": 0.0003097057342529297, "__label__art_design": 0.0002231597900390625, "__label__crime_law": 0.00033020973205566406, "__label__education_jobs": 0.0003116130828857422, "__label__entertainment": 4.744529724121094e-05, "__label__fashion_beauty": 0.00012153387069702148, "__label__finance_business": 0.00014328956604003906, "__label__food_dining": 0.0002849102020263672, "__label__games": 0.0004050731658935547, "__label__hardware": 0.000926971435546875, "__label__health": 0.000392913818359375, "__label__history": 0.0001341104507446289, "__label__home_hobbies": 6.186962127685547e-05, "__label__industrial": 0.0002589225769042969, "__label__literature": 0.00018846988677978516, "__label__politics": 0.00017964839935302734, "__label__religion": 0.0003147125244140625, "__label__science_tech": 0.01146697998046875, "__label__social_life": 6.812810897827148e-05, "__label__software": 0.005756378173828125, "__label__software_dev": 0.9775390625, "__label__sports_fitness": 0.00021779537200927737, "__label__transportation": 0.00033736228942871094, "__label__travel": 0.00014460086822509766}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27960, 0.0243]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27960, 0.62797]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27960, 0.8423]], "google_gemma-3-12b-it_contains_pii": [[0, 285, false], [285, 2955, null], [2955, 7076, null], [7076, 10345, null], [10345, 14216, null], [14216, 17502, null], [17502, 20016, null], [20016, 21743, null], [21743, 25111, null], [25111, 27960, null]], "google_gemma-3-12b-it_is_public_document": [[0, 285, true], [285, 2955, null], [2955, 7076, null], [7076, 10345, null], [10345, 14216, null], [14216, 17502, null], [17502, 20016, null], [20016, 21743, null], [21743, 25111, null], [25111, 27960, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 27960, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27960, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27960, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27960, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27960, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27960, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27960, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27960, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27960, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27960, null]], "pdf_page_numbers": [[0, 285, 1], [285, 2955, 2], [2955, 7076, 3], [7076, 10345, 4], [10345, 14216, 5], [14216, 17502, 6], [17502, 20016, 7], [20016, 21743, 8], [21743, 25111, 9], [25111, 27960, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27960, 0.07383]]}
olmocr_science_pdfs
2024-11-27
2024-11-27
f43c5cb76cf33485170510718b2ded7327e777a5
setsApp for Cytoscape: Set operations for Cytoscape Nodes and Edges [version 2; peer review: 3 approved] John H. Morris¹, Samad Lotia², Allan Wu¹, Nadezhda T. Doncheva¹,³, Mario Albrecht⁴-⁶, Alexander R. Pico⁴,², Thomas E Ferrin¹ ¹Resource for Biocomputing, Visualization, and Informatics, University of California, San Francisco, CA 94143, USA ²Gladstone Institutes, San Francisco, CA, USA ³Max Planck Institute for Informatics, Saarbrücken, 66123, Germany ⁴University Medicine Greifswald, Greifswald, 17489, Germany ⁵Graz University of Technology, Graz, 8010, Austria ⁶BioTechMed-Graz, Graz, 8036, Austria Abstract setsApp (http://apps.cytoscape.org/apps/setsapp) is a relatively simple Cytoscape 3 app for users to handle groups of nodes and/or edges. It supports several important biological workflows and enables various set operations. setsApp provides basic tools to create sets of nodes or edges, import or export sets, and perform standard set operations (union, difference, intersection) on those sets. Automatic set partitioning and layout functions are also provided. The sets functionality is also exposed to users and app developers in the form of a set of commands that can be used for scripting purposes or integrated in other Cytoscape apps. Keywords cytoscape, app, sets functionality This article is included in the Cytoscape Apps gateway. This article is included in the International Society for Computational Biology Community Journal gateway. Open Peer Review Reviewer Status ✓ ✓ ✓ Invited Reviewers 1 Jiguang Wang, Columbia University, New York, NY, USA 2 Thomas Kelder, EdgeLeap B.V., Utrecht, The Netherlands 3 Tamara Munzner, University of British Columbia, Vancouver, BC, Canada Any reports and responses or comments on the article can be found at the end of the article. Corresponding author: John H. Morris (scooter@cgl.ucsf.edu) Competing interests: No competing interests were disclosed. Grant information: JHM, SL and AP were funded by NIGMS grants P41-GM103504 and P41-GM103311. AW and TF were funded by NIGMS grant P41-GM103311. NTD was partially funded by a Boehringer Ingelheim Fonds travel grant, and her research was conducted in the context of the DFG-funded Cluster of Excellence for Multimodal Computing and Interaction. MA was financially supported by the projects GANI_MED and BioTechMed-Graz. Copyright: © 2015 Morris JH et al. This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. How to cite this article: Morris JH, Lotia S, Wu A et al. setsApp for Cytoscape: Set operations for Cytoscape Nodes and Edges [version 2; peer review: 3 approved] F1000Research 2015, 3:149 (https://doi.org/10.12688/f1000research.4392.2) Introduction CytoScape\textsuperscript{1,2} provides an environment for the visualization and analysis of networks and associated annotations. The primary audience for CytoScape is the biological community and CytoScape supports a number of standard use cases for analyzing and visualizing biological data. Many of these use cases involve the selection of a number of nodes or edges based on some analysis or annotation and either performing an action on that selection or comparing those nodes or edges to a different set of nodes or edges that resulted from alternative analyses or analyses based on alternative annotations. The core capabilities for CytoScape provide some tools to facilitate these types of comparisons but they can be counterintuitive or complicated to use. \textit{setsApp} is a CytoScape 3 application that provides a general set of tools for users and developers to define and maintain sets of nodes or edges and compare those sets using the standard set operations of union, intersection, and difference. Partition and layout features are also provided to assist in generating sets and performing set-aware layouts. In this paper, we present the implementation of \textit{setsApp}, in particular, how \textit{setsApp} integrates with the CytoScape command system, and then present a sample biological workflow using \textit{setsApp}. Implementation CytoScape provides two approaches to implementing apps: a simple app and a bundle app. Simple apps are implemented using the same general approach as in CytoScape 2.8, but at the cost of significant flexibility. Bundle apps utilize Open Service Gateway Initiative (OSGi)\textsuperscript{3} interfaces through APIs provided by CytoScape to interact with the CytoScape core functionality. \textit{setsApp} is implemented as a bundle app and utilizes the CytoScape 3.1.0 API. There are three main components to the \textit{setsApp} implementation: the user interface, the command interface, and the underlying data model for maintaining sets of nodes and edges. User interface The \textit{setsApp} user interface consists of menu items in the main Apps menu, node and edge context menus, and a panel added to the Control Panel (left or west) section of the CytoScape user interface. The main feature of the Sets panel is the list of currently defined sets. Each set can be expanded to see all of the nodes or edges within that set, and context menus provide the ability to select, deselect, rename, or remove sets. As long as you have one set defined, Partition and Layout buttons will be active at the bottom of the panel. The partition feature will create new sets based on shared and excluded sets present in all currently defined sets. The layout feature will perform the selected layout algorithm taking into account set memberships, i.e., attempting to keep sets close together. When multiple sets are selected, the Set Operations buttons are enabled. This allows users to create new sets based on the union, intersection, or difference of other sets. Note that the results of a union or intersection are well-defined for multiple sets, but the difference operation is order dependent. If only two sets are selected, the order of selection is preserved. If more than two sets are selected, the order is the order of selection, so care must be taken when attempting to create a difference set of more than two sets. Sets can be created from the currently selected nodes or edges, or based on a particular node or edge attribute. When creating sets from attributes, the user will need to supply a prefix for the sets to be created and choose the attribute (currently only String attributes are supported) from a list. Sets can also be created by importing them from a simple text file. Each set can be individually exported to a text file. \textit{setsApp} provides a context menu for sets and set members in the control pane. In addition to having menu items to manage sets, the user may select all set members in the network, or if the set is expanded, individual members. This functionality presents an easy way for users to visualize the results of set operations and to perform interactive exploratory analysis. The menus provided through the top-level Apps menu offer the same functionality as the Create set from menu in the \textit{setsApp} control panel with the addition of a menu to import a set from a file. Node and edge context menus provide the user with the ability to add or remove the corresponding node or edge from sets. Command interface In addition to the standard user interface described above, \textit{setsApp} provides a number of “commands”. These commands may be used for scripting purposes or by other CytoScape apps that wish to take advantage of the \textit{setsApp} functionality. Table 1 provides a list of commands and the arguments. A command is made available to CytoScape by creating a standard CytoScape TaskFactory with two new properties in the org.cytoscape.work package: ServiceProperties.COMMAND_NAME and ServiceProperties.SPACE, which is always set to “setsApp”; and ServiceProperties.COMMAND, which is the command name (e.g., “addTo”). The command arguments are implemented as Tunables within the Task called by the designated TaskFactory. Because there is no guarantee that the Task will be executed within the context of a GUI, care should be taken to make sure that the appropriate Tunable types are used. For example, the NodeList Tunable allows the command-line user to enter a list of nodes rather than assuming that the user will have selected nodes interactively. For another CytoScape app to use any of these commands, it would need to call one of the CytoScape TaskManagers and provide it org.cytoscape.command.CommandExecutorTaskFactory’s createTaskIterator method with the appropriate argument map, command, and command namespace. The TaskObserver method may be used if the command returns any values. For example: Table 1. setsApp Commands. Arguments with asterisks are required. <table> <thead> <tr> <th>Command</th> <th>Arguments</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td>setsApp addTo</td> <td>edgeList=list of edges* nodeList=list of nodes* network=network to use name=name of set*</td> <td>Adds the listed nodes or edges to the named set. An error will occur if the types (node or edge) do not match or if the set does not exist. The set name and one of edgeList or nodeList are required.</td> </tr> <tr> <td>setsApp createSet</td> <td>edgeList=list of edges* nodeList=list of nodes* network=network to use name=name of set*</td> <td>Creates the set from the edge or node list. It throws an error if both edge and node lists are provided.</td> </tr> <tr> <td>setsApp difference</td> <td>name=name of new set* set1=name of the first set* set2=name of the second set*</td> <td>Performs a difference of two sets and puts the result into a new set.</td> </tr> <tr> <td>setsApp export</td> <td>Column=column containing the id key name=name of set* setFile=path to the file to import*</td> <td>Exports a set to the specified file using the designated column to identify the node or edge.</td> </tr> <tr> <td>setsApp import</td> <td>Column=column containing the id key Type={Node</td> <td>Edge}* name=name of set* setFile=path to the file to import*</td> </tr> <tr> <td>setsApp intersect</td> <td>name=name of new set* set1=name of the first set* set2=name of the second set*</td> <td>Performs an intersection of two sets and puts the result into a new set.</td> </tr> <tr> <td>setsApp remove</td> <td>name=name of set*</td> <td>Removes (deletes) the set.</td> </tr> <tr> <td>setsApp removeFrom</td> <td>edgeList=list of edges* nodeList=list of nodes* network=network to use name=name of set*</td> <td>Removes the listed nodes or edges from the named set. An error will occur if the types (node or edge) do not match or if the set does not exist. The set name and one of edgeList or nodeList are required.</td> </tr> <tr> <td>setsApp rename</td> <td>newName=new name for the set oldName=old (current) name for the set</td> <td>Renames an existing set.</td> </tr> <tr> <td>setsApp union</td> <td>name=name of new set* set1=name of the first set* set2=name of the second set*</td> <td>Performs a union of two sets and puts the result into a new set.</td> </tr> </tbody> </table> Listing 1. Example Command Usage. ```java SynchronousTaskManager tm = serviceRegistrar.getService( SynchronousTaskManager.class ); CommandExecutorTaskFactory cetf = serviceRegistrar.getService( CommandExecutorTaskFactory.class ); Map<String, Object> argMap = new HashMap<String, Object>(); argMap.put("name", "NewSet"); // selected is a special keyword for the NodeList tunable argMap.put("nodeList","selected"); // the current network argMap.put("network","current"); // Assumes that this implements TaskObserver tm.execute(cetf.createTaskIterator("setsApp", "createSet", argMap, this), this); ``` Data model The main model object for a node or edge set is the Set object, which stores a map of all of the nodes or edges in this set. A SetsManager provides the methods to create and destroy sets. The SetsManager also serves the critical function of serializing the information about Sets to the default hidden table (see CyNetwork.HIDDEN_ATTRS) for nodes or edges (depending on the type of the Set). Each Set is created as a boolean column in the hidden table which is set to true if the corresponding node or edge is in that set. By storing values in the default hidden tables, the information about sets is automatically saved in Cytoscape sessions and restored when sessions are reloaded. SetsManager implements SessionReloadedListener and recreates the Sets from the information stored in the hidden table columns. Results A simple example use case might be the exploration of the data set from Ideker et al., 2001\(^1\), which measured the change in expression for 331 genes after a systematic deletion of genes known to be involved in the Saccharomyces cerevisiae switch to galactose metabolism. This data was combined with known protein-protein and protein-DNA interactions to explore the biological response to deletions in the presence (the G in the column names) or absence of galactose in the medium. This data set is now included as a sample with Cytoscape downloads (galFiltered.cys). In our workflow we use Cytoscape’s Select panel to select all proteins that are underexpressed (gal1RGexp < -0.5 fold change) in the deletion of GAL1 (Figure 1). That selection is saved as a set named GAL1- (Apps → SetsApp → Create node set). We then select all of the proteins that are overexpressed (gal1RGexp > 0.5 fold change) in the deletion of GAL1 and save that selection as a set named GAL1+. Repeating this for GAL4 (column gal4RGexp) and GAL80 (column gal80Rexp) results in 6 sets altogether: GAL1+, GAL1-, GAL4+, GAL4-, GAL80+, GAL80- (Figure 2). Note that the data for GAL1 and GAL4 is in the presence of galactose, but the data for GAL80 is in the absence of galactose since GAL80 is a known repressor of GAL4. Given those six sets of genes, we can explore the data sets by looking at combinations of the sets. For example, we could look at the intersection of all of the underexpressed proteins by selecting each of GAL1-, GAL4-, and GAL80- in the Sets panel and pressing the Intersection button in the Set Operations box near the bottom of the panel. If we name the resulting set GAL-, we see that it contains a single gene: YOL058W (ARG1). In this data set of 331 genes, only this one gene is repressed for all three of the deleted GAL genes. In the absence of galactose when GAL80 is deleted, ARG1 is underexpressed, and in the presence of galactose when either GAL1 or GAL4 are deleted the gene is also underexpressed. Looking at the expression significance values in the Node Table Panel of Cytoscape (gal1RGsig, gal4RGsig, and gal80Rsig) this is a highly significant result, although there is no direct correlation between the galactose switch and arginine biosynthesis regulation that we were able to find in the literature. On the other hand, ARG1 is regulated by the GCN4 activator which is known to repress protein synthesis during periods of stress or starvation5, which explains the significant down-regulation of ARG1. We can perform a similar analysis to understand the consistent up-regulation of the five genes in the GAL+ set corresponding to gene symbols: GIP1, NCE103, YIG1, POT1, and ICL1. Figure 2 shows the results of the intersection operations. We can also explore data sets by using layout algorithms that are informed by the sets we created earlier. By default, Cytoscape provides over a dozen layout algorithms that spatially place nodes in order to help elucidate meaningful patterns of relationships in networks. Most layout algorithms take into account connectivity between nodes. SetsApp augments Cytoscape by supplying two additional layout algorithms that take set membership into account. The setsbased grid layout places nodes in the same set together into independent grids, i.e., a grid of grids. This is ideal for quickly separating nodes in different sets for manual manipulation later on. The setsbased force directed layout employs the Prefuse force directed layout provided by Cytoscape but also tries to put nodes in the same set closer together in the network. Users can adjust the force between nodes in a given set relative to connected nodes and thereby emphasize or diminish the grouping based on set membership by changing values in the layout settings panel (Layout → Settings...). Figure 1. Screenshot of Cytoscape’s Select panel with underexpressed genes in the gal1RGexp condition being selected. Nodes that match the gal1RGexp condition are highlighted in red. Figure 2. Screenshot of Cytoscape showing the Sets panel with all condition sets created. Nodes in the GAL+ set are highlighted in red. Conclusions There are many Cytoscape workflows that could take advantage of the features of setsApp. Any workflow that might want to look for groups of nodes or edges that share multiple traits, or that explicitly do not share those traits. While it is possible to duplicate many of the final results enabled by setsApp by using Cytoscape 3.1’s new Select panel, a user would need to know in advance exactly the combination of features that were biologically interesting. setsApp provides an alternative that allows users to explore various combinations of nodes and edges and to save such selections for later uses. We also provide layout algorithms that take set membership into consideration. In the workflow we developed above, we combined the functionality of Cytoscape’s Select panel with setsApp to explore combinations of sets of genes based on shared properties. There are many more sophisticated apps available to Cytoscape users that could be used to do a more thorough analysis of this data set including jActive-Modules®, clusterMaker® and RINalyzer®, however, the workflow above demonstrates the utility of a simple set-oriented approach to exploring networks. Software availability Software available from: http://apps.cytoscape.org/apps/setsApp Latest source code: https://github.com/RBVI/setsApp Source code as at the time of publication: https://github.com/F1000Research/setsApp Archived code as at the time of publication: http://www.dx.doi.org/10.5281/zenodo.104249 License: Lesser GNU Public License 3.0: https://www.gnu.org/licenses/lgpl.html Author contributions JHM and SL wrote the manuscript and enhanced the app. AW ported the initial version of the app from Cytoscape 2.8 to Cytoscape 3. NTD wrote the initial version of the app. MA, AP and TF supervised app development and provided input on the manuscript. Competing interests No competing interests were disclosed. Grant information JHM, SL and AP were funded by NIGMS grants P41-GM103504 and P41-GM103311. AW and TF were funded by NIGMS grant P41-GM103311. NTD was partially funded by a Boehringer Ingelheim Fonds travel grant, and her research was conducted in the context of the DFG-funded Cluster of Excellence for Multimodal Computing and Interaction. MA was financially supported by the projects GANI_MED and BioTechMed-Graz. References Open Peer Review Current Peer Review Status: ✔ ✔ ✔ Version 2 Reviewer Report 06 August 2015 https://doi.org/10.5256/f1000research.7271.r9845 © 2015 Munzner T. This is an open access peer review report distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. Tamara Munzner Department of Computer Science, University of British Columbia, Vancouver, BC, Canada Revisions are reasonable. Competing Interests: No competing interests were disclosed. I confirm that I have read this submission and believe that I have an appropriate level of expertise to confirm that it is of an acceptable scientific standard. Version 1 Reviewer Report 28 July 2014 https://doi.org/10.5256/f1000research.4701.r5299 © 2014 Munzner T. This is an open access peer review report distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. Tamara Munzner Department of Computer Science, University of British Columbia, Vancouver, BC, Canada This short article clearly describes the setsApp plugin for Cytoscape and walks the reader through example analysis. It ends with a useful disclaimer that the goal of the app is to provide users with a simple workflow, rather than completely novel capabilities. The paragraph covering TaskFactory details will probably require multiple passes for readers unfamiliar with Cytoscape internals, but the major point can still be gleaned from the write-up as it stands. Minor issue: It would be easier to read if the Figures were renumbered so that they match the order of discussion in the text; now Figure 1 comes after 2 and 3. **Competing Interests:** No competing interests were disclosed. I confirm that I have read this submission and believe that I have an appropriate level of expertise to confirm that it is of an acceptable scientific standard. 1. Is it valid to perform the operations across the different networks? 2. In case sets have been defined for multiple networks, it is hard to see in the Sets panel to which network each set belongs. The only way I could find was to click the set and choose “Select” so the nodes get selected in the corresponding network. It would be useful to group the sets by network or indicate the parent network otherwise (i.e. different colors of the red dots). 3. Small GUI tweak proposal: in the dialog where the user needs to specify the set name, it would be handy if the “Enter” key would map to the “Ok” button, so you don’t have to switch to the mouse. It would be more intuitive and speed up the creation of several sets. **Competing Interests:** No competing interests were disclosed. I confirm that I have read this submission and believe that I have an appropriate level of expertise to confirm that it is of an acceptable scientific standard. The benefits of publishing with F1000Research: - Your article is published within days, with no editorial bias - You can publish traditional articles, null/negative results, case reports, data notes and more - The peer review process is transparent and collaborative - Your article is indexed in PubMed after passing peer review - Dedicated customer support at every stage For pre-submission enquiries, contact research@f1000.com
{"Source-Url": "https://f1000researchdata.s3.amazonaws.com/manuscripts/7271/8bbad93b-c268-414b-81bc-f2d4ea8c1b97_4392_-_scooter_morris_v2.pdf?doi=10.12688/f1000research.4392.2&numberOfBrowsableCollections=21&numberOfBrowsableInstitutionalCollections=5&numberOfBrowsableGateways=23", "len_cl100k_base": 5133, "olmocr-version": "0.1.53", "pdf-total-pages": 11, "total-fallback-pages": 0, "total-input-tokens": 29849, "total-output-tokens": 6171, "length": "2e12", "weborganizer": {"__label__adult": 0.0002903938293457031, "__label__art_design": 0.0004200935363769531, "__label__crime_law": 0.0003581047058105469, "__label__education_jobs": 0.0018320083618164065, "__label__entertainment": 0.00020122528076171875, "__label__fashion_beauty": 0.00021660327911376953, "__label__finance_business": 0.0005979537963867188, "__label__food_dining": 0.0004100799560546875, "__label__games": 0.0007581710815429688, "__label__hardware": 0.0017786026000976562, "__label__health": 0.000912189483642578, "__label__history": 0.00036525726318359375, "__label__home_hobbies": 0.00021195411682128904, "__label__industrial": 0.0005903244018554688, "__label__literature": 0.00036525726318359375, "__label__politics": 0.0003497600555419922, "__label__religion": 0.0004935264587402344, "__label__science_tech": 0.2498779296875, "__label__social_life": 0.0002524852752685547, "__label__software": 0.1322021484375, "__label__software_dev": 0.6064453125, "__label__sports_fitness": 0.00038909912109375, "__label__transportation": 0.0004470348358154297, "__label__travel": 0.0002371072769165039}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 24410, 0.02898]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 24410, 0.28759]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 24410, 0.87684]], "google_gemma-3-12b-it_contains_pii": [[0, 1812, false], [1812, 2939, null], [2939, 8894, null], [8894, 13111, null], [13111, 16789, null], [16789, 19245, null], [19245, 20969, null], [20969, 22640, null], [22640, 23029, null], [23029, 23979, null], [23979, 24410, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1812, true], [1812, 2939, null], [2939, 8894, null], [8894, 13111, null], [13111, 16789, null], [16789, 19245, null], [19245, 20969, null], [20969, 22640, null], [22640, 23029, null], [23029, 23979, null], [23979, 24410, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 24410, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 24410, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 24410, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 24410, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 24410, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 24410, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 24410, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 24410, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 24410, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 24410, null]], "pdf_page_numbers": [[0, 1812, 1], [1812, 2939, 2], [2939, 8894, 3], [8894, 13111, 4], [13111, 16789, 5], [16789, 19245, 6], [19245, 20969, 7], [20969, 22640, 8], [22640, 23029, 9], [23029, 23979, 10], [23979, 24410, 11]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 24410, 0.08889]]}
olmocr_science_pdfs
2024-12-10
2024-12-10
3b6a34ddf99d93d921c093a1bfa0e24fa5c97715
INTRODUCTION The marking schemes which follow were those used by WJEC for the Summer 2015 examination in GCSE COMPUTER SCIENCE. They were finalised after detailed discussion at examiners' conferences by all the examiners involved in the assessment. The conferences were held shortly after the papers were taken so that reference could be made to the full range of candidates' responses, with photocopied scripts forming the basis of discussion. The aim of the conferences was to ensure that the marking schemes were interpreted and applied in the same way by all examiners. It is hoped that this information will be of assistance to centres but it is recognised at the same time that, without the benefit of participation in the examiners' conferences, teachers may have different views on certain matters of detail or interpretation. WJEC regrets that it cannot enter into any discussion or correspondence about these marking schemes. ### GCSE COMPUTER SCIENCE #### SUMMER 2015 MARK SCHEME <table> <thead> <tr> <th>Qu</th> <th>Answer</th> <th>Marks</th> <th>MAX</th> </tr> </thead> </table> | 1 | **One mark for each of:** 2. Controller 4. Internal memory 5. Arithmetic and Logic Unit (ALU) 7. Registers **Deduct one mark for each additional tick above 4** | <table> <thead> <tr> <th>2</th> <th>Backing storage</th> <th>Example of typical use (Suitability)</th> </tr> </thead> <tbody> <tr> <td></td> <td>Solid state</td> <td>Moving small files from work to home</td> </tr> </tbody> </table> | | External hard drive | Backing up an internal hard disc | | | Transferring or using (large) files from machine to machine | | | Magnetic tape | Backing up a large commercial server | NOTE cloud storage could replace either of the backing storage methods above but MUST be a different method for each scenario. <table> <thead> <tr> <th>2</th> <th>Backing storage 1</th> <th>Backing storage 2</th> <th>Backing storage 3</th> <th>Backing storage 4</th> </tr> </thead> <tbody> <tr> <td></td> <td>Solid state</td> <td>External hard drive</td> <td>Compact Disc</td> <td>Magnetic Tape</td> </tr> </tbody> </table> NOTE order of devices must be as above but cloud storage could replace any of the devices as access speed would depend on speed of connection and cloud storage provider. © WJEC CBAC Ltd. Marking – one mark for each disadvantage which needs to be clarified, perhaps with an example, for additional mark Disadvantages of network - A network manager may need to be employed o which might be expensive - Could be infected with a virus o that could spread to all other computers - Security problems o receives traffic from other networks - Hackers may gain access o as network only as secure as weakest point of entry o to data and steal/destroy - The server / switch could go down (main cable break) so o all workstations on the network are affected - Can be expensive to set up o as Initial cost of servers, communication devices, switches, network software etc. - Substantial Initial disruption o drilling holes, fitting trunking, running cables between buildings etc… - Can have a slow response time o due to heavy network traffic o so users cannot work as effectively - Detecting network problems can be more difficult on a network o difficult to isolate - Can be slow to login to a network o As slow to download software / check password - Only limited storage space available on network o Have access to all hard disc drive on standalone computer - Time and effort to set up users o Can just start a standalone and use computer Marking – any three rules from: - Passwords must contain numeric and not numeric characters - Passwords must contain upper case and lower case characters - Passwords must contain non-alphanumeric characters - Passwords must be a minimum length - Passwords must not be written down or divulged to anyone else - Passwords must be changed regularly - Not re-use password - Not containing obvious guessable things such as name or DOB - Not be recognisable series of characters such as 1234 or ABCD or QWERTY - Passwords can be randomly generated Pupils will have read and write access to all their files Pupils will only have read access OR Teachers will have read and write access to all their files Global - Num1 or Num2 Local – Total CONDONE 'is integer' with the variable but nothing else 4 (b) Global variables can be used throughout the whole program (or project) Local variables can only be used in the procedure/module/function/subprogram where they are declared 5 (a) Differences between a compiler and interpreter are: A compiler translates the whole program in one go whereas An interpreter translates each line of code (often an intermediate code) at run time A compiler produces an executable file that will run on the target hardware machine without the compiler being installed A run time interpreter will be required at run time Compilers tend to be large complex programs Interpreters are smaller simpler programs Interpreted programs can be amended and run without translating whole program Compiled programs have to be re-compiled after a change Compilers compile programs that will usually only run on the target platform (hardware/operating system) Interpreters will interpret same program (or intermediate code) on different (some virtual) platforms 5 (b) Assemblers translate low level (assembly language) code into machine code. 6 (a) One mark for each correct row <table> <thead> <tr> <th>Row</th> <th>Data</th> </tr> </thead> <tbody> <tr> <td>2</td> <td>0111 1000</td> </tr> <tr> <td>4</td> <td>0100 0000</td> </tr> <tr> <td>5</td> <td>0111 0000</td> </tr> </tbody> </table> 6 (b) 10 \times 1 = 10 6 (c) 256 colours would require 1 byte 6 (d) (i) CONDONE 3 bytes if it clear that there is one byte for each red, green and blue 6 (d) (ii) 1 mark for method, 1 mark for answer 10 \times 8 \times 1 = 80 bytes 6 (d) (ii) CONDONE 240 bytes with calculation 10 \times 8 \times 3 = 240 bytes One mark for each facility named, and one mark for each description. Facilities offered by Software Development Environments include: - Editor: this allows a programmer to enter and edit source code - Automatic formatting: Correctly indents code - Automatic colour coding: Changes key words, literals and annotation to different colours - Linker: this is a program which allows previously compiled code, from software libraries, to be linked together - Loader: this is a program which loads previously compiled code into memory. - Debugger: this is a program which helps locate, identify and rectify errors in a program - Syntax error detection: Highlighting syntax errors before code is translated - Trace: this is a facility which displays the order in which the lines of a program are executed, and possibly the values of variables as the program is being run - Break point: this is a facility which interrupts a program on a specific line of code, allowing the programmer to compare the values of variables against expected values. The program code can then usually be executed one line at a time. This is called single-stepping - Variable watch: this is a facility which displays the current value of any variable. The value can be 'watched' as the program code is single-stepped to see the effects of the code on the variable. Alternatively a variable watch may be set, which will interrupt the program flow if the watched variable reaches a specified value - Memory inspector: this is a facility which will display the contents of a section of memory - Error diagnostics: these are used when a program fails to compile or to run. Error messages are displayed to help the programmer diagnose what has gone wrong - Emulator: will provide an emulator to run the code/app so no physical device required - Context sensitive menu: SDE suggests available options - Statement completion: SDE will complete a statement such as adding an 'end if' to an 'if' statement - GUI creation: Allows programmer to create a GUI by dragging and dropping controls (buttons, etc...) onto a form. - Publisher: facility to package up and deploy program as an easy to install package Marking – example could be the description or an actual example Examples of private functions include: standard mathematical operations such as square root or random number generator Examples of subprograms include: standard input / output routines such as saving data to disk One mark for each correct answer: <table> <thead> <tr> <th></th> <th>A</th> <th>B</th> <th>A AND B</th> </tr> </thead> <tbody> <tr> <td>0</td> <td>0</td> <td></td> <td>0</td> </tr> <tr> <td>0</td> <td>1</td> <td></td> <td>0</td> </tr> <tr> <td>1</td> <td>0</td> <td></td> <td>0</td> </tr> <tr> <td>1</td> <td>1</td> <td></td> <td>1</td> </tr> </tbody> </table> 8 (b) <table> <thead> <tr> <th>C</th> <th>0</th> <th>0</th> <th>0</th> <th>0</th> <th>0</th> <th>0</th> <th>1</th> </tr> </thead> </table> Marking - A one in last column and rest blank award one mark - For all zeros and a one in last column award two marks 8 (c) The 6 most significant bits are always 0 The least significant bit in register C takes the value of the least significant bit in B (is changed to 1) Masking of the 6 most significant bits accepted not expected (both marks for this) 9 1 mark for naming each role up to a maximum of four 1 mark for description up to a maximum of four Manages peripherals such as input and output devices - Sends data to output devices such as monitors - Receives data from input devices such as mouse/keyboard Manages printing using spooling - Data is stored on hard disc in a queue - Document is printed when printer is free / in correct order - Benefit of spooling - User can carry on working / log off when waiting for job to print Manages backing store - Ensures that data is stored and can be retrieved correctly from any disc drive - Creates and maintains filing system such as FAT or NTFS (accepted but not expected) - Organise files in a hierarchical directory structure. Carries out file compression - Where files are made smaller - Which saves space Carries out disc de-fragmentation - Where disc access speed can be increased - Is moving file parts closer together Manages memory (RAM) - Allocates memory to programs currently executing - Ensures programs / data do not corrupt each other - Ensures all programs and data including itself is stored in correct memory locations Manages processes - Ensures different processes can utilise the CPU and do not interfere with each other or crash - Allows user to run programs - On a multi-tasking O/S ensure that all tasks appear to run simultaneously - Allocates time slices - Scheduling of programs - Handles interrupts - Allows user to configure hardware 10 Marking One mark for all literals correct – ‘Total is’ and ‘Mean is’ One mark for 1 3 6 10 15 One mark for correct mean 3 Output would be: Total is 1 Total is 3 Total is 6 Total is 10 Total is 15 Mean is 3 11 1 mark for naming each error 1 mark for suitable example (there are many suitable examples) <table> <thead> <tr> <th>Error</th> <th>Suitable Example</th> </tr> </thead> <tbody> <tr> <td>Syntax</td> <td>Incorrect: IF A AND B Then</td> </tr> <tr> <td></td> <td>Correct: IF A AND B Then</td> </tr> <tr> <td>Semantic</td> <td>Attempting to assign incorrect data type</td> </tr> <tr> <td></td> <td>integer = real</td> </tr> <tr> <td>Runtime or Execution</td> <td>Division by zero</td> </tr> <tr> <td></td> <td>Reading past end of file or out of memory</td> </tr> <tr> <td>Logical</td> <td>Count = Count – 1 should be</td> </tr> <tr> <td></td> <td>Count = Count + 1</td> </tr> <tr> <td>Linking</td> <td>When the Square Root function is used and</td> </tr> <tr> <td></td> <td>the library that calculates the Square Root</td> </tr> <tr> <td></td> <td>has not been linked to the program.</td> </tr> <tr> <td>Rounding</td> <td>34.5 rounded to nearest whole number is 35,</td> </tr> <tr> <td></td> <td>an error of +0.5.</td> </tr> <tr> <td>Truncation</td> <td>34.9 truncated to whole number is 34, an</td> </tr> <tr> <td></td> <td>error of -0.9.</td> </tr> </tbody> </table> 12 (a) \[212 \rightarrow 11010100\] \[ \begin{array}{cccccccc} 2^7 & 2^6 & 2^5 & 2^4 & 2^3 & 2^2 & 2^1 & 2^0 \\ 128 & 64 & 32 & 16 & 8 & 4 & 2 & 1 \\ \end{array} \] \[ \begin{array}{cccccccc} 1 & 1 & 0 & 1 & 0 & 1 & 0 & 0 \\ 128 & +64 & +16 & +4 & =212 \\ \end{array} \] 1 mark for each correct nibble 1101 0100 12 (b) \[1101\ 0100 \rightarrow \ D 4\] 1101 \rightarrow D 0100 \rightarrow 4 © WJEC CBAC Ltd. 12 (c) 1 mark for ONLY converting one Hex digit correctly 2 marks for converting both Hex digits correctly with correct answer 2F → 47 Convert via binary 2 → 0010 F → 1111 <table> <thead> <tr> <th>2⁷</th> <th>2⁶</th> <th>2⁵</th> <th>2⁴</th> <th>2³</th> <th>2²</th> <th>2¹</th> <th>2⁰</th> </tr> </thead> <tbody> <tr> <td>128</td> <td>64</td> <td>32</td> <td>16</td> <td>8</td> <td>4</td> <td>2</td> <td>1</td> </tr> <tr> <td>0</td> <td>0</td> <td>1</td> <td>0</td> <td>1</td> <td>1</td> <td>1</td> <td></td> </tr> </tbody> </table> + 32 + 8 + 4 + 2 + 1 = 47 Alternatively convert direct <table> <thead> <tr> <th>16²</th> <th>16¹</th> <th>16⁰</th> </tr> </thead> <tbody> <tr> <td>256</td> <td>16</td> <td>1</td> </tr> <tr> <td>2</td> <td>F</td> <td></td> </tr> </tbody> </table> 2x16 15x1 32 + 15 = 47 ### How packet switching and routing operates - Data is split into packets before transmission - Packets are sent in-order but might arrive out of order and are re-assembled at destination - Each node can route a packet along different routes according to its routing table ### Contents of a packet - The actual data - Destination address - Source address - Order number of packet - Control signals / tracking information - Error control bits ### Benefits of transmitting packets using routers: - Each packet can take a different route through network which therefore makes it secure as it is difficult to intercept all the packets - Packets are less likely to be affected by network failure because they can simply take an alternative route - Each packet can take a different route through network which means more efficient use of data lines as packet can use least busy route - Each packet can take a different route through network which means a node failure does not stop the packet reaching its destination Accept answers using the network nodes in the diagram <table> <thead> <tr> <th>Score</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td>9 – 12 marks</td> <td>Contents of a packet, how packets are transmitted and benefits of transmitting packets using routers are all described. There will be few, if any, errors in spelling, grammar and punctuation. Technical terms will be used appropriately and correctly.</td> </tr> <tr> <td>5 – 8 marks</td> <td>Contents of a packet, how packets are transmitted and benefits of transmitting packets using routers are all described. There may be occasional errors in spelling, grammar and punctuation. Technical terms will be mainly correct.</td> </tr> <tr> <td>1 – 4 marks</td> <td>Superficial coverage of contents of a packet, how packets are transmitted or benefits of transmitting packets using routers. Information will be poorly expressed and there will be limited, if any, use of technical terms. There are significant errors in grammar, punctuation and spelling.</td> </tr> <tr> <td>0 marks</td> <td>No appropriate content.</td> </tr> </tbody> </table> ## Task 1 <table> <thead> <tr> <th>Answer</th> <th>MAX 6</th> </tr> </thead> </table> | One mark for each correct pair in the correct location: i.e. <h1> </h1> <center> </center> <b> </b> <a href="url"> </a> (Note http:// is required or the link will not work correctly on many devices) Accept either <p> or <p> </p> (No need to close p) Accept alternative tags e.g. <big></big> instead of <h1></h1>, etc Accept alternative solutions which work. (Only if the identical formatting would be achieved.) <html><body> <center> <h1> Cloud Storage for you! </h1> <p> <i> Access your data anywhere! </i> </p> </center> <p> <b><u> Cloud Storage </u></b> is the powerful and convenient way to access all of your information, documents, pictures, music and videos wherever you are, using any device!</p> <p>Click the link below to find out more.</p> <p> <a href="http://www.cloudstorageforyou.co.uk/">www.cloudstorageforyou.co.uk </a> </p> </body></html> | 1 1(centre) 1(h1) 1(p & i) (/centre here) 1(b & u) only award if all. 1 (only if both href and http are present.) </body> /html required here for first mark) | <table> <thead> <tr> <th>Task 2</th> <th>Answer</th> <th>MAX 9</th> </tr> </thead> <tbody> <tr> <td></td> <td>The solution provides all correct outputs OR The solution provides some correct outputs</td> <td>2 marks OR 1 mark</td> </tr> <tr> <td></td> <td>Declare StaffMemberTotal array (1..99) of integer</td> <td>Condone no declarations</td> </tr> <tr> <td></td> <td>Declare NumberOfStaffMembers is integer</td> <td></td> </tr> <tr> <td></td> <td>Declare NumberSold is integer</td> <td></td> </tr> <tr> <td></td> <td>Declare i as integer</td> <td></td> </tr> <tr> <td></td> <td>Declare j as integer</td> <td></td> </tr> <tr> <td></td> <td>Declare k as integer</td> <td></td> </tr> <tr> <td></td> <td>Output &quot;Please enter number of Staff Members: &quot;</td> <td></td> </tr> <tr> <td></td> <td>Input NumberOfStaffMembers</td> <td></td> </tr> <tr> <td></td> <td>for i = 1 to NumberOfStaffMembers <em>(Repeat i)</em></td> <td></td> </tr> <tr> <td></td> <td>for j = 1 to 12 <em>(Repeat j)</em></td> <td></td> </tr> <tr> <td></td> <td>output &quot;Enter month&quot; j &quot;figures for Staff Member&quot; i</td> <td></td> </tr> <tr> <td></td> <td>input NumberSold</td> <td></td> </tr> <tr> <td></td> <td>if NumberSold&gt;4 then output &quot;Bonus awarded.&quot;</td> <td></td> </tr> <tr> <td></td> <td>StaffMemberTotal(i)=StaffMemberTotal(i) + NumberSold</td> <td></td> </tr> <tr> <td></td> <td>next j <em>(End for repeat until j = 12)</em></td> <td></td> </tr> <tr> <td></td> <td>next i <em>(End for repeat until 1 = NumberOfStaffMembers)</em></td> <td></td> </tr> <tr> <td></td> <td>Output &quot;Totals:&quot;</td> <td></td> </tr> <tr> <td></td> <td>for k = 1 to NumberOfStaffMembers <em>(Repeat)</em></td> <td></td> </tr> <tr> <td></td> <td>Output &quot;Staff Member &quot; k &quot;:&quot; StaffMemberTotal(k)</td> <td></td> </tr> <tr> <td></td> <td>next k <em>(End for repeat until k = NumberOfStaffMembers)</em></td> <td></td> </tr> <tr> <td></td> <td>End</td> <td></td> </tr> <tr> <td></td> <td>Please see marking notes on next page.</td> <td></td> </tr> <tr> <td></td> <td>Brackets+Bold text indicate other accepted Pseudocode.</td> <td></td> </tr> <tr> <td></td> <td>Accept i,j,k for loops, accept any other meaningful variable name. (e.g. Months,)</td> <td></td> </tr> <tr> <td>Amendments to check for 0 salesmen error (and any further validation) accepted not expected.</td> <td></td> <td></td> </tr> <tr> <td>Line numbers not necessary Ignore indentation or lack of it.</td> <td></td> <td></td> </tr> <tr> <td>Accept alternative solutions as long as they provide the exact same result.</td> <td></td> <td></td> </tr> <tr> <td>Task 3</td> <td>Answer</td> <td>MAX 15</td> </tr> <tr> <td>--------</td> <td>--------</td> <td>--------</td> </tr> <tr> <td><strong>11-15 Marks</strong></td> <td>The candidate has produced a complete working solution to the task. The program is written efficiently and has been compiled. The Ship turns left, right, up and down on key press and a sound is played when the ship collides with an Iceberg. The ship breaks icebergs on collision (removing them from the world), adding to the counter. The program has been written coherently, technical terms have been used correctly, the meaning is clear and there are no errors in spelling and punctuation. Only award 15 if all tasks completed correctly (including naming of files correctly and all tasks implemented fully)</td> <td><strong>15</strong></td> </tr> <tr> <td><strong>6-10 Marks</strong></td> <td>The candidate has produced a working solution. The program has been compiled but one or more of the elements is missing or incomplete. Technical terms have been used correctly, the meaning is clear and there are few errors in spelling and punctuation. Trivial syntax errors that prevent compilation of an otherwise functional solution should not be penalised.</td> <td><strong>10</strong></td> </tr> <tr> <td><strong>1-5 Marks</strong></td> <td>The candidate has produced a partial solution to the task but there is some evidence of functionality. Technical terms, where used, are correct, but there are significant errors in spelling and punctuation. Only award 5 if the file is saved correctly (task h)</td> <td><strong>5</strong></td> </tr> <tr> <td><strong>0 Marks</strong></td> <td>No valid response</td> <td><strong>0</strong></td> </tr> </tbody> </table> **Total Marks for Paper:** **30 Marks**
{"Source-Url": "http://pastpapers.download.wjec.co.uk/s15-computer-science-ms.pdf", "len_cl100k_base": 5749, "olmocr-version": "0.1.50", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 32570, "total-output-tokens": 5466, "length": "2e12", "weborganizer": {"__label__adult": 0.0007929801940917969, "__label__art_design": 0.0008778572082519531, "__label__crime_law": 0.000942707061767578, "__label__education_jobs": 0.251220703125, "__label__entertainment": 0.0002300739288330078, "__label__fashion_beauty": 0.00052642822265625, "__label__finance_business": 0.0011444091796875, "__label__food_dining": 0.0011091232299804688, "__label__games": 0.0022106170654296875, "__label__hardware": 0.00302886962890625, "__label__health": 0.001049041748046875, "__label__history": 0.0009059906005859376, "__label__home_hobbies": 0.0004045963287353515, "__label__industrial": 0.001079559326171875, "__label__literature": 0.00130462646484375, "__label__politics": 0.0006227493286132812, "__label__religion": 0.0014896392822265625, "__label__science_tech": 0.0214080810546875, "__label__social_life": 0.0005726814270019531, "__label__software": 0.01483154296875, "__label__software_dev": 0.69091796875, "__label__sports_fitness": 0.0009279251098632812, "__label__transportation": 0.001598358154296875, "__label__travel": 0.00048613548278808594}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 18872, 0.07592]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 18872, 0.40456]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 18872, 0.86915]], "google_gemma-3-12b-it_contains_pii": [[0, 0, null], [0, 939, false], [939, 2237, null], [2237, 4303, null], [4303, 5824, null], [5824, 8451, null], [8451, 10372, null], [10372, 12072, null], [12072, 12568, null], [12568, 14550, null], [14550, 15664, null], [15664, 17170, null], [17170, 17412, null], [17412, 18872, null], [18872, 18872, null]], "google_gemma-3-12b-it_is_public_document": [[0, 0, null], [0, 939, true], [939, 2237, null], [2237, 4303, null], [4303, 5824, null], [5824, 8451, null], [8451, 10372, null], [10372, 12072, null], [12072, 12568, null], [12568, 14550, null], [14550, 15664, null], [15664, 17170, null], [17170, 17412, null], [17412, 18872, null], [18872, 18872, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 18872, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 18872, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 18872, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 18872, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 18872, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 18872, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 18872, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 18872, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, true], [5000, 18872, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 18872, null]], "pdf_page_numbers": [[0, 0, 1], [0, 939, 2], [939, 2237, 3], [2237, 4303, 4], [4303, 5824, 5], [5824, 8451, 6], [8451, 10372, 7], [10372, 12072, 8], [12072, 12568, 9], [12568, 14550, 10], [14550, 15664, 11], [15664, 17170, 12], [17170, 17412, 13], [17412, 18872, 14], [18872, 18872, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 18872, 0.273]]}
olmocr_science_pdfs
2024-11-30
2024-11-30
3964930f2bd573f87d180a0f80e02dbb711a9dac
1 Introduction We begin this lecture by discussing how to compare running times of functions in an abstract, mathematical way. The same underlying mathematics can be used for other purposes, like comparing memory consumption or the amount of parellism permitted by an algorithm. We then use this to take a first look at sorting algorithms, of which there are many. In this lecture it will be selection sort because of its simplicity. In terms of our learning goals, we will work on: **Computational Thinking:** Still trying to understand how order can lead to efficient computation. Worst-case asymptotic complexity of functions. **Algorithms and Data Structures:** In-place sorting of arrays in general, and selection sort in particular. Big-O notation. **Programming:** More examples of programming with arrays and algorithm invariants. 2 Big-O Notation Our brief analysis in the last lecture already indicates that linear search in an array of size \( n \) should take about \( n \) iterations of a loop while binary search should take about \( \log_2(n) \) iterations, with a constant number of operations in each loop body. This suggests that binary search should more efficient. In the design and analysis of algorithms we try to make this mathematically precise by deriving so-called asymptotic complexity measures for algorithms. There are two fundamental principles that guide our mathematical analysis. 1. We only care about the behavior of an algorithm on large inputs, that is, when it takes a long time. It is when the inputs are large that differences between algorithms become really pronounced. For example, linear search on a 10-element array will be practically the same as binary search on a 10-element array, but once we have an array of, say, a million entries the difference will be huge. 2. We do not care about constant factors in the mathematical analysis. For example, in analyzing the search algorithms we count how often we have to iterate, not exactly how many operations we have to perform on each iteration. In practice, constant factors can make a big difference, but they are influenced by so many factors (compiler, runtime system, machine model, available memory, etc.) that at the abstract, mathematical level a precise analysis is neither appropriate nor feasible. Let’s see how these two fundamental principles guide us in the comparison between functions that measure the running time of an algorithm. Let’s say we have functions \( f \) and \( g \) that measure the number of operations of an algorithm as a function of the size of the input. For example \( f(n) = 3 \times n \) measures the number of comparisons performed in linear search for an array of size \( n \), and \( g(n) = 3 \times \log(n) \) measures the number of comparisons performed in binary search for an array of size \( n \). The simplest form of comparison would be \[ g \leq_0 f \text{ if for every } n \geq 0, \, g(n) \leq f(n). \] However, this violates principle (1) because we compare the values and \( g \) and \( f \) on all possible inputs \( n \). We can refine this by saying that eventually, \( g \) will always be smaller or equal to \( f \). We express “eventually” by requiring that there be a number \( n_0 \) such that \( g(n) \leq f(n) \) for all \( n \) that are greater than \( n_0 \). \[ g \leq_1 f \text{ if there is some } n_0 \text{ such that for every } n \geq n_0 \text{ it is the case that } g(n) \leq f(n). \] This now incorporates the first principle (we only care about the function on large inputs), but constant factors still matter. For example, according to the last definition we have \( 3 \times n \leq_1 5 \times n \) but \( 5 \times n \not\leq_1 3 \times n \). But if constant factors don’t matter, then the two should be equivalent. We can repair this by allowing the right-hand side to be multiplied by an arbitrary constant. \[ g \leq_2 f \text{ if there is a constant } c > 0 \text{ and some } n_0 \text{ such that for every } n \geq n_0 \text{ we have } g(n) \leq c \cdot f(n). \] This definition is now appropriate. The less-or-equal symbol \( \leq \) is already overloaded with many meanings, so we write instead: \[ g \in O(f) \text{ if there is a constant } c > 0 \text{ and some } n_0 \text{ such that for every } n \geq n_0 \text{ we have } g(n) \leq c \cdot f(n). \] This notation derives from the view of \( O(f) \) as a set of functions, namely those that eventually are smaller than a constant times \( f \). \[ O(f) = \{ g \mid \text{there are } c > 0 \text{ and } n_0 \text{ s.t. for all } n \geq n_0, g(n) \leq c \cdot f(n) \} \] With this definition we can check that \( O(f(n)) = O(c \cdot f(n)) \). When we characterize the running time of a function using big-O notation we refer to it as the asymptotic complexity of the function. Here, asymptotic refers to the fundamental principles listed above: we only care about the function in the long run, and we ignore constant factors. Usually, we use an analysis of the worst case among the inputs of a given size. Trying to do average case analysis is much harder, because it depends on the distribution of inputs. Since we often don’t know the distribution of inputs it is much less clear whether an average case analysis may apply in a particular use of an algorithm. The asymptotic worst-case time complexity of linear search is \( O(n) \), which we also refer to as linear time. The worst-case asymptotic time complexity of binary search is \( O(\log(n)) \), which we also refer to as logarithmic time. Constant time is usually described as \( O(1) \), expressing that the running time is independent of the size of the input. Some brief fundamental facts about big-O. For any polynomial, only the highest power of \( n \) matters, because it eventually comes to dominate the function. For example, \( O(5n^2 + 3n + 83) = O(n^2) \). Also \( O(\log(n)) \subseteq O(n) \), but \( O(n) \not\subseteq O(\log(n)) \). \[ ^1 \text{In textbooks and research papers you may sometimes see this written as } g = O(f) \text{ but that is questionable, comparing a function with a set of functions.} \] That is the same as to say $O(\log(n)) \subset O(n)$, which means that $O(\log(n))$ is a proper subset of $O(n)$, that is, $O(\log(n))$ is a subset ($O(\log(n)) \subseteq O(n)$), but they are not equal ($O(\log(n)) \neq O(n)$). Logarithms to different (constant) bases are asymptotically the same: $O(\log_2(n)) = O(\log_b(n))$ because $\log_b(n) = \frac{\log_2(n)}{\log_2(b)}$. As a side note, it is mathematically correct to say the worst-case running time of binary search is $O(n)$, because $\log(n) \in O(n)$. It is, however, a looser characterization than saying that the running time of binary search is $O(\log(n))$, which is also correct. Of course, it would be incorrect to say that the running time is $O(1)$. Generally, when we ask you to characterize the worst-case running time of an algorithm we are asking for the tightest bound in big-O notation. 3 Sorting Algorithms We have seen in the last lecture that sorted arrays drastically reduce the time to search for an element when compared to unsorted arrays. Asymptotically, it is the difference between $O(n)$ (linear time) and $O(\log(n))$ (logarithmic time), where $n$ is the length of the input array. This suggests that it may be important to establish this invariant, namely sorting a given array. In practice, this is indeed the case: sorting is an important component of many other data structures or algorithms. There are many different algorithms for sorting: bucket sort, bubble sort, insertion sort, selection sort, heap sort, etc. This is testimony to the importance and complexity of the problem, despite its apparent simplicity. In this lecture we discuss selection sort, which is one of the simplest algorithms. In the next lecture we will discuss quicksort. Earlier course instances used mergesort as another example of efficient sorting algorithms. 4 Selection Sort Selection sort is based on the idea that on each iteration we select the smallest element of the part of the array that has not yet been sorted and move it to the end of the sorted part at the beginning of the array. Let’s play this through for two steps on an example array. Initially, we consider the whole array (from $i = 0$ to the end). We write this as $A[0..n]$, that is the segment of the array starting at 0 up to $n$, where $n$ is excluded. We now find the minimal element of the array segment under consideration (2) and move it to the front of the array. What do we do with the element that is there? We move it to the place where 2 was (namely at $A[4]$). In other words, we swap the first element with the minimal element. Swapping is a useful operation when sorting an array in place by modifying it, because the result of a correct sort must be a permutation of the input. If swapping is our only operation we are immediately guaranteed that the result is a permutation of the input. Now 2 is in the right place, and we find the smallest element in the remaining array segment and move it to the beginning of the segment ($i = 1$). Let’s pause and see if we can write down properties of the variables and array segments that allow us to write the code correctly. First we observe rather straightforwardly that $$0 \leq i \leq n$$ where \( i = n \) after the last iteration and \( i = 0 \) before the first iteration. Next we observe that the elements to the left of \( i \) are already sorted. \( A[0..i) \) sorted These two invariants are true initially and suffice to imply the postcondition. However, it won’t be possible to prove the correctness of selection sort because we can’t prove that these two invariants, on their own, are preserved by every iteration of the loop. We also need to know that all elements to the left of \( i \) are less or equal to all element to the right of \( i \). We abbreviate this: \( A[0..i) \leq A[i..n) \) saying that every element in the left segment is smaller than or equal to every element in the right segment. We summarize the invariants \[ 0 \leq i \leq n \] \[ A[0..i) \text{ sorted} \] \[ A[0..i) \leq A[i..n) \] Let’s reason through *without any code* (for the moment), why these invariants are preserved. Let’s look at the picture again. In the next iteration we pick the minimal element among \( A[i..n) \), which would be \( 12 = A[4] \). We now swap this to \( i = 2 \) and increment \( i \). We write here \( i' = i + 1 \) in order to distinguish the old value of \( i \) from the new one, as we do in proofs of preservation of the loop invariant. Since we only step when \( i < n \), the bounds on \( i \) are preserved. Why is \( A[0..i+1) \) sorted? We know by the third invariant that any element in \( A[0..i) \) is less than any element in \( A[i..n) \) and in particular the one we moved to \( A[i+1] \). And \( A[0..i) \) was already sorted before by the second invariant. Why is \( A[0..i+1) \leq A[i+1..n) \)? We know from the loop invariant before the iteration that \( A[0..i) \leq A[i+1..n) \). So it remains to show that \( A[i..i+1) \leq A[i+1..n) \). But that is true since \( A[i] \) was a minimal element of \( A[i..n) \) which is the same as saying that it is smaller or equal to all the elements in \( A[i..n) \) and therefore also \( A[i+1..n) \) after we swap the old \( A[i] \) into its new position. 5 Programming Selection Sort From the above invariants and description of the algorithm, the correct code is simple to write, including its invariants. The function does not return a value, since it modifies the given array \( A \), so it has declaration: ```c void sort(int[] A, int lower, int upper) //@requires 0 <= lower && lower <= upper && upper <= \length(A); //@ensures is_sorted(A, lower, upper); ; ``` We encourage you to now write the function, using the following auxiliary and contract functions: 1. `is_sorted(A, lower, upper)` which is true if the array segment \( A[lower..upper] \) is sorted. 2. `le_seg(x, A, lower, upper)` which is true if \( x < A[lower1..upper1] \) (which means all \( x \) is less than or equal to all elements in the array segment). 3. `le_segs(A, lower1, upper1, lower2, upper2)` which is true if \( A[lower1..upper1] \leq A[lower2..upper2] \) (which means all elements in the first segment are less or equal to the all elements in the second array segment). 4. `swap(A, i, j)` modifies the array \( A \) by swapping \( A[i] \) with \( A[j] \). Of course, if \( i = j \), the array remains unchanged. 5. `min_index(A, lower, upper)` which returns the index \( m \) of a minimal element in the segment \( A[lower..upper] \). Please write it and then compare it to our version on the next page. void sort(int[] A, int lower, int upper) //@requires 0 <= lower && lower <= upper && upper <= length(A); //@ensures is_sorted(A, lower, upper); { for (int i = lower; i < upper; i++) //@loop_invariant lower <= i && i <= upper; //@loop_invariant is_sorted(A, lower, i); //@loop_invariant le_segs(A, lower, i, i, upper); int m = min_index(A, i, upper); //@assert le_seg(A[m], A, i, upper); swap(A, i, m); return; } At this point, let us verify that the loop invariants are initially satisfied. • lower \leq i and i \leq upper since i = lower and lower \leq upper (by precondition (@requires)). • A[lower..i) is sorted, since for i = lower the segment A[lower..lower) is empty (has no elements) since the right bound is exclusive. • A[lower..i) \leq A[i..upper) is true since for i = lower the segment A[lower..lower) has no elements. The other segment, A[lower..upper), is the whole part of the array that is supposed to be sorted. We should also verify the assertion we added in the loop body. It expresses that A[m] is less or equal to any element in the segment A[i..upper), abbreviated mathematically as A[m] \leq A[i..upper). This should be implies by the postcondition of the min_index function. How can we prove the postcondition (@ensures) of the sorting function? By the loop invariant lower \leq i \leq upper and the negation of the loop condition i \geq upper we know i = upper. The second loop invariant then states that A[lower..upper) is sorted, which is the postcondition. 6 Auxiliary Functions Besides the specification functions in contracts, we also used two auxiliary functions: swap and min_index. Here is the implementation of swap. ```c void swap(int[] A, int i, int j) //@requires 0 <= i && i < \length(A); //@requires 0 <= j && j < \length(A); { int tmp = A[i]; A[i] = A[j]; A[j] = tmp; return; } ``` For min_index, we recommend you follow the method used for selection sort: follow the algorithm for a couple of steps on a generic example, write down the invariants in general terms, and then synthesize the simple code and invariants from the result. What we have is below, for completeness. ```c int min_index(int[] A, int lower, int upper) //@requires 0 <= lower && lower < upper && upper <= \length(A); //@ensures lower <= \result && \result < upper; //@ensures le_seg(A[\result], A, lower, upper); { int m = lower; int min = A[lower]; for (int i = lower+1; i < upper; i++) //@loop_invariant lower < i && i <= upper; //@loop_invariant le_seg(min, A, lower, i); //@loop_invariant A[m] == min; if (A[i] < min) { m = i; min = A[i]; } return m; } ``` 7 Asymptotic Complexity Analysis Previously, we have had to prove that functions actually terminate. Here we do a more detailed argument: we do counting in order to give a big-O classification of the number of operations. If we have an explicit bound on the number of operations that, of course, implies termination. Assume lower = 0 and upper = n for notational simplicity. The outer loop iterates n times, from i = 0 to i = n − 1. Actually, we could stop one iteration earlier, but that does not effect the asymptotic complexity, since it only involves a constant number of additional operations. For each iteration of the outer loop (identified by the value for i), we do a linear search through the array segment to the right of i and then a simple swap. The linear search will take n − i iterations, and cannot be easily improved since the array segment A[i..n] is not (yet) sorted. So the total number of iterations (counting the number of inner iterations for each outer one) \[ n + (n - 1) + (n - 2) + \cdots + 1 = \frac{n(n + 1)}{2} \] During each of these iterations, we only perform a constant amount of operations (some comparisons, assignments, and increments), so, asymptotically, the running time can be estimated as \[ O\left(\frac{n(n + 1)}{2}\right) = O\left(\frac{n^2}{2} + \frac{n}{2}\right) = O(n^2) \] The last equation follows since for a polynomial, as we remarked earlier, only the degree matters. We summarize this by saying that the worst-case running time of selection sort is quadratic. In this algorithm there isn’t a significant difference between average case and worst case analysis: the number of iterations is exactly the same, and we only save one or two assignments per iteration in the loop body of the min_index function if the array is already sorted. 8 Empirical Validation If the running time is really $O(n^2)$ and not asymptotically faster, we predict the following: for large inputs, its running time should be essentially $cn^2$ for some constant $c$. If we double the size of the input to $2n$, then the running time should roughly become $c(2n)^2 = 4(cn^2)$ which means the function should take approximately 4 times as many seconds as before. We try this with the function `sort_time(n, r)` which generates a random array of size $n$ and then sorts it $r$ times. You can find the C0 code at `sort-time.c0`. We run this code several times, with different parameters. Calculating the ratios of successive running times, we obtain <table> <thead> <tr> <th>n</th> <th>Time</th> <th>Ratio</th> </tr> </thead> <tbody> <tr> <td>1000</td> <td>0.700</td> <td></td> </tr> <tr> <td>2000</td> <td>2.700</td> <td>3.85</td> </tr> <tr> <td>4000</td> <td>10.790</td> <td>4.00</td> </tr> <tr> <td>8000</td> <td>42.796</td> <td>3.97</td> </tr> </tbody> </table> We see that especially for the larger numbers, the ratio is almost exactly 4 when doubling the size of the input. Our conjecture of quadratic asymptotic running time has been experimentally confirmed.
{"Source-Url": "http://www.cs.cmu.edu:80/~rjsimmon/15122-f14/lec/06-sort.pdf", "len_cl100k_base": 4808, "olmocr-version": "0.1.53", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 33191, "total-output-tokens": 5401, "length": "2e12", "weborganizer": {"__label__adult": 0.0004906654357910156, "__label__art_design": 0.000396728515625, "__label__crime_law": 0.0006136894226074219, "__label__education_jobs": 0.0017843246459960938, "__label__entertainment": 9.47117805480957e-05, "__label__fashion_beauty": 0.00021958351135253904, "__label__finance_business": 0.0002046823501586914, "__label__food_dining": 0.0008296966552734375, "__label__games": 0.00113677978515625, "__label__hardware": 0.0015687942504882812, "__label__health": 0.0012760162353515625, "__label__history": 0.0003650188446044922, "__label__home_hobbies": 0.00020003318786621096, "__label__industrial": 0.0006422996520996094, "__label__literature": 0.0004143714904785156, "__label__politics": 0.0004200935363769531, "__label__religion": 0.0007457733154296875, "__label__science_tech": 0.05328369140625, "__label__social_life": 0.00013768672943115234, "__label__software": 0.0035266876220703125, "__label__software_dev": 0.9296875, "__label__sports_fitness": 0.0006833076477050781, "__label__transportation": 0.001041412353515625, "__label__travel": 0.00030040740966796875}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 18332, 0.02177]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 18332, 0.71653]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 18332, 0.88438]], "google_gemma-3-12b-it_contains_pii": [[0, 1181, false], [1181, 3734, null], [3734, 6139, null], [6139, 8447, null], [8447, 9145, null], [9145, 10074, null], [10074, 11403, null], [11403, 12746, null], [12746, 14303, null], [14303, 15492, null], [15492, 17292, null], [17292, 18332, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1181, true], [1181, 3734, null], [3734, 6139, null], [6139, 8447, null], [8447, 9145, null], [9145, 10074, null], [10074, 11403, null], [11403, 12746, null], [12746, 14303, null], [14303, 15492, null], [15492, 17292, null], [17292, 18332, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 18332, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 18332, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 18332, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 18332, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 18332, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 18332, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 18332, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 18332, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 18332, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 18332, null]], "pdf_page_numbers": [[0, 1181, 1], [1181, 3734, 2], [3734, 6139, 3], [6139, 8447, 4], [8447, 9145, 5], [9145, 10074, 6], [10074, 11403, 7], [11403, 12746, 8], [12746, 14303, 9], [14303, 15492, 10], [15492, 17292, 11], [17292, 18332, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 18332, 0.0411]]}
olmocr_science_pdfs
2024-12-10
2024-12-10
0715d7ec4b3a9b49aaf27f15fdc1cd580319fb09
The Practitioners of Web Information Architecture in Small and Medium Enterprises ABSTRACT This paper reports an investigation of the practice of web information architecture (IA) in small and medium enterprises (SMEs). As information delivery via the web becomes a mainstream activity in all organisations, research and practical attention to Web IA remains focused on larger organisations and a new profession of information architect. The practice of web IA in SMEs has not been widely considered. This research collects the narratives of those who practice Web IA in the smaller enterprise and reveals that the dominant voice is that of a communication and marketing practitioner, rather than information professional. The outcomes of practice in this context suffer from a lack of knowledge and expertise. INTRODUCTION As in many countries, all sectors of Australian society – from government and private enterprise to education and community – use the web for information delivery. The increasing importance of information and the growing prominence of the web as a platform for information provision are current and universal phenomena. Coupled with a strong competitive impetus to provide and effectively structure online information (Evernden & Evernden 2003), is the rising expectation of an organisation’s client base to find information on the web to support varied interactions with the organisation (Gunter 2008). However, web information seekers do not always encounter optimal design and presentation of digital information. Dissatisfaction and anxiety with the quality of information and its structures continue to be part of the experience. A disconnection between the desire to inform effectively using the web and the demonstrated ability of organisations to achieve this outcome is The ubiquitous web and its simple hypertext protocol have created a novel, inclusive and disruptive information environment. Enabled by open technology and ready access, the design of information on the web is as likely to be in the hands of the novice as the expert. Morrogh (2002, p. 99) writes that the enterprise website is frequently outside the control of information professionals. In this environment, information and its structures are provisional, demanding of rapid response when change is required (Burford 2011a). SMEs (defined by the Australian Bureau of Statistics as organisations with less than 200 employees) are a dominant form of business in Australia and around the world. These organisations exist in an intricate coalition with larger enterprises. Economies of scale mean that smaller organisations are frequently challenged to innovate and flourish in the information economy and in the use of the internet for communicating and informing (Burgess 2008; Rathi & Given 2011). This research focuses its enquiry on the activity of web information organisation in SMEs. The formalisation of the practice of web IA and the documenting of that practice have largely been driven by practitioners in the area (Fast 2006; Surla 2006; Campbell 2007). An abundance of short papers supporting and reporting the work of IA are published in online magazines such as Boxes and Arrows, Digital Web Magazine and the IA Institute library. In 2006, Fast (para. 2) considered “that IA is characterised by its practice: not by its research”. Research literature is beginning to emerge, but is piecemeal and often dedicated to aspects of the IA components and processes (see for example, Cunliffe et al. 2002; Sinha & Boutelle 2004; Yu & Roh 2002) rather than an organisation’s ability to enable it. This study focuses on the practice environment and activity in organisational context. Professional information architects are more likely to find full-time employment or consultancy in large organisations, thereby privileging that context as theoretical stances emerge from practice. Burford (2011a, 2011b) has examined the practice of web IA in large organisations and Morville and Rosenfeld (1998, 2006) propose a methodology for web IA in large organisations; SMEs have not received the same scrutiny. Little is known about the use and usefulness of generalised design methods and best practice guidelines for web IA within the situated realities of SMEs. The extent to which the internal environment may deter or contribute to success in effectively structuring online information remains unclear. This research project pays attention to the genuine realities, needs and practices of SMEs and creates new understandings that SMEs can utilise in approaching and improving capability to build effective online information-rich environments. **The Literature** Web IA is a term that is used to describe both the information design process and its outcomes. Dillon (2002, p. 821) proposes a broad definition: “IA is the term used to describe the process of designing, implementing and evaluating information spaces that are humanly and socially acceptable to their intended stakeholders”. In its focus on the needs of the user, web IA draws on the philosophies of user-centred design to “help maximise the value of new technologies and minimise the negative effects” (Morrogh 2002, p. 97). The practice of IA, according to Dillon (2002) and Morville (2004), is a value-based craft discipline and as such has its weaknesses. Consistent results and outcomes are not assured in a predictable timeframe. Yet evolving and maturing representations of best practice are proposed to guide the work of web IA. Pioneered by information professionals Rosenfeld and Morville (1998), an evolving methodology for web IA is widely acknowledged in the literature, in education and by practitioners in the field. Morville and Rosenfeld (2006, p. 231) deconstruct an IA into component systems of organisation, labelling, navigation and search, as well as any controlled vocabulary and metadata that may be used and provide generalised “structured development processes” for practice in large organisations. They draw on the expertise and theories of prior information traditions in an attempt to take control of this emergent information space (Dillon & Turnbull 2005). Burford (2011a, 2011b) examines the practice of web IA in large organisational contexts. However, studies of web IA as situated practice in SMEs do not exist. In contrast to methodological recommendations, some scholars and practitioners prefer to steer the development of effective web IA by providing guidelines. The value of guidelines remains contentious. Spool (2003) believes that they are limited in their effectiveness because they fail to deliver a consideration of the context in which they are applied. Milne et al. (2005) claim that adherence to published guidelines does not ensure a high quality outcome for creative work, which should be undertaken with deeper understanding of practice. Discrete websites and hypertext environments have been and remain an important locale for the activity of IA. Yet, Resmini and Rosati (2011a) report a new era in IA which acknowledges a cross-channel context for information and its user. The multiple and mobile channels of web, tablet devices, smart phones, print and physical spaces invite an information architect to take responsibility for a pervasive information layer that retains meaning when a user changes channels (Resmini & Rosati 2011b). Burgess (2008, p. 129) notes that the smaller business has particular difficulty in “the setup and maintenance of websites”. He offers a model that provides “assistance with determining website content that matches the overall business strategy” (p. 129). However, Burgess’ (2008) model stops short of any advice on the organisation of this information. Sinkovics and Penz (2006, p. 303) introduce the construct of “web empowerment” in SMEs. They describe it as “a multidimensional construct comprising of consumer views on various dimensions of relevant and successful websites” (p. 303) and propose a significant set of items that represent the concerns of users and thus of SMEs as they strive for an effective and successful online presence. Random aspects of web IA are included in Sinkovics and Penz’s (2006) list but methods and processes are absent. Rathi and Given (2011) discuss the importance of integrating design principles, web usability and search engine optimisation on the websites of SMEs. They acknowledge navigation and content organisation in a list of important design elements, but do not isolate information architecture from other aspects of design. After much introspection about the role of an information architect (for example, Morville 2011) and even more attention to definitions of IA itself (Madsen 2009), it is noteworthy that Davis (2011) now calls for the focus of scholars and professionals to shift to the practitioner of IA. This research heeds that challenge and examines the situated activity of practitioners of IA in SMEs. **Research Design** The activity of online information design in SMEs is described by the research participants in this investigation, with the aim of developing a deeper understanding of the practice and its localised demands. The issues and obstacles that SME’s encounter in achieving effective web IA are explored. The web as an information space and an interaction space is multi-faceted: it is attended to aesthetically by graphic design; it is used to reveal applications or transaction systems; and, it provides a springboard for dialogue using social media. These highly visible aspects of a website are acknowledged, as this study focuses on the web as a hypertext information space and a platform for information delivery. This research considers the “invisible” work of organising information that is “severely underrepresented in the theoretical literature” (Bowker & Star 2000, p. 9). This research was designed as a particularistic, (Merriam 1998, p. 29) multiple, case study – i.e. it examined a particular phenomenon across five SME contexts. Each case was important for what it revealed about the conduct of web IA in organisations. It was purposely designed to find trends and patterns across the practices, rather than describe how IA is practiced in any particular organisation. Eisenhardt (2007, p. 25) writes that the analysis of multiple case studies enables “recognizing patterns of relationships among constructs within and across cases and their underlying logical arguments”. Yin (2009) defines the case study as an empirical inquiry that investigates a contemporary phenomenon within its real-life context and Hartley (2004, p. 323) claims that “case studies can be useful for exploring new or emerging processes or behaviours” and understanding “how behaviour and/or processes are influenced by, and influence context”. A case study approach to knowing more about how organisations are designing online information structures is applicable because contextual insights and patterns will be revealed only by examining situated practice. Recognising a continuum between “telling” and “selling”, Orna (2005, p. 14) distinguishes between organisations that create information products such as websites to “support the products and/or services which they are in business to offer” and that “embody substantial information content which aims to allow users to do something they need/want to do” and those that evoke feelings in order to market or advertise. This research focused on the use of the web for “telling” or informing to support business goals, rather than to persuade, advertise or sell. Three criteria for the selection of SMEs were established; staff numbers less than 200; websites that are publicly accessible; and a website that is information-rich. The researchers scrutinised the websites of a number of SMEs known to them, to confirm that they were information-rich and that the organisation could be classified as a SME. A person in a leadership position within each SME was contacted by phone to invite the SME to participate in the research. Six organisations were approached and five agreed to participate. With that agreement in place, a dialogue between the researcher and the person in authority pinpointed the individual/s that had most input to the creation of the information structures of the website and could contribute to the research. They were then invited to participate by the researchers in writing. Organisations were not drawn from a particular sector; rather, they were selected to establish a diverse range of purpose and business model. The profiles of the participating SMEs are outlined in Table 1, as is the profile of the person with greatest input to the practice of web IA. All other conditions and circumstances within the organisations studied were considered context for this situated study. A qualitative approach to data collection was used. Unstructured interviews were conducted with either one person or a small group of people in each SME, depending on their availability and the context of each SME. The data, resultant of the unstructured interviews, was captured in digital audio format, and was transcribed using a professional transcription company. In an inductive approach to analysis, the data were coded using NVivo as a supporting analytic tool to reveal patterns and themes across SMEs. Thematic analysis captures some level of patterned meaning within the data (Braun & Clarke 2006), and provides a theoretical freedom to approach a complex body of data and reveal themes and insights without pre-existing expectations or existing coding frames. The researchers scrutinised the information architecture of the websites of all studied SMEs using expert heuristic evaluation. Expert heuristic evaluation is traditionally a step in the development process, when expert opinion, according to a pre-agreed set of principles, is sought (Pearrow 2007). In this situation, Morville and Rosenfeld’s (2006) organisation, labelling, navigation and search systems were isolated by the researchers as criteria for expert review. The outcome of these evaluations was not communicated to the SMEs. Weaknesses in the information architectures were found in all websites but two stood out as having significant and deep seated structural problems. The results of practice evidenced by the information structures of the websites of two SMEs, are described in light of the processes and activities that surrounded its creation and maintenance. **Findings** Research participants from each of the five SMEs agreed that the website of their organisation had a primary purpose of providing information. ‘At the moment it’s informing’ (Org C) was the typical response. There were ambitions embedded in the stated purpose; for the website to become more communicative, participatory and engaging. However, that goal was for the future. The main preoccupation of all SMEs was to establish ‘a professional outward looking website that tells as much information that needs be - to give people a proper understanding of what it is that we do’ (Org B). The websites were not designed for active marketing or selling. As one web manager noted, > The website is not really written in such a way to communicate and persuade, it’s written as just here’s the information, take it as you wish. So it doesn’t quite have that same marketing speak of call to action. At the moment it’s really just, it’s just information sitting there online. (Org D) Thus a primary concern and activity in the studied SMEs was the organisation of online information to serve their clients. The findings of this research are embedded in an endeavour to inform. With this in mind, this paper reports the key findings of the research: first, that communications professionals are typically the practitioners of web IA in SMEs; and, second, that they base their practice on negligible education in information architecture. In reality, expert information architects have minimal involvement in the practice in SMEs and those who practice have little knowledge or expertise in web IA. **Under the Communication Banner** Website management was undertaken by marketing or public relations departments or teams, in four of the five SMEs. In the fifth, it was managed by a Director of Business Development. Only one SME, with 110 employees, employed a person whose role was dedicated to the website and its management. In the other four organisations, responsibility for the website was clustered with other duties of particular individuals (e.g., marketing and public relations). The website was mostly a component of a SME’s public communication endeavour. One research participant, for example, outlined how the web fits with her other communication responsibilities. > My role is Marketing Manager. So I look after the communications, primarily external communications, and coordinate advertising, P.R., design work, the website, the whole mix, this whole organisation. (Org D) In the studied SMEs, professionals from various backgrounds were responsible and actively engaged in web IA. The majority of practitioners of IA were from a professional communication background such as marketing, public relations or journalism, and held qualifications in that field. They spoke of workplace experiences in political media and public relations, radio journalism, and marketing. There was also a teacher of graphic design and a business director who were directly responsible for web IA. The career history of one practitioner of web IA was as follows: My career is actually in communication. I'm a journalist by training and I've done a lot of public affairs work in various government agencies and more recently in the community sector. (Org C) One research participant, a Marketing Manager, had recently developed and documented an IA for implementation by external web developers. She ‘worked closely with them and actually established the site map on what we wanted, and the functionality that I wanted to have’ (Org B). In this SME, web IA is practiced by a marketing communication professional with little experience or theoretical underpinning in information organisation. She is quick to affirm that her work in the SME is underpinned by principles of communication: My perception is more about communicating messages and outward appearances. I kind of moved toward more that corporate communications kind of role and so kind of morphed from very much the journo through into the PR and now I'm kind of morphing into PR marketing now. So I think I've developed my approach just having experienced all of that stuff like the importance of a message was obviously very important. (Org B) Thus, website management in SMEs is most likely to be housed in professional communication environments and to be a component of any individual’s responsibility in the workplace. Likewise, the practitioners of information architecture in SMEs work within a communication unit and disciplinary base. **A Confident Approach** In all five SMEs, the website development was outsourced to an external company. However, this was a technical project rather than one that attended to information and its structure. The SME was required to complete an IA design to signal the enterprise information requirements for the website that was to be developed. As one participant noted: The agency that we went to, they’re very much a ‘tell us what you need and we’ll build it for you but you have to tell us what you want, where you want it and why you want it’. And so I had to go to them with a brief that was pretty comprehensive. saying ‘OK this is the look and feel that we want, this is the site menu, this is what I want each page to be able to do’. (Org B) One SME, in the process of developing a new site, had recruited an outside agency to take the lead and responsibility for web IA. The agency was described as being ‘pretty highly regarded in Australia as being the leaders of digital strategy, digital advertising and marketing’ (Org D). The website of the outside agency claimed the emphasis of its capability to be “powerful thinking that allows us to connect brands and people like never before”. It was not an agency that claimed any capability in web IA. Even when outsourced, the work of web IA is typically in the hands of communication professionals, rather than specialists trained in web IA. Four of the studied organisations had recently or were currently developing an IA for a new website. They would develop the ‘site map’ and hand it to the web development company. In one case, an information architect had been involved in the provision of an IA blueprint to the SME, but it was rejected by a new incumbent web manager with academic qualifications in journalism. On his arrival, he decided that he would develop the IA for the website of the SME. Thus in the studied SMEs, information professionals were not part of the planning, design and implementation of new websites whose stated purpose was to inform. Information expertise was not sought by any of the SMEs studied in this research. One research participant listed the skills that she would require in a new website development; notably the expertise of an information architect is absent in her description: So we’re looking at who do we need to be involved, so the list was... there’s the designer, the developer, the copywriter, the editing – and I’m really fussy about the editing, but that’s more in terms of the copy really. The imagery sourcing, the videographer, the photographer, the e-commerce specialist, the systems analyst, a social media expert. And to be led and overseen by the Sales and Marketing Manager, and we sort of put of the word Creative Director in there. (Org A) The rationale for allocating the work of web IA to its practitioners appeared to be based on the prevailing disciplinary perspectives, and was readily forthcoming from the research participants. The reason for locating the work of web IA is shaped to fit the context of the practitioner. In one SME, an educational institution teaching design, the practitioner of web IA is qualified in design and is described as a very good designer and colourist. In this SME a rationale is offered for the in-house, innate ability to practice IA: Well, probably the nice thing is that being a design school, we’re already aware of; perhaps more than if you’re a finance company, in terms of the design and the communication, and getting the message across. It’s like a design project for us anyway. (Org A) Equally, there is a confident rationale when the practice of web IA is located in professional communication and informing via the web is included in the spectrum of communication activities within an SME. It is positioned to be one platform among many for the delivery of the organisational message to its clients. This practitioner of web IA relates the synergy in her work: The position has kind of morphed a little bit from pure marketing to public relations, media, web development and basically that broad spectrum of communication with our clients. Yeah, so anything to do with communicating anything in any way is my responsibility, so it’s quite broad. (Org B) Independence and confidence in organising information on the web was apparent in all studied SMEs. One research participant, recently employed to manage the website, had inherited an information design, which he reported had been constructed by a consultant information architect prior to his arrival. Although lacking in expertise himself, he dismissed this design and attended to the IA himself. He noted: There had been some work done before I got here and there had been, some consultant had come in and said ‘oh we think is a suitable information architecture and my view was well hang on, we didn’t sort of take is as gospel. (Org C) There was a naïve confidence in this approach. When research participants were asked if they felt they were sufficiently skilled and resourced to accomplish an information design for the website of the organisation, they affirmed that theirs was the best approach for the size of the business. Perhaps due to an independent spirit, acquired and inherent in many aspects of organisational work in SMEs, research participants were keen to achieve the IA of the website independently. They welcomed the opportunity to use their initiative and ingenuity and the ability to make decisions without the bureaucracy and committee structures of larger organisations. One practitioner of web IA welcomes her autonomy saying ‘it’s awesome, I feel like I’ve got my own little empire that I can control’ (Org B). From the Brochure SMEs expressed a cross-channel intention to developing branding, identity, and information for the multiple channels that would inform clients. The contracted work of external communication agencies was used for print, web and other channels. The website is bundled with all other means of communicating with clients: So we’re also looking at rebranding with a new logo, and a new image, that’s going to go right across the board in prospectuses and everywhere, so it’s a great opportunity for us to...I think it’s really important to work holistically. So the website’s not in isolation, you know it’s everything, it’s the logo rebranding, it’s the way we present ourselves all the way through. (Org A) With a dominant marketing and communication perspective and theoretical background, the narrative of web IA was grounded in brochures, copy and branding. Brochures and prospectuses were an important vehicle for informing clients and they were developed first when a new branding and messaging initiative was undertaken. The brochure then served as a springboard for the content and structure of the website. From the brochure, the website takes its shape. The demand for a new prospectus is higher than the website, so the interesting thing is that XXXX is working on the prospectus now...well she has to produce that prospectus by September, so come September she will actually have a graphic image and organisation of data that will probably be the forerunner for the website. But it may not have... it won’t have as much deep, rich content, because the website allows you to add so much more. I think this is the sort of... it’s the informal method we’ve used. (Org A) Information is of great concern to the practitioners of web IA in SMEs. However, expertise in the arrangement of information resides in the printed brochure, which then informs the information structures of the website. Expertise versus Digital Experience The practitioners of IA in SMEs had not undertaken any formal training or education in their craft. They brought little experience and knowledge of information organisation to their practice. Largely, they had no knowledge of the theory, methodology or literature in this field. One practitioner of web IA reports ‘no formal or no high degree of sophistication or you know knowledge perspective’ (Org E). Just one research participant was aware of the recommendations of some authors, naming Jakob Nielsen and James Robertson as experts that had been read and emulated. Yet confidence based on ‘organic’ learning was evident. When asked if he had done any training in web IA, one research participant replied: I’ve been in this business for nearly 20 years. Basically before all the content management systems and that sort of stuff so a lot of it’s been organic. So I’ve worked just so closely with web developers so…I’ve picked it up yeah. (Org D) Research participants claimed that approaching the information design of the websites of SMEs using their various digital marketing experiences was adequate. ‘Being more digitally focussed in my marketing efforts’ (Org B) was qualification enough for one practitioner. No greater expertise was needed. Rather, the practitioners of web IA in SMEs brought digital experience to the practice. Some supported their practice by close scrutiny of other websites: So a lot of exposure to websites and part of the process was looking at websites that he liked and trying to draw some inspiration from that. (Org E) Alongside experience and involvement in the information design of websites, common sense and intuition were cited as valuable attributes in the work of web IA in SMEs. One practitioner of web IA claimed that being a user of the web over a number of years provided significant insight. She described her approach to practice: Intuitive definitely. I think it helps if you’re a regular web user obviously. I think it’s really just something that’s developed over time, like as we’re moved more and more into the online world, the digital age; you kind of get a feeling for what you as a user want from a site. And then you need to balance that with your business need, what the business needs to have on a site. (Org B) Immersion in the online environment was considered essential in the acquisition of the skill to lead a SME in the construction of information structures for the website. There was a concentration of activity and reflection when a new website was being developed and launched. A clearly expressed requirement in all SMEs was that, once launched, they be able to update the content of the website from within the organisation. Some had previously been unable to maintain the content of the websites themselves. The sites were updated by an external company and research participants determined that this was not a workable arrangement and one to be avoided in new site developments and infrastructures. Solutions, whereby information could be edited or added to an existing category of information, were created. ‘Simple but regular changes’ (Org E) were enabled. As one participant said: All I need to do is go in, log on, bring up the edit function, it asks me what I want to do, do I want to create featured research, do I want to create a news item, do I want to add a staff member, do I want to add a Board member? You know it comes up… (Org B) Whilst the maintenance of content was front of mind, a number of SMEs had not considered the ongoing maintenance of the IA of the site, including the addition or deletion of sections of information on the website. They were content with the arrangement that ‘they can edit things within certain areas but they can’t, no-one can muck around with the structure’ (Org C). Changes to the information structures were not foreseen or readily provisioned. When asked how the organisation might accomplish this, one research participant responded: _Probably easier to go to a specialist, go back to the developer. Because, you know, it’s important to do what you’re good at, your core business – you know, that’s not our core business. I don’t think we’re in a situation where we can have someone on deck doing that, when you might as well have a project that gets done outside, and pulled in._ (Org A) The practitioners of web IA in SMEs value digital experience in general and long-term engagement with the web as a user, as grounding for their practice. They do not have formal knowledge or learning of information organisation on the web, but draw on their common sense and intuition. Their foresight and strategy in web IA is minimal. The Websites of Two SMEs There are significant consequences, resulting from the absence of information expertise. Potential problems and obstacles lurk in the unknown. To illustrate, the section that follows describes the outcomes of practice in two of the SMEs with recent website launches that the organisations believed to be successful. Without expertise in IA and a broad vision of what is possible and how to achieve it, small and reactive initiatives are undertaken to solve pressing problems. Organisations B and E are discussed as case studies to illustrate this reality. Organisation B: This SME of 15 employees reported an inability to progress much needed improvements to the IA of its website because of the parent organisation’s cumbersome web infrastructure, especially its content management system (CMS). A decision was made by the SME to carve its current website into five business areas: the corporate information section and four specific business service areas. An outsourced CMS and hosting arrangement was initiated for the web presence for the four areas of service. Four different websites with unique URLs, one for each service area were developed, albeit with similar structures. As the participant noted: _So to get around that, [the CEO] decided ‘OK let’s see what we can do externally’ and engaged a digital company to actually create some sub-sites, so focussing on our four areas, our four focus areas. And so we had four different domains; so four different websites, four different domain names not interlinked._ The rationale for this approach was to enable easy, in-house access to populate, improve and maintain the information conveyed about these four service areas within a very small organisation. This was considered a great success for the SME because at least four areas of the overall web could be successfully maintained. The fifth, corporate area of the SME’s web presence remained within the infrastructure of the parent organisation. Eighteen months on, with the arrival of a new marketing manager who was intent on renewing the central (or corporate) website and its information, a similar redevelopment project was undertaken with the same web development company. The new marketing manager designed the information structures for the corporate area of the SMEs web presence and the means by which it would integrate with the four existing service area sites. This resulted in a small organisation with five entangled websites that produced significant challenges in accessing online information for its client. Three substantial flaws in the IA implementation across the five integrated sites were determined by the researchers using expert heuristic evaluation (Pearrow 2007) and are described: 1. Each of the four themed sites contains general information about the SME, including the contact details. Thus this information is replicated five times in the overall web presence for the SME. 2. New windows are opened each time a user navigates from one of the five sites within the whole to another; within a very short time the user has opened myriad windows and is unable to backtrack or to make sense of an overall structure. 3. The four service area sites use inconsistent and unexpected navigation – e.g., a home link takes the user to the homepage of the same service area site. However the SME logo alongside the link directs the user to the homepage of the corporate site. The actions and initiatives of this SME to improve its online information presence were piecemeal, reactive and lacking in expertise in big picture information organisation. Serial actions compounded to produce a flawed outcome. It is a sequence of survival, whereby individual staff members are called upon to organise information to the best of their ability and skill set. Nonetheless, this SME is pleased with the outcome. Feedback had been sought from within the organisation and consensus was that ‘it was all looking good’. Usability assessments with clients were not completed and were not being planned at the time of the interview. Organisation E: As with other of the studied SMEs, this organisation was intent on conveying a consistent corporate identity and message in all its communiqués with clients. The website was included as a key communications hub. An external agency had been commissioned to create branding and develop a brochure containing a linear sequence of information that built a narrative of great importance to the business. A copywriter had been employed to write the content for the brochure. This valued story that had been produced for print was to be captured on the new website. Using the brochure as a blueprint, this intention was expressed to a web development company as follows: So we walked them through the hard copy brochure and just saying ‘look this is the content we have to work with, we don’t want to really go outside of this so we don’t need to generate new content’. We want to make sure that the message is consistent, we want to be able to tell the stories. However in reviewing the website and the implementation of the narrative from the brochure, the researchers find that it has not been achieved effectively. The task was complex and required expertise in web IA. The ambiguous taxonomy used to organise the information in the narrative does not convey the sequence of the brochure. Steps in the linear story become nodes in a hierarchy that are clustered with other information, thereby losing all sense of sequential and discrete narrative. The parent node is not labelled to lead an audience to the narrative that is important to the business. Proudly, and naively, this research participant describes the SME’s website as brochureware: Yeah, it’s interesting because we wanted to, we sort of reviewed why people would be using our website and it really is a little bit of, its brochureware. This organisation is not aware of the specialised practice of organising information for the web and how this medium differs from printed information. Information for the web is not isolated as distinct from the general communications of the SME to clients and given specialist attention. Rather it is derivative of digital marketing agencies that produce corporate identity and messages in brochures with a belief that these skills and artefacts are transferable to the web, without modification. **DISCUSSION AND CONCLUSIONS** The expertise of the professional information architect was not an ingredient in the creation of information structures for the websites of the studied SMEs. A strong and dominant narrative is issued by the marketing communication professional, who claims expertise in digital marketing, involvement in website construction, and a background in communication qualifies them to organise online information for the smaller enterprise. Intuition and common sense replace the skills and theoretical underpinnings of the information professional within the smaller enterprise. The studied SMEs do not isolate and detail the information work that takes place, and information expertise, either in-house or externally commissioned, is not employed. A naïve confidence in this approach is evident in the data and what is not known about web IA does not concern the organisation. In this study, information architecture is absorbed into the work of communication or visual design. The website evaluations of two SMEs reveal that web IA, in the hands of those without knowledge and a theoretical base for their practice, can lead to significant flaws in the structure of online information. Whilst the methodologies and profession of web IA continue to develop and mature, they do not appear to be recognised and adopted in SMEs. Practitioners of web IA in the studied SMEs came from disciplinary backgrounds remote from those that compose the information field. Scholars give due attention to interdisciplinary collaboration in theory and practice within the various disciplines of the information field (Dillon & Rice-Lively 2006; Bruce, Richardson & Eisenberg 2006). Others (for example, Holland 2008; Madsen 2012), debate the distinctions between multi-, inter-, and transdisciplinary approaches to information. The outcomes of this research, however, establish the need for a wider reach; one that looks outside the information field and acknowledges that digital online information and its structure is in the hands of a wider society and disciplinary base. Dillon and Rice-Lively (2006, p. 23) admit that “information is an open terrain”. Wilson (2006, p. 680) writes of a dispersed disciplinary interest in all aspects of information that has become the “life blood of society” (p. 682) and can no longer remain isolated with information researchers. Information issues have the full attention of a broad spectrum of society and, as the worldwide web continues to expand in its reach and relevance, it places responsibility for information in the hands of varied and multiple actors. Significant challenges are suggested for information architecture as a discipline and knowledge base – a need to infuse the practice of web IA in SMEs with disciplinary expertise and theory. A stronger liaison between information theorists and practitioners and the confident, yet unknowing practitioner of web IA in SMEs is indicated. Web IA requires a stronger identity and stance in the website development process, one that signals the importance of information expertise. Knowledge of web IA must infiltrate the curriculum of professional communication and web design courses, and find its voice in a much wider interdisciplinary pool, in order to be heard by the practitioners of web IA in SMEs. This investigation of situated practice of web information architecture in five SMEs reveals an absence of information expertise in the structuring of online information. This study exposes a dominant marketing and communication skill set in an information space devoid of the benefits that information architects could offer. This lack of expertise appears unnoticed by SMEs, who initiate varied approaches to ensuring the existence of a website to inform the client. Whilst the work of web IA prevails in SMEs, practitioners in this context are rarely equipped with the necessary skills and knowledge of information organisation. Likely outcomes are information structures that pose impediments to both the client and the business endeavour of the SME. This study with a small sample size is exploratory; yet, the emergent findings are demanding of further investigation. REFERENCES
{"Source-Url": "http://journalofia.org/volume5/issue2/04-burford/jofia-0502-04-burford.pdf", "len_cl100k_base": 8180, "olmocr-version": "0.1.50", "pdf-total-pages": 20, "total-fallback-pages": 0, "total-input-tokens": 40594, "total-output-tokens": 11117, "length": "2e12", "weborganizer": {"__label__adult": 0.0009431838989257812, "__label__art_design": 0.06768798828125, "__label__crime_law": 0.0014276504516601562, "__label__education_jobs": 0.099853515625, "__label__entertainment": 0.001300811767578125, "__label__fashion_beauty": 0.0008916854858398438, "__label__finance_business": 0.10223388671875, "__label__food_dining": 0.001201629638671875, "__label__games": 0.0015153884887695312, "__label__hardware": 0.0024394989013671875, "__label__health": 0.0020046234130859375, "__label__history": 0.0023937225341796875, "__label__home_hobbies": 0.0006971359252929688, "__label__industrial": 0.0019092559814453125, "__label__literature": 0.005924224853515625, "__label__politics": 0.001220703125, "__label__religion": 0.0018939971923828125, "__label__science_tech": 0.1444091796875, "__label__social_life": 0.0006494522094726562, "__label__software": 0.1649169921875, "__label__software_dev": 0.391845703125, "__label__sports_fitness": 0.00037384033203125, "__label__transportation": 0.0011472702026367188, "__label__travel": 0.0009055137634277344}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 48167, 0.02109]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 48167, 0.23768]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 48167, 0.9406]], "google_gemma-3-12b-it_contains_pii": [[0, 1545, false], [1545, 4403, null], [4403, 7174, null], [7174, 9893, null], [9893, 12867, null], [12867, 14521, null], [14521, 17021, null], [17021, 19658, null], [19658, 22504, null], [22504, 25054, null], [25054, 27795, null], [27795, 30517, null], [30517, 33234, null], [33234, 35759, null], [35759, 38622, null], [38622, 41477, null], [41477, 43699, null], [43699, 45986, null], [45986, 48167, null], [48167, 48167, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1545, true], [1545, 4403, null], [4403, 7174, null], [7174, 9893, null], [9893, 12867, null], [12867, 14521, null], [14521, 17021, null], [17021, 19658, null], [19658, 22504, null], [22504, 25054, null], [25054, 27795, null], [27795, 30517, null], [30517, 33234, null], [33234, 35759, null], [35759, 38622, null], [38622, 41477, null], [41477, 43699, null], [43699, 45986, null], [45986, 48167, null], [48167, 48167, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 48167, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 48167, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 48167, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 48167, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 48167, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 48167, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 48167, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 48167, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 48167, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 48167, null]], "pdf_page_numbers": [[0, 1545, 1], [1545, 4403, 2], [4403, 7174, 3], [7174, 9893, 4], [9893, 12867, 5], [12867, 14521, 6], [14521, 17021, 7], [17021, 19658, 8], [19658, 22504, 9], [22504, 25054, 10], [25054, 27795, 11], [27795, 30517, 12], [30517, 33234, 13], [33234, 35759, 14], [35759, 38622, 15], [38622, 41477, 16], [41477, 43699, 17], [43699, 45986, 18], [45986, 48167, 19], [48167, 48167, 20]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 48167, 0.0]]}
olmocr_science_pdfs
2024-11-30
2024-11-30
8c639fb24048c411441d58306298959e17dcda0c
Computer Aided Prototyping System (CAPS) for Heterogeneous Systems Development and Integration Luqi; Berzins, V.; Shing, M.; Nada, N.; Eagle, C. Monterey, California: Naval Postgraduate School. https://hdl.handle.net/10945/37836 This publication is a work of the U.S. Government as defined in Title 17, United States Code, Section 101. Copyright protection is not available for this work in the United States. Computer Aided Prototyping System (CAPS) for Heterogeneous Systems Development and Integration Luqi, V. Berzins, M. Shing, N. Nada and C. Eagle Computer Science Department Naval Postgraduate School Monterey, CA 93943 {luqi, berzins, mantak, nnada, cseagle}@cs.nps.navy.mil Abstract This paper addresses the problem of how to produce reliable software that is also flexible and cost effective for the DoD distributed software domain. DoD software systems fall into two categories: information systems and war fighter systems. Both types of systems can be distributed, heterogeneous and network-based, consisting of a set of components running on different platforms and working together via multiple communication links and protocols. We propose to tackle the problem using prototyping and a “wrapper and glue” technology for interoperability and integration. This paper describes a distributed development environment, CAPS (Computer-Aided Prototyping System), to support rapid prototyping and automatic generation of wrapper and glue software based on designer specifications. The CAPS system uses a fifth-generation prototyping language to model the communication structure, timing constraints, I/O control, and data buffering that comprise the requirements for an embedded software system. The language supports the specification of hard real-time systems with reusable components from domain specific component libraries. CAPS has been used successfully as a research tool in prototyping large war-fighter control systems (e.g. the command-and-control station, cruise missile flight control system, missile defense systems) and demonstrated its capability to support the development of large complex embedded software. 1. Introduction DoD software systems are currently categorized into Management Information Systems (MIS) and War Fighter/Embedded Real-time Systems. Both types of systems can be distributed, heterogeneous and network-based, consisting of a set of subsystems, running on different platforms that work together via multiple communication links and protocols. This paper addresses the problem of how to produce reliable software that is also flexible and cost effective for the DoD distributed software system domain, as depicted in the shaded area in Figure 1. * This research was supported in part by the U. S. Army Research Office under contract/grant number 35037-MA and 40473-MA. **Report Documentation Page** <table> <thead> <tr> <th>Field</th> <th>Details</th> </tr> </thead> <tbody> <tr> <td>1. REPORT DATE</td> <td>2000</td> </tr> <tr> <td>2. REPORT TYPE</td> <td></td> </tr> <tr> <td>3. DATES COVERED</td> <td>00-00-2000 to 00-00-2000</td> </tr> <tr> <td>4. TITLE AND SUBTITLE</td> <td>Computer Aided Prototyping System (CAPS) for Heterogeneous Systems Development and Integration</td> </tr> <tr> <td>5a. CONTRACT NUMBER</td> <td></td> </tr> <tr> <td>5b. GRANT NUMBER</td> <td></td> </tr> <tr> <td>5c. PROGRAM ELEMENT NUMBER</td> <td></td> </tr> <tr> <td>5d. PROJECT NUMBER</td> <td></td> </tr> <tr> <td>5e. TASK NUMBER</td> <td></td> </tr> <tr> <td>5f. WORK UNIT NUMBER</td> <td></td> </tr> <tr> <td>6. AUTHOR(S)</td> <td></td> </tr> <tr> <td>7. PERFORMING ORGANIZATION NAME(S) AND ADDRESS(ES)</td> <td>Naval Postgraduate School, Computer Science Department, Monterey, CA, 93943</td> </tr> <tr> <td>8. PERFORMING ORGANIZATION REPORT NUMBER</td> <td></td> </tr> <tr> <td>9. SPONSORING/MONITORING AGENCY NAME(S) AND ADDRESS(ES)</td> <td></td> </tr> <tr> <td>10. SPONSOR/MONITOR’S ACRONYM(S)</td> <td></td> </tr> <tr> <td>11. SPONSOR/MONITOR’S REPORT NUMBER(S)</td> <td></td> </tr> <tr> <td>12. DISTRIBUTION/AVAILABILITY STATEMENT</td> <td>Approved for public release; distribution unlimited</td> </tr> <tr> <td>13. SUPPLEMENTARY NOTES</td> <td>The original document contains color images.</td> </tr> <tr> <td>14. ABSTRACT</td> <td></td> </tr> <tr> <td>15. SUBJECT TERMS</td> <td></td> </tr> <tr> <td>16. SECURITY CLASSIFICATION OF:</td> <td>a. REPORT unclassified</td> </tr> <tr> <td>17. LIMITATION OF ABSTRACT</td> <td></td> </tr> <tr> <td>18. NUMBER OF PAGES</td> <td>13</td> </tr> <tr> <td>19a. NAME OF RESPONSIBLE PERSON</td> <td></td> </tr> </tbody> </table> Standard Form 298 (Rev. 8-98) Prescribed by ANSI Std Z39-18 Many DoD information systems are COTS/GOTS based (commercial/government off-the-shelf, including “legacy systems”). While using individual COTS/GOTS components saves DoD money, it shifts problems from software development to software integration and interoperability. It is a common belief that interoperability problems are caused by incompatible interface and data formats, and can be fixed “easily” using interface converters and data formatters. However, the real challenges in fixing interoperability problems are incompatible data interpretations, inconsistent assumptions, requirement extensions triggered by global integration issues, and timely data communication between components. Many DoD information systems, especially C4ISR systems, operate under tight timing constraints. Builders of COTS/GOTS based systems have no control over the network on which components communicate. They have to work with available infrastructure and need tools and methods to assist them in making correct design decisions to integrate COTS/GOTS components into a distributed network based system. Similar integration and interoperability problems are common in the commercial sector, and real-time issues are a growing concern. For example, just-in-time manufacturing, on-demand accounting, and factory automation all involve timing requirements. Although software engineers have more control over interfaces and data compatibility between individual components of war fighter systems, they encounter similar data communication problems when they need to connect these components via heterogeneous networks. We can tackle the problem using prototyping and a “wrapper and glue” technology for interoperability and integration. Our approach is based on a distributed architecture where components collaborate via message passing over heterogeneous networks. It uses a generic interface that allows system designers to specify communication and operating requirements between components as parameters, based on properties of COTS/GOTS components. A separate parameterized model of network characteristics constrains the concrete “glue” software generated for each node. The model enables partial specification of requirements by the system designers, and allows them to explore design alternatives and determine missing parameters via rapid prototyping. 2. The Wrapper and Glue Approach The cornerstone of our approach is automatic generation of wrapper and glue software based on designer specifications. This software bridges interoperability gaps between individual COTS/GOTS components. Wrapper software provides a common message-passing interface for components that frees developers from the error prone tasks of implementing interface and data conversion for individual components. The glue software schedules time-constrained actions and carries out the actual communication between components. (See Figure 2) Our glue-and-wrapper approach uses rapid prototyping and automated software synthesis to improve reliability. It differs from proxy and broker patterns in the object-oriented design literature [4] in that it provides a formal model to support hardware/software co-design. Existing pattern approaches focus on low level data transfer issues. Our approach allows system designers to concentrate on the difficult interoperability problems and issues, while freeing them from implementation details. Prototyping with engineering decision support can help identify and resolve requirements conflicts and semantic incompatibilities. Glue code works on two levels. It controls the orderly execution of components within a subsystem, and ensures the timely delivery of information between components across a network. Automated generation of glue code depends on automated local and distributed scheduling of actions on heterogeneous computing platforms. Identifying timing constraint conflicts and assessing constraint feasibility are critical in designing and constructing real-time software quickly. Checking whether a set of timing and task precedence constraints can be met on a chosen hardware configuration is known to be a difficult problem. Computer aid is needed in tackling such problem. Figure 2. The wrapper and glue software 3. The Computer Aided Prototyping System (CAPS) The value of computer aided prototyping in software development is clearly recognized. It is a very effective way to gain understanding of the requirements, reduce the complexity of the problem and provide an early validation of the system design. Bernstein estimated that for every dollar invested in prototyping, one can expect a $1.40 return within the life cycle of the system development [1]. To be effective, prototypes must be constructed and modified rapidly, accurately, and cheaply [8]. Computer aid for rapidly and inexpensively constructing and modifying prototypes makes it feasible [10]. The Computer-Aided Prototyping System (CAPS), a research tool developed at the Naval Postgraduate School, is an integrated set of software tools that generate source programs directly from high level requirements specifications [7] (Figure 3). It provides the following kinds of support to the prototype designer: 1. timing feasibility checking via the scheduler, 2. consistency checking and automated assistance for project planning, configuration management, scheduling, designer task assignment, and project completion date estimation via the Evolution Control System, 3. computer-aided design completion via the editors, 4. computer-aided software reuse via the software base, and 5. automatic generation of wrapper and glue code. The efficacy of CAPS has been demonstrated in many research projects at the Naval Postgraduate School and other facilities. 3.1 Overview of the Caps Method There are four major stages in the CAPS rapid prototyping process: software system design, construction, execution, and requirements evaluation/modification (Figure 4). ![Iterative Prototyping Process in CAPS](image) The initial prototype design starts with an analysis of the problem and a decision about which parts of the proposed system are to be prototyped. Requirements for the prototype are then generated, either informally (e.g. English) or in some formal notation. These requirements may be refined by asking users to verify their completeness and correctness. After some requirements analysis, the designer uses the CAPS PSDL editor to draw dataflow diagrams annotated with nonprocedural control constraints as part of the specification of a hierarchically structured prototype, resulting in a preliminary, top-level design free from programming level details. The user may continue to decompose any software module until its components can be realized via reusable components drawn from the software base or new atomic components. This prototype is then translated into the target programming language for execution and evaluation. Debugging and modification utilize a design database that assists the designers in managing the design history and coordinating change, as well as other tools shown in Figure 3. 3.2 CAPS as a Requirements Engineering Tool The requirements for a software system are expressed at different levels of abstraction and with different degrees of formality. The highest level requirements are usually informal and imprecise, but they are understood best by the customers. The lower levels are more technical, precise, and better suited for the needs of the system analysts and designers, but they are further removed from the user's experiences and less well understood by the customers. Because of the differences in the kinds of descriptions needed by the customers and developers, it is not likely that any single representation for requirements can be the “best” one for supporting the entire software development process. CAPS provides the necessary means to bridge the communication gap between the customers and developers. The CAPS tools are based on the Prototype System Description Language (PSDL), which is designed specifically for specifying hard real-time systems [5, 6]. It has a rich set of timing specification features and offers a common baseline from which users and software engineers describe requirements. The PSDL descriptions of the prototype produced by the PSDL editor are very formal, precise and unambiguous, meeting the needs of the system analysts and designers. The demonstrated behavior of the executable prototype, on the other hand, provides concrete information for the customer to assess the validity of the high level requirements and to refine them if necessary. 3.3 CAPS as a System Testing and Integration Tool Unlike throw-away prototypes, the process supported by CAPS provides requirements and designs in a form that can be used in construction of the operational system. The prototype provides an executable representation of system requirements that can be used for comparison during system testing. The existence of a flexible prototype can significantly ease system testing and integration. When final implementations of subsystems are delivered, integration and testing can begin before all of the subsystems are complete by combining the final versions of the completed subsystems with prototype versions of the parts that are still being developed. 3.4 CAPS as an Acquisition Tool Decisions about awarding contracts for building hard real-time systems are risky because there is little objective basis for determining whether a proposed contract will benefit the sponsor at the time when those decisions must be made. It is also very difficult to determine whether a delivered system meets its requirements. CAPS, besides being a useful tool to the hard real-time system developers, is also very useful to the customers. Acquisition managers can use CAPS to ensure that acquisition efforts stay on track and that contractors deliver what they promise. CAPS enables validation of requirements via prototyping demonstration, greatly reducing the risk of contracting for real-time systems. 3.5 A Platform Independent User Interface The current CAPS system provides two interfaces for users to invoke different CAPS tools and to enter the prototype specification. The main interface (Figure 5) was developed using the TAE+ Workbench [11]. The Ada source code generated automatically from the graphic layout uses libraries that only work on SUNOS 4.1.X operating systems. The PSDL editor (Figure 6), which allows users to specify the prototype via augmented dataflow diagram, was implemented in C++ and can only be executed under SUNOS 4.1.X environments. A portable implementation of the CAPS main interface and the PSDL editor was needed to allow users to use CAPS to build PSDL prototypes on different platforms. We choose to overcome these limitations by reimplementing the main interface (Figure 7) and the PSDL editor (Figure 8) using the Java programming language [2]. The new graphical user interface, called the Heterogeneous Systems Integrator (HSI), is similar to the previous CAPS. Users of previous CAPS versions will easily adapt to the new interface. There are some new features in this implementation, which do not affect the functionality of the program, but provide a friendlier interface and easier use. The major improvement is the addition of the tree panel on the left side of the editor. The tree panel provides a better view of the overall prototype structure since all of the PSDL components can be seen in a hierarchy. The user can navigate through the prototype by clicking on the names of the components on the tree panel. Thus, it is possible to jump to any level in the hierarchy, which was not possible earlier. 4. A Simple Example: Prototyping a C3I Workstation To create a first version of a new prototype, users can select “New” from the “Prototype” pull-down menu of the CAPS main interface (Figure 9). The user will then be asked to provide the name of the new prototype (say “c3i_system”) and the CAPS PSDL editor will be automatically invoked with a single initial root operator (with a name same as that of the prototype). CAPS allows the user to specify the requirements of prototypes as augmented dataflow graphs. Using the drawing tools provided by the PSDL editor, the user can create the top-level dataflow diagram of the c3i_system prototype as shown in Figure 10, where the c3i_system prototype is modeled by nine modules, communicating with each other via data streams. To model the dynamic behavior of these modules, the dataflow diagram is augmented with control and timing constraints. For example, the user may want to specify that the weapons_interface module has a maximum response time of 3 seconds to handle the event triggered by the arrival of new data in the weapon_status_data stream, and it only writes output to the weapon_emrep stream if the status of the weapon_status_data is damage, service_required, or out_of_ammmunition. CAPS allow the user to specify these timing and control constraints using the pop-up operator property menu (Figure 11), resulting in a top-level PSDL program shown in Figure 12. To complete the specification of the c3i_system prototype, the user must specify how each module will be implemented by choosing the implementation language for the module via the operator property menu. The implementation of a module can be in either the target programming language or PSDL. A module with an implementation in the target programming language is called an atomic operator. A module that is decomposed into a PSDL implementation is called a composite operator. Module decomposition can be done by selecting the corresponding operator in the tree-panel on the left side of the PSDL editor. CAPS supports an incremental prototyping process. The user may choose to implement all nine modules as atomic operators (using dummy components) in the first version, so as to check out the global effects of the timing and control constraints. Then, he/she may choose to decompose the comms_interface module into more detailed subsystems and implement the sub-modules with reusable components, while leaving the others as atomic operators in the second version of the prototype, and so on. Figure 10. Top-level Dataflow Diagram of the c3i_system. Figure 11. Pop-up Operator Property Menus OPERATOR c3i_system SPECIFICATION DESCRIPTION (This module implements a simplified version of a generic C3I workstation.) END IMPLEMENTATION GRAPH Figure 12. Top-level Specification of the c3i_system To facilitate the testing of the prototypes, CAPS provides the user with an execution support system that consists of a translator, a scheduler and a compiler. Once the user finishes specifying the prototype, he/she can invoke the translator and the scheduler from the CAPS main interface to analyze the timing constraints for feasibility and to generate a supervisor module for each subsystem of the prototype in the target programming language. Each supervisor module consists of a set of driver procedures that realize all the control constraints, a high priority task (the static schedule) that executes the time-critical operators in a timely fashion, and a low priority dynamic schedule task that executes the non-time-critical operators when there is time available. The supervisor module also contains information that enables the compiler to incorporate all the software components required to implement the atomic operators and generate the binary code automatically. The translator/scheduler also generates the glue code needed for timely delivery of information between subsystems across the target network. For prototypes which require sophisticated graphic user interfaces, the CAPS main interface provides an interface editor to interactively sculpt the interface. In the c3i_system prototype, we choose to decompose the comms_interface, the track_database_manager and the user_interface modules into subsystems, resulting in hierarchical design consisting of 8 composite operators and twenty-six atomic operators. The user interface of the prototype has a total of 14 panels, four of which are shown in Figure 13. The corresponding Ada program has a total of 10.5K lines of source code. Among the 10.5K lines of code, 3.5K lines comes from supervisor module that was generated automatically by the translator/scheduler and 1.7K lines that were automatically generated by the interface editor [9]. 5. Conclusion CAPS has been used successfully as a research tool in prototyping large war-fighter control systems (e.g. the command-and-control station, cruise missile flight control system, missile defense systems) and demonstrated its capability to support the development of large complex embedded software. Specific payoffs include: (1) Formulate/validate requirements via prototype demonstration and user feedback (2) Assess feasibility of real-time system designs (3) Enable early testing and integration of completed subsystems (4) Support evolutionary system development, integration and testing (5) Reduce maintenance costs through systematic code generation (6) Produce high quality, reliable and flexible software (7) Avoid schedule overruns In order to evaluate the benefits derived from the practice of computer-aided prototyping within the software acquisition process, we conducted a case study in which we compared the cost (in dollar amounts) required to perform requirements analysis and feasibility study for the c3i system using the 2167A process, in which the software is coded manually, and the rapid prototyping process, where part of the code is automatically generated via CAPS [3]. We found that, even under very conservative assumptions, using the CAPS method resulted in a cost reduction of $56,300, a 27% cost saving. Taking the results of this comparison, then projecting to a mission control software system, the command and control segment (CCS), we estimated that there would be a cost saving of 12 million dollars. Applying this concept to an engineering change to a typical component of the CCS software showed a further cost savings of $25,000. Figure 13. User Interface of the c3i_system 6. References
{"Source-Url": "https://calhoun.nps.edu/server/api/core/bitstreams/649a692d-1894-426e-a86a-fc7d598411a0/content", "len_cl100k_base": 4630, "olmocr-version": "0.1.50", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 27387, "total-output-tokens": 5714, "length": "2e12", "weborganizer": {"__label__adult": 0.0002574920654296875, "__label__art_design": 0.0002244710922241211, "__label__crime_law": 0.0002894401550292969, "__label__education_jobs": 0.0006122589111328125, "__label__entertainment": 4.202127456665039e-05, "__label__fashion_beauty": 0.00011217594146728516, "__label__finance_business": 0.0002363920211791992, "__label__food_dining": 0.0002287626266479492, "__label__games": 0.0004167556762695313, "__label__hardware": 0.0011720657348632812, "__label__health": 0.00030922889709472656, "__label__history": 0.0001829862594604492, "__label__home_hobbies": 6.449222564697266e-05, "__label__industrial": 0.0004374980926513672, "__label__literature": 0.00013375282287597656, "__label__politics": 0.00016558170318603516, "__label__religion": 0.0002715587615966797, "__label__science_tech": 0.0207061767578125, "__label__social_life": 5.888938903808594e-05, "__label__software": 0.0082855224609375, "__label__software_dev": 0.96484375, "__label__sports_fitness": 0.00019979476928710935, "__label__transportation": 0.000507354736328125, "__label__travel": 0.00015413761138916016}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 26615, 0.02969]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 26615, 0.41583]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 26615, 0.88795]], "google_gemma-3-12b-it_contains_pii": [[0, 667, false], [667, 3078, null], [3078, 6680, null], [6680, 9026, null], [9026, 10925, null], [10925, 12437, null], [12437, 14235, null], [14235, 17539, null], [17539, 18830, null], [18830, 20933, null], [20933, 21033, null], [21033, 21234, null], [21234, 24661, null], [24661, 24878, null], [24878, 26615, null]], "google_gemma-3-12b-it_is_public_document": [[0, 667, true], [667, 3078, null], [3078, 6680, null], [6680, 9026, null], [9026, 10925, null], [10925, 12437, null], [12437, 14235, null], [14235, 17539, null], [17539, 18830, null], [18830, 20933, null], [20933, 21033, null], [21033, 21234, null], [21234, 24661, null], [24661, 24878, null], [24878, 26615, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 26615, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 26615, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 26615, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 26615, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 26615, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 26615, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 26615, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 26615, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 26615, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 26615, null]], "pdf_page_numbers": [[0, 667, 1], [667, 3078, 2], [3078, 6680, 3], [6680, 9026, 4], [9026, 10925, 5], [10925, 12437, 6], [12437, 14235, 7], [14235, 17539, 8], [17539, 18830, 9], [18830, 20933, 10], [20933, 21033, 11], [21033, 21234, 12], [21234, 24661, 13], [24661, 24878, 14], [24878, 26615, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 26615, 0.21849]]}
olmocr_science_pdfs
2024-11-30
2024-11-30
57ff059a15290e2c3faa64c0141e961bfd6229a3
Turning Data into Knowledge: Creating and Implementing a Meta Data Strategy Anne Marie Smith, Ph.D. Director of Education, Principal Consultant amsmith@ewsolutions.com Agenda - Introduction - Meta Data Overview - Principles of Meta Data Management - Meta Data Strategy - Key Roles in Meta Data Management - Meta Data Quality - Important Aspects of Metadata - Conclusion Anne Marie Smith - Background - BA and MBA Management Information Systems (La Salle University) - PhD, Management Information Systems (NorthCentral University) - Consultant in data management, meta data, data warehousing, requirements analysis, systems re-engineering - Certified Project Management Professional (PMP) - Certified Data Management Professional (www.iccp.org) - Author of over 40 publications and papers - Instructor on varied information systems management topics What is Meta Data? Meta Data Definition All physical data (contained in software and other media) and knowledge (contained in employees and various media) from within and outside an organization, containing information about your company’s physical data, industry, technical processes, and business processes. Marco, D. P., Building and Managing the Meta Data Repository Meta Data Is Knowledge • Data is a sharable resource • Effective use and reuse of data requires an enterprise view of essential concepts, entities and attributes for cross-application and cross-departmental functionality • Enterprise view MUST be generated at the top of an organization, with active commitment and support for efforts Strategic Plan for Information - Evaluate and choose a meta data management methodology - Customize methodology for unique business requirements - Meta data strategy should be integrated into the enterprise data management strategy - Develop and implement meta data strategy - Integrate new methodology into systems development and maintenance Goals of Meta Data Strategy • Offer recognition of value of data and its components • Develop map for managing expanding information requirements • Highlight importance of enterprise data management • Address data quality, data integrity, data reuse • Enable strategic information to be consistently and accurately derived from operational data • Improve productivity through component development, management and reuse • Reduce time necessary for software development cycle • Share information with customers and business partners • An enterprise perspective of information resources and impact analysis provides competitive advantage Meta Data Strategy Components - Meta Data Challenges / Business Problems - Meta Data Goals and Objectives - Meta Data Usage Plans - Meta Data Elements - Meta Data Sources - Meta Data Quality - Meta Data Storage and Products - Meta Data Standards and Procedures - Meta Data Training - Meta Data Measurement - Project Plans – high level Data Management Objectives • Build a framework for accurately capturing, sharing, distributing, securing and leveraging a company's data resources, including creating and refining data models and establishing and maintaining an enterprise meta data management environment • Strategically plan for a company's future information requirements • Support data self-reliance and efficient use of data in business practices Principles of Meta Data Management - Establish a meta data strategy and policies - Create or adopt a meta data standards set - Establish and maintain data stewardship role and function - Establish and maintain a collection of relevant meta data - Publish relevant meta data - Maintain meta data standards set - Maintain meta data content from all systems Keys to Meta Data Management - Develop meta data strategy before embarking on evaluating, purchasing and installing complex management products - Products / tools are necessary for effective management of meta data - Senior management commitment to meta data management is required - cost and time issues - Explanation of WHY meta data is needed and the purpose of each type of meta data - Policies to ensure definitions, acronyms and abbreviations are interoperable - Procedures to ensure policies are implemented correctly • Offer recognition of value of data and its meta data (corporate assets) • Establish information requirements • Instill data management / meta data management practices into organization • Address data quality, data reuse, data integrity issues for legacy applications and new development • Promote enterprise use of common data management tools and techniques • Highlight importance of enterprise data management • Measurement of value of information Meta Data Challenge - **Broad**: some meta data for every production application and structure - **Deep**: detailed meta data for critical production applications and structures **Decision points:** - What groups have “pain”? Why does “pain” exist? - What processes can be leveraged for maintenance? - What meta data is readily available and will be useful? - Who owns meta data in an organization? MME Strategy Roadmap Assessment 1. Introduction 2. Background 3. Executive Summary of Findings & Recommendations 4. Challenges ACME Company Faces 5. Business Drivers for A Managed Meta Data Environment 6. Potential Benefits of Enterprise Meta Data 7. Issues & Challenges of Enterprise Meta Data 8. Key Recommendations 9. Meta Data Roadmap Implementation Program & Timelines M3 Methodology Meta Data Strategy Components - Meta Data Challenges / Business Problems - Meta Data Goals and Objectives - Meta Data Usage Plans - Meta Data Elements - Meta Data Sources - Meta Data Quality - Meta Data Storage and Products - Meta Data Standards and Procedures - Meta Data Training - Meta Data Measurement - Project Plans – high level Levels of Metadata • **Direct:** • Byproduct of original source – information systems that create, maintain and dispense data • **Indirect:** • Created after direct meta data – derived from system artifacts, uses of system, analysis and decision-making Kinds of Metadata - 1 • Business: • Meta data that supports a company’s business users • Examples: • Business terms and definitions for entities and attributes • Subject area names • Query and report definitions • Report mappings • Data stewards • ETL process names Kinds of Metadata - 2 - Technical: - Meta data that supports a company’s technical users and IT staff - Examples: - The method a technical analyst uses for development and maintenance of the data warehouse - Physical table and column names - Data mapping and transformation logic - Source systems - Foreign key and indexes - Security - ETL process names Meta Data Management in Governance - Stewards manage data (instances of data values) and meta data (information concerning the data). - Meta data management is a **key technical enabler** for the performance of successful governance. - Difficult to do governance successfully without a managed meta data environment. - Difficult to create a strong meta data approach without governance and stewardship. Meta Data Elements and Sources - Business definitions and business names - Database and modeling tools - Software tools - End users - Documents/Spreadsheets - Messaging/Transactions - Applications - Websites/E-Commerce - Third parties Quality: Imperative! - Low-quality meta data creates: - Replicated dictionaries / repositories / meta data storage - Inconsistent meta data - Competing sources of meta data “truth” - High quality meta data creates: - Confident, cross-organizational development - Consistent understanding of the values of the data resources - Meta data “knowledge” across the organization - Reuse of data and data structures Meta Data Quality Metrics - **Data Accuracy**: how well data values represent the actual business requirements - **Data Completeness**: how well available data meets current and future business information demands - **Data Currency**: how timely are data values - **Data Consistency**: are data definitions and values are the same across all data stores - **Data Integrity**: conformation of source data values to those allowed by business rules (data characteristics, default values, referential integrity constraints, derived data values) ## Priority Criteria Example <table> <thead> <tr> <th>Criteria for assessing assets to be governed</th> <th>Weight</th> <th>Comments</th> </tr> </thead> <tbody> <tr> <td>Enterprise asset?</td> <td>3</td> <td></td> </tr> <tr> <td>a. Reusable</td> <td></td> <td></td> </tr> <tr> <td>b. Standard</td> <td></td> <td></td> </tr> <tr> <td>c. System of record</td> <td></td> <td></td> </tr> <tr> <td>Business unit specific?</td> <td>2</td> <td></td> </tr> <tr> <td>Local?</td> <td>1</td> <td></td> </tr> <tr> <td>Ease of capture</td> <td>2</td> <td></td> </tr> <tr> <td>Subject area</td> <td>1</td> <td>Capture as part of asset metadata and filter</td> </tr> <tr> <td>Master, transaction, BI data</td> <td>3</td> <td>In this order</td> </tr> <tr> <td>Lineage at a high level</td> <td>2</td> <td></td> </tr> <tr> <td>Sustained asset, in transition or sunset</td> <td>2</td> <td>Determine how much value there would be in capturing meta data from a system which is being retired.</td> </tr> <tr> <td>Consolidate other metadata sources - EPR</td> <td></td> <td><strong>Parallel track</strong>: engagement would include commitment to retire old source</td> </tr> </tbody> </table> 0 = not needed 1 = some importance 2 = important 3 = critical Courtesy of Deborah Poindexter, EWSolutions Identifying Data and Meta Data Sources - Transactional systems, data warehouses, non-structured sources (documents, email) - Prioritize based on your criteria, examples: - Enterprise data – used by more than one functional area - Reusable - Standard - System of record - Specific subject area - Master, transaction, BI data - Sustained asset – not scheduled for retirement Meta Data Standards - Established by Meta Data Council - Naming standards - Abbreviations (systems and business) - Class words - Code values - Business names and definitions - CASE modeling standards - Standard definitions for elements - Entity and element creation/modification procedures - Storage and accessibility of standards and procedures Meta Data Storage and Products - Central versus distributed storage - Active versus passive storage - Physical requirements of storage facility - Meta data products, capabilities and integration - Repository - User interfaces to repository - Warehouse manager software - Query tool data dictionary Meta Data Training - Systems - Data Administration - Database Administration - Application Development and maintenance programming - Executive - Business - Primary users (e.g., data stewards) - Secondary users - Executive Meta Data Measurement - Measure use and effectiveness of meta data - Measure success of quality control program - Measure acceptance and success of stewardship - Integration of meta data strategy into systems methodology and business practices - Measure reuse of data and data structures A focus on meta data requires a conscious cultural change from individually developed applications to a unified acceptance and usage of data as the foundation of information and knowledge. Change is unsettling to all creatures - expectations and reactions must be anticipated, addressed and resolved. To be effective, cultural change must be managed in a spirit of co-operation and mutual accountability. Meta Data Strategy First Steps Meta Data Strategy First Steps 1. Develop a charter for meta data management 2. Form the Meta Data Council – oversight for all meta data activities 3. Establish roles for council members - stewards 4. Create meta data management scope documents and overall project plan 5. Define and prioritize the council’s activities 6. Design standard documents and forms for meta data management Create a Charter • Create a documented charter for all meta data activities, including all appropriate functions • Business purposes that necessitated creating the meta data roles • Target the specific concerns and opportunities of the organization concerning meta data management • **Best Practice:** Most charters should fit on one or two single-spaced pages. Anything longer is likely too long • Charter is a business document and not a technical document **Sample Project Charter** **Project Title:** Information Technology (IT) Upgrade Project **Project Start Date:** August 23, 2001 **Projected Finish Date:** February 24, 2002 **Project Manager:** John Doe, jdoe@company.com **Project Objectives:** Upgrade hardware and software for all employees (approximately 2,000) within 9 months based on new corporate standards. See attached sheet describing the new standards. Upgrades may affect servers and midrange computers as well as network hardware and software. Budgeted $1,000,000 for hardware and software costs and $500,000 for labor costs. **Approach:** - Update the IT inventory database to determine upgrade needs - Develop detailed cost estimate for project and report to CIO - Issue a request for quotes to obtain hardware and software - Use internal staff as much as possible to do the planning, analysis, and installation **Approval Signatures:** • Chief Data Steward - Chair • Business Data Stewards • Technical Steward • Other IT staff as necessary (DA, DBA, etc.) • Project Representatives Participates in the organization’s Governance Council – focused on meta data issues and activities Meta Data Council Charge - Coordinates and directs meta data strategies and processes across the enterprise - Ensures meta data strategies and processes support organizational mission and objectives - Develops and directs meta data standards across the organization and projects - Assigns roles, identifies responsibility and authority and implements meta data governance through a number of organizational layers - Provides mechanisms for coordination, communications, information sharing, prioritization, and conflict resolution within the organization and across projects - Communicates the institutional value and importance meta data and information management brings to the organization - Serves as a resource to key organizational committees with meta data management issues **Meta Data Council** **Meta Data Management Activities** - Policies, Procedures, Standards **Members:** - Chair/Chief Data Steward - Business Data Stewards - Technical Steward - Other IT - Project Reps Establish Roles For Council - Define the team’s roles and responsibilities - The stewardship roles (executive sponsor, chief, business, and technical) are a good place to start - Most organizations will tailor (modify, add, and/or delete) these roles, titles and descriptions to suit their specific needs Meta Data Responsibilities - **Data Stewardship**: responsible for consistency and integrity of data objects under their control; usually from functional business units - **Data Custodians**: responsible for syntactical value of data; usually from Data Administration and/or Database Administration - Jointly establish standards and procedures for proper use, quality control and integration ("stewardship team") Key Meta Data Management Tasks - Establish data owners, custodians and users - Formalize data stewardship team and governance council - Define corporate data and process standards - Define edit philosophy and user education philosophy - Centralize information object identification and control processes and impact assessment Key Meta Data Management Tasks - Define basic enterprise information through an enterprise data model – capture enterprise level meta data - Develop application data and process models based on enterprise model - define application information - Become an integral part of the software design and development process - Define data and meta data capture, integration, access, and delivery processes and choose appropriate tools Meta Data Responsibility and Use - **Data Ownership** – syntactical value of data - **Data Stewardship** – consistency and integrity of meta data - Establish standards and procedures - Proper use, quality control and measurement - Integration with methodology and business Define and Prioritize Activities - Meta Data Council must define the specific activities they will perform, individually and as a team. - These activities MUST support the strategic objectives of the Meta Data Management charter. - Once the activities have been defined, they must be prioritized – challenge: competing interests, competing resources, project needs, etc. ## Define and Prioritize Activities <table> <thead> <tr> <th>Possible Data Stewardship Activities</th> <th>Projected Organizational Benefit</th> <th>Projected Challenges</th> <th>Priority – H, M, L</th> </tr> </thead> <tbody> <tr> <td>Define physical domain values for each attribute on the primary applications</td> <td>Critical information for using systems as sources for decision-support</td> <td>Identify primary applications first, need access to technical meta data, differing values for common attributes</td> <td>H</td> </tr> <tr> <td>Define key business rules for all data warehousing and CRM applications</td> <td>Essential for migration of DW and CRM applications in Q2</td> <td>No documented business rules, activity will require many interviews</td> <td>H</td> </tr> <tr> <td>Identify potential data stewards in company we are acquiring</td> <td>Must be performed during due diligence phase – not until Q3</td> <td>Need resumes and backgrounds of all acquired company staff</td> <td>M</td> </tr> <tr> <td>Align common meta data across primary source systems</td> <td>Critical information for using systems as sources for decision-support</td> <td>Differing values for common attributes</td> <td>H</td> </tr> </tbody> </table> Courtesy of Deborah Poindexter, EWSolutions Proceedings of the MIT 2007 Information Quality Industry Symposium PG 434 Meta Data Strategy Scope Document Scope Document • Critical for setting good requirements • All activities should be based on the scope document • Use to prevent “scope creep” • Do NOT skip this step Scope Document - Major Sections - Project Description - Current state of meta data management - Future state of meta data management - Project Scope – areas to be included and areas to be excluded - Critical Success Factors - Risk Factors - Assumptions - Issues - Resources (targeted, not formal yet) - High-level Project Plan Success and Challenges - **Successes:** - Reduction of redundant data - Increased understanding of data sources, targets, usage, etc. - User-driven queries and information needs - Increased collaboration among roles - **Challenges:** - Resistance to change from IT and business users - Concern over costs of Data Stewardship program - Education in enterprise data management, data stewardship - Lack of support from executives Iterative Approach - Integrate meta data management efforts into current methodology iteratively: - Planning - Requirements - Analysis - Design - Development - Testing - Implementation - Maintenance - Enhancement How do your meta data management plans / objectives fit into these lifecycle stages? Conclusions • Meta Data Strategy can assist in achievement of data and information / intelligence goals • Meta Data Strategy should be part of a comprehensive systems methodology and developed in conjunction with the business community • Establishment and implementation of metrics and a permanent council for implementation are fundamental to the success of a Meta Data Strategy Meta Data Reference Sources - http://dublincore.org/ - http://metadata-standards.org - http://www.ukoln.ac.uk/metadata/ References - Brackett, M. H., Data Sharing, (1994), Wiley - Brackett, M. H., Data Resource Quality, (2000), Addison-Wesley - English, L. P., Improving Data Warehouse and Business Information Quality (1999), Wiley - Marco, D. P., Building and Managing the Meta Data Repository (2002), Wiley - Tannenbaum, A., Metadata Solutions, (2003), Addison-Wesley - Van Grembergen, W., Strategies for Information Technology Governance, (2004), Idea Group Publishing EWSolutions, Inc. 15 Spinning Wheel Road, Suite 330 Hinsdale, IL 60521 Office 630.920.0005 Fax 630.920.0008 www.EWSolutions.com
{"Source-Url": "http://mitiq.mit.edu/IQIS/Documents/CDOIQS_200777/Papers/01_23_2D.pdf", "len_cl100k_base": 4301, "olmocr-version": "0.1.50", "pdf-total-pages": 53, "total-fallback-pages": 0, "total-input-tokens": 79483, "total-output-tokens": 6019, "length": "2e12", "weborganizer": {"__label__adult": 0.0004892349243164062, "__label__art_design": 0.0010690689086914062, "__label__crime_law": 0.001270294189453125, "__label__education_jobs": 0.053497314453125, "__label__entertainment": 0.00021648406982421875, "__label__fashion_beauty": 0.0003676414489746094, "__label__finance_business": 0.038543701171875, "__label__food_dining": 0.0005731582641601562, "__label__games": 0.0007681846618652344, "__label__hardware": 0.0019502639770507812, "__label__health": 0.00092315673828125, "__label__history": 0.0008053779602050781, "__label__home_hobbies": 0.0005636215209960938, "__label__industrial": 0.0016460418701171875, "__label__literature": 0.0010652542114257812, "__label__politics": 0.000640869140625, "__label__religion": 0.0006394386291503906, "__label__science_tech": 0.1451416015625, "__label__social_life": 0.0005784034729003906, "__label__software": 0.11236572265625, "__label__software_dev": 0.63525390625, "__label__sports_fitness": 0.0003669261932373047, "__label__transportation": 0.0007920265197753906, "__label__travel": 0.0004012584686279297}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 20554, 0.01048]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 20554, 0.18338]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 20554, 0.81524]], "google_gemma-3-12b-it_contains_pii": [[0, 170, false], [170, 373, null], [373, 853, null], [853, 1251, null], [1251, 1565, null], [1565, 1910, null], [1910, 2547, null], [2547, 2883, null], [2883, 3304, null], [3304, 3660, null], [3660, 4186, null], [4186, 4639, null], [4639, 5041, null], [5041, 5416, null], [5416, 5431, null], [5431, 5767, null], [5767, 6026, null], [6026, 6321, null], [6321, 6708, null], [6708, 7112, null], [7112, 7348, null], [7348, 7772, null], [7772, 8314, null], [8314, 9614, null], [9614, 10008, null], [10008, 10363, null], [10363, 10670, null], [10670, 10908, null], [10908, 11197, null], [11197, 11604, null], [11604, 11635, null], [11635, 12020, null], [12020, 12486, null], [12486, 13402, null], [13402, 13648, null], [13648, 14637, null], [14637, 14945, null], [14945, 15361, null], [15361, 15688, null], [15688, 16116, null], [16116, 16390, null], [16390, 16762, null], [16762, 18005, null], [18005, 18039, null], [18039, 18206, null], [18206, 18534, null], [18534, 18979, null], [18979, 19297, null], [19297, 19680, null], [19680, 19680, null], [19680, 19902, null], [19902, 20426, null], [20426, 20554, null]], "google_gemma-3-12b-it_is_public_document": [[0, 170, true], [170, 373, null], [373, 853, null], [853, 1251, null], [1251, 1565, null], [1565, 1910, null], [1910, 2547, null], [2547, 2883, null], [2883, 3304, null], [3304, 3660, null], [3660, 4186, null], [4186, 4639, null], [4639, 5041, null], [5041, 5416, null], [5416, 5431, null], [5431, 5767, null], [5767, 6026, null], [6026, 6321, null], [6321, 6708, null], [6708, 7112, null], [7112, 7348, null], [7348, 7772, null], [7772, 8314, null], [8314, 9614, null], [9614, 10008, null], [10008, 10363, null], [10363, 10670, null], [10670, 10908, null], [10908, 11197, null], [11197, 11604, null], [11604, 11635, null], [11635, 12020, null], [12020, 12486, null], [12486, 13402, null], [13402, 13648, null], [13648, 14637, null], [14637, 14945, null], [14945, 15361, null], [15361, 15688, null], [15688, 16116, null], [16116, 16390, null], [16390, 16762, null], [16762, 18005, null], [18005, 18039, null], [18039, 18206, null], [18206, 18534, null], [18534, 18979, null], [18979, 19297, null], [19297, 19680, null], [19680, 19680, null], [19680, 19902, null], [19902, 20426, null], [20426, 20554, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 20554, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 20554, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 20554, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 20554, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 20554, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 20554, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 20554, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 20554, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 20554, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 20554, null]], "pdf_page_numbers": [[0, 170, 1], [170, 373, 2], [373, 853, 3], [853, 1251, 4], [1251, 1565, 5], [1565, 1910, 6], [1910, 2547, 7], [2547, 2883, 8], [2883, 3304, 9], [3304, 3660, 10], [3660, 4186, 11], [4186, 4639, 12], [4639, 5041, 13], [5041, 5416, 14], [5416, 5431, 15], [5431, 5767, 16], [5767, 6026, 17], [6026, 6321, 18], [6321, 6708, 19], [6708, 7112, 20], [7112, 7348, 21], [7348, 7772, 22], [7772, 8314, 23], [8314, 9614, 24], [9614, 10008, 25], [10008, 10363, 26], [10363, 10670, 27], [10670, 10908, 28], [10908, 11197, 29], [11197, 11604, 30], [11604, 11635, 31], [11635, 12020, 32], [12020, 12486, 33], [12486, 13402, 34], [13402, 13648, 35], [13648, 14637, 36], [14637, 14945, 37], [14945, 15361, 38], [15361, 15688, 39], [15688, 16116, 40], [16116, 16390, 41], [16390, 16762, 42], [16762, 18005, 43], [18005, 18039, 44], [18039, 18206, 45], [18206, 18534, 46], [18534, 18979, 47], [18979, 19297, 48], [19297, 19680, 49], [19680, 19680, 50], [19680, 19902, 51], [19902, 20426, 52], [20426, 20554, 53]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 20554, 0.05051]]}
olmocr_science_pdfs
2024-12-03
2024-12-03
e2f2a879319eda5ecef501458b678ee67956b8b8
Application White-listing with Bit9 Parity GIAC (GSEC) Gold Certification Author: Michael Weeks, mweeks9989@gmail.com Advisor: Dominicus Adriyanto Accepted: October 5, 2014 Abstract Endpoint protection based solely on Anti-Virus (AV) signature-based technology is fundamentally flawed. AV technology will only protect against known malware the AV provider has identified and written signatures for. The problem with classic AV protection is it does not detect unknown or unseen malware because it is signature based. A better method is to identify secure software and only allow that software to run. This technique is called application white-listing. Bit9's security solution, Parity, is a leader in this arena. This paper will delve deep in the implementation, configuration, and deployment of the product and explore how the data provided by the product can be utilized to significantly enrich the metrics of a security operations team. 1. Introduction Antivirus is a requirement for a host of compliance standards and is championed to be a critical component for any security baseline (PCI-DSS 3.0-5.1). A recent google search for “Cyber Security Breaches” in Google News shows 16,700 results in Google News. Even NIST has stated that that AV is not an adequate control (Artes, et al, 2013). The basis for this argument is that AV, even with heuristics, looks for methods or signatures that are known to the specific AV vendor. Bit9 Parity goes a step further and restricts the execution of any executables or applications to those only allowed by the product (Bit9 Datasheet, 2013). Parity has a host of benefits as well as some significant drawbacks, but with proper and careful implementation, a deployment of Parity can be successful. Parity has multiple methods to manage and control an environment. Parity is deployed with a server, database and console to control and manage Parity Agents. The deployed agents are a package of executables and configuration files that contain a kernel module that sits on the hardware layer and proxies the raw system calls from the user layer to those resources. For this reason it makes manipulation of the agent from the user layer very difficult. There is also a management console to manipulate the server that controls all agents on endpoints. The server has a backend database that stores data to be used by its processes and to administer the environment. The data in the back-end database has tremendous use, not just for managing the product, but also as a source for a security operations team to pull information. Carbon Black, which was also recently purchased by Bit9, functions as a detection mechanism to support Parity’s control mechanisms. According to the Bit9 site: “Records of execution, file system modifications, registry modifications, network connections, and a copy of every unique binary” (Bit9 and Carbon Black are Now One Company 2014). Some weaknesses in the product are its dependency on the software-signing certificates for ease of administration and user acceptance. This was a significant issue when Parity was compromised by advanced actors, and the Bit9 software signing certificates were compromised (Krebs, 2013). This can be corrected by disabling the trust of Bit9’s software-signing certificates. In addition, the execution prevention can be bypassed by exploits and attacks that stay transient in memory as well as injecting into running processes. One specific method for bypassing the product, outlined at Shmoocon in 2012, was to inject into a .DLL and then migrate to the notifier.exe tool, in the Parity agent, in order elevate privileges. The vulnerability was patched in version 6.0.0. (Shaffer 2012). Despite these few weaknesses, Bit9 Parity can be deployed to greatly enhance endpoint protection as well as protect against most unknown threats. However, in order to protect against unknown threats, and prevent significant negative impact on operations it must be deployed correctly. Michael Weeks, mweeks9989@gmail.com 1.1. Pre-Deployment During pre-deployment, the first thing that must be decided is where it will be deployed. Bit9 would recommend that the product be deployed on all systems in an environment. However, this is not feasible as the cost of the product and the complexity of most environments makes 100% immediate deployment difficult. Parity takes a default deny approach (Bit9 Data Sheet, 2014). This is a good method for protection but can make deployments difficult. To deal with this situation it is a good idea to deploy the product in homogenous environments first. Therefore, in planning deployment it is best to identify and group environments by their similarity and their levels of criticality. The most critical could be where the protection needs to go first. However an additional risk of deploying the product in critical environments is that by description they are critical to the business. So the product must deployed with care, proper planning and testing. There are two major methods of deployment. The product must first be deployed with one of two goals in mind, protection, or control of the environment. 1.1.1. To Protect the Environment (Client-side) Protection and prevention is absolutely ideal when it comes to deployment of Parity. When working with dynamic and non-homogenous environments the product should be deployed in this mindset. An excellent environment for deploying to protect would be a desktop or laptop (client side) environment. With this method of deployment a few extra deployment options must be configured. For instance a few extra white-listing rules to allow dynamic approvals of a multitude of applications, specifically .net and other development tools. Also enabling trust approvals to a certain level will ensure any software signed by a certificate trusted by Bit9 Parity’s Database. This will remove administrative overhead significantly by allowing those files that are “known good: to run in environment. One caveat to that being, that a lot of DLLs and other libraries are not signed by a software certificate and will have to be identified by administrators of the product. Some organizations have purchased Parity purely for the external device control. Parity has excellent control for the denial of non-approved USB keys and can prevent this type of threat. Installation and enabling of this feature prior to any lockdown of executables can be a quick milestone accomplishment in Parity deployment plan. Another consideration is that Parity comes with two types of licenses: Visibility which will provide file and event tracking, provide file bans and device blocking, as well as the Parity Suite which is designed for getting systems into full lockdown. Michael Weeks, mweeks9989@gmail.com 1.1.2. To Control the Environment (Servers) In order to protect an environment administrators and security personnel must control and understand their environment. However methods of deployment can differ with these underlying goals in mind. Deploying to control should be applied in specific environments that have rigorous change control and a low level of change. This would be server environments or other systems that are running on end-of-life operating systems, such as Supervisory Control and Data Acquisition (SCADA) systems, as well as some Point of Sale Systems (POS). This method of deployment must become an integral part of the change control process, because no changes can be made without the Parity administrator getting involved in the change. Limiting software approvals by certificate trust level must be used sparingly. Any approvals based on trusted directories, users and other trust levels baked into the product should not be allowed. Rules should specify a particular process, specific directory not ending in an *, as well as a not using the “everyone” user. This method of deployment (as well as the protection deployment) also heavily utilizes policies. Levels of Lockdown should be created to move systems in and out of maximum lockdown. In this method of deployment there is heavy reliance on policy, because the servers will be migrated in and out of the policy in conjunction with the change control policy. It is highly recommended to deploy separate servers for each of these methods of deployment. To ensure that over-permissive software rules do not accidentally give excessive permissions to those servers in the control deployment. 2. Deployment After deciding what environment to start, it is time to build out the Parity Server and console. According to the Bit9 installation guide, the server should have a SQL server available or a new SQL server database, either 2005 or 2008 deployed and configured prior to installation. (Parity 6.0 Deployment Guide, 2013) The server will also need .net framework 3.5 and a host of other web application Microsoft requirements. All should be included with a current version of Server 2008. [Appendix A]. Prior to installation ensure that all servers meet local hardening procedures. It is recommended to use a database on another server for administration of more than 300 systems. After the database has been identified (or installed) the service account that is identified will need create and owner rights for the database. The database will be called DAS – this is prepopulated by the Parity install scripts, as well as the schema, and all tables. Logging in as the service account and running the installation will greatly simplify deployment. Steps for installation are detailed in the Parity Deployment guide from Bit9, the installation is simple and can be walked through by most experienced administrators. Ensure to install with best practices and ensure that all drive installations are on a separate drive from the operating system. Logs should also be on a separate drive, especially if the database is on the same server. The full document should be retrieved from Bit9’s support portal for installation guides for the version in use. 2.1. Configuration After the server has been installed, it should be simple to browse to the https://localhost which will direct to the Parity console if logging on locally. Browsing from another system to https://servername which will direct the administrator to the Parity console. The default credentials should be username admin and password admin. As always, best practices, change immediately! ![Login Screen](image) **Figure 4 – Login Screen** After logging in and changing default username and password, an excellent next step is to enable AD logins for administrators. Using local change control procedures request three security groups with exactly the following naming convention: cn="Bit9 Administrators" – full administrators to the console, cn="Bit9 Power Users" – Power Users, and cn="Bit9 ReadOnly Users” – users that can access the console and query data. All other users will have unauthorized access. The security groups will have to be on the same domain that the Parity server is joined to. Administrators should be individuals familiar with the product that, know how to maintain and own the product and its deployment. PowerUsers should be those member of the helpdesk/desk side in a Deployed to Protect (client side) environment or System Administrators in a Deployed to Control (server) environment. ReadOnly Users should be those in management or possibly some security analyst that need to research executables in the environment. After the security groups have been configured, it is a simple process of enabling the AD authentication under the Administration Tab > General Tab under Active Directory / LDAP integration. This configuration should be carefully considered in the Deploy to Control method for deployment, with this type of configuration the security of Active Directory must be considered absolute. Michael Weeks, mweeks9989@gmail.com 2.1.1. Bit9 Knowledge Base Another critical component is the Bit9 knowledgebase. The Bit9 knowledgebase is one of the single largest collection of known good executables available commercially. This will require outbound connectivity to the Bit9 knowledgebase servers on port 443 from the Parity server. It will also require a license from Bit9 knowledgebase. There is an open API to query the data through a restful API. (Script attached – Appendix B) The knowledgebase can be configured in the Administration tab > Licensing > Parity Knowledge Activation. 2.1.2. Other System Administration On the system administration tab there are a host of other setup actions that can be accomplished on this tab as well. On the mail tab, the SMTP settings for alerts can be configured to send alerts for status of systems. The advanced options has the ability to back-up the database, configure automated updates, log out times for the parity console, file uploads configuration, old computer cleanup, software rule completion, and certificate options. Most of these options are not of much concern, however the cleaning up of old agents should be configured. The Security tab under Administration has a critical configuration. The Parity agents communicate with the Parity Console through certificate authentication. The date the certificate expires should be noted, when this happens the agents will not be able to communicate with the server. In Deploy to Protect configuration, this can be production impacting because if agents cannot communicate with the Parity Console then the memory will spike on the servers causing resource depletion. Which is not something that will make operations personnel very happy. A script is attached to move agents from lockdown policy in case a situation like this occurs. [Appendix B] The events tab have two important configurations. Event Log Management need to be well thought out and minimized to ensure system performance is not significantly impacted. The External Event Logging can send events to a SIEM or other syslog server for off-box storage and retention of logs. This can be set to send in CEF, syslog, and other formats. 2.1.3. Policy Configuration Designing the policies in Parity is absolutely critical to having a successful deployment. The default policies that come with the product are a good place to start. “Default Policy” which is designed for the agents to go to once the agent is initially installed. The “Local Approval Policy” which is designed to approve any running executables on the system. The “Template Policy” which is designed to be copied and configured for new policies. Initially four new policies need to be created for management of agents. “Lockdown Policy” must be created to replace the Default Policy and to be the final stop for agents during configuration. “Lockdown Reporting” policy which will be configured on systems to report as if they were in lockdown without actually blocking, and a “Monitoring Policy” to start hashing and collecting execution information on systems. “Disabled Policy” should also be created to for the installation of the agents, and removal of the agents if necessary. The cycle of agents to move for installations should be as follows: - “Disabled Policy” for installation, configuration will allow systems to be installed and uninstalled easily without issue. Also with initial installation of disabled agents on systems, agents can be deployed in mass to a list of systems. - “Monitor Policy” agents will start to hash all files on the system. This activity is processor intensive and should be implemented on systems during downtime, or on one system at a time. - “Lockdown Reporting” agents will behave and report as if the agent is in lockdown mode. This should be utilized for monitoring of agents to remove false positives during tuning. - “Lockdown” agents will lockdown and not allow any approved executables to run. The next critical point to configuration and deployment are software rules. Software rules are a unique feature in Parity and can be the key to a successful deployment or can possibly, undo any protections Parity may provide. After configuring the policies and any trusts for software certificates, software rules should be configured. If the environment is a windows environment some of the default rules should be turned on. Updates for Windows should be enabled, and depending on the environment (Server/Client) all other available software updates that are available on the systems. Most software can be approved through certificates by watching for executions, researching the execution and approving. Some software creates dynamic executables or DLLs, or .pyc python executables, an example being is the .Net framework. The .Net framework creates dynamic DLLs inside multiple directories. There are multiple paths for file creation with specific care to ensure that only DLLs can be written and the specific process is csc.exe. ![Application White-listing with Bit9 Parity](image) **Fig 5 - .Net framework file creation** This will allow the .DLLs to be written as needed to the specified directories as well as only by the specified process. This protects the creation of the files but does not automatically approve the files created on disk. This is only one half of the equation, it is necessary to add the execution control of DLLs on the .net framework. Ensuring that only <Reg:HKLM\Software\Microsoft\.NetFramework\InstallRoot>*\mscorvw.exe and <Reg:HKLM-SoftwareX86\Microsoft\.NetFramework\InstallRoot>*\mscorvw.exe are allowed to run DLLs will go a long way towards protecting the environment from methods of exploiting the .net framework. This is one of the more unique rules that required to be created in the majority of Windows environments. For most rules, a good rule of thumb is to monitor systems in lockdown reporting and review the blocks as block events come in. If the software was a legitimate piece of software, copy the path, and the process that executed the software. Then add a rule to the software rules that allows the software to execute with the specified process. In higher security environments (server) it may be ideal to enter a username as well. Scripts and software become difficult because it becomes necessary to ensure those scripts can execute as well. There are pre-built rules for the execution of scripts however they can be somewhat permissive. It is slightly better to designate specific directories and not allow those scripts to start other executable processes, or even better utilize script signing and sign scripts that are allowed to run in an environment. 2.2. Deploying Agents After all the agent configuration policies have been created and some basic software rules like the .net software rule, it is time to start deploying agents. The agents can be downloaded from https://parityserver/hostpkg/. It is best to start with an agent disabled policy. ![Agent Removal Policy](Image) **Figure 7 – Agent Removal Policy** Installing the agent can be done on all systems through multiple methods, GPO, software packaging and through scripting. Scripting is beneficial, because it can be scheduled and the output can be collected for error checking. See appendix B for an example installation script. Installing the agents is a slow process which requires getting a list of all devices, verifying in the Parity Console the assets are available and the communication level of the agent. Something to consider is that any Windows version after Server 2008 and Windows 7 should deploy the agents without the need for a reboot. However older versions will require a reboot. If the agents are not communicating with the Parity Server ensure that agents can reach the server on TCP port 41002 or reboot the system if necessary. 2.3. Locking Down the Agents After ensuring that all agents are deployed it is time to start locking down agents. This can be accomplished by selectively moving agents into the “Monitoring Policy”. This step in the installation process has the most impact on the system therefore it is best to move agents into this policy during times of less usage and only move a few agents at a time. The Parity agent will start to hash every file on the system at this time and will utilize CPU and memory. If deploying to client systems, initiate after hours. If it is a server environment attempt to stagger it between failover between high-availability environments, or during maintenance windows. After all agents have been moved to the “Monitor Policy” utilize the same method to move the agents into “Lockdown Reporting”. As systems start reporting blocked executables slowly approve individual executables as well as create software rules to ensure that valid executables are approved. This process can be slow, however it is crucial to ensure that the false block rate is as low as possible in order to reduce the impact to business operations. Once the block rate has been reduced to an acceptable level it is time for the most difficult portion of the deployment process. 2.3.1. Policies and Procedures Before moving any systems into lockdown (other than testing systems) it is time to ensure there is a process for addressing blocked executables that users/administrators need to run on the systems. It is likely that any organization that is going to deploy Parity will have methods and processes for IT workflow. This is an ideal method for dealing with end user issues with Parity blocks of potentially useful and needed executables. This should be communicated with the user population to ensure that users know where to go in case they have Parity block. User notifications can be configured in the Parity Console to inform the user where to go if they do receive a block, as well as very basic workflows in the product. The workflows in the product are not entirely complete and will require some type of process to track changes and to ensure that software is approved for use. Initial deployment will be painful, but with proper project management and communication skills this process can go well. See appendix C for example Policy/Procedures documents. For server deployments, to ensure that false blocks are mitigated, use the change control system. In the change control process there should be a method for changing systems. The Parity administrator and team will have to get involved with the change control process. An excellent method is to move the agents into the “Local Approval” policy during maintenance, and then back into lockdown when the maintenance is completed. For emergency changes the Parity Administrators will have to have on-call rotations, or if resources are limited ensure that System Administrators are trained to deal with situations where Parity could prevent the execution of duties. Using these methods and working slowly and methodically, Parity can be locked down efficiently and with minimal incidents. 3. Operational Uses for Parity There are many other uses for Parity other than just to protect the environment. It is an excellent source of information showing exactly what is running in an environment. By querying the data in Parity, a Security Analyst could research to find if a downloaded malicious file actually reached the endpoint system or not. An Analyst could also upload a hash from doing analysis on another system to Parity to block across the install base. The server actually has a very simple SOAP API utilizing JSON that can be called very simply from web posts. (Example Script Attached Appendix A) Another consideration is the recent acquisition of Carbon Black by Bit9. The purchase of Carbon Black also has tremendous potential for Security Analytics utilizing the visibility that Parity has into an environment. Its ability to delve into the memory could tremendously offset some of the places that Parity fall-short in prevention. Some organizations may want to purchase this additional tool to augment their security analysis. As mentioned earlier, another very significant protection that Parity provides is the blocking of USB devices. This happens at the kernel level, so a huge sector of USB attacks can be mitigated using Parity. 4. Conclusion When evaluating any technology technologist and security practitioners should carefully analyze with due care the technologies, especially those that will require employee time and energy as well as significant capital expenditure. Bit9’s Parity will take significant time, funds, and energy to deploy. It will take a concerted effort from senior leadership to decide on the product and then organizational push to deploy it. The approach that Application-Whitelisting takes is a simple one, trust only what is known and all other executables and binaries are not trusted and are not allowed to run. If an organization believes that they may be targeted by an advanced actor then the advanced protection provided by an approach like Application-Whitelisting should be evaluated. The decision is a risk decision, the protections Parity offers are significant. If deployed properly, malware will not be able to gain a persistence on a network, as well a huge number of other attacks will be mitigated. If an organization deems that they need the level of security, the costs and energy that Parity takes to deploy are well worth the efforts. 5. References Bit9 Inc., Installing Parity, Document Version: 6.0.2c, September 8, 2011 Michael Weeks, mweeks9989@gmail.com 6. Appendix A - From “Installing Parity” V. 6.0.2 <table> <thead> <tr> <th>Physical Single-Tier System &lt; 5000 Clients</th> <th>Physical 2-Tier System &gt; 5000 Clients</th> </tr> </thead> <tbody> <tr> <td>Requirement</td> <td>Combined Parity Server/ SQL Server Specifications</td> </tr> <tr> <td>Processor</td> <td>Dual Core Server Class</td> </tr> <tr> <td>&lt; 300 Clients</td> <td>300 - 5000 Clients</td> </tr> <tr> <td>Disk space</td> <td>40 GB</td> </tr> <tr> <td>RAM</td> <td>2-4 GB</td> </tr> <tr> <td>Network</td> <td>1 GB NIC</td> </tr> <tr> <td>IP address</td> <td>Static IP address only (no DHCP) with an assigned FQDN or alias. Computers running the Parity Agent recognize the server by either its fixed IP address, DNS-name lookup or an alias. IPv4 must be the default protocol for the server.</td> </tr> </tbody> </table> If you are using IIS 7.0, in the **IIS Roles Manager**, verify the following configuration: - **Common HTTP Features**: All - **Application development**: - ASP.NET - .NET Extensibility - CGI - ISAPI Extensions - ISAPI Filters - **Health & Diagnostics**: - HTTP Logging - Logging Tools - Request Monitor - Tracing - **Security**: - Basic Authentication - Windows Authentication - URL Authorization - Request Filtering - IP and Domain Restrictions - **Performance**: None - **Management Tools**: - IIS Management Console - IIS Management Scripts and Tools - Management Service - FTP Publishing Service: None (This is not a full excerpt for server requirements please follow Bit9 – Parity Installation Guide from vendor for all information) 7. Appendix B ```powershell #!/usr/bin/powershell # Pass API calls to console # post hash to parity and blockify it function Upload-HashToParity($hash,$ParityURL,$feed){ #Requires pshell 3.0 $ParityLoginUrl = "$ParityURL/login.php" $cred = Get-Credential $username = $cred.GetNetworkCredential().UserName $Credentials = New-Object System.Management.Automation.PSCredential -ArgumentList $UserName, $adPW $password = $Credentials.GetNetworkCredential().Password $useragent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3)" #$headers = @{} Invoke-WebRequest -Uri $ParityLoginUrl -UserAgent $useragent -Method Get -SessionVariable Parity $loginPostData = @{username=$username;password=$password;oldURL='/home.php';oldURLParams='';dbuse='das';submit='Submit'} Invoke-RestMethod -Uri $ParityLoginUrl -UserAgent $useragent -WebSession $parity -Method POST -Body $loginPostData #let's see if we have a cookie set if ($Parity.Cookies.Count -eq 0) { Write-Host "fail to connect" break } else { $rule = "$feed-$dte" $description = "Malware+Artifacts" $fileurl = "$ParityURL/file-policy-details.php" $uploaddata = @{ fileRuleName=$rule ruleActionSelect:'3' nameOrHash='hash' Platform:'1' fileName:'` hashType='MD5' hash=$hash antibody_id_list='' antibody_id='' description="Malware+Artifacts" policyScope='allHostGroups' formAction='create' returnurl="/approvals.php?tab=fileRules'formDetails='false'" } $upload = Invoke-WebRequest -Uri $fileurl -ContentType application/x-www-form-urlencoded -UserAgent $useragent -Method post -WebSession $parity -body $uploaddata } } ``` agent Removal Script Param ([string]$password) $computer = get-content .\listofcomputers.txt invoke-command -ComputerName $computer -ScriptBlock { c:\Program Files (x86)\Bit9\Parity Agent\dascli.exe password $password c:\Program Files (x86)\Bit9\Parity Agent\dascli.exe enable c:\Program Files (x86)\Bit9\Parity Agent\dascli.exe setpolicy 'agent removal' } agent installation Script $servers = Get-Content .\servers.txt foreach ($server in $servers) { invoke-command -ComputerName $server -ScriptBlock { cmd.exe "\unccpathtoparitymsi" } } end Script Michael Weeks, mweeks9989@gmail.com Appendix C Sample Policy and Procedures: Desk-Side Parity Procedures 1. Purpose Anti-virus software has been significant tool in combating malicious software and unwanted software. However the organization has decided that the protections AV provide are insufficient and have taken an application whitelisting approach. Application whitelisting is an approach to only allowed approved software to be allowed to run in the environment. 2. Scope The organization has chosen Bit9’s product Parity for the implementation on end-point systems. The agent will be installed on all end-point systems to protect the organization against unwanted software. The end goal is to have all endpoint systems in a lockdown configuration. 3. Policy All systems that users log into directly to work that are client side system and managed by the desk-side support team will have the agent installed. The agent will be installed in the following fashion: - When a new system is built out, and on all current systems the agent will be installed. This will be accomplished within 5 days of system build. - After the agent is installed the agent will be moved into monitor mode to hash all endpoints on the system. This will be accomplished within 5 business days after installation. - Once the hashing of all files are complete the agent will be moved into lockdown reporting. This will be accomplished within 5 business days after moved into monitor mode. - Configuration will be handled by the Parity Administrator team to ensure that false positives are mitigated to a <5% level. This will be accomplished within 20 business days of the installed system. 4. Enforcement Any systems that do not meet the compliance date will be restricted from network communication until lockdown is complete. Procedure for Software Approvals The software approval list is at the following location: http://internal-corporate-site/approvallist.organization.com. All software on this list will be configured and allowed to run. If there are any additional items requested from the user population the following procedures will be met: - User will submit a helpdesk ticket requesting the additional software. - The user’s supervisor will review the software for an approved business use. - Ticket will then be routed to the Desk-Side Support Team to ensure the software can be supported. - The ticket will be routed to the Security Operations team will review the software for malicious sources. - Finally the Parity Administration team will review the ticket and either whitelist the installation file and/or create any software rules to allow the software to run. Deploy to Protect (Server) Example Policy and Procedures: Change Control Process Utilizing Parity 1. Purpose The change control monitoring for the organization is a rigorous and important process to protect the environment from dangerous changes as well as security vulnerabilities. For this reason has decided to use an integrity control application from the Bit9 called Parity. 2. Scope The software will be deployed on all production servers providing services to customers. 3. Policy The Parity agent will be deployed to any production servers in a disabled policy. Any new servers will receive the agent according to the in-house build process. The agent will then be moved to the Monitor policy in order to hash files on the system. This change will be scheduled and change controlled. After all files have been hashed the agent will then be moved into Local Approval, to approve any files on the system. After all files on the system have been approved, the agents will be moved into Lockdown Reporting for the Parity Administration team to create any software rules that are necessary for the server function. Finally the server will be moved into Lockdown to prevent any unauthorized changes. After the completion of the Change Control Process – see http://internal-corporate-site.organization.com/ChangeControlProcess.doc. The Parity Administrator will move the servers into local approval to approve any changes that will occur during the change window. After the change window is complete the Parity Administrator will move the server into Lockdown Reporting to monitor any potential blocks of valid executables that may have changed after the installation. After a sufficient amount has passed but no more than 24 hours, the Parity Administrator will move the system back into lockdown. For any emergency or exception changes the Parity Administrator will be available on-call to change the server into the appropriate policy to perform the maintenance necessary. The emergency or exception change will be reviewed according to the change control policy. 4. Enforcement Any employee or administrator that does not follow the rules in this policy may be subject to disciplinary action, up to and including termination of employment. <table> <thead> <tr> <th>Course Name</th> <th>Location</th> <th>Dates</th> <th>Type</th> </tr> </thead> <tbody> <tr> <td>SANS Amsterdam August 2020 Part 1</td> <td>Amsterdam, NL</td> <td>Aug 03, 2020 - Aug 08, 2020</td> <td>Live Event</td> </tr> <tr> <td>SANS FOR508 Canberra August 2020</td> <td>Canberra, AU</td> <td>Aug 17, 2020 - Aug 22, 2020</td> <td>Live Event</td> </tr> <tr> <td>SANS Amsterdam August 2020 Part 2</td> <td>Amsterdam, NL</td> <td>Aug 17, 2020 - Aug 22, 2020</td> <td>Live Event</td> </tr> <tr> <td>SANS Virginia Beach 2020</td> <td>Virginia Beach, VAUS</td> <td>Aug 31, 2020 - Sep 05, 2020</td> <td>Live Event</td> </tr> <tr> <td>SANS Philippines 2020</td> <td>Manila, PH</td> <td>Sep 07, 2020 - Sep 19, 2020</td> <td>Live Event</td> </tr> <tr> <td>SANS London September 2020</td> <td>London, GB</td> <td>Sep 07, 2020 - Sep 12, 2020</td> <td>Live Event</td> </tr> <tr> <td>SANS Baltimore Fall 2020</td> <td>Baltimore, MDUS</td> <td>Sep 08, 2020 - Sep 13, 2020</td> <td>Live Event</td> </tr> <tr> <td>Threat Hunting &amp; Incident Response Summit &amp; Training 2020</td> <td>New Orleans, LAUS</td> <td>Sep 10, 2020 - Sep 17, 2020</td> <td>Live Event</td> </tr> <tr> <td>SANS OnDemand</td> <td>OnlineUS</td> <td>Anytime</td> <td>Self Paced</td> </tr> <tr> <td>SANS SelfStudy</td> <td>Books &amp; MP3s OnlyUS</td> <td>Anytime</td> <td>Self Paced</td> </tr> </tbody> </table>
{"Source-Url": "https://www.sans.org/reading-room/whitepapers/commerical/application-white-listing-bit9-parity-35572", "len_cl100k_base": 7637, "olmocr-version": "0.1.50", "pdf-total-pages": 22, "total-fallback-pages": 0, "total-input-tokens": 46737, "total-output-tokens": 9028, "length": "2e12", "weborganizer": {"__label__adult": 0.0005598068237304688, "__label__art_design": 0.0005598068237304688, "__label__crime_law": 0.008544921875, "__label__education_jobs": 0.0030841827392578125, "__label__entertainment": 0.00021088123321533203, "__label__fashion_beauty": 0.0002734661102294922, "__label__finance_business": 0.00493621826171875, "__label__food_dining": 0.00032401084899902344, "__label__games": 0.0013017654418945312, "__label__hardware": 0.00917816162109375, "__label__health": 0.0009927749633789062, "__label__history": 0.0003361701965332031, "__label__home_hobbies": 0.00030612945556640625, "__label__industrial": 0.001931190490722656, "__label__literature": 0.0003223419189453125, "__label__politics": 0.0006041526794433594, "__label__religion": 0.0004453659057617187, "__label__science_tech": 0.260986328125, "__label__social_life": 0.00022554397583007812, "__label__software": 0.343017578125, "__label__software_dev": 0.36083984375, "__label__sports_fitness": 0.0002923011779785156, "__label__transportation": 0.0005035400390625, "__label__travel": 0.00018537044525146484}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 37910, 0.02714]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 37910, 0.12917]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 37910, 0.9109]], "google_gemma-3-12b-it_contains_pii": [[0, 0, null], [0, 946, false], [946, 4028, null], [4028, 6790, null], [6790, 8234, null], [8234, 10026, null], [10026, 11909, null], [11909, 14081, null], [14081, 15856, null], [15856, 16568, null], [16568, 17616, null], [17616, 18577, null], [18577, 20732, null], [20732, 23829, null], [23829, 25319, null], [25319, 27018, null], [27018, 28870, null], [28870, 31029, null], [31029, 31649, null], [31649, 34289, null], [34289, 36545, null], [36545, 37910, null]], "google_gemma-3-12b-it_is_public_document": [[0, 0, null], [0, 946, true], [946, 4028, null], [4028, 6790, null], [6790, 8234, null], [8234, 10026, null], [10026, 11909, null], [11909, 14081, null], [14081, 15856, null], [15856, 16568, null], [16568, 17616, null], [17616, 18577, null], [18577, 20732, null], [20732, 23829, null], [23829, 25319, null], [25319, 27018, null], [27018, 28870, null], [28870, 31029, null], [31029, 31649, null], [31649, 34289, null], [34289, 36545, null], [36545, 37910, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 37910, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 37910, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 37910, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 37910, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 37910, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 37910, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 37910, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 37910, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 37910, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 37910, null]], "pdf_page_numbers": [[0, 0, 1], [0, 946, 2], [946, 4028, 3], [4028, 6790, 4], [6790, 8234, 5], [8234, 10026, 6], [10026, 11909, 7], [11909, 14081, 8], [14081, 15856, 9], [15856, 16568, 10], [16568, 17616, 11], [17616, 18577, 12], [18577, 20732, 13], [20732, 23829, 14], [23829, 25319, 15], [25319, 27018, 16], [27018, 28870, 17], [28870, 31029, 18], [31029, 31649, 19], [31649, 34289, 20], [34289, 36545, 21], [36545, 37910, 22]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 37910, 0.08787]]}
olmocr_science_pdfs
2024-11-29
2024-11-29
cb64d910e9fa58e3941cd86fe3b889ecd10c587d
Product-Focused Software Process Improvement December 2-4, 2015 Bolzano - Bozen, Italy 16th International Conference on Product-focused Software Process Improvement (PROFES) Workshop Processes, Methods and Tools for Engineering Embedded Systems (PROMOTE) Workshop International Workshop on Human Factors in Software Development Processes (HuFo) Workshop Software Startups: State of the Art and State of the Practice (SSU) Tutorial User Experience: Do We Mean the Same? (Tutorial) PROFES 2015 2-4.12.2015 rooms: D102, D103 pp. 10-13 PROMOTE 2.12.2015 room: D102 pg. 5 HuFo 2.12.2015 room: D103 pg. 6 SSU + Tutorial 2.12.2015 room: D002 pg. 7 Venue maps pp. 8-9, 14 Venue and logistic information International week venue University main building, piazza Università 1 Registration at University main building, first floor in front of room D102, 8:00 – 9:00 everyday Major distances from the conference venue 5-10 min walking distance from Hotel Città – Stadt Hotel, Parkhotel Luna Mondschein, Hotel Scala Stiegl, Main train station (in Italian ‘Bolzano-Bozen centrale’), Major parking places (piazza Walther, Central Parking, Laurin) 10 min walking distance to Castel Mareccio – Schloss Maretsch (Via Claudia De' Medici, 12) PROFES 2015 Wednesday, December 2nd 8:00 - 9:00 Registration to Workshops 9:00 - 10:30 Session 1: PROMOTE 2015 - HuFo 2015 - SSU 10:30 - 11:00 Coffee break 11:00 - 12:30 Session 2 12:30 - 14:00 Lunch Cafetteria 14:00 - 15:30 Session 3 15:30 - 16:00 Coffee break 16:00 - 17:30 Session 4 17:30 - 18:30 PROFES15 Welcome Reception F6 Thursday, December 3rd 8:00 - 9:00 Registration 9:00 - 9:30 Conference Welcome 10:30 - 11:00 Coffee break 11:00 - 12:20 session Left: Lessons learned from industry-research collaborations session Right: Instruments to improve the software development process rooms D102/D103 12:30 - 14:00 Lunch Cafetteria 14:00 - 15:20 session Left: Requirements, features, and release management session Right: Practices of modern development processes rooms D102/D103 15:20 - 15:50 Coffee break 15:50 - 17:00 session Left: Process variability session Right: Human factors in modern software development rooms D102/D103 17:15 - 18:00 Panel: The role of empirical research in Software Engineering 20:00 Conference Dinner at Castel Mareccio/Schloss Maretsch <table> <thead> <tr> <th>Time</th> <th>Event</th> </tr> </thead> <tbody> <tr> <td>8:00 - 9:00</td> <td>Registration</td> </tr> <tr> <td>9:00 - 10:00</td> <td><strong>Keynote</strong>: Janne Järvinen “Need for Speed – Transforming the software intensive industry for new digital economy” room D102</td> </tr> <tr> <td>10:00 - 10:30</td> <td><strong>Coffee break</strong></td> </tr> <tr> <td>10:30 - 11:50</td> <td><strong>session Left</strong>: Effort and size estimation validated by professionals</td> </tr> <tr> <td>10:30 - 10:30</td> <td><strong>session Right</strong>: Empirical generalisation rooms D102/D103</td> </tr> <tr> <td>12:00 - 13:30</td> <td><strong>Lunch</strong> Cafetteria</td> </tr> <tr> <td>13:30 - 14:50</td> <td><strong>session Left</strong>: Software reliability and testing in industry</td> </tr> <tr> <td>13:30 - 14:50</td> <td><strong>session Right</strong>: Empirical generalisation rooms D102/D103</td> </tr> <tr> <td>14:50 - 15:15</td> <td><strong>Coffee break</strong></td> </tr> <tr> <td>15:15 - 15:45</td> <td>Closing session, Best paper award, and PROFES2016</td> </tr> <tr> <td>16:30 - 18:00</td> <td>Visit to local Winery</td> </tr> </tbody> </table> ## Workshops detailed program **PROMOTE 2015** **Room D 102** ### Wednesday, December 2nd <table> <thead> <tr> <th>Time</th> <th>Activity</th> </tr> </thead> <tbody> <tr> <td>9:00 - 10:30</td> <td><strong>Session 1</strong></td> </tr> <tr> <td>9:00 - 9:10</td> <td>Welcome from the workshop chairs</td> </tr> <tr> <td>9:10 - 10:30</td> <td><strong>Keynote:</strong> Mining logs to predict system errors</td> </tr> <tr> <td>B. Russo</td> <td></td> </tr> <tr> <td>10:30 - 11:00</td> <td><strong>Coffee break</strong></td> </tr> <tr> <td>11:00 - 12:30</td> <td><strong>Session 2</strong></td> </tr> <tr> <td>11:00 - 11:30</td> <td>Performance Engineering for Industrial Embedded Data-Processing Systems</td> </tr> <tr> <td>M. Hendriks, J. Verriet, T. Basten, M. Brasse, R. Dankers, R. Laan, A. Lint, H. Moneva, L. Somers, and M. Willekens</td> <td></td> </tr> <tr> <td>11:30 - 12:00</td> <td>Fault-prone Byte-code Detection Using Text Classifier</td> </tr> <tr> <td>T. Fujiwara, O. Mizuno, and P. Leelaprute</td> <td></td> </tr> <tr> <td>12:00 - 12:30</td> <td>Variability management strategies to support efficient delivery of embedded systems</td> </tr> <tr> <td>S. Teppola, P. Parviainen, J. Partanen, and P. Kettunen</td> <td></td> </tr> <tr> <td>12:30 - 14:00</td> <td><strong>Lunch</strong></td> </tr> <tr> <td>14:00 - 15:30</td> <td><strong>Session 3</strong></td> </tr> <tr> <td>14:00 - 14:30</td> <td>Using Cross-Dependencies during Configuration of System Families</td> </tr> <tr> <td>C. Brink, P. Heisig, and S. Sachweh</td> <td></td> </tr> <tr> <td>14:30 - 15:30</td> <td><strong>Discussion Topic:</strong> Technical Debt in Embedded Systems</td> </tr> <tr> <td>15:30 - 16:00</td> <td><strong>Coffee break</strong></td> </tr> <tr> <td>16:00 - 17:00</td> <td><strong>Session 4</strong></td> </tr> <tr> <td>16:00 - 16:30</td> <td><strong>Discussion Topic:</strong></td> </tr> <tr> <td>The Future of Embedded Systems in Industrial Context</td> <td></td> </tr> <tr> <td>16:30 - 17:00</td> <td><strong>Final Conclusions on the Workshop</strong></td> </tr> </tbody> </table> ### Workshops detailed program **HuFo 2015** **Room D 103** --- **Wednesday, December 2<sup>nd</sup>** <table> <thead> <tr> <th>Time</th> <th>Session</th> </tr> </thead> </table> | 9:00 - 9:30 | Welcome speech, workshop introduction and self-introduction of participants: Throughout the presentation sessions, participants will be invited to take notes of ideas, comments and issues on in a shared online document | | 9:30 - 10:30 | **Session 1** **A Meta-Ontology for Accurate Ontologies to Specify Domain Specific Experiments in Software Engineering** *W. Ferreira, M. T. Baldassarre, S. Soares and G. Visaggio* If Usability Evaluation and Software Performance Evaluation shook their hands: a perspective *T. Di Mascio, L. Tarantino and G. De Gasperis* | | 10:30 - 11:00 | **Coffee break** | | 11:00 - 12:30 | **Session 2** **Evaluating Mobile Malware by extracting User Experience-based features** *F. Mercaldo and C. A. Visaggio* **Information system software development with support for application traceability** *V. Đukić, I. Luković, M. Črepinšek, T. Kosar and M. Mernik* **A Qualitative Empirical Study in the Development of Multi-platform Mobile Applications** - *R. Francese, M. Risi, G. Scanniello and G. Tortora* | | 12:30 - 14:00 | **Lunch** | | 14:00 - 15:10 | **Session 3** **Characterising users through an analysis of on-line Technical Support forums** - *S. Gizaw, J. Buckley and S. Beecham* **Quantitative metrics for User Experience: a case study** *R. Capellini, F. Tassistro and R. Actis-Grosso* **Software Developers as Users: Developer Experience of a Cross-Platform Integrated Development Environment** - *K. Kuusinen* | | 15:10 - 15:30 | **Preliminary discussion** Preliminary discussion on workshop's outcomes | | 15:30 - 16:00 | **Coffee break** | | 16:00 - 17:30 | **Plenary discussion and proposals for future developments + Closing** We read aloud the comments and notes on the shared document, discuss and list important keywords, identify challenges and topics and final remarks | ## Workshops detailed program **Software Startups: State of the Art and State of the Practice (SSU)** Room D 002 ### Wednesday, December 2nd <table> <thead> <tr> <th>Time</th> <th>Session</th> <th>Details</th> </tr> </thead> </table> | 9:00 - 10:30 | Session 1: Software Startup Challenges and Solutions | Keynote speech: Software startup research Presentation of initial roadmap of software startup research and paper presentation and discussion: Ways to Cross the Rubicon: Pivoting in Software Startups *H. Terho, S. Suonsyrjä, A. Karisalo and T. Mikkonen* On the feasibility of startup models as a framework for research on competence needs in software startups *P. Seppänen, K. Liukkunen and M. Oivo* | | 10:30 - 11:00 | Coffee break | | | 11:00 - 12:30 | Session 2: New Perspectives on Software Startup | Towards a Software Tool Portal to Support Startup Process *H. Edison, D. Khanna, S. S. Bajwa, V. Brancaleoni and L. Bellettati* What can software startuppers learn from the artistic design flow? Experiences, reflections and future avenues *J. Risku and P. Abrahamsson* Designing a Maturity Model for Software Startup Ecosystem *D. Cukier, F. Kon and N. Krueger* A Conceptual Framework of Lean Startup Enabled Internal Corporate Venture *H. Edison* | | 12:30 - 14:00 | Lunch | | | 14:00 - 15:30 | Session 3: Completing Roadmap of Software Startup Research | | | 15:30 - 16:00 | Coffee break | | | 16:00 - 17:30 | Session 4: TUTORIAL - User Experience (UX) and Software Startups | | Ground floor map First floor map # Main Conference detailed program ## Thursday, December 3rd <table> <thead> <tr> <th>Time</th> <th>Session Left – room D102</th> <th>Session right – room D103</th> </tr> </thead> <tbody> <tr> <td>11:00-12:20</td> <td>Lessons learned from industry-research collaborations - Session chair: S. di Martino</td> <td>Instruments to improve the software development process - Session chair: J. Järvinen</td> </tr> <tr> <td></td> <td><strong>Full paper:</strong> Strategic Ecosystem Management: A multi-case study in the B2B domain</td> <td><strong>Full paper:</strong> Software Process Improvement Implementation Risks: A Qualitative Study based on Software Development Maturity Models Implementations in Brazil</td> </tr> <tr> <td></td> <td><em>H. H. Olsson and J. Bosch</em></td> <td><em>E. Dutra and G. Santos</em></td> </tr> <tr> <td></td> <td><strong>Full paper:</strong> Challenges of structured reuse adoption – Lessons learned - V. Bauer</td> <td><strong>Full Paper:</strong> SINIS: A Method to Select Indicators for IT Services - B. Trinkenreich, G. Santos and M. Barcellos</td> </tr> </tbody> </table> Keynote speaker: Dieter Rombach **The Maturing of Empirical Studies: Towards Industrial Benefits** Measurement and empirical studies have matured over the past decades. This includes the combination of quantitative and qualitative studies, the combination of controlled experiments and case studies, or the closer cooperation between academia and industry. This presentation surveys the achievements over the past decades, and proposes possible agendas for the future. The survey of achievements will be illustrated via concrete examples. Finally, the strategy of Fraunhofer ISE in Germany and Fraunhofer CESE in the US for measurement and facts based cooperation with industry is outlined. 12:30 - 14:00 Lunch 14:00 - 15:20 **Session Left – room D102** Requirements, features, and release management - Session chair: B Gallina **Full paper:** Quantitative Requirements Prioritization – a case study - E. Johansson, D. Bergdahl, J. Bosch and H. H. Olsson **Full paper:** A Case Study on Artefact-based RE Improvement in Practice - D. M. Fernández and S. Wagner **Session right – room D103** Practices of modern development processes - Session chair: K. Kati **Full paper:** Artefacts in Agile Software Development - G. Wagenaar, R. Helms, D. Damian and S. Brinkkemper 15:20 - 15:50 Coffee break 15:50 - 17:00 **Session Left – room D102** Process variability - Session chair: V. Bauer **Research Preview Paper:** Modeling Variability in Software Process with EPF Composer and SMartySPEM: a Qualitative Study - J. Dias and E. Oliveira Jr **Session right – room D103** Human factors in modern software development - Session chair: D. Pfahl **Full Paper:** What Motivates Software Engineers Working in Global Software Development? - S. Beecham and J. Noll **Research Preview Paper:** Empower a Team’s Product Vision with LEGO Serious Play - D. Pichlis, S. Hofemann, M. Raatikainen, J. Sorvettula and C. Stenholm **Research Preview Paper:** Early Product Design in Startups: Towards a UX Strategy - L. Hokkanen, K. Kuusinen and K. Väänänen 17:15 - 18:00 Panel: The role of empirical research in Software Engineering 20:00 Conference Dinner at Castel Mareccio/Schloss Maretsch ### Main Conference detailed program **Friday, December 4th** <table> <thead> <tr> <th>Time</th> <th>Event</th> </tr> </thead> <tbody> <tr> <td>08:00 - 9:00</td> <td>Registration</td> </tr> <tr> <td>9:00 - 10:00</td> <td><strong>Keynote speaker: Janne Järvinen</strong></td> </tr> <tr> <td></td> <td>Need for Speed – Transforming the software intensive industry for new digital economy</td> </tr> <tr> <td></td> <td>Abstract: The internet is and increasingly will be the first truly global platform for the digital economy that will enable significant new business, economic and social opportunities. The complexity and competition around the new internet infrastructure, services and business environment will increase dramatically and will fundamentally change the way software will be developed, deployed and used to reach business goals. Consequently, we are facing a fundamental systemic transformation towards a world where digital resources are constantly available online, and available for all to use. This keynote discusses experiences from Finnish N4S program (<a href="http://www.n4s.fi">www.n4s.fi</a>) that addresses these challenges introducing capabilities for real-time value delivery, deep customer insight and mercury business.</td> </tr> <tr> <td>10:00 - 10:30</td> <td>Coffee break</td> </tr> <tr> <td>10:30 - 11:50</td> <td><strong>Session Left – room D102</strong></td> </tr> <tr> <td></td> <td>Effort and size estimation validated by professionals - Session chair: D. Rombach</td> </tr> <tr> <td></td> <td><strong>Session right – room D103</strong></td> </tr> <tr> <td></td> <td>Empirical generalisation - Session chair: M. Kuhrmann</td> </tr> <tr> <td></td> <td>Full paper: An Empirical Study on Memory Bias Situations and Correction Strategies in ERP Effort Estimation - P. Erasmus and M. Daneva</td> </tr> <tr> <td></td> <td>Research Preview Paper: Defining Continuous Planning through a Multiple-Case Study - T. Suomalainen</td> </tr> <tr> <td></td> <td>Full Paper: Issue Dynamics in Github Projects - R. Kikas, M. Dumas and D. Pfahl</td> </tr> <tr> <td>Time</td> <td>Session Left – room D102</td> </tr> <tr> <td>--------------</td> <td>------------------------------------------------------------------------------------------</td> </tr> <tr> <td>12:00 - 13:30</td> <td><strong>Lunch</strong></td> </tr> <tr> <td>13:00 - 14:50</td> <td><strong>Software reliability and testing in industry</strong> - Session chair: G. Reggio</td> </tr> <tr> <td></td> <td><strong>Full paper:</strong> A Process for Risk-Based Test Strategy Development and Its Industrial Evaluation - R. Ramler and M. Felderer</td> </tr> <tr> <td>14:50 - 15:15</td> <td><strong>Coffee break</strong></td> </tr> <tr> <td>15:15 - 15:45</td> <td><strong>Closing session, Best paper award, and PROFES2016</strong></td> </tr> <tr> <td>16:30 - 18:00</td> <td><strong>Visit to local Winery</strong></td> </tr> </tbody> </table> Map to reach Castel Mareccio on foot Message from the chairs Welcome to Bozen-Bolzano, Italy for the 16th International Conference on Product-Focused Software Process Improvement (PROFES 2015). In the beautiful alpine winter atmosphere, PROFES 2015 offers the opportunity for practitioners, researchers, and educators to present and discuss experiences, ideas, and innovations for the management and improvement of software development processes. Janne Järvinen, Director of F-Secure plc (leader for information security), and Dieter Rombach, head of the Research Group for Software Engineering (AGSE) and Fraunhofer Institute for Experimental Software Engineering (IESE), Germany, are the two keynote speakers of the main conference. The conference offers ten different parallel sessions on: lessons learned from industry-research collaborations; instruments to improve software development processes; requirements, features, and release management; practices of modern development processes; human factors in modern software development; effort and size estimation validated by professionals; empirical generalisation; and software reliability and testing in industry. The call for papers of the main conference attracted 50 submissions, 18 of which were selected as full papers and ten as research preview papers. This year also the three co-located workshops and two tutorials are remarkable. The workshop main topics concern: processes, methods, and tools for engineering embedded systems; human factors in software development processes; and software startups: state of the art and state of the practice. The tutorials focus on technologies to measure energy consumption of software applications and methods to understand user experience in the use of software. We would like to thank the enthusiastic participation of our authors and the diligent effort of our reviewers, and the contribution of our sponsors. We would also like to gratefully acknowledge the untiring support of the local organisers, publicity chairs, and all the members of the Organising Committee who made the conference a success. A special thanks to the student volunteers, the Press and Event Management Office, and the Faculty of Computer Science of the Free University of Bozen/Bolzano, who kindly hosts the conference and provides all the facilities for its realisation. We wish you a pleasant conference! General chair: Pekka Abrahamsson Program co-chairs: Markku Oivo & Barbara Russo Proceedings chair: Luis Ricardo Corral Velazquez Organizing co-chairs: Gabriele Bavota & Daniel Graziotin Thanks to the program committees Silvia Abrahão, Universidad Politecnica de Valencia (UPV) (Spain) Soussuke Amasaki, Okayama Prefectural University (Japan) Ulf Asklund, Lund University (Sweden) Maria Teresa Baldassarre, Università degli Studi di Bari A. Moro (Italy) Stefan Biffl, Technische Universität Wien (Austria) Andreas Birk, Software.Process.Management (Germany) Sjaak Brinkkemper, Universiteit Utrecht (Netherlands) Luigi Buglione, Université du Québec (Canada) Gerardo Canfora, University of Sannio (Italy) Jeffrey Carver, University of Alabama (USA) Marcus Ciolkowski, Kaiserslautern University of Technology (Germany) Daniela S. Cruzes, SINTEF Maya Daneva, University of Twente (Netherlands) Oscar Dieste, Universidad Politécnica de Madrid (Spain) Tore Dybå, University of Oslo (Finland) Christof Ebert, University of Stuttgart (Germany) David Falessi, Cal Poly (USA) Michael Felderer, University of Innsbruck (Austria) Marcela Genero, University of Castilla-La Mancha (Spain) Daniel Graziotin, Free University of Bozen-Bolzano (Italy) Noriko Hanakawa, Hannan University (Japan) Jens Heidrich, Fraunhofer IESE (Germany) Yoshiki Higo, Osaka University (Japan) Frank Houdek, Ulm University (Germany) Helena Holmström Olsson, Malmö University (Sweden) Hajimu Iida, Nara Institute of Science and Technology (Japan) Letizia Jaccheri, Politecnico di Torino (Italy) Andreas Jedlitschka, Fraunhofer IESE (Germany) Marco Kuhrmann, University of Southern Denmark (Denmark) Constanza Lampasona, Fraunhofer IESE (Germany) Casper Lassenius, Aalto University (Finland) Christin Lindholm, Lund University (Sweden) Ricardo Jorge Machado, University of Minho (Portugal) Lech Madeyski, Wroclaw University of Technology (Poland) Tomi Mannisto, University of Helsinki (Finland) Mika Mäntylä, University of Oulu (Finland) Jouni Markkula, University of Jyväskylä (Finland) Kenichi Matsumoto, Reitaku University (Japan) Emilia Mendes, Blekinge Institute of Technology (Sweden) Daniel Méndez Fernández, Technische Universität München (Germany) Maurizio Morisio, Politecnico di Torino (Italy) Jürgen Münch, University of Helsinki (Finland) Risto Nevalainen Mahmood Niazi, King Fahd University of Petroleum and Minerals (Saudi Arabia) Paolo Panaroni, INTECS (Rome) Oscar Pastor, Universidad Politécnica de Valencia (Spain) Kai Petersen, Blekinge Institute of Technology (Sweden) Dietmar Pfahl, University of Tartu (Estonia) Reinhild Plösch, Johannes Kepler Universität Linz (Austria) Bruno Rossi, Free University of Bozen-Bolzano (Italy) Martin Solari, Universidad ORT (Uruguay) Klaas Stol, Lero (Greece) Michael Stupperich, Daimler AG (Stuttgart) Marco Torchiano, Politecnico di Torino (Italy) Guilherme Travassos, University of Maryland (USA) Adam Trendowicz, Fraunhofer IESE (Germany) Burak Turhan, University of Oulu (Finland) Rini van Solingen, Delft University of Technology (Netherlands) Sira Vegas, Technical University Madrid (Spain) Mathias Vierimaa Stefan Wagner, University of Stuttgart (Germany) Dietmar Winkler, Vienna University of Technology (Austria) Krzysztof Wnuk, Blekinge Institute of Technology (Sweden) Arrivederci a Bolzano – Auf wiederschehen in Bozen
{"Source-Url": "http://profes2015.inf.unibz.it/wp-content/uploads/2015/12/ProgramPROFES2015.pdf", "len_cl100k_base": 5974, "olmocr-version": "0.1.50", "pdf-total-pages": 16, "total-fallback-pages": 0, "total-input-tokens": 38500, "total-output-tokens": 6999, "length": "2e12", "weborganizer": {"__label__adult": 0.0003387928009033203, "__label__art_design": 0.0003180503845214844, "__label__crime_law": 0.00024437904357910156, "__label__education_jobs": 0.004482269287109375, "__label__entertainment": 6.175041198730469e-05, "__label__fashion_beauty": 0.00015032291412353516, "__label__finance_business": 0.00036716461181640625, "__label__food_dining": 0.00040531158447265625, "__label__games": 0.0006799697875976562, "__label__hardware": 0.0005950927734375, "__label__health": 0.0004503726959228515, "__label__history": 0.00022351741790771484, "__label__home_hobbies": 8.034706115722656e-05, "__label__industrial": 0.0003292560577392578, "__label__literature": 0.00020015239715576172, "__label__politics": 0.0002301931381225586, "__label__religion": 0.00032258033752441406, "__label__science_tech": 0.006069183349609375, "__label__social_life": 0.00013113021850585938, "__label__software": 0.00574493408203125, "__label__software_dev": 0.9775390625, "__label__sports_fitness": 0.0003159046173095703, "__label__transportation": 0.00036072731018066406, "__label__travel": 0.0003266334533691406}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 24953, 0.05908]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 24953, 0.05556]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 24953, 0.66771]], "google_gemma-3-12b-it_contains_pii": [[0, 667, false], [667, 1231, null], [1231, 2448, null], [2448, 3650, null], [3650, 6206, null], [6206, 8371, null], [8371, 9879, null], [9879, 9896, null], [9896, 9912, null], [9912, 12159, null], [12159, 13966, null], [13966, 16708, null], [16708, 19205, null], [19205, 19242, null], [19242, 21789, null], [21789, 24953, null]], "google_gemma-3-12b-it_is_public_document": [[0, 667, true], [667, 1231, null], [1231, 2448, null], [2448, 3650, null], [3650, 6206, null], [6206, 8371, null], [8371, 9879, null], [9879, 9896, null], [9896, 9912, null], [9912, 12159, null], [12159, 13966, null], [13966, 16708, null], [16708, 19205, null], [19205, 19242, null], [19242, 21789, null], [21789, 24953, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 24953, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 24953, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 24953, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 24953, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 24953, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 24953, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 24953, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 24953, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 24953, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 24953, null]], "pdf_page_numbers": [[0, 667, 1], [667, 1231, 2], [1231, 2448, 3], [2448, 3650, 4], [3650, 6206, 5], [6206, 8371, 6], [8371, 9879, 7], [9879, 9896, 8], [9896, 9912, 9], [9912, 12159, 10], [12159, 13966, 11], [13966, 16708, 12], [16708, 19205, 13], [19205, 19242, 14], [19242, 21789, 15], [21789, 24953, 16]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 24953, 0.28522]]}
olmocr_science_pdfs
2024-12-02
2024-12-02
10fd4448055a026f02b99f210c7a5dd9893f050b
High-Throughput Stream Processing with Actors Luca Rinaldi, Massimo Torquati, Gabriele Mencagli, Marco Danelutto lucarinaldi,torquati,mencagli,marcod@di.unipi.it Computer Science Department, University of Pisa, Italy Abstract The steady growth of data volume produced as continuous streams makes paramount the development of software capable of providing timely results to the users. The Actor Model (AM) offers a high-level of abstraction suited for developing scalable message-passing applications. It allows the application developer to focus on the application logic moving the burden of implementing fast and reliable inter-Actors message-exchange to the implementation framework. In this paper, by using the CAF framework as reference AM implementation, we focus on evaluating the model in high data rate streaming applications targeting scale-up servers. Our approach leverages Parallel Pattern (PP) abstractions to model streaming computations and introduces optimizations that otherwise could be challenging to implement without violating the Actor Model’s semantics. The experimental analysis demonstrates that the new implementation skeletons we propose for our PPs can bring significant performance boosts (more than 2x) in high data rate streaming applications. Keywords: Actor Model, Parallel Patterns, Data Stream Processing, Programming Model, Multi-Cores ACM Reference Format: 1 Introduction The ever-increasing volume of data produced in the form of continuous streams, has made scalable concurrency a fundamental aspect of the software development process. Actor-based languages and frameworks are more and more employed to design and develop complex streaming applications that need high flexibility, adaptivity, and high-scalability [13]. The Actor Model (AM) of computation [6, 26, 47] offers a high-level of abstraction that allows developers to focus on their application business logic while the underlying implementation framework takes care of implementing fast, memory-safe, and reliable messaging systems. However, in the AM, the scalability concept is often associated with scale-out settings (i.e. large distributed systems or clusters). This is due to its share-nothing pure message-passing model, which somehow trades single node performance for scalability to a large number of nodes [16]. Nonetheless, solutions capable of consolidating several distributed servers in a single scale-up multi-core have recently gained special attention since they can reduce HW costs, software licenses cost, data-center space, and power consumption [11]. Numerous recent research efforts in the direction of designing Stream Processing Engines (SPEs) bear with this trend [38, 39, 48]. To this end, the “pure” AM does not offer significant margins for enhancing its efficiency on a single scale-up multi-core. This is primarily due to the impossibility of exposing the physical shared-memory to Actors, and to introduce low-level optimizations in the messaging systems without breaking the semantics of the model [44]. In our previous works [42, 43], to face the performance optimization issues of the AM on a scale-up server, we proposed to enhance the model with a set of well-known Parallel Patterns (PPs). PPs are integrated into the AM as “macro Actors”. The low-level platform-specific optimizations and the exploitation of the shared-memory are confined within the implementation skeleton of the PPs and they are entirely transparent to the application programmer. The programmer has the responsibility to select the proper PP to solve his/her problem. In contrast, the patterns provider has the responsibility to produce an efficient and memory-safe implementation of PPs for the target platform (separation of concerns software design principle). This approach trades the full flexibility of the AM with increased efficiency on the single node. Problem statement. In contrast to the batch processing model, the continuous streaming model processes input data as soon as it is available. The aim is to minimize results latency while keeping up with the input rate. This processing model is adopted in several streaming applications whose typical software architecture is exemplified in Fig. 1. The application processes continuous streams of data from a set of sources (e.g., IoT sensors, financial markets). The input data are then processed and aggregated through a network of Actors (typically having a DAG topology), each one implementing a stateless or stateful operator (e.g., filter, reducer, flat-map). Customers (which are the sinks of the network) dynamically subscribe/unsubscribe application services, which de facto are continuous streams of output results (e.g., in the financial domain, chart patterns within stock prices). The application graph also comprises a set of non-latency critical Actors implementing specific features (e.g., logging, billing, disk data recording). Depending on the input data rate, the number of sources, and the number of services offered, single operators may be replicated several times, paying attention to carefully routing messages to the correct next Actor in case of stateful operators. These streaming applications could be conveniently implemented by using Actor Model implementations (e.g., CAF [21], Akka [25]), because of the many concurrent entities involved, the explicit management of message routing, and the lack of shared states. Actually, in the stream analytics domain, specialized SPEs model applications that have static dataflow graphs of operators executed by dedicated threads [2]. Our objective is to understand whether a more powerful and flexible model of computation (i.e., the AM), is suitable for the execution of high data rate stream analytics applications. We want to investigate if it is possible to preserve the expressive and flexibility power of the AM and to execute high-throughput streaming operators capable of coexisting with standard Actors. To assess the AM performance figures in this application context, we simulated a simplified version of the schema in Fig. 1 by using the C++ Actor Framework (CAF) [21, 22]. Precisely, we implemented a linear pipeline of three Actors: Source, Forwarder and Sink (cf. Sec. 4). We observed that the maximum rate our microbenchmark can sustain is more than 2 times lower than the one obtained by implementing the same benchmark “manually” with native C++ threads. Besides, the average message latency is about 3 times higher. Careful performance analysis has shown two issues: 1. The messaging system’s complexity for managing different message types in an Actor is a limiting performance factor in Actor-based streaming applications where streaming operators usually deal with a single data type 1. 2. At high input rates, the unlimited capacity of Actors’ mailboxes pushes too much pressure in the memory system, making it challenging to stabilize the application behavior and limit memory consumption. Contributions. In this work, we tackle the two issues discussed above. We utilized CAF as a reference implementation of the AM. Specifically, our contributions are: - we show the performance limits of Actor-based implementations in high-throughput data stream processing computations; - we propose a new implementation skeleton of the Sequential PP (the basic building-block of our PPs), which has been specifically optimized for high-throughput and low-latency data streaming computations in scale-up servers; - we propose a new implementation skeleton of the Farm PP that optimizes Pipeline compositions of consecutive Farm PPs to reduce the number of message hops; - we discuss the issues of unbounded mailboxes in streaming computations. To introduce a basic backpressure mechanism for streaming operators, we propose a new communication primitive that takes into account the queue length of the receiving Actor. Using a set of well-known streaming benchmarks, we demonstrate the performance advantages of using the new implementations in the C++ Actor Framework. Outline. Sec. 2 provides some background information. Sec. 3 introduces the Parallel Pattern Actors used to enhance the performance of Actor-based programs on scale-up servers. Sec. 4 proposes a new implementation skeleton of the Farm PP that optimizes Pipeline compositions of consecutive Farm PPs to reduce the number of message hops; Sec. 5 presents the experimental evaluation, with the considered applications and the results in terms of throughput. Sec. 6 discusses some related works, and Sec. 7 summarizes the results. 2 Background The Actor Model. The Actor Model (AM) [6, 7, 33] is a well-established approach to concurrent and distributed computations. It addresses the challenges of data races in concurrent shared-memory programming with threads by forbidding shared mutable state among Actors. Actors exchange immutable messages, and the only mechanism for observing or modifying internal Actor states is to implement a message-based protocol. Each Actor has a private mailbox of unbounded capacity, which stores input messages. The processing of messages is performed asynchronously and atomically, and there is no guarantee on the processing order. 1 It is worthwhile mentioning the sources of overhead we faced are not related to potential implementation flaws of the CAF library. The memory isolation, the message-passing style of communications, and the serial processing of messages ensure data-race freedom in Actor-based programs. **Pattern-based parallel programming.** One of the well-established approaches for raising the level of abstraction in parallel computing is based on the concepts of Parallel Patterns (PPs) [37], which are customizable schemes of parallel computations that recur in many applications and algorithms [27]. These parallel abstractions are made available to programmers as high-level programming constructs with a well-defined functional and extra-functional semantics. Each parallel pattern has one or more implementation schema (called implementation skeleton) for a given target platform [24]. Notable examples of PPs are Pipeline, Map-Reduce, Task-Farm, Divide&Conquer. PPs are used in several programming frameworks and libraries such as Microsoft PPL [20], Intel TBB [41], SKEPU [30] and FastFlow [9]. **Data Stream Processing.** Several broadly used Stream Processing Engines (SPEs), such as Storm [2] and Flink [1], adopt the continuous streaming model where inputs are processed as soon as they are available, and output results are produced continuously to provide timely information to the users. Streams are unbounded sequences of data coming from one or more sources. A source produces data tuples of the same type. Distinct sources may produce tuples of different data types. Streaming applications are modeled as DAGs of stateless or stateful operators that produce results based on their business logic. Operators can be replicated to keep up with high input data rates as well as to increase the system throughput. To deal with streams, many SPEs provide operators that repeatedly apply the processing on a window of recent tuples. This is enabled by the so-called sliding window processing model [32], where a window is a bounded set of the most recent tuples whose content is dynamically determined according to various semantics (e.g., count-based, time-based). **The CAF library.** The C++ Actor Framework (CAF) is an Actor-based framework implemented in modern C++ [21, 22]. The framework follows the Classical Actor Model [26] initially proposed by Agha [6]. Actors define a set of behaviors, each activated upon the receipt of a specific input message type. CAF implements behaviors through C++ lambda functions. The appropriate lambda function will be selected through a pattern matching between its formal parameters and the input message types. Moreover, CAF and all implementation of the Classic Actor Model, enables run-time change of Actor behaviors employing the became primitive. By using the send primitive Actors can send any sequence of data types into the mailbox of other Actors. Such types sequence will be moved to a type-erased tuple that erases the actual type preserving annotations of the erased types. These annotations will be used in the pattern matching phase to discover the behavior to execute and to cast back the types to the original ones. Besides, the CAF messaging system supports two priority levels and the possibility to skip unwanted messages (e.g., messages for behaviors not yet set up). CAF Actors uses a combination of a LIFO lock-free queue with multiple FIFO buffers to implement the mailbox. The LIFO queue is a thread-safe unbounded linked-list with an atomic pointer to its head. There is one FIFO linked-list for each priority level. CAF supports two priority levels. Each FIFO queue also has an additional cached buffer to maintain messages that are skipped. The sender Actor inserts new elements atomically in the head of the LIFO queue. The receiver Actor, atomically extracts all the messages from the LIFO queue using a compare-and-swap operation. Then, the messages are divided into the two FIFO queues on the basis of their priority. Finally, the consumer Actor can dequeue messages with a different proportion from the two queues to maintain the priority. CAF allows multiple Actors to implicitly share message contents, as long as no Actor performs writes. This permits sending the same content to multiple Actors without any copying overhead provided the message handler of receiving Actors take an immutable reference (copy-on-write). A Work-Stealing algorithm is used to dynamically assign ready Actors to run-time threads. However, it is also possible to assign private threads to Actors by spawning detached and blocking Actors. They are useful for implementing particular functionalities or executing non-blocking I/O operations. ### 3 Parallel Pattern Actors Recently we proposed to use Parallel Pattern abstractions to enhance the performance of the Actor Model in shared-memory systems [42, 43]. The motivation is twofold: a) to introduce a communication structure in Actor-based applications that usually are characterized by unstructured communication topologies [31], and b) to safely enable some low-level shared-memory based optimizations that are generally not allowed by the “pure” Actor Model\(^2\). The set of PPs we defined, is sketched in Fig. 2. We provided Data-parallel PPs namely Map and Divide&Conquer (D&C); and Control-parallel PPs namely SeqActor, Pipeline, and Farm. Fig. 3 shows an example of a possible composition and nesting of PPs in Actor-based networks. In our previous works, we focused mainly on enabling shared-memory exploitation to speed up data-parallel computations such those present in some well-known multi-core benchmarks (e.g., PARSEC [18]). These computations, usually work on independent partitions of large arrays or matrices through parallel-for and Map-Reduce. Therefore, we implemented the Map, and also the D&C Parallel Pattern \(^2\)The implementation, called CAF-PP, is available at https://github.com/ParaGroup/caf-pp. using the shared memory within their implementation skeletons, avoiding data copy, and enhancing the performance of fine-grained synchronizations. This approach using PPs for speeding up data-parallel computations allowed us to obtain performance close to specialized thread-based multi-core libraries such as FastFlow [9], providing at the same time the memory-safe environment of the Actor Model to application programmers. Data-flow PPs such as SeqActor, Pipeline, and Farm have been initially introduced mainly to enable patterns composition, nesting and to provide the programmer with well-defined structured topologies in the AM. The SeqActor pattern is an Actor wrapper. It is used to integrate standard CAF Actors within PP Actors (e.g., for creating a pipeline of Actors). The Pipeline implements a parallel composition of multiple Parallel Pattern working in parallel on subsequent data elements. It takes care of connecting each Parallel Pattern in the correct order. The Farm pattern models Parallel Pattern replication. Each distinct PP replica (usually called Worker), works in parallel on distinct data elements of the input stream. Stream elements are forwarded to the Workers according to some predefined scheduling policy (e.g., round-robin, random, byKey), or by using a user-defined policy (through a C++ lambda function). If the number of replicas is left unspecified, a default value will be used. The most important feature of these patterns is their ability to compose different PPs in a functional way. Sequential, Map and D&C cannot contain nested patterns, and they must be used as leaves of the data-flow tree representing the application (or part of it) implemented with Parallel Patterns. In this work, our objective is to enhance the performance of Control-parallel patterns, focusing on streaming applications and their ever increasing demand of high-throughput and low end-to-end message latency. Specifically, we propose a different implementation skeleton for the Sequential and Farm patterns that optimizes the message exchange in the composition of PPs within Actor-based applications. 4 Streaming Parallel Patterns Actors The Actor Model is in principle particularly suited to implement streaming applications because of the many concurrent entities usually involved, the explicit management of messages routing, and the absence of shared states among operators. An Actor can be mapped one-to-one with a streaming operator; thus, the Actor programmer may concentrate on implementing the operators’ business logic without worrying about how inter-Actors communications happen. In the context of high-throughput demanding streaming applications targeting scale-up servers, the use of system-level languages for implementing the AM is unquestionably a performance plus compared to, for example, Java-based implementations. The C++ ACTOR FRAMEWORK (CAF) allows the development of Actor-based programs leveraging modern C++. Differently from other well-known implementations of the Actor Model, such as ERLANG [12] and AKKA [10], which use virtual machine abstractions, CAF applications are compiled directly into native machine code. However, CAF does not provide specific support for data-intensive streaming applications. To evaluate the performance of CAF Actors in streaming computations, we implemented two microbenchmarks. Microbenchmarks. By using the Parallel Pattern Pipeline, we connected three SeqActors in a linear chain. The first Actor (called Source) generates a stream of tuples at maximum speed (each tuple is 24 B). The second Actor (called Forwarder) forwards each input tuple to the next stage, and finally, the last Actor (called Sink) collects all tuples. Then, the same pipeline has been implemented by using three C++ threads and two FIFO lock-free queue [8] to implement the channels between the stages. The two implementations were executed for 60 s and their throughput was measured in the Sink node. CAF (version 0.17.5)4 has been configured to run with three run-time Worker threads and with the aggressive polling strategy that maximizes system reactivity [45]. Fig. 4 shows the results obtained. The measured throughput by employing CAF Actors is more than 2 times lower than the thread-based implementation (1.4 vs 3.3 M tuples/s). To better understand the problem, we used a second microbenchmark implementing a simple Producer-Consumer --- 3CAF offers experimental support for data-flow streams between Actors [3]. We did not use such a building-block in our implementation because, from the performance standpoint, it does not solve the issues outlined in Sec. 4. We also tested the pre-release 0.18 obtaining similar performance figures. pattern using two CAF Actors (P and C) exchanging 100 M small messages (4 B each). The objective is to evaluate the overhead for exchanging a single message between P and C. The first version uses the lock-free queue used in the CAF run-time for implementing Actors' mailboxes as a communication channel between P and C (cf. Sec. 2). Therefore, P pushes the messages directly into the queue while C pops them out. In the second version, instead, we used the default CAF messaging system (which leveraging the same lock-free queue with the dynamic message dispatching). Fig. 5 shows the results of this second microbenchmark. The overhead introduced by the Actors messaging system is more than 2 times the base case (0.33 µs vs 0.75 µs). Such overhead is due to the complexity of managing different types of messages, even if, as in our microbenchmarks, the Actors will always receive the same input type for the entire execution. This extra cost, perhaps, can be lowered by fine-tuning the implementation code, but certainly, it cannot be completely removed without loosing the flexibility of defining multiple behaviors for an Actor. In streaming applications, operators work on statically defined input and output data types (the type of input and output tuples), and the extra complexity of managing multiple data types is the primary source of overhead. **Streaming Operators.** To tackle the problem that appeared in the microbenchmarks, we propose a new implementation skeleton for the Sequential pattern capable of handling a single message type and optimized for defining high-throughput data streaming operators in CAF. Such new skeleton is implemented by the SeqNode class whose interface is inspired to the one provided by the node building-block in the FastFlow parallel library [9]. Fig. 6 shows its current interface. Each new operator must define at least the consume method, which is called as soon as a tuple is available to be consumed by the node. During the SeqNode execution, input tuples are processed sequentially and in order. The other two methods on_start and on_stop, are automatically invoked once when the node starts and right before it terminates, respectively. These virtual methods may be overwritten in the user-defined operator to implement initialization and finalization code for the operator node. The SeqNode has a typed input queue and zero, one or more typed output queue references (implemented by the multiQueues object in Fig. 6 line 15) in order to connect the operator implemented by the node to one or more different SeqNodes. ```cpp 1 template<typename Tin, typename Tout=Tin> 2 class SeqNode { 3 public: 4 void run() { 5 // execute the node 6 } 7 protected: 8 virtual void consume(Tin & x) = 0; 9 virtual void on_start() { /* nop */ } 10 virtual void on_stop() { /* nop */ } 11 void send_next(Tout & x) { 12 // ... 13 } 14 } 15 Queue<Tin> in; 16 std::optional<multiQueues<Tout>> out; 17 }; ``` Fig. 6. The base interface of a streaming operator. Therefore, the Sequential pattern has two implementation skeletons: SeqActor and SeqNode. The main differences between them is that the first behaves like a standard CAF Actor and so it can exchange messages with any other Actor as it is a standard CAF Actor or a PP. On the contrary, the SeqNode can be used only inside a Pipeline pattern or it can be a Worker of a Farm pattern. The Pipeline and Farm patterns provide the necessary interface to enable the SeqNode to communicate with other standard Actors. Fig. 7 shows how to define SeqNode operators and how to connect ```cpp 1 struct Operator: SeqNode<T> { 2 Operator(MyState s): SeqNode(), s_(s) {} 3 void consume(T & x) override { 4 T y = do_something(x, s_); 5 send_next(std::move(y)); 6 } 7 private: 8 MyState s_; // operator local state 9 }; 10 11 int main() { 12 //... 13 MyState s1, s2; 14 Operator op1(s1); 15 Operator op2(s2); 16 Pipeline pipe{op1, op2}; 17 auto p = spawn_pattern(sys.pipe).value(); 18 //... 19 }``` Fig. 7. Simple example showing how to define an operator node and how to use it in a Pipeline pattern. On the contrary, the second and third Actor introduces an extra message hop for each operator Actor to implement the pre-defined or user-defined distribution policies. The extra hops may have an impact on the end-to-end latency for traversing the entire network. For these reasons, we decided to implement a more straightforward form of flow-control by providing a `send_next_if` command within Parallel Patterns. The `if` condition is applied to the actual number of messages present in the destination queue. If the length of the queue (observed by the sender) is greater than the specified parameter value, the send command immediately returns to allow the user to take actions (e.g., waiting a while before retrying or discarding the message or buffering it locally). The `send_next_if` command, like `send_next`, uses the policy configured by the next pipeline stage to select the queue in which to insert the message. However, if the next stage policy is either `round-robin` or `random`, the command will try to enqueue the messages in all next queues before returning with failure. This simple mechanism allows the sender to implement flow-control strategies and to auto-regulate the speed of sending messages. In high data rate scenarios, such control-flow strategies are typically needed only in the `Source` operator. We modified the CAF LIFO queue by adding a new method that returns the estimated length of the queue (i.e., `synchronized_size`). This method will be internally used by the `send_next_if` command to check the queue length of `SeqActors` and `SeqNodes`. `synchronized_size` counts the elements present both in the multiple FIFO queues and in the LIFO thread-safe queue. In the first case the count is performed without synchronization and might return an approximated value, instead the LIFO queue count is performed within a spin-lock to avoid data-races. However, in the implementation we made, the extra cost of the synchronization is payed only in the `send_next_if` where the queue length is needed and not in the `send_next`. ### 5 Evaluation The experiments were conducted on a Intel Xeon multi-core equipped with a dual-socket Intel E5-2695 Ivy Bridge CPUs running at 2.40GHz and featuring 24 cores (12 per socket 2-way hyper-threading). Each hyper-threaded core has 32 KB private L1, 256 KB private L2 and 30 MB of L3 shared cache. The server has 48 logical cores, 64 GB of DDR3 RAM. It runs Linux 4.15.0 x86_64 with the CPUfreq performance governor enabled. We used gcc 9.0.1 with the `-O3` optimization flag. The CAF version is 0.17.5, and for all tests, the number of run-time Worker threads was set to the total number of Actors used. The Work-Stealing CAF run-time has been configured to use the most `aggressive` polling strategy. In addition to the simple pipeline microbenchmark discussed in the previous section, we tested a set of streaming... applications typically used to evaluate Stream Processing Engines, namely Word Count, Fraud Detection, Spike Detection, Linear Road, briefly described in the following. Our first test was to evaluate the improvement of using SeqNodes instead of SeqActors in the three-stage pipeline microbenchmark. Fig. 9 compares the maximum throughput (tuples/s) obtained by the three versions, CAF implementing Pipeline (SeqActor,SeqActor,SeqActor); CAF PP implementing Pipeline (SeqNode,SeqNode,SeqNode), of the same operators. A large part of the overhead discussed in Sec. 3 has been removed. The difference with the baseline (called Thread in Fig. 4), is now about 15% (2.8 M vs 3.3 M tuples/s), which means that there are still a small margin for fine-tuning our SeqNode implementation. Concerning the cost for exchanging a message between a Producer and a Consumer Actor, Fig. 10 shows that the SeqNode-based implementation (i.e., CAF PP) reduces the average time from 0.81 µs to 0.38 µs. **Applications.** We considered four streaming applications whose operators graphs are sketched in Fig. 11. The figure also shows the kind of communication between operators: forward, byKey and broadcast. These communication attributes are meaningful if the next operator is replicated using a Farm pattern. The forward communication is the default one. It states that an input tuple can be assigned to any replicas. We implemented this communication mode with the round-robin policy strategy of the Farm pattern. The byKey distribution allows sending all input tuples with the same key attribute (i.e., a specific field of the tuple) to the same operator replica. Finally, the broadcast distribution duplicates the tuple and sends it to all next operators. Fraud Detection (FD) applies a Markov model to compute the probability of a credit card transaction to be a fraud. Spike Detection (SD) finds the spikes in a stream of sensor readings using a moving-average operator and a filter. Word Count (WC) counts the number of instances of each word in a text file. An operator splits the lines into words; a second operator counts the word instances. Linear Road (LR) emulates a tolling system for the vehicle expressways. The system uses a variable tolling technique accounting for traffic congestion and accident proximity to calculate toll charges. In Fig. 12, 13, 14, 15 we reported the throughput obtained by implementing the applications’ operators (one replica per operator) by using the two implementation skeletons for the Sequential pattern (SeqActor vs SeqNode, labeled with CAF and CAF PP, respectively). All tests have been executed 20 times for 60 seconds. The average value obtained and the error-bar are reported in the figures. The throughput has been measured in the Sink operator varying the input data rate in the Source. As long as the data rate is relatively low, there are no significant differences between the two implementation skeletons, even though the end-to-end latency is higher for the SeqActor-based implementation (not reported here for space reasons). Conversely, with high data rates, the difference between the two versions is increasing significantly. Word Count presents the biggest difference. This is due to the very high data rate produced by the Splitter operator that gets in input a line from the Source, and produces in output all words it contains, thus multiplying the nominal input data rate. Fig. 16 shows the performance improvement obtained for all applications by the SeqNode-based implementations. In this case, for both implementations, we ran the Source operator at maximum speed. In addition, they use the send_next_if primitive. The “queue length value” is set to 1K elements, and if reached, the Source waits for some nanoseconds before retrying the send. In this way, the internal pipeline operators are not overloaded and the entire system stabilizes after few seconds of execution. In this case we executed all applications for 10 minutes. As expected, the improvement of the CAF PP version using SeqNodes is significant, more than 2X in all application but Fraud Detection where it is about 30%. Finally, the table in Fig. 17 reports the results obtained in all applications by replicating all streaming operators. Instead of finding the best replication degree for each operator (operators have different execution times, and some of them may need more replicas while others do not need to be replicated at all), we decided to equally replicate all of them until we fill up all logical cores of the server considered (48 in our case). The replication degree is specified in the table. --- The C++ source code is publicly available in GitHub: https://github.com/ParaGroup/StreamBenchmarks. way, we can evaluate the behavior of the two implementation skeletons under very high data rates, since all Source replicas execute at maximum speed. In this test we used for both versions the implementation skeleton for the Farm pattern that removes the routing Actor between two consecutive Farm PPs. For all applications, we obtained a performance improvement in terms of throughput, and as expected, the relative distance between the two implementation skeletons (i.e., SeqActor vs SeqNode) further increased in all applications but Linear Road, where the relative distance remains about the same due to its peculiarities. All in all, at high data rates, the new implementation skeletons of our PPs provide a definite performance boost without compromising the AM’s message-passing semantics. 6 Related Work The Actor Model provides important guarantees to deadlock-freedom and data-race-freedom. However, on shared-memory systems, those guarantees come at the price of some extra performance overheads. Combining the Actor Model with shared-memory for performance is efficient but may introduce data-races. Several research works focused on improving the performance of the Actor Model without losing its important guarantees. Some tried to provide more efficient run-time mechanisms to speed up the execution of Actor-based applications [14, 31, 45, 46], others, instead provide high-level abstractions to support the distinctive features of the Actor Model [19, 23, 34, 40, 44]. Some works focused on improving the AM messaging system. Actor4j [15] is a new AM implemented in Java that focuses on optimizing message exchange among Actors. Actor4j differently from Akka [10] moves the Actor queue to the underline native executor, thus the Actor is bound to that executor along with other concurrent Actors. Using this approach the implementation can optimize message queue at the level of the underline executor guaranteeing low latency. SALSA Lite [28] is a run-time the AM language SALSA. It has been designed to efficiently implements the basic features of the Actor Model, i.e. message-passing and dynamic Actors creation. SALSA Lite is highly optimized for multi-cores and proposes a non-transparent execution of Actors where the user should manually assign Actors to executors. Selectors [35] in an extension of the AM. The Selectors manages multiple incoming queues that can be activated or deactivated. A deactivated queue may continue to receive messages, but the Selectors will temporarily ignore it. The authors claimed that the use of the Selectors concept makes synchronization and coordination patterns more natural to implement (e.g., synchronous request-reply, producer-consumer with bounded buffer). The CAL Actor Language [29] attempted to integrate the data-flow programming model with Actors. CAL has been adopted in the standardization effort of the MPEG Reconfigurable Video Coding Framework [17]. Akka [10] is one of the most used Actor frameworks. In Akka, the programmer can choose the type of queue to use for the mailbox of each Actor [3]. There is a set of default queues with different features, e.g. bounded or unbounded queue, priority-based queues, and it is even possible to supply a custom queue. Moreover, Akka provides mechanisms to replicate Actors by using Routers [4]. A Router provides a set of distribution policies, one of them being the possibility to send the message to the Actors with the smallest queue length. This feature is supported regardless of the kind of mailbox used by the individual Actor. Every Akka mailbox implementation provides an API to get the queue length. Moreover, Akka has an extension, not based on the AM, designed for streaming called Akka Stream. The system is based on the Reactive Stream project and implements a static graph of operators with typed messages. Instead, the CAF Stream experimental extension of CAF, has a similar design of Akka Stream, but (for now), it does not provide any high-level structure for building networks of operators. It maintains a close connection with CAF Actors. Recently, there has been an interest in developing SPEs for scale-up servers [39, 48]. However, most of them are based on the JVM or use the batching model. The WindFlow library [38], written in modern C++, implements the continuous streaming model and leverage PP abstractions for complex streaming operators. Its run-time is based on the thread-based FastFlow library [9]. To the best of our knowledge, there were no previous attempts to integrate optimized stream-oriented PPs within the Actor Model. 7 Summary In this work, we studied the use of the Actor Model in high data rate streaming computations on multi-cores. We used C++ Actor FRAMEWORK as a reference implementation of the Actor Model. We discussed the performance limits of Actor-based implementation in high-throughput streaming applications. Then, we propose a new implementation skeleton of both the Sequential and Farm Parallel Patterns for CAF, which have been specifically optimized for high-throughput and low-latency data streaming computations implemented with Actors. The results obtained by testing a small set of well-known benchmarks demonstrate the benefits of using the new implementations, which can bring a performance boost of more than 2× on state-of-the-art scale-up servers. The optimizations introduced are transparent to the CAF Actor programmer that uses PPs. References
{"Source-Url": "http://pages.di.unipi.it/mencagli/publications/preprint-agere-2020.pdf", "len_cl100k_base": 7495, "olmocr-version": "0.1.50", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 37043, "total-output-tokens": 12300, "length": "2e12", "weborganizer": {"__label__adult": 0.00036716461181640625, "__label__art_design": 0.0003440380096435547, "__label__crime_law": 0.0003292560577392578, "__label__education_jobs": 0.00041794776916503906, "__label__entertainment": 8.749961853027344e-05, "__label__fashion_beauty": 0.00015306472778320312, "__label__finance_business": 0.00020802021026611328, "__label__food_dining": 0.00034165382385253906, "__label__games": 0.0006937980651855469, "__label__hardware": 0.001476287841796875, "__label__health": 0.0004456043243408203, "__label__history": 0.0002875328063964844, "__label__home_hobbies": 8.296966552734375e-05, "__label__industrial": 0.00043392181396484375, "__label__literature": 0.00019884109497070312, "__label__politics": 0.00031638145446777344, "__label__religion": 0.0005230903625488281, "__label__science_tech": 0.039215087890625, "__label__social_life": 7.420778274536133e-05, "__label__software": 0.00690460205078125, "__label__software_dev": 0.94580078125, "__label__sports_fitness": 0.00028133392333984375, "__label__transportation": 0.0005884170532226562, "__label__travel": 0.0002181529998779297}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 49028, 0.04181]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 49028, 0.19022]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 49028, 0.87119]], "google_gemma-3-12b-it_contains_pii": [[0, 4636, false], [4636, 9577, null], [9577, 15394, null], [15394, 20112, null], [20112, 24277, null], [24277, 27173, null], [27173, 31915, null], [31915, 34755, null], [34755, 41194, null], [41194, 49028, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4636, true], [4636, 9577, null], [9577, 15394, null], [15394, 20112, null], [20112, 24277, null], [24277, 27173, null], [27173, 31915, null], [31915, 34755, null], [34755, 41194, null], [41194, 49028, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 49028, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 49028, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 49028, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 49028, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 49028, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 49028, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 49028, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 49028, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 49028, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 49028, null]], "pdf_page_numbers": [[0, 4636, 1], [4636, 9577, 2], [9577, 15394, 3], [15394, 20112, 4], [20112, 24277, 5], [24277, 27173, 6], [27173, 31915, 7], [31915, 34755, 8], [34755, 41194, 9], [41194, 49028, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 49028, 0.0]]}
olmocr_science_pdfs
2024-11-28
2024-11-28
2a5bbef2910dbbda6d501f55711b33e4aef3d621
Avance Bibliothek Management System Maddirala Jagadish #1, Palli Hemanth Kumar*2, Pamarthi Jagadish#3 *Computer Science & Engineering, Jntuk - Kakinada University Nuzvid, nuzvid(m.d), Krishna(dist), Vijayawada Computer Science & Engineering, Jntuk - Kakinada University Vuyyuru(m.d), Krishna(dist), Vijayawada # Computer Science & Engineering, Jntuk - Kakinada University Ramanna gudam, nuzvid(md), Krishna(dist), Vijayawada Abstract- In this paper Book management system is a place where all kind of books are available. Avance Bibliothek Management system is a web based application. This system contains list of all the books and can be accessed by remote users concurrently from anywhere in the campus by using internet. But for that users must be registered individually through their unique user id’s. This system is three tier architecture. Client sends requests, on receiving the request the server processes it and extracts the data from database and sends the result back to the client. This system provides separate interface and login for librarian, students and faculties. Librarian can modify database. Users can search for books in module presented in authorized college website. They can recommend for new books by just sending messages to the librarian from anywhere in the college. They can view the issue and return dates of any book and due they have to pay. This system generates reports that can be used in analysing the library performance. Thus the management can take appropriate steps to improve the facilities. Keywords— Bibliotheks, Clients, management, database services, I. INTRODUCTION Actually Avance Bibliothek is the combination of German and French which means advanced library. So, the title itself shows our intention of implementing basic existing modules of library management system to the advanced modules. 1.1 Existing system: The main drawbacks of the basic library system are listed below: The basic library management system facilitates the basic features and it provides the less interaction facility between user and the admin and it providing the facilities at campus only and it doesn’t providing the novels and self assessment schemes like very useful for relaxing in the leisure times in the campus. It took much time for queries taking long time consuming process and it doesn’t supports the user at anywhere outside the campus it is only at offline statement. • Searching of required books to the user only at campus. • Not providing novels and self assessment schemes. • Answering management query is a time consuming process. • No user alerts. • User can only use at offline level only. 1.2. Proposed system The proposed system provides the advanced features as that does not provided by the basic library management system and these features are both soft copies of reference books and lectures of highly designated professionals and then providing the superior advantages which are likely to be very useful and easy to use the user by using this facilities and also providing the knowledge sharing centre through internet access by the user by using this system • e-books and e-learning • position finder • buzz system • self assessments • providing the revised question papers – Previous Papers • Wisdom Center II. LITERATURE SURVEY II.1. Technique: This involves questions such as whether the technology needed for the system exists, how difficult it will be to build, and whether the firm has enough experience using that technology. The assessment is based on an outline design of system requirements in terms of Input, Processes, Output, Fields, Programs, and Procedures. This can be qualified in terms of volumes of data, trends, frequency of updating in order to give an introduction to the technical system. The application is the fact that it has been developed on Windows XP platform and a high configuration of 1GB RAM on Intel Pentium dual core processor. This is technically feasible. II.2. Feasibility study: Feasibility Study is a preliminary study undertaken to determine and document a project's viability. The term feasibility study is also used to refer to the resulting document. These results of this study are used to make a decision whether to proceed with the project, or table it. If it indeed leads to a project being approved, it will — before the real work of the proposed project starts — be used to ascertain the likelihood of the project's success. It is an analysis of possible alternative solutions to a problem and a recommendation on the best alternative. It, for example, can decide whether an order processing be carried out by a new system more efficiently than the previous one. III SYSTEM REQUIREMENT’S SPECIFICATION SYSTEM ARCHITECTURE: The application will follow three-tier architecture. In three-tier architecture application will run the traditional client/server model but from the web server. The client only displays the GUI and data but has no part in producing results. Fig. Three-tier architecture Three-tier architecture will contain the following tiers Client/Presentation Tier: This tier includes all the HTML content or forms to be displayed on the client browser. It is the form which provides the user interface to end user. Programmer uses this tier to get or set the data back and forth. Business Logic Layer: In the Business logic tier, the actual processing of the data and the logic behind the implementation of the application will be present. This tier can contain a class, which can be used to write the functions, and also works as a mediator between the presentation tier and data tiers. Data Tier: Data Tier contains methods and classes that deal with passing and storing data to the data Storage Layer. Queries or stored procedures are used to access the data from the database or to perform any operation to the database. It stores the data passed by the presentation tier. DEFINITIONS, ACRONYMS & ABBREVIATIONS: - HTML: Hypertext Markup Language is a markup language used to design static web pages. - Asp: Active server pages are used to develop web application. - IIS: Internet Information Service is a web server to run web application. - VS: Visual Studio is application where we can develop application by using this IDE. - HTTP: Hypertext Transfer Protocol is a transaction oriented client/server protocol between web browser & a Web Server. - HTTPS: Secure Hypertext Transfer Protocol is a HTTP over SSL (secure socket layer). - TCP/IP: Transmission Control Protocol/Internet Protocol, the suite of communication protocols used to connect hosts on the Internet. IV. MODULAR DESIGN The modules are: 1. Registration Module. 3. Admin Module. 5. Brainbooster Module. 6. Reports Module. IV.1. Registration module: Registration module mainly contains of two types of registration 1. Student registration. 2. Staff registration. Staff and student registration form Firstly student registration: If the student wants to log into the website then must registered in this student registration. It contains all the details of the students, this registration can be taken the purpose of whether the user can be trusted person or not, also it can be useful for the admin to know the complete data of the account holder. Staff registration: To access this web site, even faculty members also should be register here, it contains the complete data about the staff, by giving the first and last name of the user, then this module generates the full name of the user automatically and to give a unique ID to the user. IV.2. Book maintenance module: This module includes the different categories of books. In simply says, this is The module that can shows the all kinds of books which are available in the web site. These are categorized into - TECHNICAL - MANAGEMENT - JOURNALS - NOVELS - MAGAZINES - E-BOOKS - E-LEARNING TECHNICAL sub module provides the information about the technical books which are available in the library. That information can be shown in the branch wise like: CSE, IT, CIVIL, MECH, ECE, EEE. MANAGEMENT sub module provides the information about the management books which are available in the library. This kind of information can be shown in the branch wise like HR, FIANANCE, MARKET Its NG, SYSTEMS. JOURNALS sub module provides the information about the list of journals which are available in the library. The list can be categorized into ACEDAMIC, TRADE, SCIENTIFIC. NOVELs sub module provides the information about the list of the novels which are available in the library. IV.3. Accounts module: Accounts module consists of two types of accounts 1. Student accounts 2. staff accounts It’s main purpose is to display the total issuing and returning of books by the both students and staff it shows the information of all the books issued or returned from the library and information includes book name, book id, author name, user phone number, Address, and type of entry and date of entry IV.4. Admin module: Admin module is nothing but the administration module. This module contains all the rights regarding the books. The permissions can be approved through this module. In this module there are two phases. One was issue book and other was return book. If the student can get the book from the library then in the admin module will be update the issue book in the user account. If the student can submit the book to the librarian, then the admin will be a update the student account in return books. For the staff also this process will be same as the student accounts. IV.5. Brain booster module: Brain booster is the module that can be useful for the students to prepare the competitive examinations. This module contains the sub modules those are self assessments, wisdom center and mind games. Self assessments are the self tests conducting for the competitive exams, wisdom center includes the e-paper and current affairs for the students to develop the skills in general knowledge. Mind games are more useful for the relaxation. IV.6. Reports module: This module contains the data about the issue book, return book and issue date, return date. In this module has extra feature that is to send the request to admin for the required book. V. DESIGN 5.1 UNIFIED MODELING LANGUAGES Definition: UML is a general-purpose visual modelling language that is used to specify, visualize, construct, and document the artifacts of the software system. UML is a method for describing the system architecture in detail using the blueprint. UML represents a collection of best engineering practices that have proven successful in the modelling of large and complex systems. UML is a very important part of developing objects oriented software and the software development process. UML uses mostly graphical notations to express the design of software projects. UML is a language: It will provide vocabulary and rules for communications and function on conceptual and physical representation. So it is modeling language. UML Specifying: Specifying means building models that are precise, unambiguous and complete. In particular, the UML address the specification of all the important analysis, design and implementation decisions that must be made in developing and displaying a software intensive system. UML Visualization: The UML includes both graphical and textual representation. It makes easy to visualize the system and for better understanding. UML Constructing: UML models can be directly connected to a variety of programming languages and it is sufficiently expressive and free from any ambiguity to permit the direct execution of models. Building blocks of UML: - The vocabulary of the UML encompasses 3 kinds of building blocks. - Things. - Relationships. - Diagrams. Things: Things are the data abstractions that are first class citizens in a model. Things are of 4 types Structural Things, Behavioural Things, Grouping Things, An notational Things. Relationships: Relationships tie the things together. Relationships in the UML are Dependency, Association, Generalization, Specialization UML Diagrams: A diagram is the graphical presentation of a set of elements, most often rendered as a connected graph of vertices (things) and arcs (relationships). There are two types of diagrams, they are followed by - Structural Diagrams. - Behavioural Diagrams. V.1. Structural Diagrams: The UML’s four structural diagrams exist to visualize, specify, construct and document the static aspects of a system. I can View the static parts of a system using one of the following diagrams. Structural diagrams consists of Class Diagram, Object Diagram, Component Diagram, Deployment Diagram. V.2 Behavioural Diagrams: The UML’s five behavioural diagrams are used to visualize, specify, construct, and document the dynamic aspects of a system. The UML’s behavioural diagrams are roughly organized around the major ways which can model the dynamics of a system Behavioural diagrams consists of Use case Diagram, Sequence Diagram, Collaboration Diagram, State chart Diagram, Activity Diagram. VI. UML DIAGRAMS VI.1 Use-Case diagram: A use case is a set of scenarios that describing an interaction between a user and a system. A use case diagram displays the relationship among actors and use cases. The two main components of a use case diagram are use cases and actors. VI.2 Class Diagram: Class diagrams are widely used to describe the types of objects in a system and their relationships. Class diagrams model class structure and contents using design elements such as classes, packages and objects. VI.3. Deployment Diagram A deployment diagrams shows the hardware of your system and the software in those hardware. Deployment diagrams are useful when your software solution is deployed across multiple machines with each having a unique configuration. Below is an example deployment diagram. VII. IMPLEMENTATION VII.1 .Net Frame Work: Microsoft .NET Framework: The .NET Framework is a new computing platform that simplifies application development in the highly distributed environment of the Internet. The .NET Framework is designed to fulfil the following objectives: - To provide a consistent object-oriented programming environment whether object code is stored and executed locally, executed locally but Internet-distributed, or executed remotely. - To provide a code-execution environment that minimizes software deployment and versioning conflicts. - To provide a code-execution environment that guarantees safe execution of code, including code created by an unknown or semi-trusted third party. - To provide a code-execution environment that eliminates the performance problems of scripted or interpreted environments. • To make the developer experience consistent across widely varying types of applications, such as Windows-based applications and Web-based applications. • To build all communication on industry standards to ensure that code based on the .NET Framework can integrate with any other code. The .NET Framework has two main components: the common language runtime and the .NET Framework class library. The common language runtime is the foundation of the .NET Framework. You can think of the runtime as an agent that manages code at execution time, providing core services such as memory management, thread management, and remoting, while also enforcing strict type safety and other forms of code accuracy that ensure security and robustness. In fact, the concept of code management is a fundamental principle of the runtime. Code that targets the runtime is known as managed code, while code that does not target the runtime is known as unmanaged code. The class library, the other main component of the .NET Framework, is a comprehensive, object-oriented collection of reusable types that you can use to develop applications ranging from traditional command-line or graphical user interface (GUI) applications to applications based on the latest innovations provided by ASP.NET, such as Web Forms and XML Web services. The .NET Framework can be hosted by unmanaged components that load the common language runtime into their processes and initiate the execution of managed code, thereby creating a software environment that can exploit both managed and unmanaged features. The .NET Framework not only provides several runtime hosts, but also supports the development of third-party runtime hosts. For example, ASP.NET hosts the runtime to provide a scalable, server-side environment for managed code. ASP.NET works directly with the runtime to enable Web Forms applications and XML Web services, both of which are discussed later in this topic. Internet Explorer is an example of an unmanaged application that hosts the runtime (in the form of a MIME type extension). Using Internet Explorer to host the runtime enables you to embed managed components or Windows Forms controls in HTML documents. Hosting the runtime in this way makes managed mobile code (similar to Microsoft® ActiveX® controls) possible, but with significant improvements that only managed code can offer, such as semi-trusted execution and secure isolated file storage. The following illustration shows the relationship of the common language runtime and the class library to your applications and to the overall system. The illustration also shows how managed code operates within a larger architecture. Features of the Common Language Runtime: The common language runtime manages memory, thread execution, code execution, code safety verification, compilation, and other system services. These features are intrinsic to the managed code that runs on the common language runtime. With regards to security, managed components are awarded varying degrees of trust, depending on a number of factors that include their origin (such as the Internet, enterprise network, or local computer). This means that a managed component might or might not be able to perform file-access operations, registry-access operations, or other sensitive functions, even if it is being used in the same active application. The runtime enforces code access security. For example, users can trust that an executable embedded in a Web page can play an animation on screen or sing a song, but cannot access their personal data, file system, or network. The security features of the runtime thus enable legitimate Internet-deployed software to be exceptionally featuring rich. The runtime also enforces code robustness by implementing a strict type- and code-verification infrastructure called the common type system (CTS). The CTS ensures that all managed code is self-describing. The various Microsoft and third-party language compilers generate managed code that conforms to the CTS. This means that managed code can consume other managed types and instances, while strictly enforcing type fidelity and type safety. In addition, the managed environment of the runtime eliminates many common software issues. For example, the runtime automatically handles object layout and manages references to objects, releasing them when they are no longer being used. This automatic memory management resolves the two most common application errors, memory leaks and invalid memory references. The runtime also accelerates developer productivity. For example, programmers can write applications in their development language of choice, yet take full advantage of the runtime, the class library, and components written in other languages by other developers. Any compiler vendor who chooses to target the runtime can do so. Language compilers that target the .NET Framework make the features of the .NET Framework available to existing code written in that language, greatly easing the migration process for existing applications. While the runtime is designed for the software of the future, it also supports software of today and yesterday. Interoperability between managed and unmanaged code enables developers to continue to use necessary COM components and DLL. The runtime is designed to enhance performance. Although the common language runtime provides many standard runtime services, managed code is never interpreted. A feature called just-in-time (JIT) compiling enables all managed code to run in the native machine language of the system on which it is executing. Meanwhile, the memory manager removes the possibilities of fragmented memory and increases memory locality-of-reference to further increase performance. Finally, the runtime can be hosted by high-performance, server-side applications, such as Microsoft® MS Access™ and Internet Information Services (IIS). This infrastructure enables you to use managed code to write your business logic, while still enjoying the superior performance of the industry's best enterprise servers that support runtime hosting. .NET Framework Class Library: The .NET Framework class library is a collection of reusable types that tightly integrate with the common language runtime. The class library is Object Oriented, providing types from which your own managed code can derive functionality. This not only makes the .NET Framework types easy to use, but also reduces the time associated with learning new features of the .NET Framework. In addition, third-party components can integrate seamlessly with classes in the .NET Framework. For example, the .NET Framework collection classes implement a set of interfaces that you can use to develop your own collection classes. Your collection classes will blend seamlessly with the classes in the .NET Framework. As you would expect from an object-oriented class library, the .NET Framework types enable you to accomplish a range of common programming tasks, including tasks such as string management, data collection, database connectivity, and file access. In addition to these common tasks, the class library includes types that support a variety of specialized development scenarios. For example, you can use the .NET Framework to develop the following types of applications and services: - Console applications. - Scripted or hosted applications. - Windows GUI applications (Windows Forms). - ASP.NET applications. - XML Web services. - Windows services. For example, the Windows Forms classes are a comprehensive set of reusable types that vastly simplify Windows GUI development. If you write an ASP.NET Web Form application, you can use the Web Forms classes. Client Application Development: Client applications are the closest to a traditional style of application in Windows-based programming. These are the types of applications that display windows or forms on the desktop, enabling a user to perform a task. Client applications include applications such as word processors and spreadsheets, as well as custom business applications such as data-entry tools, reporting tools, and so on. Client applications usually employ windows, menus, buttons, and other GUI elements, and they likely access local resources such as the file system and peripherals such as printers. Another kind of client application is the traditional ActiveX control (now replaced by the managed Windows Forms control) deployed over the Internet as a Web page. This application is much like other client applications: it is executed natively, has access to local resources, and includes graphical elements. In the past, developers created such applications using C/C++ in conjunction with the Microsoft Foundation Classes (MFC) or with a rapid application development (RAD) environment such as Microsoft® Visual Basic®. The .NET Framework incorporates aspects of these existing products into a single, consistent development environment that drastically simplifies the development of client applications. The Windows Forms classes contained in the .NET Framework are designed to be used for GUI development. You can easily create command windows, buttons, menus, toolbars, and other screen elements with the flexibility necessary to accommodate shifting business needs. For example, the .NET Framework provides simple properties to adjust visual attributes associated with forms. In some cases the underlying operating system does not support changing these attributes directly, and in these cases the .NET Framework automatically recreates the forms. This is one of many ways in which the .NET Framework integrates the developer interface, making coding simpler and more consistent. Unlike ActiveX controls, Windows Forms controls have semi-trusted access to a user's computer. This means that binary or natively executing code can access some of the resources on the user's system (such as GUI elements and limited file access) without being able to access or compromise other resources. Because of code access security, many applications that once needed to be installed on a user's system can now be safely deployed through the Web. Your applications can implement the features of a local application while being deployed like a Web page. VI.2. ASP.NET: ASP.NET is part of the whole. NET framework, built on top of the Common Language Runtime (also known as the CLR) - a rich and flexible architecture, designed not just to cater for the needs of developers today, but to allow for the long future we have ahead of us. What you might not realize is that, unlike previous updates of ASP, ASP.NET is very much more than just an upgrade of existing technology – it is the gateway to a whole new era of web development. ASP.NET is a feature at the following web server releases: - Microsoft IIS 5.0 on WINDOWS 2000 Server - Microsoft IIS 5.1 on WINDOWS XP ASP.NET has been designed to try and maintain syntax and run-time compatibility with existing ASP pages wherever possible. The motivation behind this is to allow existing ASP Pages to be initially migrated ASP.NET by simply renaming the file to have an extension of .aspx. For the most part this goal has been achieved, although there are typically some basic code changes that have to be made, since VBScript is no longer supported, and the VB language itself has changed. Some of the key goals of ASP.NET were to: - Remove the dependency on script engines, enabling pages to be type safe and compiled. - Reduce the amount of code required to develop web applications. - Make ASP.NET well factored, allowing customers to add in their own custom functionality, and extend/ replace built-in ASP.NET functionality. - Make ASP.NET a logical evolution of ASP, where existing ASP investment and therefore code can be reused with little, if any, change. - Realize that bugs are a fact of life, as ASP.NET should be as fault tolerant as possible. Benefits of ASP.NET: The .NET Framework includes a new data access technology named ADO.NET, an evolutionary improvement to ADO. Though the new data access technology is evolutionary, the classes that make up ADO.NET bear little resemblance to the ADO objects with which you might be familiar. Some fairly specific changes must be made to existing ADO applications to convert them to ADO.NET. The changes don't have to be made immediately to existing ADO applications to run under ASP.NET, however. ADO will function under ASP.NET. However, the work necessary to convert ADO applications to ADO.NET is worthwhile. For disconnected applications, ADO.NET should offer performance advantages over ADO disconnected record sets. ADO requires that transmitting and receiving components be COM objects. ADO.NET transmits data in a standard XML-format file so that COM marshaling or data type conversions are not required. ADO.NET has several advantages over ASP: - The following are some of the benefits of ADO.NET: - Make code cleaner. - Improve deployment, scalability, and reliability. - Provide better support for different browsers. - Enable a new breed of web applications. ActiveX: ActiveX is a specification developed by Microsoft that allows ordinary Windows programs to be run within a Web page. ActiveX programs can be written in languages such as Visual Basic and they are compiled before being placed on the Web server. ActiveX application, called controls, are downloaded and executed by the Web browser, like Java applets. Unlike Java applets, controls can be installed permanently when they are downloaded; eliminating the need to download them again. ActiveX’s main advantage is that it can do just about anything. This can also be a disadvantage: Several enterprising programmers have already used ActiveX to bring exciting new capabilities to Web page, such as “the Web page that turns off your computer” and “the Web page that formats disk drive”. Fortunately, ActiveX includes a signature feature that identifies the source of the control and prevents controls from being modified. While this won’t prevent a control from damaging system, we can specify which sources of controls we trust. ActiveX has two main disadvantages: It isn’t as easy to program as scripting language or Java. ActiveX is proprietary. It works only in Microsoft Internet Explorer and only Windows platforms. VI.4. ADO.NET: ADO.NET provides consistent access to data sources such as Microsoft SQL Server, as well as data sources exposed via OLE DB and XML. Data-sharing consumer applications can use ADO.NET to connect to these data sources and retrieve, manipulate, and update data. ADO.NET cleanly factors data access from data manipulation into discrete components that can be used separately or in tandem. ADO.NET includes .NET data providers for connecting to a database, executing commands, and retrieving results. Those results are either processed directly, or placed in an ADO.NET Dataset object in order to be exposed to the user in an ad-hoc manner, combined with data from multiple sources, or remote between tiers. The ADO.NET Dataset object can also be used independently of a .NET data provider to manage data local to the application or sourced from XML. Why ADO.NET? As application development has evolved, new applications have become loosely coupled based on the Web application model. More and more of today's applications use XML to encode data to be passed over network connections. Web applications use HTTP as the fabric for communication between tiers, and therefore must explicitly handle maintaining state between requests. This new model is very different from the connected, tightly coupled style of programming that characterized the client/server era, where a connection was held open for the duration of the program's lifetime and no special handling of state was required. In designing tools and technologies to meet the needs of today's developer, Microsoft recognized that an entirely new programming model for data access was needed, one that is built upon the .NET Framework. Building on the .NET Framework ensured that the data access technology would be uniform—components would share a common type system, design patterns, and naming conventions. ADO.NET was designed to meet the needs of this new programming model: disconnected data architecture, tight integration with XML, common data representation with the ability to combine data from multiple and varied data sources, and optimized facilities for interacting with a database, all native to the .NET Framework. Leverage Current ADO Knowledge: Microsoft's design for ADO.NET addresses many of the requirements of today's application development model. At the same time, the programming model stays as similar as possible to ADO, so current ADO developers do not have to start from scratch in learning a brand new data access technology. ADO.NET is an intrinsic part of the .NET Framework without seeming completely foreign to the ADO programmer. ADO.NET coexists with ADO. While most new .NET applications will be written using ADO.NET, ADO remains available to the .NET programmer through .NET COM interoperability services. ADO.NET provides first-class support for the disconnected, n-tier programming environment for which many new applications are written. The concept of working with a disconnected set of data has become a focal point in the programming model. The ADO.NET solution for n-tier programming is the Dataset. XML Support: XML and data access are intimately tied—XML is all about encoding data, and data access is increasingly becoming all about XML. The .NET Framework does not just support Web standards—it is built entirely on top of them. VI.5. SQL SERVER 2008: Microsoft SQL Server 2008 is comprehensive, integrated data management and analysis software that enables organizations to reliably manage mission-critical information and confidently run today's increasingly complex business applications. SQL Server 2008 allows companies to gain greater insight from their business information and achieve faster results for a competitive advantage. Top-10 Features of SqlServer-2008: 1. T-SQL (Transaction SQL) enhancements: T-SQL is the native set-based RDBMS programming language offering high-performance data access. It now incorporates many new features including error handling via the TRY and CATCH paradigm, Common Table Expressions (CTE), which return a record set in a statement, and the ability to shift columns to rows and vice versa with the PIVOT and UNPIVOT commands. 2. CLR (Common Language Runtime): The next major enhancement in SQL Server 2005 is the integration of a .NET compliant language such as C#, ASP.NET or VB.NET to build objects (stored procedures, triggers, functions, etc.). This enables you to execute .NET code in the DBMS to take advantage of the .NET functionality. It is expected to replace extended stored procedures in the SQL Server 2000 environment as well as expand the traditional relational engine capabilities. 3. Service Broker: The Service Broker handles messaging between a sender and receiver in a loosely coupled manner. A message is sent, processed and responded to, completing the transaction. This greatly expands the capabilities of data-driven applications to meet workflow or custom business needs. 4. Data encryption: SQL Server 2000 had no documented or publicly supported functions to encrypt data in a table natively. Organizations had to rely on third-party products to address this need. SQL Server 2008 has native capabilities to support encryption of data stored in user-defined databases. 5. SMTP mail: Sending mail directly from SQL Server 2000 is possible, but challenging. With SQL Server 2005, Microsoft incorporates SMTP mail to improve the native mail capabilities. Say "see-ya" to Outlook on SQL Server! 6. HTTP endpoints You can easily create HTTP endpoints via a simple T-SQL statement exposing an object that can be accessed over the Internet. This allows a simple object to be called across the Internet for the needed data. 7. Multiple Active Result Sets (MARS): MARS allow a persistent database connection from a single client to have more than one active request per connection. This should be a major performance improvement, allowing developers to give users new capabilities when working with SQL Server. For example, it allows multiple searches, or a search and data entry. The bottom line is that one client connection can have multiple active processes simultaneously. 8. Dedicated administrator connection: If all else fails, stop the SQL Server service or push the power button. That mentality is finished with the dedicated administrator connection. This functionality will allow a DBA to make a single diagnostic connection to SQL Server even if the server is having an issue. 9. SQL Server Integration Services (SSIS): SSIS has replaced DTS (Data Transformation Services) as the primary ETL (Extraction, Transformation and Loading) tool and ships with SQL Server free of charge. This tool, completely rewritten since SQL Server 2000, now has a great deal of flexibility to address complex data movement. 10. Database mirroring: It's not expected to be released with SQL Server 2005 at the RTM in November, but I think this feature has great potential. Database mirroring is an extension of the native high-availability capabilities. So, stay tuned for more details. VI.6. HTML: HTML (Hyper Text Markup Language) is the language that is used to prepare documents for online publications. HTML documents are also called Web documents, and each HTML document is known as Web page. A page is what is seen in the browser at any time. Each Web site, whether on the Internet or Intranet, is composed of multiple pages. And it is possible to switch among them by following hyperlinks. The collection of HTML pages makes up the World Wide Web. A web pages is basically a text file that contains the text to be displayed and references of elements such as images, sounds and of course hyperlinks to other documents. HTML pages can be created using simple text editor such as Notepad or a WYSIWYG application such as Microsoft FrontPage. VII. CONCLUSION The goal of the system is to bring down the work load with the increased efficiency and to speed up the activities. With this it is very easy to process course fee that is collected time to time from students who are registered and studying at franchisees. REFERENCES www.ijcsit.com 7250 BIographies Maddirala Jagadish pursuing M.Tech in LIMAT in the stream of Computer Science and Engineering was born on 12th August, 1992. He received a Bachelor Degree in Computer Science and Engineering from Sri Saradhi Institute of Engineering & Technology in 2013. Palli Hemanth Kumar pursuing M.Tech in LIMAT in the stream of Computer Science and Engineering was born on 15th June, 1991. He received a Bachelor Degree in Electronics and Computer Engineering from Prasad V Potluri Siddhartha Institute of Technology in 2013. Pamarthi Jagadish pursuing M.Tech in LIMAT in the stream of Computer Science and Engineering was born on 15th June, 1991. He received a Bachelor Degree in Information Technology from Sri Saradhi Institute of Engineering & Technology in 2012.
{"Source-Url": "http://www.ijcsit.com/docs/Volume%205/vol5issue06/ijcsit2014050675.pdf", "len_cl100k_base": 7432, "olmocr-version": "0.1.49", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 26322, "total-output-tokens": 8939, "length": "2e12", "weborganizer": {"__label__adult": 0.0003986358642578125, "__label__art_design": 0.0006618499755859375, "__label__crime_law": 0.0004074573516845703, "__label__education_jobs": 0.033233642578125, "__label__entertainment": 0.00013315677642822266, "__label__fashion_beauty": 0.00021314620971679688, "__label__finance_business": 0.0008168220520019531, "__label__food_dining": 0.00046944618225097656, "__label__games": 0.0007801055908203125, "__label__hardware": 0.0013303756713867188, "__label__health": 0.0004954338073730469, "__label__history": 0.00048661231994628906, "__label__home_hobbies": 0.0001976490020751953, "__label__industrial": 0.00046181678771972656, "__label__literature": 0.0007023811340332031, "__label__politics": 0.00020432472229003904, "__label__religion": 0.00054168701171875, "__label__science_tech": 0.0229339599609375, "__label__social_life": 0.0002275705337524414, "__label__software": 0.037384033203125, "__label__software_dev": 0.89697265625, "__label__sports_fitness": 0.0002315044403076172, "__label__transportation": 0.0006265640258789062, "__label__travel": 0.0002956390380859375}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 40996, 0.02293]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 40996, 0.53724]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 40996, 0.90713]], "google_gemma-3-12b-it_contains_pii": [[0, 4690, false], [4690, 7807, null], [7807, 11998, null], [11998, 14771, null], [14771, 21182, null], [21182, 27173, null], [27173, 32947, null], [32947, 38657, null], [38657, 40996, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4690, true], [4690, 7807, null], [7807, 11998, null], [11998, 14771, null], [14771, 21182, null], [21182, 27173, null], [27173, 32947, null], [32947, 38657, null], [38657, 40996, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 40996, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 40996, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 40996, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 40996, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 40996, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 40996, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 40996, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 40996, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 40996, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 40996, null]], "pdf_page_numbers": [[0, 4690, 1], [4690, 7807, 2], [7807, 11998, 3], [11998, 14771, 4], [14771, 21182, 5], [21182, 27173, 6], [27173, 32947, 7], [32947, 38657, 8], [38657, 40996, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 40996, 0.0]]}
olmocr_science_pdfs
2024-11-28
2024-11-28
a20a214d5f81d12cab64f715d26cfc0c63164cfa
USING WEB SERVICES TO FOSTER GLOBAL COLLABORATION IN SOUND DESIGN James A. Ballas and Justin Nevitt Naval Research Laboratory Code 5585 Washington, DC, USA james.ballas[justin.nevitt]@nrl.navy.mil ABSTRACT The migration of client-server systems to web services using Service Oriented Architecture (SOA) design principles is widespread and likely to dominate the future evolution of computing. Use of web services is especially challenging for streaming content such as that which would be used for sound design. This paper describes the principles of a Service Oriented Architecture (SOA) and ways that it could support sound design and foster global collaboration across the web. 1. INTRODUCTION The current trend in the computer industry is to migrate from client-server, point-to-point systems to Service Oriented Architecture (SOA) systems that provide loosely coupled components that are available as web services and that can be composed into functional workflows. SOAs are widely deployed for text content, such as search and e-commerce, but are not widely used for streaming content. This paper begins with a definition of SOA and its advantages. This is followed by a description of SOA components. The paper concludes with a description of how SOA can be used to support sound design. Our optimism about the potential use of SOA for sound design is based on our success in implementing web service systems in other domains that incorporate many of the same components as those described here [1] [2]. 1.1. Service Oriented Architecture SOA is a system in which services are deployed and registered by providers and able to be discovered and used by consumers. These elements exist as the SOA triangle [3], illustrated in Fig 1. ![Figure 1. The Service Oriented Architecture (SOA) triangle that illustrates the fundamental design of a web services system.](image) The benefits of SOA are obtained if the enterprise is designed according to the following principles: - distributed components that function independent of their physical location; - loosely coupled components that can be invoked as needed; - granular services that can be configured into workflows; - platform independence achieved by adherence to platform-agnostic standards and specifications; - discoverable components reachable through public interfaces. In turn, the following benefits can be realized: Ease of Deployment. A web service means that your code only has to be deployed at one site in the enterprise. Updating will only require redeployment to this single site. Reuse. The deployment of core functions as services greatly increases the efficiency of code writing and execution. These core functions do not have to be replicated throughout the enterprise but instead are deployed at one endpoint with a public interface. Agility. Software development is a time-intensive task that requires money, man hours, and other resources. SOA allows for rapid development of new functionalities to react to customers’ needs. Using a technology called Business Process Execution Language (BPEL, which is described in more detail later in this paper), users can join separate pieces of functionality (services) together to form a new business process or workflow. The orchestration of several services takes a fraction of the time it would take to hand code a new application or adapt a legacy system with the same functionality [4]. 1.2. Service Description The use of web services depends on publicly available service descriptions. The specification of a service requires a Web Service Description Language (WSDL) document as well as data descriptions in the form of xml schema documents. The WSDL describes the interface, ports, messages, and binding for a web service. The schema documents are XML Schema Definitions (XSD) that include standard data types (e.g., string, integer) that are recognized universally, as well as unique data types that are defined for the particular web service. Universal data types might include data types that have been established by an international standards body (besides Oasis, which is the controlling organization for the web). For example, one set of metadata that is commonly used is that from the Dublin Core Metadata Initiative (DCMI). While the DCMI is well developed for some domains, it is notably sparse with respect to audio, containing only the following metadata definition for sound among its basic types: ```xml <rdf:Description rdf:about="http://purl.org/dc/dcmitype/Sound"/> <dc:creator rdf:resource="http://purl.org/dc/elements/1.1/"/> <dc:date rdf:resource="http://purl.org/dc/elements/1.1/"/> <dc:format rdf:resource="http://purl.org/dc/elements/1.1/"/> <dc:identifier rdf:resource="http://purl.org/dc/elements/1.1/"/> <dc:language rdf:resource="http://purl.org/dc/elements/1.1/"/> <dc:publisher rdf:resource="http://purl.org/dc/elements/1.1/"/> <dc:rights rdf:resource="http://purl.org/dc/elements/1.1/"/> <dc:subject rdf:resource="http://purl.org/dc/elements/1.1/"/> <dc:title rdf:resource="http://purl.org/dc/elements/1.1/"/> <dc:type rdf:resource="http://purl.org/dc/elements/1.1/"/> <dc:identifier rdf:resource="http://purl.org/dc/elements/1.1/"/> <dc:publisher rdf:resource="http://purl.org/dc/elements/1.1/"/> <dc:rights rdf:resource="http://purl.org/dc/elements/1.1/"/> <dc:subject rdf:resource="http://purl.org/dc/elements/1.1/"/> <dc:title rdf:resource="http://purl.org/dc/elements/1.1/"/> <dc:type rdf:resource="http://purl.org/dc/elements/1.1/"/> </rdf:Description> ``` There are other metadata documents that address aspects of audio material. The Digital Library Foundation has defined the Metadata Encoding and Transmission Standard (METS.XSD) that includes elements to encode descriptive, administrative, and structural metadata about digital objects, including digital audio recording; but as with the DCMI, there is little in its specification that is audio related. 1.3. Service Registration and Discovery For web services to be used in new workflows, they have to be registered in the equivalent of a “yellow pages.” The primary method by which services are registered and discovered (located) in a SOA is through common registries based on the Universal Description, Discovery, and Integration (UDDI) specification. UDDI is, in effect, like a phonebook for web services; both the service location and a technical description of the service offerings are available. When the UDDI specification was being developed, several public registries were available until 2006, but were shut down with the conclusion of the successful testing of the UDDI technology. While the UDDI specification is supported in commercial products (e.g., Microsoft’s Office suite has a web services toolkit, which includes search as part of its Visual Basic system), there is limited public registry. One exception is the UDDI Basic system, which uses crawlers to find service specifications (WSDL files), as well as to provide a mechanism to register services. Its directory is searchable through a browser, but not through the UDDI inquiry operation. A search using “audio” resulted in 86 hits. Fifty-two of these were Amazon’s E-Commerce Service, which includes a capability for a vendor to describe the audio format of a product. The remaining 34 hits were for a variety of services including services to upload, download, create and play audio files, as well as to retrieve audio attributes. The service description includes an availability metric, generated by periodically testing the service. Seekda.com also provides a mechanism to test the web services it has registered. For example, faces.com has defined a set of services to support sharing of photos and music, as well as blogging. Audio files are added to tunefeedes using a SOAP operation called Tunefeed_AddAudioInfo (string Signature, string AudioListXml, string AuthKey). 1.4. Service Binding Use of services requires an application that can send and receive SOAP over HTML. This application will attach to the service endpoint through a process called binding. A notional binding specification for an Audio Design service is as follows: ```xml <wsdl:binding name="Audi DesignerServiceBinding" xmlns:soap="http://schemas.xm lsoap.org/wsdl/soap/"> <soap:operation soapAction="" style="document" xmlns:soap="http://schemas.xm lsoap.org/wsdl/soap/"> <wsdl:input> <soap:body use="literal" xmlns:soap="http://schemas.xm lsoap.org/wsdl/soap/"></wsdl:input> <wsdl:output> <soap:body use="literal" xmlns:soap="http://schemas.xm lsoap.org/wsdl/soap/"></wsdl:output> </wsdl:operation> </wsdl:binding> ``` This binding defines an operation called DesignRequest, that will receive an incoming message and respond with an outgoing message. The formats of these messages are defined in other segments of the WSDL. For example, an input message called “DesignRequest!” would include three parts when defined as follows: ```xml <wsdl:message name="DesignRequest" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xm lsoap.org/wsdl/soap/" xmlns:tns="http://purl.org/dcmitype/"> <wsdl:part name="RequestDescription" type="xsd:string"/> <wsdl:part name="AudioOutFileName" type="xsd:string"/> <wsdl:part name="DataInFileName" type="xsd:string"/> </wsdl:message> ``` 1.5. Service Orchestration Service Orchestration is a technology that links services together to create workflows which exhibit greater functionality. when working with a suite of services than when working with individual services. Electronic business might utilize orchestration to implement a workflow that finds products from vendors, gets a vendor selection from a user, does electronic billing, generates purchase orders, and contacts a shipper for pickup and delivery of the product. Orchestration technology is described in the BPEL4WS (Business Process Execution Language for Web Services) specification. The summary of the specification from the OASIS technical committee is as follows: BPEL4WS is an XML-based language enabling users to describe business process activities as Web services and define how they can be connected to accomplish specific tasks. WS-BPEL is designed to specify business processes that are both composed of and exposed as web services. In 2007 IBM, SAP, Oracle, BEA, Adobe and Active Endpoints formally submitted the BPEL4People extension and WS-HumanTask specification to OASIS for approval. WS-HumanTask and BPEL4People are standards proposed to expand on BPEL’s specification. They allow BPEL to completely model a business process, including complex human tasks and interactions. BPEL4People is a specific set of extensions to the BPEL (WS-BPEL 2.0) language that outlines a human task much like a call to a service. It allows service orchestrators to include human interactions at the orchestration level (BPEL4People). WS-HumanTask is the web services specification that describes the human tasks, assignments of people to tasks, and task parameters such as human role, task assignment (to a person) and task deadline. With this extension of the BPEL language, orchestration of workflows moves beyond machine-to-machine and specifically includes human activities. 1.6. Service Security Web services typically will require some type of security to restrict the use of the services, and the data that these produce, to authorized users. As web services have been adopted widely for business, service security is an established technology. Several types of security are available. On the wire security is provided by the use of secure socket layer (SSL) transport. This is simpler to implement than one might expect. It requires SSL certificates that are digital signatures. These can be self-signed or can be obtained from government or private organizations. With certificates in hand, they are loaded into the appropriate keystores, and the web server is configured for SSL operation. User authorization requires a second level of security employing username and passwords to authenticate users. A moderate level of security can be obtained by requiring a username/password to gain access to a web site, but typically these are html forms that employ the INPUT type=’password’ which simply echoes “*” when the user types the password. The actual password is not secured and is passed back from the browser as clear text. A stronger method to restrict access is to employ username/password as described by the SAML specification. This encrypts the username and password in the header of the web service call. Currently, skilled Java programming is required to implement this capability. But as web services become more established, out of the box implementations will become common, especially for open sourced, Linux-based systems. 1.7. Content Discovery Search capability is currently driving the economy of the web, most clearly demonstrated by the success of Google. The commercial search companies succeed by producing, indexing, and owning metadata about web content. But web sites often have internal search capability, demonstrating that content discovery can be implemented on any database. The U.S. Department of Defense invested in and demonstrated the feasibility of federated search technology. This is a design that uses a central query service to receive user input, parse it, and then transmit the queries to data providers through a search web service (SWS) specification. The data providers employ their own method of searching their data bases, and return messages with hits and URL links to the data itself. A similar design is behind Amazon’s Open search specification. A major limitation of content discovery capability is that it does not function well for media, unless the files have been tagged. However, by incorporating content analysis services, such as audio classifiers, into a search workflow, a functional search of web audio content could be achieved. The content analyzers would be designed to expose their capability as a web service. The workflow would apply these services to databases, and return the results back to the user. 2. WEB SERVICES FOR STREAMING CONTENT The web services paradigm is a powerful one that can be applied to many different IT problems. There has yet to be much done with web services in the area of streaming audio content. This is expected, as the basic specifications for web services heavily emphasize text-based content. Nonetheless, the potential applications of a web services framework for streaming audio content are extensive. After overcoming certain hurdles inherent to conducting business with loosely coupled entities, one will be able to do many of the normal auditory processing tasks usually relegated to thick apps on workstations. All the advantages of using web services will follow. Potential applications are described in the following sections. 2.1. Sonification application Imagine that a developer has invented an algorithm that creates a particularly useful sonification of data. Using this algorithm, a stock broker would like to construct a live sonification of stock watch data that is available in xml form from a web service. The resulting sonification would be available from a streaming server, and the broker has a webapp to listen to the audio stream from this server. If all these functions existed as a web service, one could easily orchestrate them together to get the desired effect. In addition, if you later decided to use a different data source or a different sonification algorithm, you could substitute those with ease. The architecture for this is illustrated in Fig 2. 2.2. Search application Imagine that a sound designer is tasked with finding an archetype example of a particular voice utterance and has available an immense library of audio recordings from the radio industry; however, the designer cannot listen to more than one recording at a time. A web service orchestration that combines a speech-to-text service and a search service would provide a solution. The speech-to-text service would be called to generate the text of the audio recordings, and its output would be searched by the search service. In practice, the audio recordings would probably be pre-indexed, just as the Google appliance is used to crawl the web searching for and indexing documents. Such a crawler would be an enterprise implementation of machine listening. The architecture for this application is illustrated in Fig 2, which happens to be the same architecture for the sonification application. 2.4. Architecture summary These examples require an architecture with the following components: - a streaming server that can be controlled by a publicly available web service; - web services that can perform computations on audio content, including generating it under algorithmic control, searching audio files and classifying audio segments; - orchestrations of publicly available web services including the service controlling the streaming server; - web applications that can access these web services and receive streaming content. The following section describes examples of the components illustrated in Fig 2. 2.5. IBM Streaming Server The development of a suite of web services for audio design and its applications is notably advanced by IBM's Streaming Server (http://www.alphaworks.ibm.com/tech/streamingengine). This server can be hosted in Apache Tomcat, an open source web server. It has a WSDL that defines the web service calls that can be made, and can generate media streams from recorded or live sources using the Real Time Streaming Protocol (RSTP) for control and the Real-time Transport Protocol (RTP) for transport. RSTP is a tape-like control protocol (e.g., play, pause, record). The media streams that are currently supported are MP3 audio and MPEG-4 video. The WSDL defines 147 elements, 88 messages, and 88 operations (e.g., as start and stop the server, etc). One of the operations is createLiveAssetSession. This operation expects a message with the following elements: ```xml <element name="createLiveAssetSession"> <complexType> <sequence> <element name="name" type="xsd:string"/> <element name="srcType" type="xsd:int"/> <element name="srcHost" type="xsd:string"/> <element name="srcPort" type="xsd:int"/> <element name="srcName" type="xsd:string"/> <element name="mcast" type="xsd:boolean"/> <element name="archName" type="xsd:string"/> <element name="archDur" type="xsd:int"/> </sequence> </complexType> ``` The response is simply a Boolean that the session was or was not created. This example from the WSDL illustrates the control that an application can have over this server, such as the URL source (srcHost is the URL of the live source; srcPort is the IP port at this URL). The WSDL definition of the message elements does not enumerate what is expected in the parts of this message, but these could be easily added. The streaming server has been tested and we have verified that it can be controlled through web service calls that conform to the WSDL specification. 2.6. Audio Computation While a streaming engine can deliver content, and a web services streaming engine can be controlled through web service calls, the actual media content has to come from some other source. An example of audio computation technology that can be quickly demonstrated, but that also has impressive growth capability, is the python-based boodler system (http://sourceforge.net/projects/boodler/). This is a system to generate soundscapes, using agents that start, stop, and parametrically manipulate sound segments. It can produce raw sound files as well as MP-3 and it can be exposed as a web service using SOAPy (http://sourceforge.net/projects/soapy). --- 2 After starting the server and verifying its operation, we loaded the WSDL into the eclipse Web Services Explorer, and successfully made calls to the published operations. Another type of audio computation would be analysis technology that would take sound files (either recorded or live) and extract features about the sound such as its source event. For example, one of us has recently published source code for an audio classifier [5]. This classifier determines whether a sound might be classified as a propeller airplane. The algorithm uses statistical properties of the sound to make this classification, and the final decision algorithm could be modified for other types of events. This code could be converted to Java, and hosted as a web service. Alternatively, the windows executable could be exposed as a web service through the Java Runtime.exec() method. We have successfully implemented this option and confirmed that the classifier can be called as a web service and will correctly process the files that have been specified in the web service call. 2.7. Orchestration A streaming server and audio computation services are critical components of this SOA, but their usage requires a development environment such as Eclipse as well as an experienced programmer. An alternative to these is the web services orchestration design and deployment environments offered by several vendors. ActiveBPEL Designer is an environment we have been using to construct web services workflows. The Designer produces BPEL code that is executed by an open source BPEL engine that is hosted in a web services container such as Apache Tomcat. An example of an orchestration design is illustrated in Fig 3. This workflow receives a request to create a live source, checks whether the server is started (and if not, starts the server), enables the Real Time Streaming Protocol (RTSP) on the server, copies the parameters for the live source into a web server message to the streaming server, and finally sends the message to create the service to the streaming server. The result of this request is returned to the user to complete the workflow. This design could be easily modified to call ancillary services such as those described in previous sections (e.g., create a soundscape). 2.8. Browser Applications The last component in Fig. 2 is the web application, typically a browser, that can utilize the web services and receive the streaming content. Two issues associated with any browser application are real-time rendering and proprietary coding. It is well established that the protocol typically used for text content (e.g., HTTP) is not designed for streaming content. The RTSP and the Real-time Transport Protocol (RTP) were developed to support streaming applications. RTSP uses a tape-like control interface (e.g., play, pause, record). Streaming servers such as QuickTime and its open source version, Darwin, utilize RTP/RTSP as does the IBM streaming server described earlier. Utilization of these protocols can sometimes cause issues if firewalls have been configured to block their use or if the server is using the UDP transport layer and it is blocked. The second issue associated with the browser is proprietary coding, such as that utilized by Adobe Flash. In order to improve real-time performance, streaming content is often compressed and encoded. While proprietary coding might provide some features that are not available in an open coding scheme, its use in a SOA enterprise will require all the web services to use that proprietary format. Unless the commercial vendor offers a decoder, services that require access to the raw waveform could not be developed. For example, a service that would generate metadata for the audio content would need access to the raw audio. The widely used MP3, which is the audio layer of MPEG-1, is a proprietary format, and its use must be licensed for commercial applications (see www.mp3licensing.com). Open source coders/decoders are available for applications that need access to the raw audio. Finally, the browser will need a player application that is capable of handling the protocols, coding, and the computer’s audio hardware. Alternatively, IBM’s alphaworks has another suite of technologies, IBM Presenter and IBM Viewer, that also could be incorporated into a web services system (http://www.alphaworks.ibm.com/tech/personalpresenter). Besides hosting a player, the browser would host the interfaces to other web services that are illustrated in Fig 2. Once a suite of services is available, workflows could be composed and the BPEL orchestration can include BPEL4People capability that would add user control and feedback to a workflow process. 3. CONCLUSION The payoff of SOA lies in the potential to incorporate data sources, search engines, user-facing services (user interfaces), computational services and other computer capabilities hosted locally but available globally. Data from financial, government, or entertainment sources could be tied to sonification algorithms which would be generating audio content for the streaming server. Sound designs could be collaborative enterprises with individuals hosting disparate services such as filters, effects, generators, mixers, and renders. A SOA that is focused on sound and its design would be an enabling framework for global collaboration. 4. ACKNOWLEDGMENTS The preparation of this paper was sponsored by the U.S. Naval Research Laboratory. The views and conclusions expressed in this paper are those of the authors and do not reflect the official policies, either expressed or implied, of the U.S. Navy. 5. REFERENCES
{"Source-Url": "https://smartech.gatech.edu/bitstream/handle/1853/49966/BallasNevitt2008.pdf?isAllowed=y&sequence=1", "len_cl100k_base": 5268, "olmocr-version": "0.1.53", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 18687, "total-output-tokens": 6028, "length": "2e12", "weborganizer": {"__label__adult": 0.00045871734619140625, "__label__art_design": 0.002391815185546875, "__label__crime_law": 0.000423431396484375, "__label__education_jobs": 0.0012178421020507812, "__label__entertainment": 0.0004363059997558594, "__label__fashion_beauty": 0.00021660327911376953, "__label__finance_business": 0.0006785392761230469, "__label__food_dining": 0.0003955364227294922, "__label__games": 0.000507354736328125, "__label__hardware": 0.002361297607421875, "__label__health": 0.0004982948303222656, "__label__history": 0.0003743171691894531, "__label__home_hobbies": 9.101629257202148e-05, "__label__industrial": 0.0004968643188476562, "__label__literature": 0.0005049705505371094, "__label__politics": 0.0002720355987548828, "__label__religion": 0.0005540847778320312, "__label__science_tech": 0.12249755859375, "__label__social_life": 0.0001099705696105957, "__label__software": 0.030548095703125, "__label__software_dev": 0.833984375, "__label__sports_fitness": 0.00019490718841552737, "__label__transportation": 0.0005865097045898438, "__label__travel": 0.00021517276763916016}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 26592, 0.01773]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 26592, 0.66112]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 26592, 0.91057]], "google_gemma-3-12b-it_contains_pii": [[0, 3936, false], [3936, 9452, null], [9452, 15838, null], [15838, 19924, null], [19924, 24466, null], [24466, 26592, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3936, true], [3936, 9452, null], [9452, 15838, null], [15838, 19924, null], [19924, 24466, null], [24466, 26592, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 26592, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 26592, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 26592, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 26592, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 26592, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 26592, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 26592, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 26592, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 26592, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 26592, null]], "pdf_page_numbers": [[0, 3936, 1], [3936, 9452, 2], [9452, 15838, 3], [15838, 19924, 4], [19924, 24466, 5], [24466, 26592, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 26592, 0.0]]}
olmocr_science_pdfs
2024-12-07
2024-12-07
ef44422e8232ab7e832b95a85e9e0601a5f132a3
Fabio Sergio Bruscetti, Javier Guevara, María Claudia Abeledo, Daniel Alberto Priano Centro de Investigación y Desarrollos en Informática (CIDI), Instituto de Tecnologías Emergentes Ciencias Aplicadas (ITECA), Universidad Nacional de San Martín (UNSAM), San Martín 1650, Argentina Corresponding Author Email: mabeledo@unsam.edu.ar https://doi.org/10.18280/isi.280502 Received: 19 June 2023 Revised: 7 October 2023 Accepted: 13 October 2023 Available online: 31 October 2023 Keywords: SDN, computer networks, software-defined networking, network management, software tools, network configuration scripting, configuration management ABSTRACT The advent of Software Defined Networking (SDN) has ushered in an era where the functions of interconnected devices are no longer constrained by their original design. Instead, these devices, now transformed into "general-purpose" nodes within the network, have roles that are defined by their configuration settings. Given that these configurations can be compiled into a computer file, software tools have been developed to consolidate and automate the administration of configuration parameters across all devices in an SDN network. These tools, akin to source code control tools used in programming languages, are capable of managing configurations for individual or groups of devices simultaneously. This study presents an evaluation of three such tools—Ansible, Puppet, and Chef—assessing their merits and demerits across various performance and usability dimensions, including configuration, installation, ease of use, and management capabilities. The comparative analysis reveals Ansible as a remarkably versatile tool, offering a wealth of advantages that make it a compelling choice for a majority of automation and configuration management tasks. 1. INTRODUCTION In the realm of OpenFlow-enabled Software-Defined Networking (SDN) [1, 2], changes to the network may be instantaneously implemented, yet often necessitate human approval and intervention. The average latency for tangible results to materialize from such modifications is approximately one to two weeks—a delay that poses significant management challenges in legacy systems, as exemplified by Voice over IP (VoIP) applications [3]. This predicament has stimulated the emergence of automation tools like Ansible [4], Puppet [5], and Chef [6]. Ansible, a free software tool, offers robust cross-platform automation capabilities. Primarily designed for IT professionals, it facilitates the deployment of applications, updating of workstations and servers, configuration of cloud resources, and management of software and hardware configurations [7]. With no dependency on agent software and no need for additional security infrastructure, Ansible provides a straightforward implementation process. Meanwhile, Puppet, a software tool, empowers its users to define infrastructure through code (SDN) and effectively manage multiple servers. It also enforces system settings and configurations. As a part of the DevOps [8, 9] platform, Puppet holds significant value for managing multiple servers [10]. Chef, an open-source cloud configuration management and deployment software, is devised to orchestrate servers in the cloud or within a departmental data center. It enables DevOps to rapidly instantiate any server as needed, obviating the need for separate management tools for each individual or standalone server [11]. This study undertakes a comprehensive comparison of these three tools, delineating their relative strengths and weaknesses. It includes simulation tests and analyses of their evolution over time. The evolution of simulation testing in Ansible, Puppet, and Chef has been largely driven by the need to cater to increasingly complex systems, diverse environments, and stricter security demands. These tools have progressively adopted more sophisticated techniques for automation, testing, and configuration validation-enhancing the reliability and efficiency of configuration automation solutions. While the tests for the current study are yet to be completed due to the diversity of proposed scenarios, the findings will be discussed in future work. The study concludes by detailing the factors that contribute to the prevailing acceptance of one tool over the others. 2. NETWORK ADMINISTRATION Network automation is the process of automating the configuration, management, testing, deployment, and operation of physical and virtual devices within a network. Network services can substantially be enhanced through automated tasks, functions, and repetitive processes. Any type of network can use this kind of automation. Implementing hardware and software-based network automation will improve efficiency, reduce human error, and lower operating expenses for data centers, service providers, and businesses operations. DevOps is a current cultural and technical trend in most companies focused on digital technologies. The purpose of DevOps is to eliminate the differences between the software developers and the operations that run on the infrastructure. Once this goal is achieved, the development, testing and deployment processes will be more frequently, reliable and faster. This leads a cultural change where teams will evolve from stand-alone to cross-functional. DevOps also leads a change in the security arena because rules and parameters of automated processes must be adapted to ensure quick and continuous releases to patch bugs or provide updates. DevOps tools also support cross-functional interoperability and automated workflows to enable multi-platform integration [12]. On the other hand, NetDevOps [13] takes the collaboration, tools and automation approaches and extends them to network architects and operators. NetDevOps (named by Cisco) or DevNetOps combine network engineers and their tools. Cisco, a leading provider of networking hardware, appears to be leading the NetDevOps shift from theory to practice with some of its customers. In other words, one of the main leaders in the networking market tries to move its clients to use of “infrastructure-as-code” and go towards automation and scripting, applying some of those ideas [14]. These are the foundations of the Cisco developer community, where members can learn all about theirs API [15] and how they can relate to a special kind of networks called intent-based networks [16]. In this way, companies consolidate networks operation in the DevOps culture and automation ensuring that their hardware is connected properly. Routers and switches will be programmed and configured through an API which will also manage security and provide the analytics capability according to DevOps principles and processes for networks. To implement changes in a test network and then move them into production networks in a consistent and secure way, CI/CD pipelines (Continuous Integration/Continuous Delivery) can store the network configurations as code in a source code control program. Although these changes are relatively new, service providers where the first to promote some of these NetDevOps transformations. In addition of this, many changes have emerged from the corporate IT areas where there is a greater need to automate and manage more and more network devices. Ansible, Puppet and Chef are widely used tools for network automation and DevOps implementation practices. These tools help streamline and simplify infrastructure and application management, enabling greater efficiency, reliability and scalability in development and operations environments. The relationship for each tool mentioned is detailed below: 1. Ansible is a central tool in DevOps practices, as it can be used to automate everything from infrastructure provisioning to application deployment and configuration management. Ansible playbooks allow infrastructure and applications to be defined and maintained as code, facilitating collaboration between development and operations teams. Ansible also integrates with CI/CD tools to enable automated deployments. 2. Puppet plays a key role in DevOps by enabling automated management and configuration of infrastructure and applications. It allows you to define the desired state of systems and ensure that it is maintained at all times. This facilitates consistent and reproducible application deployment, and also fosters collaboration across teams throughout the development and operational lifecycle. 3. Chef is very popular in DevOps environments because of its focus on infrastructure as code. Chef cookbooks allow you to define, maintain and version infrastructure and application configuration in a similar way to software source code. This facilitates collaboration, automation and continuous deployment, which are key pillars of DevOps. 3. NETDEVOPS IN COMPANIES In companies experimenting with NetDevOps, networking teams are focusing on establishing a culture and environment where creating, testing, and publishing changes to the network can happen more quickly, frequently, and reliably. Developers and operators working together are primarily interested in launching fast and stable releases. However, there is a lot of work to be done regarding communication between the network and the DevOps teams and their tools. But what are the benefits of NetDevOps? Given its roots in DevOps, it makes sense that NetDevOps adopts many of the same goals. "DevOps is described by four principles: a holistic system thinking approach (see the whole system, not just one part), no organisational silos, rapid feedback, and automation to reduce work," says Joel King, an independent network automation architect. Network operations has lagged behind other functional areas that support an organisation's IT infrastructure, King points out, especially when it comes to automation through network programmability. "To implement a new application or service that supports the business, compute, storage and network components require configuration changes or the implementation of new hardware," King explains. "Often these changes are made manually by an engineer typing in a terminal window, and they may need to be reviewed through a change control process and implemented during an off-hours time slot. NetDevOps "helps improve agility and is particularly valuable for organisations that deploy infrastructure as code, because the network is often a bottleneck," says Andrew Lerner, vice president of networking research at Gartner Inc (USA) "NetDevOps practices drive clear workflows and documentation, which helps with auditing, governance and troubleshooting” [17]. 4. THE NEED FOR NEW TOOLS Nowadays, this is an imperative, not only from the perspective of the management and operation of physical devices but also from the perspective of the analysis and control of network traffic. Manual or “human” verification will no longer work properly on current scenarios. Using a manual approach, for example, the number of bits in network traffic difficult to find specific binary flows in network connections. When we talk about network devices configuration, the CLI (Command-Line Interface) method is the most used to make changes to configurations. This method allows access to devices through the console port, the auxiliary port, or through Telnet or SSH. Once connected to the CLI, network technicians can make changes to device settings. However, the CLI method has several drawbacks. First, it offers the wrong level of abstraction by allowing human operators to operate the console without being able to validate that the proper procedures are being followed. Also, different vendors do not use a standard CLI language. CLI (Command Line Interface) method is a common way of interacting with computer systems and executing commands to perform tasks. Although it is widely used and has many advantages, it also has certain limitations. Some of these limitations include: Complexity of commands: Some commands can be complicated and have a syntax that is difficult to remember. This can lead to human error if commands are entered incorrectly. Learning curve: Learning to use a CLI effectively can take time, especially for novice or non-technical users. The need to memorise commands and their syntax can be challenging. Visualisation limitations: Command line interfaces often do not provide complete visual representations of information, which can make it difficult to understand certain data, especially in complex systems. Difficulty in automation: Automating tasks through the CLI can be complex, as it often requires the use of scripts or scripting to achieve this. This can be more difficult to maintain and less flexible than more robust automated solutions. Need for technical knowledge: Using the CLI generally requires a solid knowledge of the terminology and structure of the system or software in question. This may exclude non-technical users or those less familiar with the technology. Difficulty in graphical environments: Compared to graphical user interfaces (GUIs), CLIs may be less intuitive for some people, especially those who are more accustomed to visual interactions. Feedback limitations: Some CLIs may provide limited or insufficiently descriptive information about errors that occur, which can make troubleshooting difficult. Cross-platform incompatibility: Some CLI commands may be specific to certain platforms or operating systems, which may require adjustment if changing environments. Difficulty with complex tasks: Performing complex, multi-faceted tasks through the CLI can be more complicated and error-prone than doing so through a specially designed GUI. Industry reacted and introduced NETCONF [18]. NETCONF is the standard to install, modify and remove any configuration of network devices, while YANG [19] is used to model both the configuration and the status of the network elements. YANG organizes data definitions in tree structures and provides modeling features such as extensible types, separation of status and configuration data, handling of syntactic and semantic constraints, among others. These definitions are organized in modules that allow their extensibility and reuse. On the other hand, NETCONF has various constraints to use a same version on different vendor operating systems. Many of them use a proprietary version which makes it difficult to write NETCONF applications for use in multi-vendor networks. NETCONF was basically created to make automation easier, but the difficulties it presented made automation even more difficult. Also, old troubleshooting tools like Ping and Traceroute did not provide a holistic assessment of how the network is performing. For example, Traceroute has problems with unnumbered IP links; these types of links are best for automated network environments. On the other hand, Ping does not provide information about network performance. These tools were originally created for simpler environments. For this reason, the need arises to progress towards a vendor-independent solution that allows configuring the rules and policies of any network and being able to verify if they are aligned with what is expected of them, that is, their intention. The solution must be regardless of the number of devices, the operating system installed, the traffic rules and any other type of policy that should be configured. There is a need for the networks to be automated and predictable. The existing tools did not add value. A new model is required to trace all traffic and device interactions, not just at the device level, but at the entire network level. 5. NETWORK AUTOMATION TOOLS As we have mentioned, network automation is the process of setting up software to automatically manage, configure, test, deploy, and operate network devices (whether physical or virtual). For this reason, SDN networks will make it possible to implement in a much simpler way the automation before described and network automation tools will be the key. These tools discover and map all connected devices, manage different network configuration, provide resources, and allow to plan their network capacity. The automation of the network can be implemented through script languages (lines of code of a programming language that will be executed on a trigger event) or based on software (conventional languages with source code that must be interpreted or compiled for use). The last ones are also known as smart network automation tools. Software-based tools will be discussed below as they can almost eliminate the performance of manual tasks. The following is a summary analysis of each tool, its advantages and disadvantages: (1) Ansible: 1) Advantages: - Ease of use: Ansible uses a simple, readable YAML-based syntax, making it easier to learn and use for those new to configuration automation. - No agents required: Ansible operates over SSH or WinRM, which means there is no need to install agents on managed nodes, simplifying the deployment and administration process. - Dry-run mode: Ansible allows you to simulate changes before applying them, which helps prevent errors. - Cross-platform support: It can manage operating systems and devices from different platforms, including Linux, Windows and network devices. - Extensive community and documentation: Ansible has an active community and a wealth of online resources available. 2) Disadvantages: - Scalability: While Ansible can handle large deployments, it can face performance issues compared to more scalability-oriented tools. - Runtime: Ansible can be slower compared to other tools in large-scale deployments due to its SSH-based execution model. (2) Puppet: 1) Advantages: - Resource management model: Puppet uses a declarative model to manage resources, allowing you to define the desired state and Puppet takes care of enforcing it. - Broad ecosystem: Puppet has a large number of predefined modules that make it easy to configure and manage various components. - Long-term management: Puppet is suitable for environments that require long-term configuration management and constant maintenance of the desired state. - Role and profile management: Puppet allows a clear separation between role definition, profiles and node-specific configuration. 2) Disadvantages: Learning curve: Puppet can be more complex for beginners to learn due to its terminology and structure. Requires agents: Managed nodes must have a Puppet agent installed, which can increase complexity and maintenance requirements. (3) Chef: 1) Advantages: Infrastructure as code: Chef allows infrastructure to be defined as code, which facilitates automation and consistent deployment. Flexibility: Chef is highly configurable and adapts well to diverse environments and use cases. Large community: Chef has an active community and a variety of resources available online. 2) Disadvantages: Learning curve: Chef can be complex to learn for beginners due to its terminology and approach. Requires agents: Like Puppet, Chef requires agents installed on managed nodes, which can add complexity and maintenance requirements. More initial configuration: Chef may require more initial configuration compared to other tools. 6. ANSIBLE TOOL This tool is designed for multi-tier deployments [20], modeling the interrelationship of all IT systems across the infrastructure rather than just managing one system at a time. It does not use agents or additional custom security scheme, so it is easy to implement. Most importantly, it uses a quite simple language (YAML, in the form of Ansible Playbooks) that enables automation tasks to be described in an almost plain English. Ansible connects to your nodes and distributes small programs called "Ansible modules". Ansible then runs these modules using SSH [21] by default and removes them when done. Your module library can reside on any machine and no servers, daemons, or databases are required. Generally, it will work with the user's favorite programs such as remote terminal access, text editor and a version control system for tracking changes. Ansible supports passwords, and the best way to use it is via SSH keys with the SSH-agent as shown in Figure 1. Any user can log in, it does not have to be root. Then the user can use the SU or SUDO commands without problems. Ansible's "authorized key" [22] module is a great way to use it to control which machines can access which hosts. Through Ansible, multiple inventories can be configured statically or dynamically, composed of hosts, groups of hosts and groups of groups, host variables, group variables, non-SSH connections and many more. This parameterization is stored in a text file as shown in Figure 2. To add new hosts to the network, it is not necessary an additional server to generate the SSH keys, with Ansible it will be possible to generate these keys on each host. As shown in Figure 3, all components of the infrastructure topology can be orchestrated precisely with Ansible playbooks [24]; it will allow a detailed control over how many nodes can be tackle at once. 7. PUPPET TOOL Puppet is an open-source software tool for the deployment and management of network configurations. It is most used in Linux and Windows to move configurations to multiple application servers at the same time. Puppet can also be used on various platforms, including IBM mainframes, Cisco switches, and Mac OS servers. Like other DevOps applications, Puppet does more than just automate system administration. It changes the human workflow and allows developers and sysadmins to work together. Developers can write, test, and launch applications without waiting for Operations staff to provide the necessary resources. Puppet is available in both open source and commercial versions. It has its own language called the eponymous Puppet [25]. Puppet automates configuration changes and removes manual script-based changes. However, Puppet is not just another shell language like PowerShell for Windows or Unix, or Linux Bash shells. Also, Puppet is not a pure programming language like PHP. Puppet uses a declarative, model-based approach to automation of the IT infrastructure. This allows Puppet to define the infrastructure through lines of code and to enforce the system configuration through specific applications. 7.1 Puppet modeling capabilities Puppet identifies the current state of a node, defines the model of the desired end state, and describes the actions required to move from one to the other. Each server instance managed by Puppet receives a catalog of resources and relationships with its current state, compares it to the desired state, and then defines and makes the necessary changes for the system to meet that desired state. Puppet will be able to manage the software and its services by creating the complete configurations through lines of code. Puppet encourages users to control the different levels of complexity of the settings. Users will be able to write code that is reusable, easy to configure, understand and refactor. To achieve this, Puppet uses profiles and roles. The code can be separated into the following three levels: 1. Component modules: They manage each technology, such as puppetlabs-apache [26]. 2. Profiles [27]: Container classes that use multiple component modules to configure a layered stack of technologies. For example, you can create a profile to configure Jenkins, the integration application, its web interface, and automated tasks. 3. Roles [27]: Container classes that use multiple profiles to build a complete system configuration. For example, a server will have standard profiles, such as "base operating system profile" and "base web server profile". The first one could declare that the server must run Ubuntu 16.04.2, while the other would declare that it must use NGINX [28]. All this stuff (tools, languages, profiles, roles, processes, etc.) can seem to add additional complexity. In fact, it provides the flexibility and potential to create practical and specific interfaces to automate the configurations of each system within an organization. This will make, for example, hierarchical data easier to use, system configurations easier to read, and refactoring easier to perform as shown in Figure 4. Ansible and Puppet are two popular configuration management tools, and the choice between them depends on several factors. How Puppet Works? Easy of use and quick learning: Ansible tends to have a smoother learning curve than Puppet. It doesn't require agents: Ansible operates over SSH or WinRM and does not require the installation of agents on managed nodes. This simplifies the deployment and administration process, which can be an advantage if you want to avoid the effort of maintaining agents on all systems. Ad hoc task automation: Ansible is particularly effective for automating one-off and ad hoc tasks. Ansible makes it easy to run commands on multiple servers on an occasional basis or to perform specific tasks without complex configuration. Focus on simplicity: Ansible uses YAML to define configurations and tasks, which can be more intuitive for those familiar with markup languages or text-based configuration. Application deployment and orchestration: Ansible can be a solid choice because of its focus on infrastructure as code and its ability to work with a variety of platforms. Smaller or medium-sized deployments: Ansible may be better suited for medium-sized or smaller deployments, where simplicity and flexibility may outweigh the scalability and complexity needs that Puppet could better handle. On the other hand, the choice between Puppet and Ansible depends on a number of factors, and there are situations where Puppet might be preferable over Ansible. Here are some considerations for deciding when it's better to use Puppet over Ansible: Long-term management and constant maintenance: Puppet is especially well-suited for environments that require long-term configuration management and constant maintenance of the desired state. If you are looking for a tool that is effective at maintaining configuration consistency over time and ensuring that systems comply with policies on an ongoing basis, Puppet could be a solid choice. Role and profile management: Puppet is known for its role and profile management approach. If you want to clearly and structurally define the configuration of different types of systems (roles) and node-specific customisations (profiles), Puppet offers a robust approach to achieve this. Complex configurations and multiple states: If the infrastructure is large and complex with multiple states and node-specific configurations, Puppet may be preferable. Its declarative model allows you to define the desired state and Puppet takes care of applying it consistently across all nodes. 8. CHEF TOOL Chef converts and models "cloud configuration management" in lines of code through a flexible and versatile process which is human-readable and easily verifiable. Infrastructure-as-code enables both the management of local and cloud resources. Chef is also a framework for automating and managing infrastructure and applications. Specifically, Chef translates system administration tasks into reusable definitions, known as cookbooks and recipes. In a recipe, Chef's authors define the desired state of a system by writing its configuration in lines of code. Chef then processes that setting along with data about the specific node where the code is running to ensure that the desired state matches the final state of the system. 8.1 Chef automation Automation makes the process much more scalable. With Chef, you simply clone your existing platform into a test platform. You do not need to configure servers or clusters manually. Your test platform can be the public cloud, the same used for the production environment. The entire setup process can take minutes instead of hours, days, or weeks. The following is an implementation of the Chef tool. In this example, if a new website configuration does not work, it does not need to be manually reconfigured. Chef is used to automatically revert to the previous version of the application code in the production environment and for all users. In Figure 5 we present a screen capture of the Chef tool [29]. Figure 6 shows an Oracle VirtualBox screen capture on workstation side. Chef also allows cloud deployments quite easy. An example of this can be the implementation of NGINX to analyze the performance of an Apache web server. This will be done using the NGINX cookbook [30] for Linux servers. You do not need to become a NGINX expert. You just need to implement NGINX on a test server, transfer the web programs using Chef's Recipes [31], and start making comparisons. (1) Listed below are reasons to use Ansible instead of Chef: Simplicity and speed of deployment: Ansible is known for its ease of use and smoother learning curve. If you need to deploy an automation solution quickly or if you have a team that is new to configuration automation, Ansible may be a better choice. (2) Reasons to use Puppet instead of Chef are also listed below: Ad hoc task automation: Ansible shines at automating one-off, ad hoc tasks, such as running commands on multiple servers or performing specific tasks without complex configuration. If you're looking for a solution for quick administration tasks, Ansible is a solid choice. No agents required: Ansible operates without the need to install agents on your systems. If you prefer to avoid installing and maintaining agents on your systems, Ansible is an attractive option. Long-term management-Puppet is suitable for environments that require long-term configuration management and consistent maintenance of the desired state. If you're looking for a tool that is effective at maintaining configuration consistency over time, Puppet may be more appropriate. Role and profile management: Puppet excels at defining roles, profiles, and node-specific configuration. If you want to clearly separate configuration logic from node-specific details, Puppet may be more appropriate. Large-scale infrastructure: If you have a large and complex infrastructure, Puppet may be more scalable and effective for managing the configuration of multiple large-scale systems. To conclude with Chef's analysis, the following are real-world scenarios for the use of Chef: Simplicity and speed of deployment: Ansible is known for its ease of use and smoother learning curve. If you need to deploy an automation solution quickly or if you have a team that is new to configuration automation, Ansible may be a better choice. Ad hoc task automation: Ansible shines at automating one-off, ad hoc tasks, such as running commands on multiple servers or performing specific tasks without complex configuration. If you're looking for a solution for quick administration tasks, Ansible is a solid choice. No agents required: Ansible operates without the need to install agents on managed nodes. If you prefer to avoid installing and maintaining agents on your systems, Ansible is an attractive option. 9. CONCLUSIONS In simple terms, the tools described above provide an abstraction layer between the existing configuration of a server and its desired state. Optimum configuration state for this network devices will be achieved by focusing more on the desired result than on the detailed tasks required to achieve it. In this review we can see that Ansible has several advantages over the other tools since it is more oriented to SysOps due to its structure and paradigm. Instead, Puppet and Chef are focused on developers. Ansible is the easiest option to configure and then you would be starting to use it immediately. The tool has a detailed and structured documentation. As we can see, the Ansible has gained popularity because it is oriented to uniform infrastructure and there are several add-on components available to improve its user interface capabilities and functionality. There is a huge group of administrators who have chosen it as a configuration management tool among the other competitors mentioned hereto. Puppet is a reliable tool with particularly good usability. Taking full advantage of its wide range of features, structure, and scalability requires some practical knowledge of Ruby. Puppet setup maybe much detailed and sometimes complicated, but it is the safest choice if you are looking for a homogeneous software environment. The Puppet user will need to learn new procedures and functions to program the tool. Table 1. SDN automation configuration tools comparison <table> <thead> <tr> <th>Item/Tool</th> <th>ANSIBLE</th> <th>PUPPET</th> <th>CHEF</th> </tr> </thead> <tbody> <tr> <td>Language</td> <td>Python, YAML</td> <td>Ruby, Puppet DSL, Embedded Ruby (ERB), DSL</td> <td>Chef DSL Ruby</td> </tr> <tr> <td>Usage</td> <td>Easy</td> <td>Complex</td> <td>Complex</td> </tr> <tr> <td>Architecture</td> <td>Only master (Agentless)</td> <td>Master-Agent</td> <td>Master-Agent</td> </tr> <tr> <td>Installation / Setup</td> <td>Easy</td> <td>Complex</td> <td>Complex</td> </tr> <tr> <td>Configuration</td> <td>Only Pull</td> <td>Only Pull</td> <td>Both Push and Pull</td> </tr> <tr> <td>Management</td> <td>Easy (push model)</td> <td>Complex (master-agent)</td> <td>Complex (Chef server – Managed systems)</td> </tr> </tbody> </table> Chef is a simple, well-designed tool and much more usable than Puppet. It has a demanding learning curve for SysOps who lack experience in application development and coding as it requires a broader knowledge of programming languages and more experience. In general, all three tools are expected to continue to be part of the automation and configuration management landscape. However, the choice of which one to use will depend on the specific needs and goals of each particular organisation, as well as how each tool fits with emerging trends in technology and DevOps practices. In Table 1 we expose a comparison of main characteristic of each tool. REFERENCES NOMENCLATURE CLI Command Line Interface DevOps DevOps Methodology DSL Domain-Specific Language ERB Embedded Ruby GNS3 Graphical Network Simulator 3 application software. GUI Graphical User Interface IBM International Business Machines Corporation IT Information Technology Mac OS Apple Computer’s Macintosh Operating System NETCONF Network Configuration Protocol NetDevOps Networking operations using DevOp tools NGINX Web server application PFP Hypertext Scripting Preprocessor SDN Software Developed Networks SSH Secure Shell Protocol SU Linux command SUDO Linux command SysOps System Operator VM Oracle Corporation’s Virtual Machine software VirtualBox VoIP Voice over Internet Protocol WinRM Windows Remote Management WS Workstation YAML Configuration language YANG Data Modeling language
{"Source-Url": "https://iieta.org/download/file/fid/112081", "len_cl100k_base": 6723, "olmocr-version": "0.1.49", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 27531, "total-output-tokens": 9735, "length": "2e12", "weborganizer": {"__label__adult": 0.0002498626708984375, "__label__art_design": 0.0003113746643066406, "__label__crime_law": 0.0002104043960571289, "__label__education_jobs": 0.0008573532104492188, "__label__entertainment": 0.00013136863708496094, "__label__fashion_beauty": 0.00012230873107910156, "__label__finance_business": 0.0005464553833007812, "__label__food_dining": 0.00024187564849853516, "__label__games": 0.000583648681640625, "__label__hardware": 0.002407073974609375, "__label__health": 0.0002567768096923828, "__label__history": 0.00022542476654052737, "__label__home_hobbies": 0.00010383129119873048, "__label__industrial": 0.00038051605224609375, "__label__literature": 0.00021016597747802737, "__label__politics": 0.00018215179443359375, "__label__religion": 0.00031113624572753906, "__label__science_tech": 0.055450439453125, "__label__social_life": 0.00011098384857177734, "__label__software": 0.146728515625, "__label__software_dev": 0.78955078125, "__label__sports_fitness": 0.0001685619354248047, "__label__transportation": 0.00028824806213378906, "__label__travel": 0.0001895427703857422}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 41694, 0.03145]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 41694, 0.29409]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 41694, 0.89087]], "google_gemma-3-12b-it_contains_pii": [[0, 5241, false], [5241, 11889, null], [11889, 18445, null], [18445, 21292, null], [21292, 26800, null], [26800, 31480, null], [31480, 37380, null], [37380, 41694, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5241, true], [5241, 11889, null], [11889, 18445, null], [18445, 21292, null], [21292, 26800, null], [26800, 31480, null], [31480, 37380, null], [37380, 41694, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 41694, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 41694, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 41694, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 41694, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 41694, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 41694, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 41694, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 41694, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 41694, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 41694, null]], "pdf_page_numbers": [[0, 5241, 1], [5241, 11889, 2], [11889, 18445, 3], [18445, 21292, 4], [21292, 26800, 5], [26800, 31480, 6], [31480, 37380, 7], [37380, 41694, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 41694, 0.03687]]}
olmocr_science_pdfs
2024-11-24
2024-11-24
b3b380618628a5836f11b12e0bba3fb7fb367b17
Developing RDF-based Web Services for Supporting Runtime Matchmaking and Invocation Hong Qing Yu, Dong Liu, Stefan Dietze and John Domingue Knowledge Media Institute The Open University Milton Keynes, United Kingdom Abstract—In our previous research, we proposed an Autonomous Matchmaking Web Services (AMWS) framework, in which Web services broker themselves to notify the service registry whether they are suitable to the service requests. This framework is designated to more efficiently work for dynamically assembling services at runtime in a massively distributed environment. The central point of the AMWS is to use RDF (Resource Description Framework) to carry all exchanging messages. However, the implementation detail has not been discussed yet. In this paper, we focus on showing the two most important implementation parts of (1) transforming existing services to become AMWS compliant services that can consume and produce RDF messages; (2) service semantics can be annotated and self-brokered by using our developed Development Time Semantic Annotation and Lowering (DTSAL) Library at programming time. Keywords: Web services, Autonomous Matchmaking, Semantic Web, Semantic Web Services, RDF. I. INTRODUCTION Automatic service discovery, selection, orchestration and invocation are the main research topics in the fields of service oriented computing. The majority of research efforts towards service automation is based on Semantic Web Services and targets the issues at the semi-automatic level, in which each individual task (e.g. discovery, selection, orchestration and invocation) is completed automatically by machines but human coordinates the whole service consumption lifecycle. Figure 1 shows the common process of development lifecycle based on current ideas of Semantic Web Services. Services are annotated with semantics that are stored in the service semantic repository. When service users want to consume services, they usually first discover services through a semantic broker, then invoke the corresponding services. The work at the semi-automatic level can be further divided into two categories A and B (see Figure 2). Category A fully trusts and depends on the Web service broker. In this way, the client is thin by just sending service specification and waiting for the expected response. The broker is a fat by taking care of all the dynamic activities. The main research contributions in this category are WSMX architecture [1] (e.g. IRS-III [2]) and OWL-S [12] based architectures (e.g. service composition application [4] based on planning algorithms). However, to be able to use these architectures, the user has to understand the data model of the services that registered in the broker and the complicated OWL or WSMO ontologies in order to invoke the discovered services and represent the output data correctly. Due to these prerequisites, all proposed orchestration managers are pre-defined static orchestration rather than runtime configurable. Category B uses registration style to dynamically discover suitable services but leave other dynamic activities to the client side. In this way, client side can control service orchestration or select business strategy. The most recent contribution is Linked Services Concept [18] that uses Linked Data [13] principles to publish service semantics in to the Linked Data cloud. ![Figure 1. The Current Semantic Web Service architecture.](image1) ![Figure 2. Two categories of semi-automatic approaches.](image2) Application [15] and [19] are developed based on Linked Services. Semi-automation benefits to system development at design time, but it is not suitable for runtime environment in which system context changes dynamically. Furthermore, the following two issues have to be addressed in order to achieve service consumption at full-automatic level, in which the whole service consumption process lifecycle is automatically completed by machines without any human interactions. - **Hidden data representation model** which causes the problem of sharing the common understanding of the service input and output data representations. The major reason is the contradictions between semantic description/annotation and non-semantic Web service implementation. First of all, all current service description languages focus on describing service interface rather than services themselves [26]. Secondly, no matter how services are semantically described or annotated, the underlying service invocation and response messages are still based on non-semantic invocation messages, such as SOAP [8], XML or Json¹. Therefore, manually setting up the invocation message to map the parameters is unavoidable [22]. - **Out-of-date semantics** which leads the invocation faults. Current Semantic Web Service standards require service providers or users to register service semantics once service is implemented or used to a third party controlled service repository. However, the changes of service cannot be automatically reflected, especially for users who registered the service semantics but cannot know any changes on service side. The main conceptual frameworks and specifications for semantically describing services (e.g. WSMO, OWL-S and SAWSDL which derive from WSDL-S [16]) are very comprehensive. Most SWS initiatives were built upon the enrichment of SOAP-based Web services to have semantics. Although some tools have been developed to foster to use these standards such as WSMO studio [20], these comprehensive semantic standards are too heavy to only show interface semantics of the service and still not describing the important part of the service – data representation model. It is only most recently that lightweight services (e.g. Web APIs and RESTful services) and service annotations have been researched. The main results of these recent studies are SA-REST [16], hRESTs [25], WSMO-Lite [14], MicroWSMO [17] and MSM (Minimal Service Model) [21]. These standards are easily to be understood and adopted. However, current processes to use these lightweight semantics are still focusing on service annotations for implementing a big middle broker layer rather than thinking of adding semantic values directly to services themselves (e.g. iServe platform [21]). Therefore, the issues of runtime service invocation and out of date semantics are still remaining. An Autonomous Matchmaking Web Services (AMWS) framework proposed in our previous work [9] aims to tackle the above issues and introduces a semantic message (RDF) based Web Service standard. In this paper, we move one step forward to discuss how semantic message based autonomous matchmaking Web services can be implemented. A development-time semantic annotation and lowering library is implemented to minimize the out-of-date semantics. The remainder of this paper is organized into four sections. Section II plains the background and our motivation. Section III introduces the details of the service development. Section IV discusses the related work. Section V draws a conclusion and discusses our future research directions. II. OVERVIEW OF THE AUTONOMOUS MATCHMAKING WEB SERVICE FRAMEWORK Our initial work [9] has introduced the fundamental concepts of the Autonomous Matchmaking Web Service (AMWS) framework (see Figure 3). Comparing to traditional Semantic Web Services approach, there are two key changes: - using RDF-based semantic message exchanging protocols rather than syntax-based message protocols (e.g. SOAP); and - introducing semantic query endpoint for the service. The invocation endpoint is as same as normal service invocation endpoint but only consumes and produces RDF messages. The semantic query endpoint takes RDF service request message as inputs and responses to the user by dynamically checking whether its own semantics satisfies the request. In this way, service registry only charges to broadcast the service requests in the suitable service category and let services themselves to decide if they are the matched services. ![Figure 3. Autonomous Matchmaking Web Service Framework](image) The AMWS framework brings at least two benefits for service-oriented computing. - **Facilitating the full-automation of the service consumption process**: all information and communication messages are semantically understandable by using unified RDF data structure and LOD semantics. As result, the data structure and semantics are known at the same time, which is a fundamental requirement to enable services to be automatically assembled and invoked. • Balancing workload among services, requester and registry: each part of the three takes their own responsibilities to efficiently finish the service consumption life-cycle. Therefore, the AMWS framework is suitable for the large scale distributed applications. However, current Web services standards are not support the semantic query endpoint and only have invocation endpoint. Therefore, converting existing services to enable implementing Autonomous Matchmaking Web Service Framework is the core challenge. The following section will give details of our current approach to transforming existing web services to the AMWS-compliant services. III. IMPLEMENTING AMWS-COMPLIANT WEB SERVICES This paper focuses on transforming existing services to become Semantic-MESSAGE-based Web services. There are following three key steps. (1) Transforming communication protocol to RDF: this is done by wrapping the existing Web service functions to have only one input parameter that is a RDF message string and only one output parameter that is a RDF message string too (see Subsection A for details). (2) Semantic annotating services while developing: Unlike Semantic Web Service technology, our annotation work is added while developers is wrapping the function or developing a new function. Therefore, the published semantics keeps with the latest updated functional information (see Subsection B for details). (3) Developing an extra function to be invoked as the semantic query endpoint: this function implements service matchmaking algorithms and determines whether the service is matched for the request (see Subsection C for details). A. An illustration example: Wrapping DBpedia Web service We use the DBpedia SPARQL query RESTful service as an illustration example to show the wrapping process. The detailed service information is listed in Table I. <table> <thead> <tr> <th>Service properties</th> <th>Property values</th> </tr> </thead> <tbody> <tr> <td>Endpoint</td> <td><a href="http://dbpedia.org/sparql">http://dbpedia.org/sparql</a></td> </tr> <tr> <td>HTTP method</td> <td>GET</td> </tr> <tr> <td>Parameters</td> <td></td> </tr> <tr> <td>format</td> <td>rdf/xml, text</td> </tr> <tr> <td>query</td> <td>Your sparql</td> </tr> <tr> <td>debug</td> <td>on, off</td> </tr> <tr> <td>timeout</td> <td>time duration (e.g. 30seconds)</td> </tr> </tbody> </table> Figure 4 shows one instance of the RDF input message based on the defined RDF schema. It contains all the corresponding parameters for lowering. Figure 5 shows the lowering technique used to translate the DBpedia SPARQL query function call from RDF request to the actual service request. HTTP GET method is used to invoke the function. The RDFInputPaser is a key function from DiSAL (see subsection B) for lowering input RDF message based on a SPARQL statement. The fixed parameter value format="rdf/xml" is used to create response in RDF format. Other parameter values are defined by parsing the input RDF message. After the service call, the results from the response are translated back to RDF format. ```xml <rdf:RDF> <dbpedia:Query rdf:ID="query"> <dbpedia:default-graph-url> http://dbpedia.org/ </dbpedia:default-graph-url> <dbpedia:query> Select * Where {p a <dbpedia:Person>} LIMIT 10 </dbpedia:query> <dbpedia:debug off/> <dbpedia:timeout>30</dbpedia:timeout> </dbpedia:Query> </rdf:RDF> ``` Figure 4. An example RDF input for the wrapped DBpedia service ```java public String searchDBpedia(String RDFInputMessage){ String RDFResponse = null; String sparqlQuery = "Select ?query ?debug ?timeout Where..."; String endpoint = "http://dbpedia.org/sparql"; RDFInputParser rdf = new RDFInputParser(); HashMap<String, String> parameterIndividual = rdf.parseInputRDFInputMessage(sparqlQuery); String query = parameterIndividual.get("query"); String debug = parameterIndividual.get("debug"); String time = parameterIndividual.get("time"); HttpClient client = new HttpClient(); GetMethod method = new GetMethod(endpoint); method.setQueryString(new NameValuePair[] { new NameValuePair("format", "rdf/xml"), new NameValuePair("query", query), new NameValuePair("debug", debug), new NameValuePair("time", time) }); try { client.executeMethod(method); RDFResponse = method.getResponseBodyString(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return RDFResponse; } ``` Figure 5. Wrapping the DBpedia service to RDF-based AMWS. B. Development-time Semantic Annotation and Lowering Library To address the out-of-date semantic usages issue, we propose to add semantic annotations inside the code while developing or modifying service functions. To achieve this, we develop a Development-time Semantic Annotation and --- 2 http://wiki.dbpedia.org/OnlineAccess Lowering (DiSAL) Java Library, whose implementation structure is shown in Figure 6. The DiSAL uses openRDF\(^3\) and RDF2Go\(^4\) Java library to create RDF statements. A set of service description ontologies is applied to enable developer to choose differently according to the type of wrapped service (e.g. SOAP or RESTful). In the current implementation, the service description ontologies include hRESTs, WSMO-lite, micro-WSMO and MSM. Moreover, DiSAL supports to lower the RDF document by giving a SPARQL query. The lowering function foster to both Semantic Message based Web services wrapping and new development processes. Figure 6. Implementation structure of the DiSAL Java Library Figure 7. illustrates the annotation code for the DBpedia SPARQL query RESTful service. The annotation mainly includes four parts: (1) constructing the namespace, service name, operation name, and invocation endpoint; (2) categorising service; (3) declaring HTTP invocation method; (4) defining input parameters and their model-references; (5) defining output parameters and their model-references. Figure 7. An hRESTs service annotation example C. Adding Extra Functions to Support AMWS Framework By using DiSAL library, each wrapped service has its semantic to be computed in order to check whether the service can do the job according to the RDF based semantic service request message. Therefore, an extra function (semantic check endpoint) should be added to the service for answer the YES/NO to the registry by parsing the RDF request semantics and comparing to its own semantics if the service tries to support AMWS framework (see Figure 2). The response message of the semantic query endpoint follows AMWS Confirmation Response Message (CRM) standard that is represented in Figure 9. The CRM is composed by two parts of yes/no confirmation and runtime service invocation information. Figure 8 shows the DBpedia SPARQL query RESTful service annotation RDF result using hRESTs. Firstly, sparqlQuery function is defined as an hrests:Operation of the DBpediaSparql (see F.2). Thirdly, the sparqlQuery function is categorized as knowledge that is sub-class of information (see F.3). Fourthly, hrests:Operations have been described including invocation method (hrests:hasMethod), invocation endpoint (hrests:hasAddress), output message (hrests:hasOutputMessage) and input message (hrests:hasInputMessage) (see F.4). Finally, all the hrests:modelReference are added to specify more accurate and specific semantic to the required domain. For instance, two model references can be used to tell that the input message includes an optional debug parameter (see F.5). Figure 8. A service RDF annotation example Figure 9. CRM ontology that is introduced in AMWS framework. We implement an example of the semantic query function by using RDF2Go to parse the request semantics and checking the service semantic capability. The checking workflow is illustrated in Figure 10. The matching algorithm used in the last step of the semantic query workflow is --- \(^3\) http://www.opendata.org/ \(^4\) http://semanticweb.org/wiki/RDF2Go (1) Category is matched, if a request category term in the reference ontology is equal to or is the super-class of the service category annotation referenced term. (2) Input is matched, if request input message terms in the reference ontologies are equal to or are the sub-class of the service input message annotation referenced terms. (3) Output is matched, if request output message terms in the reference ontologies are equal to or super class of the service output message annotation referenced terms. (4) Method is matched, if a request method message term in the reference ontology is equal to the service method annotation referenced term. (5) Service should send “Yes” when all previous four conditions are matched. Otherwise, “No” will be sent. Since different kinds of services have heterogeneous business logics and concerns, the implementation of the semantic checking workflow and matchmaking workflow should be heterogeneously designed for their own purposes. Therefore, the checking workflow and algorithm illustrated here only show a possible example of the semantic checking implementation. With both service invocation endpoint and semantic checking endpoint, the example of DBpediaSparql service is compliant to the AMWS framework to enable to be asked in broadcast way and invoked via RDF based invocation messages. IV. RELATED WORK The Linked Services [21] and Linked Open Services (LOS) [22] approaches both use Linked Data theory as their technical foundations and agree that service should communicate using RDF for supporting automatic web service consumption life cycle. The Linked Services approach focuses on annotating and publishing existing Web services semantics to the Linked Data cloud in order to discovery services using Linked Data theory. Based on Linked Service proposal, service annotation model (e.g. MSM), service annotation tools (e.g. Sweet [23] and SmartLink [24]) and semantic description repository (e.g. iServe) have been developed. Although, a preliminary service invocation engine has been developed to use the semantic data of the published services, it is still working on dynamic service invocation level because it is very handful to setting up the invocation RDF to match exactly the service invocation lowering annotations. Moreover, two more issues remains: (1) the underlying services are not added semantic values to themselves as the semantics are stored in third party repository that need to be manually updated when changing takes place; (2) centralised service semantic repository leads to service discovery and invocation are also through the centralised environment, therefore, scalability issue cannot be resolved easily. The LOS approach focuses on wrapping existing RESTful services or SPARQL endpoints to manipulate services that can consume and produce RDF messages by using SPARQL language such as Ask or Construct to support dynamic lowering and composition. Therefore, LOS service semantic model mainly described SPARQL graph pattern of input and output. As far as our best knowledge, LOS does not support to publish service semantics and dynamic service discovery methodology. Moreover, LOS again only supports dynamic service invocation rather than automatic because, the service users need to know the lowering schema first in order to enable LOS understand their RDF invocation requests. V. CONCLUSION AND FUTURE WORK In our previous research work, AMWS framework is proposed to fully use Semantic Web technology to exchanging messages between Web service communication protocols. The advantages of AMWS are fully supporting automatic service discovery and invocation at runtime. However, the feasibility and implementation details have not been investigated. In this paper, we introduce an implementation process to wrap existing Web services (DBpedia SPARQL query RESTful service in our case) to become an AMWS framework compliant semantic message based Web service. The wrapping process includes (1) reengineering Web service to enable receiving and sending RDF semantic input and output messages; (2) annotating services on Development Time using DiSAL library and (3) developing and adding the service semantic checking function to the service. To fully support the whole working process to the AMWS framework, many researches and implementations are remained. We list three priorities in below: - investigating the optimization algorithm to deal with the service selection issue caused by broadcasting discovery methodology. - developing an automatic mediation engine to mediate different service annotation referenced terms from different annotation ontologies. One possible way is to enrich the Service Searching Message (SSM) with the medication results. • developing different DiTSAL libraries to different kinds of current Web service programming language (e.g. C#). ACKNOWLEDGMENT The authors thank to EU funded Multi-type Content Repurposing and Sharing in Medical Education (mEucator) ECP2008EUD/418006 project for supporting this work. REFERENCES
{"Source-Url": "http://oro.open.ac.uk/30059/5/camera-ready.pdf", "len_cl100k_base": 4312, "olmocr-version": "0.1.50", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 20407, "total-output-tokens": 6454, "length": "2e12", "weborganizer": {"__label__adult": 0.00030612945556640625, "__label__art_design": 0.00026106834411621094, "__label__crime_law": 0.00031566619873046875, "__label__education_jobs": 0.0004546642303466797, "__label__entertainment": 6.663799285888672e-05, "__label__fashion_beauty": 0.00014388561248779297, "__label__finance_business": 0.000247955322265625, "__label__food_dining": 0.0003364086151123047, "__label__games": 0.00032973289489746094, "__label__hardware": 0.0007190704345703125, "__label__health": 0.0005469322204589844, "__label__history": 0.0002315044403076172, "__label__home_hobbies": 6.318092346191406e-05, "__label__industrial": 0.0003082752227783203, "__label__literature": 0.00028705596923828125, "__label__politics": 0.0002624988555908203, "__label__religion": 0.0004367828369140625, "__label__science_tech": 0.029052734375, "__label__social_life": 9.85264778137207e-05, "__label__software": 0.0098876953125, "__label__software_dev": 0.95458984375, "__label__sports_fitness": 0.00023245811462402344, "__label__transportation": 0.0004606246948242187, "__label__travel": 0.0002111196517944336}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27031, 0.01501]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27031, 0.13628]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27031, 0.82574]], "google_gemma-3-12b-it_contains_pii": [[0, 3513, false], [3513, 8615, null], [8615, 13556, null], [13556, 16683, null], [16683, 21440, null], [21440, 27031, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3513, true], [3513, 8615, null], [8615, 13556, null], [13556, 16683, null], [16683, 21440, null], [21440, 27031, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 27031, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27031, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27031, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27031, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27031, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27031, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27031, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27031, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27031, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27031, null]], "pdf_page_numbers": [[0, 3513, 1], [3513, 8615, 2], [8615, 13556, 3], [13556, 16683, 4], [16683, 21440, 5], [21440, 27031, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27031, 0.05696]]}
olmocr_science_pdfs
2024-12-01
2024-12-01
4e2894f270e1fe26598c9aa0a3f85ab015688b35
Functional Requirements for the Migration to Fedora 3.0 The 5.0 release of the RUcore repository software will not include new functionality, but will include major changes to the infrastructure of the repository. There are two main goals in this release: 1) to migrate the repository objects with current functionality from Fedora 2.1 to Fedora 3.0, and 2) to prepare the infrastructure to support the enhanced functionality expected in 5.1 and later releases. 1. Migration to Fedora 3.0 1.1 Content Model Architecture Fedora’s 3.x release itself involves some major changes to its current infrastructure. Chief among these is the use of the so called Content Model Architecture (CMA), the most immediate affect of which is to replace the disseminator architecture used in earlier releases of Fedora. Repository operations and behaviors are now attached to objects at the content model level. Where earlier versions of Fedora recognized three types of object: ordinary data objects, behavioral definition objects (BDef), and behavior mechanism objects (BMech), Fedora 3 recognizes a fourth type, content model (CModel) objects. The relations of these different types of object are now to be expressed as RDF statements in RELS-EXT Datastreams (e.g. “fedora-model:hasModel” for data objects, “fedora-model:hasSDef” for CModel objects, and “fedora-model:isContractor” for SDep or Service Deployment objects). All objects will now be associated with a content model, though as with the “default disseminator” of earlier versions, there could be a transparent default content model for simple objects that do not require special dissemination views. Most of the objects in the RUcore repository do not require special dissemination, and thus would be able to use such a default content model. Fedora 3 provides a migration utility that should help to create content model objects replicating --- 1 In beta releases the nomenclature of BDef and BMech for these objects was supported, but as of the 3.0 release in late July these are known as “Service Definition” (SDef) and “Service Deployment Mechanism” (SDep) objects. 2 The RELS-EXT datastream assigning a content model looks something like this: ```xml <foxml:contentDigest TYPE="DISABLED" DIGEST="none"/> <foxml:xmlContent> <rdf:Description rdf:about="info:fedora/rutgers-lib:XXXYYYZZZ"> <fedora-model:hasContentModel rdf:resource="info:fedora/rutgers-lib:Book-cmodel"/> </rdf:Description> ``` This code associates an as yet unnumbered object with a generic book content model Rutgers-lib:201856. The string “XXXYYYZZZ” is replaced with the Fedora PID of a new object upon ingest. Markup like this would have to be inserted in pre-ingest objects by the WMS, much in the way it currently inserts code identifying disseminators. The WMS would reserve a Fedora PID and use that in place of the XXXYYYZZZ string in pre-ingest objects. Note that this datastream, unlike disseminator datastreams, is versionable so that the content model and its attendant dissemination could easily be changed if need be. the functionality of the relatively few disseminators currently in use by RUcore. This procedure is still being tested. The new content models are not simply replacements for disseminators however. The [Fedora Content Model Architecture web page](http://www.fedora-oss.org) lists two combinable “meanings” for the term Content Model: 1) Content structure as used by publishers and other traditional content-related professions 2) A computer model describing an information representation and processing architecture The second definition closely approximates the “disseminator” function of the CMA that has been discussed above, while the first definition could suggest something more like the term “object architecture” as used in the context of the RUcore repository. Our early experiments with the migration and automated creation of CModels for RUcore objects, however, suggest that the migration scripts, which create CModels based on the differing sets of XML datastreams present in existing objects, are not capable of creating the sort of “semantic” CModels that would accord with our notions of object architecture. A recent test of the automated migration script on lefty64 based on about 3,100 objects carried over from lefty generated almost 400 distinct CModels. We need to design our own generic CModels and assign them to objects meeting certain sets of criteria. We are currently testing the implementation of such an approach, and it has had promising results so far, but it will almost certainly complicate the migration process beyond the use of the migration script, perhaps requiring an additional filter of the RELS-EXT Datastreams applied at some point in the migration. As we continue to assess the functionality of the content models, we envision having all objects, rather than simply those requiring dissemination, assigned content models based on our current definitions of “object architectures”. As this approach would have an impact on the WMS in addition to the migration of current objects, we will need to affirm that some kind of useful validation capability will eventually be gained in the process. 1.2 Migrating objects and ingest targets to FOXML 1.1 and METSFedoraExt 1.1 Fedora 3 makes use of updated XML schemas for FOXML as well as the Fedora version of METS now known as METSFedoraExt. This will have consequences for us not only during the migration process, but also going forward with the WMS and dlr/EDIT Fedora management system. The migration scripts allow objects in an earlier Fedora repository to be upgraded “in place”, a process that changes the XML encoding of the objects while leaving them in their current directories. The changes to the schema are relatively subtle, but will need to be accounted for in our XML-creation programs. The foxml:digitalObject element, for instance, gets a new, required “VERSION” attribute as --- 3 For example, objects with three digiprov sections generate a different content model from essentially similar objects that happen to have two or four digiprov sections. 4 The WMS will begin using the element `<rulib:contentModel>` in place of the current `<rulib:objectArchitecture>` in technical metadata sections. 5 While export in the new METS format still works as expected, we have experienced problems ingesting METSFedoraExt-1.1 into the Fedora 3.0 beta repository. We do not know if this is an issue that will be corrected in the production version. As well as a new schema location. The foxml:disseminator element is no longer accepted and will need to be replaced by a RELS-EXT datastream referencing a particular CModel object. The foxml:dataddressVersion element gets a new, empty element, foxml:contentDigest, designed to contain attributes with signature information, but which is marked “DISABLED” by default for compatibility with older objects. Managed datastreams are not affected by the migration script and remain in their current directories. 1.3 Adjusting to and using the new Fedora API Once again, the new version of Fedora includes changes to the API used to access or manage various web services. Many of these changes, such as the addition of the checksumType and checksum parameters to various datastream methods, were already in place for the 2.2 version of Fedora, but are nonetheless new to us as we never implemented that version. There is a new start date parameter for the purgeDatastream method, and in Fedora 3 a new ownerID parameter for the modifyObject method. Fedora 3 also includes a new set of “relationship methods” (addRelationship, getRelationships, and purgeRelationship) that we might use to manage or extend RELS-EXT sections that designate a content model or membership in a group of related objects. Fedora 3 contains an enhanced REST API including a number of API-M methods previously only available through SOAP. Many of these appear not to have been implemented yet, and while the others are worth investigating for possible use in the future, we will probably not be using them for the initial migration. There are plans to include such interesting features as a Java Messaging Service (JMS) and validation testing of things like conformance to content models, but there is no documentation at the present time to suggest how these features might be expected to work. 1.4 Concomitant software infrastructure upgrades The 5.0 RUcore release will involve other software infrastructure upgrades in addition to the migration to Fedora 3. Chief among these will be the move to PHP 5 and the use of a 64 bit architecture for development. PHP 5 migration will involve testing and in some cases altering user applications in the WMS, the dlr/EDIT Fedora management system, the statistics and notification system, and the public search and display portals. PHP 5 includes a new and improved SOAP module that may be of use for applications needing to interact with the Fedora repository. There is now also a Perl SOAP::Lite “stub” class for accessing the entire Fedora API. As this is derived directly from the Fedora WSDL --- 6 See the “purple” code in the foxml example in an earlier footnote. Though for now we are not changing our approach to signature testing, we may still want to make use of this element at some point in the future to store the SHA1 signatures of archival datastreams in a place where Fedora’s new signature checking methods can find them. 7 For historical reasons, we have avoided purging datastreams based on date/time attributes, which were unreliable in earlier versions of Fedora. We might investigate possible uses for the new ownerID attribute, which is currently left blank in migrated test objects on lefty64. The Fedora 3 documentation notes, for instance, that this may be a string of comma separated values that could be used in XACML policies. 8 RELS-EXT sections are created either on ingest or using the addDatastream method. file, it gives us a flexible means of keeping up with any future changes that may be made to the Fedora APIs. 2. Infrastructure Preparation to Support Future Functionality 2.1 Implementation of XACML policies for authentication and authorization The 5.0 RUcore release will be the first to support XACML policies in Fedora. XACML has been part of Fedora since the 2.1 release, but our earlier versions of RUcore, which supported only open access, have not used policy enforcement. This will change in the new release so that we can use XACML for fine-grained authorization at the datastream level in projects such as Rutgers ETDs as well as the new NJVid project. The ETD project requires an elegant mechanism for embargoing certain dissertations for a period of time, while NJVid envisions an elaborate authentication and authorization structure for allowing videos to be streamed to differing classes of users authenticated by partner institutions.9 We are currently experimenting on lefty64 with the use XACML policies. Fedora ships with a set of default repository policies that are very restrictive for the API-M and quit unrestrictive for API-A methods. Users are expected to modify these policies to suit their own requirements. Policies may also attach to individual objects in various ways: 1) through an external XML file stored with a filename related to the object’s Fedora PID in an object policies directory defined in the Fedora configuration file, or 2) as a datastream of the object with the datastream ID “POLICY” using any of the four possible control groups (X, M, E, or R)10. The first option has several drawbacks, including the fact that such policies are loaded only when the Fedora server is started and the difficulty of maintaining such a system on a large scale and over time. The second option has the benefit of allowing policies to be assigned dynamically on ingest or through the API-M addDatastream method. This may be the preferred method for assigning policies to ETD objects that have embargoes for certain time periods based on a time related to the student’s date of graduation. Thus such policies, though they may be based on templates, would have to be tailored to particular objects at the time of ingest. In most other circumstances, however, we envision a limited number of policies each being used for large sets of objects. In such a circumstance, use of the X or M control groups would necessitate awkward repetition of code in the workflow management system or at some later stage for individual objects and thus difficulty of maintenance. The E or R control groups would allow individual policy datastreams to be stored in an editable form either outside the repository or within --- 9 At present we envision using Shibboleth to provide authentication across institutions, though it is not yet clear how it will be implemented. Fedora’s XACML functions will be used to handle the authorization of access to datastreams, and will be implemented in a way that is agnostic about the ultimate means of authentication. 10 X stands for XML code that is part of the object file itself, such as the DC or MODS datastreams. M stands for an external file of some sort associated with the object and managed internally by Fedora, such as our presentation datastreams or METS structure map files. E stands for a similar external file accessible through the http protocol and left outside the repository for storage though retrieved and managed transparently by Fedora upon access. R stands for an external file accessible through the http protocol to which Fedora redirects users upon request. an easily manageable set of special policy objects in the RUcore or another Fedora repository. Fedora ships with a repository policy that does not allow datastreams with the ID “POLICY” to be accessed. If we decide to keep this policy, any policies referenced in E or R datastreams would have to have an ID other than “POLICY” (say, “POLICY1”) in the context of their own policy objects, though they would be referenced by other objects with ID “POLICY”. This will be good practice whether or not we decide to keep the default policy viewing restrictions. Our anticipated use of individual object policies in ETD objects would seem to require that such policies be visible for inspection and editable through one of the current editing interfaces, but this can be accomplished without changing the current restrictions on API-A access to POLICY datastreams. 2.2 Exploration of alternative object architectures In preparation for the management of many large video objects and other “unusual” objects such as electronic journal articles or EAD finding aids, we need to explore alternatives to the fairly rigid system of “M” or managed datastreams that that we have used until now. We have already begun to discuss using “R” (redirected) datastreams for large archival video files, and we need to start modeling such objects on the test server, as well as experiments with “R” datastreams for electronic journal articles and EAD files where maintaining external link relationships for presentation datastreams can be important. We should also begin experimenting with a means of federating searches across distributed Fedora installations. These tests will have implications for various systems, such as the current checksum testing system and the workflow management system. 2.3 Storage architecture The following are major assumptions regarding the storage architecture and the 5.0 RUcore release: We will need to treat archival masters for large files using the Fedora “redirect” mode. In particular, the NJVid release will need this capability for video archival masters. Note that WMS has already been updated to allow any archival master to be external. The WMS will have to mark such datastreams as “R” and create them with IDs in the form “RARCH1” rather than “ARCH1” to identify them more readily as “external” files to management programs such as the signature verifier. For the 5.0 RUcore release, the “external” file system will be local to the Fedora server. In addition to changes for WMS, the signature verifying code will need to find the archival master as a managed datastream or an external datastream.11 11 We have experimented with Fedora’s own checksum mechanism but found it not suitable for our uses at the present time. We tried putting checksums in the foxml:contentDigest element for certain datastreams. Such checksums are tested on ingest and may be tested by Fedora at any time using the compareDatastreamChecksum method of API-M in a way that is attractively agnostic about server location. Thus E and R datastreams with checksums are tested along with M or X datastreams in a way that is transparent to the user. For E and R datastreams that reside in another Fedora instance, the checksum testing is actually off-loaded onto the server in question. For R datastreams that do not reside in a Fedora instance, the datastream is first pulled onto the accessing Fedora server and the testing is done on a copy there. This approach, however, has the disadvantage of unacceptably slowing the ingest times of such For external archival masters (RARCHs), the archival master file along with presentation files and the checksum will need to be located in the external file system. WMS will upload the presentation files, point to the archival master, and include the checksum in technical metadata. This process requires that these files and the checksum be pre-loaded in the external file system. The question of whether we need a backend storage server will need further discussion. In particular, we need to be part of the discussion with NJVid as to what storage system they will purchase. 3. Issues Going Forward We are still in an early testing phase using the first public release version Fedora 3. After an initial period of difficulties, we have had success modeling the new API methods for dlr/EDIT, so that the functionality on the 3.0 test machine now replicates that of the 2.1 production server.\footnote{Ingesting METS objects is still an unresolved problem, but this may be simply an issue with the beta version of Fedora 3.0. Since there is no mention of METS being deprecated in the current documentation, we look for it to be fixed in the production version.} The old disseminators are now functioning on the test machine using the new content model architecture, and we have successfully modified these models and added them to existing objects to provide dissemination. The migration utility has produced too many content models replicating the same functionality for disseminators and unnecessarily distinguishing objects with similar semantic architectures, but we have discovered a means of “seeding” that utility with archetypical objects that promises to mitigate this problem. We need to explore the management of the content models more thoroughly, and to see if it is feasible to validate somehow our “object architecture” models. Our early tests with XACML show some promise, but we need to experiment with implementing role-based policies in an authentication-neutral setting, which could later be hooked up to an authentication system (we expect this to be Shibboleth) yet to be built or not yet ready for testing. Since a number of our current and anticipated user interface functions (e.g., streaming video) access data streams outside of the usual Fedora services, we need to build an efficient system of using API methods to probe Fedora for policy restriction information within the user interface. 3.1 Questions and resolutions going forward These are some questions and resolutions grouped by category. At the end of each requirement there will be an indicator of whether it will be implemented in the 5.0 or 5.1. CMA 1) We will point to a content model on ingest by adding the special RELS-EXT elements, such as the one in the early footnote, to our objects. (5.0) 2) All objects will require a content model. We will be adding appropriate “object architecture” content models on ingest. (5.0) 3) We should create content models that represent our object architectures. It will require experimentation with content modeling as well as analysis of the essential characteristics of the current object architectures to be used in the modeling. Content models chiefly describe certain expected datastreams and their mime-types, but we have not yet discovered a means of enforcing validation.\textsuperscript{13} We assume that Fedora will provide a means of validating content models in its final 3.0 release, and will go forward on that assumption. We have tested this using various methods of assigning content models to objects. RELS-EXT elements can be included on ingest, and after ingest we can also use the addDatastream method to add content model relationships to already ingested objects. (5.0) 4) The old disseminators will work in Fedora 3.0 after migration through their related content models, though we have to call them somewhat differently since the disseminator PIDs no longer reside immediately in the object’s XML. (5.0) WMS Impact 1) The WMS will have to replace its current disseminator datastreams with RELS-EXT elements pointing to content models controlling the equivalent disseminations.\textsuperscript{14} Such content models do not currently affect ingest from the point of view of the WMS.\textsuperscript{15} In fact, it is still possible to ingest objects that reference non-existing content models. We need to explore this functionality more fully. (5.0) \textsuperscript{13} It would appear from our experiments that functioning content models (i.e., models that drive disseminations) can be assigned currently to objects whose datastreams do not reflect the datastreams identified in the content models themselves. \textsuperscript{14} The following is an example of a new RELS-EXT datastream assigning a collection-disseminating content model (the 123456789 identifier would actually be a Fedora PID number reserved in advance by the WMS): <foxml:disseminator ID="DISSI" BDEF_CONTRACT_PID="rutgers-lib:1565" STATE="A" VERSIONABLE="true"> <foxml:disseminatorVersion ID="DISSI.0" LABEL="DLR Dynamic Collection" ORDER="0"/> </foxml:disseminator> This replaces the following lines used for the disseminators of current collection objects: <foxml:disseminator ID="DISSI" BDEF_CONTRACT_PID="rutgers-lib:1565" STATE="A" VERSIONABLE="true"> <foxml:disseminatorVersion ID="DISSI.0" LABEL="DLR Dynamic Collection" B MECH_SERVICE_PID="rutgers-lib:1567" CREATED="2003-06-05T06:32:00.000Z"> <foxml:serviceInputMap> <foxml:datastreamBinding KEY="OBJSTRING" DATASTREAM_ID="SMAPI1" LABEL="Binding for DR Collection" ORDER="0"/> </foxml:serviceInputMap> </foxml:disseminatorVersion> </foxml:disseminator> \textsuperscript{15} The rdf:about attribute (green code in the foxml example footnotes), however, must properly reference the PID that is about to be created for the object, and thus the WMS must probe for this information in advance using the getNextPID method. The dlr/EDIT ingest script will also do this for objects with the XXXYYYYZZZ place-holding strings. 2) The WMS should begin planning to be able to point to external XACML policy objects as datastreams and should also develop the capability to include individual policies with objects such as the ETD objects requiring specific embargoes. XACML policy objects will already have been created and ingested separately, and it will also be possible to add datastreams referencing these objects to individual objects or collections of objects in the Fedora repository. The ETD policies can be based on templates filled in by the ETD application and delivered either as inline XML or managed XML files in the manner of the current SMAP1 files. (5.1) 3) The WMS should point to external archival master datastreams with IDs in the form RARCH1, RARCH2, etc. This will be a requirement at least for video objects in the next release, and we will need to build in the necessary flexibility in handling control groups. This will also make it easier to distinguish external archival files in the checksum testing program. (5.0) 4) As noted above, the WMS will begin using the element <rulib:contentModel> in place of the current <rulib:objectArchitecture> in technical metadata sections. Current <rulib:objectArchitecture> will have to be migrated as part of the filtering process. (5.0) Migration 1) We have determined that objects in a Fedora 2.1 instantiation can be migrated in place to 3.0, but we will still require a full re-ingest to allow object datastream IDs to be regularized in preparation for the Content Models. Any additional filtering or work on the content models will have to be done before re-ingestion into Fedora 3.0. The objects in the repository will be pulled to the SCC, filtered, migrated to 3.0 and then exported for re-ingestion into the Fedora 3.0 instance on mss3. (5.0) 2) Any software that uses the Fedora API (access or management) will require changes to accommodate Fedora 3.0. The software calling on disseminators will require a new syntax and a new means of acquiring information about a particular disseminator, as this information is no longer stored in the object. Software accessing individual datastreams will require an efficient means of polling and interfacing with any XACML policies for those datastreams so that user links can be created consistent with the requirements of such policies. (5.0) 3) WMS editing functions for Fedora objects will continue to use Javabridge in the 5.0 release. It will need to revise its SOAP syntax to accommodate the new Fedora API. We will need to move from the 3.x version of Javabridge to the 5.2.2 version that has been designed to work with PHP 5. (5.0) (JAT - August 20, 2008)
{"Source-Url": "https://rucore.libraries.rutgers.edu/collab/ref/spc_sawg_r5_0_fedora3_migration3.pdf", "len_cl100k_base": 5489, "olmocr-version": "0.1.50", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 18289, "total-output-tokens": 5968, "length": "2e12", "weborganizer": {"__label__adult": 0.00020933151245117188, "__label__art_design": 0.00029468536376953125, "__label__crime_law": 0.0002849102020263672, "__label__education_jobs": 0.0014295578002929688, "__label__entertainment": 7.87973403930664e-05, "__label__fashion_beauty": 0.00011497735977172852, "__label__finance_business": 0.0003829002380371094, "__label__food_dining": 0.00016927719116210938, "__label__games": 0.0003490447998046875, "__label__hardware": 0.0010633468627929688, "__label__health": 0.0001996755599975586, "__label__history": 0.00026106834411621094, "__label__home_hobbies": 7.492303848266602e-05, "__label__industrial": 0.0003020763397216797, "__label__literature": 0.0002135038375854492, "__label__politics": 0.00021970272064208984, "__label__religion": 0.00031566619873046875, "__label__science_tech": 0.032135009765625, "__label__social_life": 0.00011217594146728516, "__label__software": 0.07586669921875, "__label__software_dev": 0.88525390625, "__label__sports_fitness": 0.00013971328735351562, "__label__transportation": 0.0002440214157104492, "__label__travel": 0.00016355514526367188}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 26072, 0.01892]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 26072, 0.21659]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 26072, 0.91143]], "google_gemma-3-12b-it_contains_pii": [[0, 3271, false], [3271, 6724, null], [6724, 10184, null], [10184, 13822, null], [13822, 17367, null], [17367, 20165, null], [20165, 23414, null], [23414, 26072, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3271, true], [3271, 6724, null], [6724, 10184, null], [10184, 13822, null], [13822, 17367, null], [17367, 20165, null], [20165, 23414, null], [23414, 26072, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 26072, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 26072, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 26072, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 26072, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 26072, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 26072, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 26072, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 26072, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 26072, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 26072, null]], "pdf_page_numbers": [[0, 3271, 1], [3271, 6724, 2], [6724, 10184, 3], [10184, 13822, 4], [13822, 17367, 5], [17367, 20165, 6], [20165, 23414, 7], [23414, 26072, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 26072, 0.0]]}
olmocr_science_pdfs
2024-11-29
2024-11-29
ee45d4c087a3b191a398da33836ff08b5b4af322
Abstract A major reason for the success of the STRIPS planner and its derivatives was the use of a representation that succinctly captured the changes in the world due to different actions. As planning systems are extended to deal with uncertainty, we seek ways to model the world that maintain this advantage. In this paper I examine four somewhat representative planning systems designed for uncertain domains that can change independently of the actions performed by the planning agent. These are Buridan, anytime synthetic projection, Weaver and XFRM. I compare their positions on several design issues including the power of the languages used to represent plans and actions, and the use to which it is put in both plan synthesis and plan evaluation. I briefly explore the tradeoff that exists between the expressiveness of the language used to reason about the effects of action in the world and the extent to which the planning system can take advantage of the language to build plans efficiently. Introduction AI planning systems gain much leverage from the combination of means-ends reasoning and subgoaling. As these systems are applied to more complex domains we must question whether this approach will scale to richer action, goal and plan representations. There are encouraging indications for uncertain action outcomes, eg (Pryor & Collins 1993, Kushmerick, Hanks, & Weld 1993), we would like to push the envelope to include external events and richer temporal models for goals, plans and actions. In this paper I briefly describe and compare four planners that deal with uncertainty in initial conditions and the effects of actions, three of which reason about events explicitly. The systems have made different sets of design decisions, and after presenting them I will briefly discuss what we might learn from them about applying planning techniques to more involved domains. The systems I describe are as follows: - **Buridan and C-Buridan** (Draper, Hanks, & Weld 1994, Kushmerick, Hanks, & Weld 1993) use a partial-order causal-link planner designed for an action representation that models different possible outcomes of an action probabilistically. - **Anytime synthetic projection** (Drummond & Bresina 1990) uses a model of both actions and exogenous events, building up a conditional plan by forward chaining, and reasoning about the planner’s actions and external events in the same step. - **Weaver** (Blythe 1994) uses a state-based planner (Carbonell et al. 1992) to improve a plan, guided by a critic that alters the planner’s goals, initial state and action descriptions based on a probabilistic analysis of the plan. - **XFRM** (McDermott 1992) uses a transformational planner to improve plans built from a library. Plan transformation is achieved by pairs of critics and repair routines, some of which are general while some are domain-dependent. In the next section I describe the languages and algorithms used by each of these systems in more detail. Where possible I have used a uniform language to describe each system to make the comparison easier. This has not been done for XFRM, however, which can use arbitrary lisp code as part of its action definition. Although the descriptions of the systems are too brief to do them justice, I mention some broad issues in this approach to planning under uncertainty in the third section. The example systems I begin this section with a description of the language I use to discuss the various planning systems. A probabilistic extension to ADL Buridan and Weaver both have action representations that are simplifications of Pfeuinz’s ADL (Pednault 1986). This language has a syntax similar to STRIPS (Fikes & Nilsson 1971) but is equivalent in representational power to the situation calculus (McCarthy & Hayes 1969). In Pednault’s formalism, a state is represented as an algebraic structure, specifying a domain, a set of relations and functions over the domain, a set of distinguished objects of the domain and a mapping from a set of variable names to elements of the domain. Since neither Buridan nor Weaver use variables in their plans and all reachable states are constrained to have the same domain, I simplify the description here by allowing states to be simply symbols, elements of the set $S$. Each planning domain specifies in addition to $S$ a set of objects $O$ and a set of relations $R$. Each relation $r \in R$ has some arity $n_r$, and for each state $s \in S$ and relation $r$ a subset of $O^h$ is defined. For example if $O$ is the set \{truck1, package3, london, pittsburgh\} and in is a binary relation in $R$, then the state $s$ might map in to the set \{(truck1, london), (package3, pittsburgh)\}, called its “interpretation” in $s$, written $I(in, s)$. Note that while each state must associate in with such a set, not every subset of $O^2$ need correspond to a state. In addition I require that no two states have the same interpretation for each relation. Actions in ADL are partial mappings from individual state to individual state. The domain of an action $A$, the subset of $S$ for which the mapping is defined, must be specifiable by a logical expression in the relations $R$, called the precondition of $A$. The mapping itself is specified through the interpretations of the relations, which are in turn specified through add and delete lists for each relation $r \in R$. Thus if $A$ has add and delete lists $\alpha_r$ and $\delta_r$, respectively for $r$, and applying $A$ in state $s$ leads to state $t$, then $I(r, t) = (I(r, s) - \delta_r) \cup \alpha_r$. We define the set of adds and deletes specified for every relation in $R$ as the effect set $e$ of $A$. The state $t$ defined as above is denoted $result(s, e)$. The planning systems described here model actions as producing a probability distribution over $S$ when performed in a state in $S$. To do this they use probability distributions over finite sets of effect sets, called effect distributions. These can be written as a set of pairs, \{$(p_1, e_1), \ldots, (p_n, e_n)\}$ for some finite $n$, where each $p_i > 0$ and \[\sum p_i = 1.\] If an action is specified with this effect distribution and is performed in some state $s$, then the probability distribution for the resulting state is given by the set \{$(p_1, result(s, e_1)), \ldots, (p_n, result(s, e_n))$\}. Finally, the actions are generalised to have a binary tree of effect distributions, whose internal nodes are relations and appropriate $n$-tuples of $O$, for example “in(truck1, pittsburgh)” and whose leaves are effect distributions. When these actions are performed, the tree is traversed, taking at each internal node the “true” or “false” branch depending on whether the $n$-tuple is in the relation’s interpretation for the current state, and the effect distribution found at the leaf is used to build the probability distribution for the resulting state. I will refer to this binary tree as an action’s effect distribution tree, and will write the probability distribution over $S$ that results from performing action $A$ in state $s$ as $P(s, A)$. C-Buridan Buridan and C-Buridan (Draper, Hanks, & Weld 1994, Kushmerick, Hanks, & Weld 1993) are partial-order planners based on SNLP. C-Buridan is an extension of Buridan that allows information-gathering operators and conditional plans. They use the action representation described above, with two simplifications. First, each action’s precondition is “true”, so the action is applicable to every state in $s$, with results depending on the tree of effect distributions. Second, the planners use a propositional logic, so all the relations in $R$ have arity 0. C-Buridan in addition models information-gathering actions that have observation labels as well as effects. The planners are given an initial probability distribution over $S$, a goal description $G$ and a threshold probability $p_t$. They seek plans that will reach a state satisfying $G$, from one drawn from the initial probability distribution, with probability at least $p_t$. Their algorithm is based on SNLP, which is described in detail in (McAllester & Rosenblitt 1991). The systems begin by defining a “start” operator, whose effect distribution tree encodes the initial state probability distribution, and a “finish” operator whose effect distribution tree has only one useful leaf that adds the proposition “goal” with certainty, and whose path through the tree encodes the goal statement. An initial plan consisting of these two operators is put on the list of open plans. The planning algorithm used repeatedly selects the first plan in this list, and estimates its probability of success. If this is shown to be above the threshold, it is returned and the plan terminates. Otherwise, the plan is modified in several ways, the modified plans are evaluated according to a heuristic that returns a number and are placed in the list of open plans, sorted according to this ranking number. The first way a plan may be modified is by adding a causal link from a particular outcome (effect set) of a new or existing action to a goal, an internal node on a path to an outcome that already has a causal link. Second, an ordering constraint can be added between two actions. This option is considered if there is a “threat”, a possibility that one action may stop a causal link from working if it is executed between an establishing outcome and the goal. The action may be ordered either before the outcome or after the goal if this is consistent with the other orderings and causal links. Third, causal links can be added with the aim of reducing the probability of a threatening outcome of the threat action taking place, essentially by taking as a subgoal the negation of some step on the path in the effect distribution tree that leads to the bad outcome. C-Buridan can also modify plans by branching, resolving a threat by incrementing the context of steps subsequent to an information-gathering step with observation labels from that step, and ensuring that the threatening step has a different context from the threatened link — in other words, ensures that it would be in a different branch of the plan. The stage of estimating the probability of success of a plan in Buridan can be done in one of four different ways, described in (Kushmerick, Hanks, & Weld 1993). None of these uses information that is not present in the plan or the domain representation. The default method finds a lower bound for the probability by considering the causal link structure of the plan. Some important points to note about Buridan and C-Buridan from the point of view of this paper are these. The plan evaluator and the planner work with the same language for actions and plans. The planners include two steps that are not found in their deterministic counterpart: confrontation and branching. Confrontation is essentially a new way of determining subgoals, which are treated as before. The language used allows a probabilistic representation of uncertainty in the initial state and in action outcomes, but not in exogenous events. Anytime Synthetic Projection Anytime synthetic projection (ASP) (Drummond & Bresina 1990) models both actions and exogenous events, specified as probabilistic state transitions. It represents its plans as a collection of situated control rules that map descriptions of a state to chosen actions, and attempts to maximise the probability that the rules will result in behaviour that satisfies its goals, described below, although no guarantee of maximum probability is given. Goals are given to the planner in terms of “behavioural constraints”, which can specify predicates that are to be true over certain temporal conditions. The goal is represented as a “behavioural constraint strategy” which is a partially ordered set of behavioural constraints. Specifically, behavioural constraints are constructed according to the following grammar: \[\beta \rightarrow (\text{and } \beta_1 ... \beta_n) \mid (\text{or } \beta_1 ... \beta_n)\] \[\beta \rightarrow (\text{maintain } \psi_1 \tau_2) \mid (\text{prevent } \psi_1 \tau_2)\] \[\beta \rightarrow (\text{maintain } \psi \phi_1) \mid (\text{prevent } \psi \phi_1)\] \[\psi \rightarrow (\text{and } \psi_1 ... \psi_n) \mid (\text{or } \psi_1 ... \psi_n) \mid \text{predicate}\] Here, the symbol \(\beta\) represents a behavioural constraint, \(\phi\) a time variable, \(\tau\) a time constant and \(\psi\) a formula. Time points are natural numbers. The algorithm searches for combinations of actions and events that satisfy a behavioural constraint strategy using a forward-chaining filtered beam search (Ow & Morton 1986). First, the current state is defined as the initial state. A behavioural constraint \(\beta\) that is not preceded in the partial order is chosen to work on. From the current state, all possible transitions that pass a filter based on their probability are considered as possible successor states. For each of these, a heuristic value is calculated based on the state’s probability and estimated remaining work to satisfy \(\beta\). A subset of the successors with highest heuristic value are added to the list of open situations, from which the next current situation is chosen. The size of this subset is fixed by the beam-width parameter of the search. When a state is chosen whose path from the initial state satisfies \(\beta\), the system compiles search control rules that specify the actions chosen along the path, picks a new behavioural constraint from the strategy and takes this state as the new initial state. Thus the system eagerly commits to a subplan for each constraint in turn, a strategy called “cut and commit”. Actions and events have durations, which are used to give a time stamp to each state. These are used to verify that a state-action sequence adheres to a temporal behavioural constraint. In this system the planner and the projection system work as one, which the authors term “synthetic projection” to distinguish it from “analytic projection” which is separate from the plan creation step, as in Buridan. The system uses a richer representation for goals and actions, but uses a relatively weak planning algorithm. Forward chaining on applicable actions can lead to many possible successor states, and the system is left to the mercy of the local heuristic when pruning takes place. Since the heuristic counts separate predicates in a conjunction equally when estimating remaining work, and also because of the cut-and-commit strategy, it is not clear how the planner can deal with goal interactions. Backtracking over previously planned-for behaviours is briefly discussed, although the authors consider leaving the compiled control rules in place. Weaver Weaver (Blythe 1994) is a planning system that deals with uncertainty in the initial state, action outcomes and exogenous events. It uses a probabilistic extension of ADL to represent actions, similarly to Buridan and C-Buridan. It also represents exogenous events in the same way and creates subgoals based on their preconditions. In addition to the precondition and effect distribution tree, an action \(A\) also has a duration \(d(A)\) and a single effect set \(\text{inter}(A)\) that models the state during the execution of the action. Thus, in the absence of exogenous events, if action \(A\) is performed in state \(s\), the state is immediately transformed to \(s' = \text{result}(s, \text{inter}(A))\), and the probability distribution for the state at \(d(A)\) time units later is \(P(s', A)\), based on \(A\)’s effect distribution tree as defined in section. In addition to a single effect set, an event \(E\) has a probability \(p(E)\), which is its probability of occurrence over one time unit given that its preconditions are satisfied. If exogenous events are allowed to take place over the duration of the operator’s application, the probability distribution over \(S\) that arises is more complicated but still well-defined, under the constraint that each pair of events has either a disjoint domain or a disjoint effect set. That is, if two events can take place in the same state, they have orthogonal effects and are therefore order-independent. The actual probability distribution is a little involved and can be found in (Blythe 1995). Weaver uses the Prodigy planner (Carbonell et al. 1992) as a subroutine and builds up a conditional plan by calling Prodigy with different initial conditions, and occasionally modifying its actions. Weaver models a plan using a Bayes net to calculate its probability of success and to choose bugs to fix, an approach similar to (Dean & Kanazawa 1989). Rather than include a node for each state variable at each time point, however, the net is computed in such a way that nodes are added on demand, when there is a possibility that an event or undesired action outcome may adversely affect the overall plan. Weaver’s algorithm works as follows: first, the Bayes net is initialised to reflect the probability of the goal being true in the initial state. If this is above a user-defined threshold probability the algorithm terminates. Otherwise a node in the Bayes net is found which with sufficiently high probability does not have a value for which the plan succeeds, along with a parent node that explains the failure - either representing an event or an action with an outcome that contributes to the failure. Weaver tries two ways to improve the plan to fix this problem: either planning under the assumption that the bad outcome takes place and creating a conditional plan, or amending the plan to reduce the probability of the bad action outcome or event. If neither of these techniques works, Weaver tries to fix a different problem in the plan. If no problem can be fixed, it backtracks over earlier planning choices. When Prodigy plans as a subroutine to Weaver, it plans for a single initial state and ignores the possibility of exogenous events taking place in the domain. Prodigy therefore ignores the uncertainty of the domain and yields faulty plans that Weaver analyses and attempts to fix. The clear boundaries of the part of the system that deals with uncertainty and the part that doesn’t can lead to great inefficiencies as Prodigy may produce plans with very low probabilities of success. XFRM XFRM (McDermott 1992) is a transformational planner that works with the Reactive Plan Language (RPL) (McDermott 1991). This language is very rich, and the planner is very wide in scope, so I will concentrate here only on aspects of the language most relevant to the planning system, and the planning system itself. In particular, much of the work in this system on interleaving planning and execution will be ignored. Like Buridan, the planner creates partially-ordered plans. However, RPL also has facilities for loops, and can include arbitrary lisp code in its plans. Rather than derive plans from goal descriptions and the dynamics of the world, XFRM relies on libraries of plans installed by the user, and applies plan transformations to try to improve their expected performance. This is currently measured as a weighted difference of the number of top-level user goals achieved and the time the plan takes. Although the system is capable of representing exogenous events, it is not dealt with in the current version of the planner. Given a set of top-level goals, XFRM initialises its list of plans with one built from the plan library, gets a set of projections for this plan and runs its plan critics to find its “worst” bug. Then it repeatedly selects a plan from the list, send it to the executor, generates a set of new plans by fixing the worst bug and for each of the new plans generates a set of projections of the plan and runs its plan critics on the projection set to determine the worst bug and score the plan. Since this routine is designed to be run concurrently with execution, the termination criterion is that execution has finished. The key operations are plan projection, running plan critics and fixing the worst bug. A plan is evaluated by making a set of projections. The projector takes a partially ordered plan and on each call generates one scenario of running the plan — a totally-ordered set of events in a timeline. Reasoning about the effects of actions is done by a set of rules that specify the events that take place when actions are performed, and the effect that events have on the world in terms of “occasions”, which are predicates with a temporal extent, and clipping rules. Typically an action is modelled with two events representing its start and finish. Forward-chaining rules are used to add occasions for events and to specify what occasions an event might “clip”, or make untrue. Backward-chaining rules can find which events might add occasions in response to queries, for example to establish if the next chosen action is applicable. Typically, XFRM runs about 3 projections per plan, using them to estimate the goodness of the plan and the severity of the worst bug. Plan critics are separate routines that analyse the set of projections for various bugs. Some of these are domain-dependent, specified by the user, but some are generic, such as a protection-violation critic that notices when parts of the partially ordered plan may interact with each other. The transformations made to the plan to fix a protection violation essentially add ordering constraints, similarly to one of Buridan’s responses to a threat. In principle the planner has access to the same representation as the projector, since a critic and a bug repair routine can look at any part of the plan. In practice, however, the generic critics do not make use of much more than explicit protection statements and ordering statements in the plan, and most of the RPL language is used by the projector and controller. Discussion Although they use quite different planning techniques, the four systems described in this paper use largely similar representations for actions and events. They all model uncertainty in the effects of actions probabilistically, and those that model exogenous events use probabilities for them too. Those which model action durations model them either as fixed (ASP and Weaver) or as functions of the state (XFRM); none model probability distributions over the durations. Nevertheless, there are differences in the representations used, both in their power and their flexibility. In this section I hope to draw out some of these differences and explore the extent to which they depend on the algorithms used, and the extent to which they are arbitrary and could be swapped between the different systems with little penalty. One fundamental difference that leads to different design choices for the systems is the relation between planning and execution. Buridan and Weaver both concentrate on building a plan off-line, before execution begins, while ASP and XFRM both attempt to interleave planning and execution. This most directly affects the representation of plans. ASP uses situated control rules and XFRM a full programming language, while C-Buridan and Weaver both use sets of actions including branches. C-Buridan’s partially ordered and Weaver’s totally ordered. The plan representation used by XFRM in turn makes it hard to use any evaluation method other than collecting a set of projections. Estimations of probabilities can be slow to converge in such schemes, but this does not pose a serious problem for XFRM, since it is only likely to mistakenly swap a plan for a worse one when their actual values are quite close. Analysing the task network for a projection can yield as much information as the more direct evaluations of Weaver and Buridan. What restricts XFRM from using them in general is the need to specify, for example, a confrontation method that can cope with plans involving loops and semaphores. However there is no reason why critics couldn’t be provided that can mimic the more powerful planning refinements when the plans are simple enough. At the other end of the spectrum, we might consider how far the plan and goal languages of Buridan and Weaver could be scaled up while their planning techniques were still effective. There is plenty of room for improvement in the action model used by both systems. For example, probabilistically independent effects of actions are currently split up artificially in effect probability distributions only to be re-joined with multiple causal links or plan branches. An SNLP-based planner could probably cope with a representation of exogenous events such as used by Weaver, applying steps similar to threat resolution to reduce the impact of unwanted events. However, Buridan’s probability evaluation technique using causal links would no longer produce a lower bound in general unless all possible events were analysed for a plan. Weaver’s model of exogenous events allows planning techniques to be applied to a restricted class of dynamic certain planning problems, but it remains unclear whether uncertainty can be combined with richer temporal models of goals or actions in such a way that the simple goal-reduction techniques of classical planners can be of use. The key may lie either in transforming plan bugs into more well-understood subgoals, as is done in Weaver, or in enlarging the set of plan refinement techniques as in Buridan and C-Buridan. References
{"Source-Url": "http://www.aaai.org/Papers/Symposia/Spring/1995/SS-95-07/SS95-07-006.pdf", "len_cl100k_base": 5336, "olmocr-version": "0.1.50", "pdf-total-pages": 5, "total-fallback-pages": 0, "total-input-tokens": 17041, "total-output-tokens": 6544, "length": "2e12", "weborganizer": {"__label__adult": 0.00035691261291503906, "__label__art_design": 0.0006031990051269531, "__label__crime_law": 0.0005011558532714844, "__label__education_jobs": 0.0013980865478515625, "__label__entertainment": 0.00013244152069091797, "__label__fashion_beauty": 0.0002027750015258789, "__label__finance_business": 0.00043845176696777344, "__label__food_dining": 0.0004470348358154297, "__label__games": 0.0009474754333496094, "__label__hardware": 0.0008611679077148438, "__label__health": 0.0007081031799316406, "__label__history": 0.00035881996154785156, "__label__home_hobbies": 0.0001951456069946289, "__label__industrial": 0.0007624626159667969, "__label__literature": 0.0005640983581542969, "__label__politics": 0.0004076957702636719, "__label__religion": 0.0005197525024414062, "__label__science_tech": 0.15234375, "__label__social_life": 0.00015151500701904297, "__label__software": 0.0131072998046875, "__label__software_dev": 0.82373046875, "__label__sports_fitness": 0.0003764629364013672, "__label__transportation": 0.0008535385131835938, "__label__travel": 0.0002219676971435547}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 28424, 0.01568]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 28424, 0.5106]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 28424, 0.92524]], "google_gemma-3-12b-it_contains_pii": [[0, 4488, false], [4488, 11115, null], [11115, 17862, null], [17862, 24205, null], [24205, 28424, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4488, true], [4488, 11115, null], [11115, 17862, null], [17862, 24205, null], [24205, 28424, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 28424, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 28424, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 28424, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 28424, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 28424, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 28424, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 28424, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 28424, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 28424, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 28424, null]], "pdf_page_numbers": [[0, 4488, 1], [4488, 11115, 2], [11115, 17862, 3], [17862, 24205, 4], [24205, 28424, 5]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 28424, 0.0]]}
olmocr_science_pdfs
2024-11-27
2024-11-27
4361d6f29674564dec9098b9eeff071953db99bf
Reading an Entire Line of Data of Unknown Length Into a Character Variable Mel Widawski, Office of Academic Computing, UCLA, Los Angeles, California ABSTRACT At times when reading complex files it is useful to read a data line into a single character variable and then use string functions to parse the line of data. When the data is in variable-length records, this can cause problems. The solution is to use the $VARYING##. format on the input statement along with the LENGTH= option on the INFILE statement. This paper will show how to do this, and discuss implications. A small application using this method to create condensed output will be shown. Concepts used in this presentation are: - INFILE 'path' LENGTH=lan; - INPUT a $VARYING##. lan; - PUT _INFILE_; - INDEX(a,'string') INTRODUCTION There are times when simple input statements are not sufficient to read your data. At these times one solution is to read your data into a single character variable and then use string functions to parse the data into understandable components. These components are then converted to variables as we know them in data analysis. When the data are read as fixed-length records, there is no problem reading a data line into a character variable for parsing. However, variable-length records cause a problem because the record might end before a given length string is filled. The solution to this problem is to use the $VARYING##. lvar format to read the string. Using this format requires that the length of the line be known. Thus using this format requires an additional step. A variable containing the length of the line has to be set on the INFILE statement. The following program segment demonstrates the components in context. DATA A; INFILE '.\vpageX.lst' LENGTH=len; INPUT line $VARYING200. len; RUN; LENGTH= on the INPUT statement sets the variable len to the length of each line as it is read. $VARYING200. allows reading lines up to 200 characters long. Specifying len after the format provides the actual length for that line. I have used this format for reading a group schedule and producing an individual schedule. This requires reading lines of varying lengths and creating variables out of pieces of those lines. Another application involved reading play-by-play sheets for basketball games and extracting the time, the relative scores, and when a given player entered and left the game. The data was in variable-length records and key words identified which lines of data and what portions of the line needed to be read. A SIMPLE EXAMPLE Let us look at a simple situation where reading fixed-length strings will not work. The problem we have is to read some output and determine the number of lines on each page. We detect a page by testing for the automatic title string, The SAS System. The data is the output of SAS® procedures. ``` DATA A; INFILE '.\vpageX.lst' LENGTH=len; INPUT line $VARYING200. len; RUN; ``` ``` 01The SAS System 17:35 Monday, July 26,1999 1 02030085 MAKE PRICE 0405 1 AMC 4099 06 2 AMC 4749 07 3 AMC 3799 0809 10The SAS System 17:35 Monday, July 26,1999 2 11 1213MAKE Frequency Percent 14... 15AMC 3 11.5 16Audi 2 7.7 17BMW 3.8 18 19 20 21The SAS System 17:35 Monday, July 26,1999 3 22 23Cumulative Cumulative 24REP7B Frequency Percent Frequency Percent 25... 26 2 3 11.5 3 11.5 27 3 15 57.7 18 69.2 28 4 6 29.1 24 92.3 29 5 2 7.7 26 100.0 30 31 32 33The SAS System 17:35 Monday, July 26,1999 4 34 35Cumulative Cumulative 36FOREIGN Frequency Percent Frequency Percent 37... 38 0 19 73.1 19 73.1 39 1 7 26.9 26 100.0 40 ``` 68 This file has the following number of lines per page: <table> <thead> <tr> <th>Page</th> <th>Number of Lines</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>9</td> </tr> <tr> <td>2</td> <td>11</td> </tr> <tr> <td>3</td> <td>12</td> </tr> <tr> <td>4</td> <td>8</td> </tr> </tbody> </table> The line numbers inserted on the left make it easy for you to verify the counts. **Fixed Character Input** Here is a program that reads this data with fixed character formats: ```plaintext DATA b; INFILE '.\vpagex.ist' END=eof; INPUT test $CHAR30. @; IF INDEX(test,'The $AS System')>0 THEN DO; IF nf>O THEN OUTPUT ; nf=0; END; nf+1; IF eof KEEP nf RUN; ``` This program reads the lines of output, but does not count the lines correctly. It skips lines less than 30 characters long. It misses outputting the number of lines for the last paragraph because the last line is too short. The following is the comparison of the number of lines in each page and the number of lines that this program detects: <table> <thead> <tr> <th>Page</th> <th>Number of Lines</th> <th>NF</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>9</td> <td>5</td> </tr> <tr> <td>2</td> <td>11</td> <td>7</td> </tr> <tr> <td>3</td> <td>12</td> <td>9</td> </tr> <tr> <td>4</td> <td>8</td> <td>8</td> </tr> </tbody> </table> The NF column contains the program's count of the number of lines for each page. In each case an undercount results for each line with a length under 30 characters long. **Character-varying Input** Here is a program that reads this data with character-varying formats ($VARYING###. Len): ```plaintext DATA a; INFILE '.\vpagex.ist' LENGTH=len END=eof; INPUT test $VARYING200. len @; IF INDEX(test,'The $AS System')>0 THEN DO; IF nv>O THEN OUTPUT ; nv=0; END; nv+1; IF eof THEN OUTPUT; KEEP nv RUN; ``` This program reads the lines of output, and does count the lines correctly. Each line is counted and none are skipped. The following is the comparison of the number of lines in each page and the number of lines that this program detects: <table> <thead> <tr> <th>Page</th> <th>Number of Lines</th> <th>NV</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>9</td> <td>9</td> </tr> <tr> <td>2</td> <td>11</td> <td>11</td> </tr> <tr> <td>3</td> <td>12</td> <td>12</td> </tr> <tr> <td>4</td> <td>8</td> <td>8</td> </tr> </tbody> </table> The NV column contains the program's count of the number of lines for each page. In each case the results are as you would expect. **A Caution** In the above examples you can obtain the correct answer for the fixed character case by including MISSOVER on the INFILE statement. If we were searching for additional key strings on shorter lines, then this shortcut would not work. It also would not work for centered output. Thus it would be to your advantage to learn the method shown here. **A PROGRAM FOR CONDENSING OUTPUT** Output is usually chunked so that every new procedure starts on a new page. Each page may contain only a small number of lines, with the bulk of lines on the page wasted. A number of programmers have come to me to ask for a program that will place more than one procedure on a page. They also request that we keep the information on any given original page together. In this way, a table never spans a page break. This requires a two-step process. First, the number of lines per page must be determined. Next, the lines are output to a file, and at the beginning of each page the program determines if the next page will fit on the current output page. If it doesn't, then the page is padded to the printer page length for your output font. To find out how to determine this for window see below. To preserve spacing I use PUT _INFILE_. 69 The following program is a rather simple way to accomplish this task. ```sas /* *********************************************** * /* *** OUTPUT CONDENSE *** */ /* *** Set the line length PS= and the search *** */ /* *** string STR= at the beginning of the *** */ /* *** program using Macro Variables. *** */ /* *********************************************** */ %let ps=78; /* This should equal # of lines in */ /* an output page for your printer. */ %let str=The SAS System; /* **************************************************** */ /* *** This DATA step determines the length *** */ /* *** in lines of each input page, and saves *** */ /* *** that value in a data set called "a" *** */ /* ************************************************* */ data a; infile '.\vpagx.lst' length=len end=eof; input test $ varying200. len if index(test,'&str')>0 then do; if n=0 then output; n=0; end; n+1; if eof then output; keep n; run; /* **************************************************** */ /* *** This DATA step determines how many *** */ /* *** input pages fit on an output page. *** */ /* *** It then fills the rest of the page *** */ /* *** with blank lines up to the output page *** */ /* *** size. *** */ /* ************************************************* */ data _null_ infile '.\vpagx.lst' length=len end=eof; file '.\vpagxo.lst' ; input test $ varying200. len if index(test,'&str')>0 then do; set a; if (nn+n)>&ps then do; do i=1 to (&ps-nn); put ; end; nn=0; end; nn+1; put _infile_; if nn=&ps or eof then do; nn=0; end; end; run; /* ************************************************* */ /* *** Just open the output file 'vpagxo.lst' *** */ /* *** in the program editor. Do a print *** */ /* *** preview to insure that the paging is *** */ /* *** correct and then print the output. *** */ /* ************************************************* */ ``` Macro Variable: PS This variable contains the number of lines of printing set by your system. It is set in the %LET statement, and the value is used everywhere you see &PS in the program. Macro Variable: STR This variable contains the string that identifies the title line of the original output. The program uses it to determine the start of each page. By using character-varying formats and the INDEX function, the program will work just as well if the output is centered or not. The string value used here is the default title. This program will also work with alternate titles as long as there is a unique string to identify the title. One option would be the date that appears on the title line of the output. Notice that the macro variable &STR is replaced by its value. When a macro variable is enclosed in double quotes, it is replaced by its value; that is not true if it is enclosed in single quotes. Additional Program Elements Defined You may not be familiar with a number of the program elements I use in this program. I will present a short discussion of some of the program elements that may be unfamiliar. I assume that everyone is familiar with the DATA statement, and the INPUT statement. **INDEX(string,search)** This function returns the position in the string of first character of search. If the search string is found in string, then the result is greater than zero. If the search string is not found, then the result is zero. **END=eof** This parameter sets the value of the variable eof to one for the last line in the input file. **OUTPUT** This statement causes a line to be written to the output SAS File. If there is an OUTPUT statement, then a case is output only when that statement is executed. There is no longer an automatic output at the end of the data step. Without it a case is written on every pass through the DATA step. **PUT _INFILE_** This statement causes an entire input line to be written as is to either the log or the file defined by the FILE statement. It insures a verbatim transfer. **SET** You may not know that you can use a SET statement along with an INPUT statement. The variables in the data set are retained until the next SET statement is executed. Thus the variable \( n \) is available until the next execution of \texttt{SET} replaces it. \textbf{Determining Page Size} This variable contains the number of lines of printing set by your system. In MS Windows\textsuperscript{®} this is determined by your printing font which is set in PRINT SETUP... on the FILE menu in SAS. To determine the page size on your PC, choose PRINT SETUP... from the FILE menu and you will see something that looks like the following window. \begin{figure} \centering \includegraphics[width=\textwidth]{print_setup.png} \caption{Print Setup Window} \end{figure} \textbf{Page Size :} in the PRINT SETUP window is the value that you should use to define \texttt{PS} in the \texttt{\%LET} statement. In this case it is 78 so the statement looks like the following: \begin{verbatim} \%LET ps=78; \end{verbatim} The actual value that you choose will depend on the font size you have chosen for printing. If you are unhappy with the number of lines you can choose a different font size. A smaller size allows more output per page. \textbf{PARSING DATE DATA} Let us consider a data set that has variable-length records and date variables entered in different formats. Such a data set follows: \begin{verbatim} mel 03/07/45 red john 3/8/45 blu mel 7 mar 45 grn don 7mar45 grn mel 3/7/45 grn mike 10/27/45 vio mary 55200 vio \end{verbatim} The task can be broken down into segments. First, the input lines have to be read into variable-length records. Second, the components need to be separated. Third the date types need to be determined, and date variables need to be created. The first task involves the use of \texttt{SVARYING###. Len.} The possibility of embedded blanks makes this necessary, since the data cannot just be read freefield. The second task is rather easy because the date portion always starts in the same column, and the color is always three characters. This is not always that easy. Sometimes you have to search for the first delimiter and then pull off a name. The third task is the hardest task, as sometimes the type of date is ambiguous. In our case, it is a little easier as we can make use of the fact that day-month-year dates will always have character months. Also, month-day-year dates will always have numeric values, and some type of delimiter. Julian dates are all numeric with no delimiter, and are always of length 5 in our data set. \textbf{The Program and Output} The following program attempts to accomplish the task of reading and parsing this data set. \begin{verbatim} DATA aj; INFILE '.\vdate.dat' LENGTH=len; INPUT rest SVARYING60. len; name=SUBSTR(rest,1,5); bdate=TRIM(LEFT(SUBSTR(rest,len-(3+5»; color=SUBSTR(rest,len-2,3)); IF INDEXC(UPCASE(bdatec), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')>0 THEN bdate=INPUT(bdatec,DATE9.); ELSE IF VERIFY(TRIM(LEFT(bdatec) '0123456789')=0 THEN DO; IF LENGTH(TRIM(bdatec))=5 AND 90>SUBSTR(bdatec,1,2)>20 AND SUBSTR(bdatec,3,3)<=366 THEN bdate=INPUT(bdatec,julian5.); END; ELSE bdate=INPUT(bdatec,MMDDYV8.); PROC PRINT; FORMAT bdate DATE8.; RUN; \end{verbatim} The output produced by this program demonstrates the successful parsing and interpreting of the data. Dates are printed using a DATE8 format. <table> <thead> <tr> <th>NAME</th> <th>BDATEC</th> <th>COLOR</th> <th>BDATE</th> </tr> </thead> <tbody> <tr> <td>mel</td> <td>03/07/45</td> <td>red</td> <td>07MAR45</td> </tr> <tr> <td>john</td> <td>3/8/45</td> <td>blu</td> <td>08MAR45</td> </tr> <tr> <td>mel</td> <td>7 mar 45</td> <td>grn</td> <td>07MAR45</td> </tr> <tr> <td>don</td> <td>7mar45</td> <td>grn</td> <td>07MAR45</td> </tr> <tr> <td>mel</td> <td>3/7/45</td> <td>grn</td> <td>07MAR45</td> </tr> <tr> <td>mike</td> <td>10/27/45</td> <td>vio</td> <td>27OCT45</td> </tr> <tr> <td>mary</td> <td>55200</td> <td>vio</td> <td>19JUL55</td> </tr> </tbody> </table> Program Elements Defined You may not be familiar with a number of the program elements I use in this program. I will present a short discussion of some of the program elements that may be unfamiliar. **SUBSTR(string,begin,nchar)** This function takes the portion of the string starting at begin and will have nchar characters. Thus, `SUBSTR(rest,1,5)` will yield the first five characters of the string rest. **TRIM(LEFT(str))** These functions pare off leading and trailing blanks. **VERIFY(str,charlist)** This function returns the position of the first character in str that is not in charlist. A value of zero is returned if all of the characters in str are in the charlist. **INDEXC(str,charlist)** This function returns the position of the first character in str that is in charlist. A value of zero is returned if none of the characters in str are in the charlist. We use it here to determine if there is a character coded month imbedded in the date. **LENGTH(str)** This function returns the length of str that is in charlist. **INPUT(str,format)** This function reads a string using the format specified. If you can determine the appropriate date format for a string then you can use this function to read it. CONCLUSION We have demonstrated various uses of the $VARYING##. len format. You should find it useful any time you have variable record length data that needs to be read into a string variable for manipulation. In addition, you now have a small program that may be used to condense output. One last caution: at times you may want to do some arithmetic on the length variable **len** before using it with the $VARYING## format for example, you may want to read the string starting at some point after the beginning of the line. A variation of the above example would be to read the name separately from the rest of the line. ``` DATA a; INFILE '.\vdate.dat' LENGTH=1en; len=len-5; INPUT name $ @6 rest $VARYING60. lenn; ``` This will not work. In order to do this you will have to include a null INPUT statement to set the value of len. ``` DATA a; INFILE '.\vdate.dat' LENGTH=len; INPUT @; len=len-5; INPUT name $ @6 rest $VARYING60. lenn; ``` Other more complex examples are available on request from the author. Please make requests by email as shown below. REFERENCES ACKNOWLEDGMENTS I would like to acknowledge a number of clients whose desire for saving trees led me to design the example used here. Also, I would like to thank my colleagues, Casey Cantrel and Jonah Schlackman with whom I discussed the solution to the condensing output problem. And finally, thanks to Barbara Widawski without whose editing this manuscript would be illegible. SAS is a registered trademark or trademark of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. Windows, and Windows NT are registered trademarks or trademarks of Microsoft Corporation in the USA. ® indicates USA registration. CONTACT INFORMATION Mel Widawski Office of Academic Computing UCLA Los Angeles, CA mel@ucla.edu
{"Source-Url": "https://www.lexjansen.com/wuss/1999/WUSS99015.pdf", "len_cl100k_base": 4779, "olmocr-version": "0.1.53", "pdf-total-pages": 5, "total-fallback-pages": 0, "total-input-tokens": 15420, "total-output-tokens": 5122, "length": "2e12", "weborganizer": {"__label__adult": 0.0002440214157104492, "__label__art_design": 0.0005116462707519531, "__label__crime_law": 0.0002899169921875, "__label__education_jobs": 0.004558563232421875, "__label__entertainment": 8.96453857421875e-05, "__label__fashion_beauty": 0.00014090538024902344, "__label__finance_business": 0.0007562637329101562, "__label__food_dining": 0.0004045963287353515, "__label__games": 0.0003514289855957031, "__label__hardware": 0.0010023117065429688, "__label__health": 0.0004532337188720703, "__label__history": 0.00022149085998535156, "__label__home_hobbies": 0.0001747608184814453, "__label__industrial": 0.0006041526794433594, "__label__literature": 0.00027441978454589844, "__label__politics": 0.00023353099822998047, "__label__religion": 0.0003001689910888672, "__label__science_tech": 0.063232421875, "__label__social_life": 0.00014662742614746094, "__label__software": 0.072509765625, "__label__software_dev": 0.8525390625, "__label__sports_fitness": 0.00019657611846923828, "__label__transportation": 0.0003266334533691406, "__label__travel": 0.00019562244415283203}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 18005, 0.10632]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 18005, 0.34657]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 18005, 0.8184]], "google_gemma-3-12b-it_contains_pii": [[0, 3606, false], [3606, 7089, null], [7089, 11297, null], [11297, 14372, null], [14372, 18005, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3606, true], [3606, 7089, null], [7089, 11297, null], [11297, 14372, null], [14372, 18005, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 18005, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 18005, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 18005, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 18005, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 18005, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 18005, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 18005, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 18005, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 18005, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 18005, null]], "pdf_page_numbers": [[0, 3606, 1], [3606, 7089, 2], [7089, 11297, 3], [11297, 14372, 4], [14372, 18005, 5]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 18005, 0.0894]]}
olmocr_science_pdfs
2024-12-09
2024-12-09
ca495570902d7830331aa27cc0e335c3a700ae86
Integration of a Multilingual Preordering Component into a Commercial SMT Platform Anita Ramm, a Riccardo Superbo, b Dimitar Shterionov, b Tony O’Dowd, b Alexander Fraser c a IMS, University of Stuttgart b KantanMT.com c CIS, LMU Munich Abstract We present a multilingual preordering component tailored for a commercial Statistical Machine translation platform. In commercial settings, issues such as processing speed as well as the ability to adapt models to the customers’ needs play a significant role and have a big impact on the choice of approaches that are added to the custom pipeline to deal with specific problems such as long-range reorderings. We developed a fast and customisable preordering component, also available as an open-source tool, which comes along with a generic implementation that is restricted neither to the translation platform nor to the Machine Translation paradigm. We test preordering on three language pairs: English→Japanese/German/Chinese for both Statistical Machine Translation (SMT) and Neural Machine Translation (NMT). Our experiments confirm previously reported improvements in the SMT output when the models are trained on preordered data, but they also show that preordering does not improve NMT. 1. Introduction Statistical Machine Translation (SMT) is still the most widely used machine translation paradigm in commercial translation services. Unlike previous approaches, SMT models can be trained very fast and do not require any language-specific knowledge, but only parallel bilingual data. Translation quality in SMT typically depends on the quality and quantity of the training data, but also on the syntactic and morphological differences between the source and the target languages. One of the most common and well analysed problems in SMT is how to place translated words in the correct order with respect to the target language. Often, when the source language (SL) and the target language (TL) have a different syntax, SMT places the TL words in incorrect positions or even omits them. The former case hinders translation fluency, but usually does not strongly affect the meaning of the translation. The latter case, however, damages translation adequacy and may have a negative effect on the conveyed meaning, because specific information given in the source may be missing in the translation. One of the simplest, yet most effective ways to deal with reordering problems in SMT is to move the words in the SL to positions that are typical of the TL prior to training and translation. This approach, called preordering, is performed using rules which describe movements of words or word sequences, typically expressed in terms of part-of-speech (POS) tags or syntactic subtrees. Preordering decreases the syntactic differences between SL and TL sentences and allows for a correct alignment of words in discontiguous phrases. By making the SL and TL look more similar, the long-range reorderings, which are troublesome for automatically-learnt lexicalised reordering models, become much less problematic. The work published on preordering (see Section 2) reports very impressive improvements in the translation quality. In this paper, we describe the design and the implementation of a preordering approach as well as its integration into KantanMT\(^1\), a commercial custom MT platform. Both the implementation and the integration need to observe the following set of requirements: (i) the implementation must be customisable according to the clients’ needs; (ii) the integration of preordering into the training and translation pipelines of the platform should happen seamlessly and sustain backward compatibility; and (iii) the newly integrated preordering component should add as little overhead as possible to the total training/translation time. We focus on the extendible implementation of a preordering component and show how it can be tailored to each user’s individual needs. We tested our preordering component on three language pairs: English (EN) → German (DE)/Japanese (JA)/Chinese (ZH)\(^2\), and report results gained when different parsers are used. Despite the fact that our preordering component is inspired by SMT, it can seamlessly be applied to NMT as well. Our experiments will however show that preordering does not improve NMT. The remainder of the paper is structured as follows. Section 2 briefly outlines the relevant previous work and motivates the development of the preordering component in the present work. In Section 3, we present the reordering rules for the language pairs under consideration. In Section 4, we describe in detail the implementation of the preordering component. In Section 5, we evaluate its effects within the extended MT platform. Finally, we draw conclusions in Section 6. --- \(^1\)https://kantanmt.com/ \(^2\)By Chinese, we mean Simplified Mandarin Chinese. 2. Related work Many approaches have been proposed to deal with reordering problems within SMT. One of the simplest, yet most effective methods is preordering, which involves a modification of the SL data prior to training and translation. The reordering rules are usually defined on the basis of POS tags and/or syntactic node labels in the source language parse trees. The rules may be hand-crafted or automatically derived from the word-aligned parallel texts. They may be deterministic (i.e., leading to a single reordered variant of the given source sentence) or non-deterministic (i.e., leading to several variants of the source sentence). An extensive overview of different preordering approaches is presented by Bisazza and Federico (2016). Xu et al. (2009) and Nakagawa (2015) proposed preordering methods which can be applied to many different language pairs. In a multilingual environment, such methods are certainly very convenient. Moreover, the method advanced by Nakagawa (2015) is very fast, as it does not require any linguistic preprocessing (e.g., tagging or parsing) of the training data. Thus, it additionally fits the speed requirements of commercial MT software. However, the approach discussed by Nakagawa (2015) is non-deterministic: a single source sentence is transformed into a number of different reordered variants. As such, it requires lattice-based tuning and decoding which is not supported by the in-house pipeline that we aim to extend. When many different rules can be applied to a single sentence, it also becomes difficult to track errors in the MT output which may be caused by incorrect reordering rules. In the context of commercial settings, however, we need to have the possibility to (manually) improve the rules in order to further increase the quality of the generated translations. To allow for modification and adaptation of the reordering rules, and encouraged by the simplicity of the deterministic preordering approaches as well as by the improvements reported for the deterministic rules, we present the implementation and integration of the deterministic preordering approach into a commercial, multilingual MT platform. Like Xu et al. (2009), we work with a single source language (English) which translates into three different target languages: German, Japanese and Chinese. Our method relates to the approaches proposed by Gojun and Fraser (2012) for EN→DE and Lee et al. (2010) for EN→JA translation. Both approaches use a set of deterministic hand-crafted reordering rules and apply them to the source-side (i.e., English) constituency parse trees. Both works report on significant improvements in the MT outputs. 3. Reordering rules Our rule sets are hand-crafted by the language-pair experts taking into account the rules described by Gojun and Fraser (2012) and Lee et al. (2010). English-German. The main syntactic difference between English and German is the position of the verbs. Depending on the clause type, the verbs in German may be in the second position (SVO) or in the last position (SOV) in a clause, while in English the sentence structure is always SVO. Our rule set is based on the rules described by Gojun and Fraser (2012). We defined nine reordering rules which move the verbal elements of the English verbal phrases, as well as the negation particle not. The rules are conditioned by the clause types (e.g., S, SBAR) since the position of the German verbs depends on the type of clause in which they occur. **English-Japanese.** English and Japanese differ in many syntactic aspects: the order of the clauses is different, as well as the order of the words within the clauses. An extensive overview of the differences on various syntactic levels can be found in Bisazza and Federico (2016). The rule set for Japanese is taken from Lee et al. (2010). We only applied context-free grammar (CFG) rules and omitted context-sensitive grammar (CSG) rules, since the information required for such rules is not given in our parse trees. In total, we defined seven reordering rules which change the position of specific subordinate clauses and parts-of-speech (i.e., verbs or conjunctions). Additionally, we defined one insertion rule to handle null subjects in Japanese. **English-Chinese.** To our knowledge, there is no previous work on preordering for EN→ZH. Wu (2016) manually inspected Chinese SMT output and categorised errors related to reordering problems. Relying on this work, as well as on the work on preordering for ZH→EN proposed by Wang et al. (2007), we defined a set of rules which include clause movements, such as moving subordinate clauses before main clauses, as well as various phrase movements. However, this set of rules did not lead to satisfying results and, after further investigation, we reduced the set to only two different rules: (i) moving all PPs before the modifying noun, (ii) moving only PPs with the preposition of in front of the modifying noun (this is a subset of the movements defined by the preceding rule). We report results for using either rule (i) or rule (ii)). ### 4. Implementation The KantanMT platform is based on the SMT Moses toolkit (Koehn et al., 2007). The preordering component acts as part of the data preprocessing step in the training and translation pipelines.\(^3\) It is applied to the training/testing data before all the other corpus-processing steps, such as lowercasing, cleansing, etc. Preordering is invoked only if reordering rules for the given language pair are provided. Otherwise, the processing pipeline simply skips the preordering step. \(^3\)A simplified version of the preordering component is freely available for research purposes: https://github.com/KantanLabs/KantanPreorder. 4.1. Pipeline overview The preordering component is implemented as a three-step process that uses the training, tuning and testing data in the SL (English) as input data, and reorders it sentence by sentence. The processing steps are illustrated in Figure 1. For a general sentence $\omega$, we first generate the constituent parse tree $T_\omega$. We then apply the tree modifications according to our reordering rules to generate the reordered tree $T^r_\omega$. Finally, we read out the reordered sentence $\omega^r$ from the modified tree $T^r_\omega$. ![Figure 1. Pipeline for the multilingual preordering. The figure shows tree modification for one of the rules used for Japanese.](image) **Parsing of SL data.** Our approach employs reordering of English constituent parse trees. We use the Stanford Shift-Reduce (SR) constituency parser (Zhu et al., 2013) to generate these trees mainly because of its speed (see Section 5). But our implementation also works with two other parsers: the Charniak-Johnson parser (Charniak and Johnson, 2005) and the Stanford PCFG constituency parser (Klein and Manning, 2003). The preordering component does not parse nor reorder sentences that are longer than 60 words, shorter than 5 words or contain many special characters. We impose this restriction because parsers may generate incorrect parse trees or take too long to parse such sentences. **Tsurgeon-based reordering.** For modifications of the parse trees, we employ Tsurgeon (Levy and Andrew, 2006) – a tool for parse tree editing based on regular expressions. Tsurgeon first uses a pattern, defined as a Tregex expression, to identify specific subtrees. These expressions make use of relational dependencies between tree nodes, such as immediate dominance and precedence. Once a subtree matches the pattern, Tsurgeon applies basic tree transformations to it (e.g., move, insert, etc.). An example is given in Figure 1: the applied rule shows the movement (move np $-$ sbar) of the relative clause under the SBAR node (SBAR=sbar) in front ($-$) of the modifying noun phrase (NP=\(n_p\)). Before applying reordering rules to a parse tree, we modify the tree to ensure that reordering operations will not cross the clause boundaries. That is to say, no word movement will place a word outside of the corresponding clause. Afterwards, we apply the language-pair specific reordering operations. **Reading out the reordered sentences.** Given the modified parse trees, the reordered sentences are read out by gathering the terminal nodes. Subsequently, the entire source language data undergoes the tokenisation and lowercasing steps. 4.2. Optimised performance and scalability Training and translation speeds are crucial for a commercial MT system’s quality of service. To perform preordering efficiently, we developed the preordering component with a distributed software architecture, and optimised both the parser and Tsurgeon. First, we run the parser as a simple web service on the machine used for training or translation. This ensures that the parsing model is loaded into the memory prior to parsing any sentence. Furthermore, running the parser as a simple web service makes the implementation independent from the parsing software used. Next, we modify Tsurgeon and introduce a limited-depth search in order to avoid infinite loops and ensure that the reordering of a single sentence will always terminate. In case either the parser or Tsurgeon fails, we output the original sentence. This way, we preserve coherence within the training/translation data. Our preordering component uses GNU parallel (Tange, 2011) to distribute the workload on all available cores. In particular, we divide the data into as many parts as the CPUs and run preordering for each part in parallel and asynchronously. The GNU parallel tool orchestrates the execution and ensures that the output is serialised correctly. The parallel architecture leads to a substantially lower reordering time as compared to the non-parallel implementation. In a particular test case for EN→DE, involving the reordering of 5000 segments with the Stanford shift-reduce parser, the parallel implementation on 8 cores took 46.10s, whereas the serial took 263.24s. The run-time depends on the complexity of the sentences, number of the rules, the parser, as well as parsing model used, etc. Analysis of the effects of these factors on the efficiency is out of the scope of this paper and shall be addressed in future work. 4.3. Customisability Since the tree modifications are based on Tsurgeon, they are independent of the language pair for which the reordering is to be performed (as long as there is a corresponding constituent parse tree). Thanks to the well-defined syntax of the rules, it is easy to extend and/or modify the existing rule sets. In order to add reordering for a new target language (and English as the source language), it is only necessary to specify the new reordering rules. That is, no further adaptation of the training/translation pipelines is needed. Applying reordering to a new source language would, however, require the pipelines to be adapted and new parsers or models to be incorporated. In principle, this is an easy task thanks to the generic implementation of the reordering component.\footnote{In Section 5, we present our experiments with two different parsers and three different models, which is evidence of the extendibility of our tool.} Furthermore, since some rules are shared across languages, there are cases where already existing rules can be re-used for new language pairs. For instance, a rule for moving verbs at the end of the clause can be used for all SVO-SOV language pairs. Rules can be developed by anyone familiar with Tsurgeon syntax. However, language proficiency and translation experience are required in order to create a valid set of rules. 5. Evaluation We evaluated our preordering component in different settings and examined the benefit of preordering on both SMT and NMT. All models were trained on the same sets of data from the legal domain. The German models were trained on 1,018,738 parallel sentences, while for Japanese and Chinese, the training data consisted of 213,592 and 387,275 sentences, respectively. The models were tuned and tested on 500 in-domain sentences. The MT quality is evaluated in terms of BLEU (Papineni et al., 2002), TER (Snover et al., 2006) and F-Measure (Melamed et al., 2003). In addition, we give the time required to preorder the SL data used to build the translation models. 5.1. Preordering and SMT The models were trained with the SMT Moses toolkit (Koehn et al., 2007). We used Moses default settings, including the lexicalised reordering model with distortion limit of 6 words. The 5-gram language models were trained with the target side of the parallel training data. We used fast_align for word alignment (Dyer et al., 2013). Model weights were tuned with MERT (Och, 2003) with a maximum of 25 iterations. The evaluation results, as well as the total training time (including reordering and tuning time), are given in Table 1. The scores show that the quality of the translations varies when different parsers are used. For all target languages, the MT output improves for all parsers. The highest MT improvement for German (+1,39 BLEU) is obtained when the BLLIP parser is used, while the Japanese translations improve the most when reordering is performed on the output produced through the SR parser (+1,89 BLEU). The Chinese MT output profits the most from the reordering of of-PPs in the PCFG trees (+0,13 BLEU). Parsing accuracy depends on the domain and type of training data (Kummerfeld et al., 2012). It may thus be interesting to extend the preordering component with domain-dependent parsing software, as well as domain-specific parsing models. Baseline | SR | PCFG | BLLIP ---|---|---|--- | | | | EN–DE | 51.73 | 64.21 | 40.1 | 187 EN–JA | 54.02 | 78.22 | 49.44 | 135 EN–ZH | 54.07 | 68.34 | 51.33 | 235 EN–ZH | 55.92 | 77.34 | 50.92 | 235 EN–ZH | 57.47 | 69.34 | 51.34 | 235 EN–ZH | 58.47 | 69.34 | 51.34 | 235 EN–ZH | 59.47 | 69.34 | 51.34 | 235 EN–ZH | 60.47 | 69.34 | 51.34 | 235 Table 1. Automatic evaluation scores (given as percentages) for the SMT models together with the time (given in minutes) for reordering ($t_r$) and the total training time ($t_t$), including tuning. The run times relate to the 8-core CPU machines. Parsers: SR: Stanford shift-reduce parser, PCFG: Stanford PCFG parser, BLLIP: Charniak/Johnson parser. 5.2. Preordering and NMT Training setting. Our NMT models are built on the same data as our SMT models, after removing duplicates of source-target sentences. We used the open-source toolkit OpenNMT (Klein et al., 2017) to train a single RNN (Recurrent Neural Network) encoder-decoder model (Cho et al., 2014; Sutskever et al., 2014) with attention mechanism (Bahdanau et al., 2014). We used a word-segmentation with byte pair encoding (BPE) (Sennrich et al., 2016) of 25,000 operations for English and German. We built the BPE dictionary from normal-cased (i.e., lower- and upper-cased) tokens bypassing the requirement for a recasing model. For Chinese and Japanese, we used a character-based segmentation (Chung et al., 2016). Each network was trained on one GPU (NVIDIA K520, 4GB RAM) for a maximum of 15 epochs, using the ADAM (Kingma and Ba, 2015) learning optimisation function with initial learning rate of 0.005. We need to highlight that our NMT pipeline is optimised for speed (e.g., EN–JA models are built in less than 8 hours); within the scope of this work, we did not aim to build NMT models that perform better than SMT (according to the automatic metrics), but rather to explore the impact of preordering on NMT. Automatic evaluation. The evaluation scores are presented in Table 2. In addition to TER, F-Measure and BLEU, we also give the models’ perplexity during training to assess the effect of reordering on NMT engines. The scores indicate that, overall, preordering does not improve the quality of NMT models. On the contrary, all metrics, including perplexity, are better for the baseline models. However, we ought to note that the EN–ZH (ofPP) NMT model has the highest BLEU score for EN–ZH. This result, although episodic for our data, indicates that preordering can have a positive effect under certain conditions. This calls for further, in-depth analysis, which we plan to address in future work. Human evaluation. Automatic evaluation metrics often tend to misjudge NMT quality (Shterionov et al., 2017). Therefore, we carried out human evaluation tests on Chinese (80 sentences) and German (250 sentences) MT output. For each of the two Table 2. Scores (given in percentages) together with training time (given in minutes) for one epoch ($t_e$) for the baseline and reordered NMT models. The human evaluation indicates the percentage of sentences for which the translation is deemed better. <table> <thead> <tr> <th></th> <th>Baseline</th> <th></th> <th></th> <th></th> <th></th> <th>SK</th> <th></th> <th></th> </tr> </thead> <tbody> <tr> <td></td> <td>Perplexity</td> <td>TER F</td> <td>BLEU Human</td> <td>$t_e$</td> <td>Perplexity</td> <td>TER F</td> <td>BLEU Human</td> <td>$t_e$</td> </tr> <tr> <td>EN-DE</td> <td>2.83</td> <td>54.63</td> <td>63.07</td> <td>38.26</td> <td>49.2</td> <td>123</td> <td>2.94</td> <td>54.84</td> </tr> <tr> <td>EN-JA</td> <td>1.41</td> <td>27.44</td> <td>84.54</td> <td>67.66</td> <td>–</td> <td>31</td> <td>1.5</td> <td>35.28</td> </tr> <tr> <td>EN-ZH (ppNP)</td> <td>3.46</td> <td>63.34</td> <td>61.01</td> <td>27.65</td> <td>36.9</td> <td>91</td> <td>3.71</td> <td>67.15</td> </tr> <tr> <td>EN-ZH (ofPP)</td> <td>3.66</td> <td>65.48</td> <td>60.37</td> <td>28.75</td> <td>32.4</td> <td>91</td> <td>3.66</td> <td>65.48</td> </tr> </tbody> </table> Table 3. Example of baseline (B) and reordered (R) translation of a sentence EN and its reordered version ENr. The verbs are indicated in italic, while the differing object NPs are given in bold. The German reference is indicated as REF. <p>| | | |</p> <table> <thead> <tr> <th></th> <th></th> <th></th> </tr> </thead> <tbody> <tr> <td>EN</td> <td>The Commission <em>may</em>, in any case, <em>withdraw</em> <em>such products</em> or substances in accordance with Article37(2).</td> <td></td> </tr> <tr> <td>ENr</td> <td>The Commission <em>may</em>, in any case, <em>such products</em> or substances in accordance with Article37(2) <em>withdraw</em>.</td> <td></td> </tr> <tr> <td>B</td> <td>Die Kommission <em>kann</em> in jedem Fall <em>diese Produkte</em> oder Stoffe gemäß Artikel37 Absatz2 <em>zurückziehen</em>.</td> <td></td> </tr> <tr> <td>R</td> <td>Die Kommission <em>kann</em> in jedem Fall <em>solche Erzeugnisse</em> oder Stoffe gemäß Artikel37 Absatz2 <em>zurückziehen</em>.</td> <td></td> </tr> <tr> <td>REF</td> <td>Kommission <em>kann</em> in jedem Fall <em>solche Erzeugnisse</em> oder Stoffe gemäß Artikel37 Absatz2 <em>zurückziehen</em>.</td> <td></td> </tr> </tbody> </table> languages, two reviewers compared randomly selected MT sentence pairs (obtained using reordered (R) and baseline (B) training data). For EN-DE they had to indicate which of the two translations was better or whether they were the same; for EN-ZH they had to compare three translations (B, ppNP and ofPP) and score each of them on the scale of 1 to 5. We mainly notice: (i) the translation quality of the B translations is slightly better than that of the R translations, (ii) reordering does not seem to impact the placement of (single) words in the NMT output, but it may lead to syntactically completely different translations, as well as different lexical choices, and (iii) often the B models already correctly translate sentences which our preordering aims to correct. **Discussion.** Bentivogli et al. (2016) showed that NMT deals very well with word order issues for EN→DE. Mainly, this is because the RNN encoder-decoder model encapsulates knowledge of the complete input sentence. That is, a complete input sentence is mapped to a complete output sentence, contrary to phrase-based SMT where one sentence is handled phrase by phrase. This allows NMT to deal with both short- and long-distance order issues much more efficiently. Despite showing great improvement when compared to SMT, NMT still makes some mistakes in relation to the placement of words in the translations. We applied preordering on NMT to examine the possibility to reach further improvement in the NMT quality. Our experiments showed that preordering is not beneficial for NMT based on RNNs. This may be explained by the fact that preordering is applied on some, but not all source sentences (depending on the parser’s accuracy and coverage of the preordering rules), which leads to noisy training data. Although adding noise to a neural network may improve the generalisation abilities of the network (Jim et al., 1994; Bishop, 1995), in our experiments we did not use any technique to accommodate any excessive noise introduced by the reordering, which may result in a lower network performance. For future works, we plan to investigate in depth this hypothesis, and upgrade our preordering component to address performance issues, aiming to improve the translation quality of NMT models. 5.3. Processing time vs. translation quality improvement Since the processing time plays an important role for commercial MT, we ought to investigate whether the improvements reported in Section 5.1 justify the longer processing time. Given the baseline training time (see Table 1), the total training time increases by 36% for EN→DE and 15% for EN→JA when the fastest parser (SR parser) is used. BLEU improvements, and even more importantly, positive feedback of our clients, justify longer processing time for both language pairs. For Chinese, the increase is 24% for EN→ZH (of PP) and 22% for EN→ZH (ppNP). On the other hand, the PCFG (4-6 hours) and BLLIP (6-20 hours) parsers lead to a non-acceptable increase of the training time, although for German and Chinese, the best translations are obtained using the BLLIP and PCFG parser, respectively. Future work will aim at making these parsers faster so as to be usable within our commercial SMT platform. In some settings, however, an increase of processing time may be acceptable if it promises high-quality translations. For example, for translation via API, where only a few segments are translated at once, the increase in time is negligible. Furthermore, if a single model is to be used for many decoding iterations, one could consider training it using a slower, but better parser. Ultimately, it is up to the clients to decide how fast the translations of the provided test sets are to be generated. Given the evaluation results and the training times of the SMT models, we suggest employing the fastest SR parser. 6. Conclusion We presented a generic component for preordering that is integrated in the corpus preprocessing step for a commercial MT platform. Reordering of the SL sentences is based on Tsurgeon, a tool for editing parse trees based on regular expressions. Thanks to the well-defined syntax of the Tsurgeon expressions, the preordering component is easy to maintain and to extend to other language pairs. We implemented deterministic rule-based reordering because it performs well, and we can control and adapt it, if needed, to maximise the translation quality. Furthermore, due to its deterministic character, we are not forced to choose between different reorderings of a single sentence or to modify the pipeline into which the preordering component has been integrated. We described how to achieve preordering speeds that can satisfy the high performance demands of commercial MT software. We showed that a single preordering pipeline can successfully be applied to three different language pairs. Furthermore, the EN→ZH language pair has not been handled this way before. Our experiments confirmed previously reported improvements for combining preordering with SMT. Additionally, we applied preordering to NMT and observed that NMT does not generally benefit from the reordering of the source training data. In the future work, we will further investigate impact of the preordering approach on NMT. **Acknowledgements** This research was supported by the European Association for Machine Translation. **Bibliography** Gojun, Anita and Alexander Fraser. Determining the Placement of German Verbs in English-to-German SMT. In *EACL*, 2012. Sennrich, Rico, Barry Haddow, and Alexandra Birch. Neural Machine Translation of Rare Words with Subword Units. In ACL, 2016. Address for correspondence: Anita Ramm ramm@ims.uni-stuttgart.de University of Stuttgart, Institute for Natural Language Processing, Pfaffenwaldring 5b, 70569 Stuttgart, GERMANY
{"Source-Url": "https://www.degruyter.com/downloadpdf/j/pralin.2017.108.issue-1/pralin-2017-0009/pralin-2017-0009.pdf", "len_cl100k_base": 6867, "olmocr-version": "0.1.50", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 30497, "total-output-tokens": 8643, "length": "2e12", "weborganizer": {"__label__adult": 0.0005393028259277344, "__label__art_design": 0.0008168220520019531, "__label__crime_law": 0.0006880760192871094, "__label__education_jobs": 0.002162933349609375, "__label__entertainment": 0.00035119056701660156, "__label__fashion_beauty": 0.0002911090850830078, "__label__finance_business": 0.0006899833679199219, "__label__food_dining": 0.0004260540008544922, "__label__games": 0.0009946823120117188, "__label__hardware": 0.0008821487426757812, "__label__health": 0.0008602142333984375, "__label__history": 0.0004718303680419922, "__label__home_hobbies": 9.453296661376952e-05, "__label__industrial": 0.0007114410400390625, "__label__literature": 0.002468109130859375, "__label__politics": 0.0006060600280761719, "__label__religion": 0.0009183883666992188, "__label__science_tech": 0.2386474609375, "__label__social_life": 0.0002110004425048828, "__label__software": 0.04425048828125, "__label__software_dev": 0.70166015625, "__label__sports_fitness": 0.0003979206085205078, "__label__transportation": 0.0006670951843261719, "__label__travel": 0.0002435445785522461}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 33251, 0.05335]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 33251, 0.34345]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 33251, 0.88465]], "google_gemma-3-12b-it_contains_pii": [[0, 1686, false], [1686, 4885, null], [4885, 7814, null], [7814, 10629, null], [10629, 12696, null], [12696, 15662, null], [15662, 18480, null], [18480, 21406, null], [21406, 25411, null], [25411, 28283, null], [28283, 30929, null], [30929, 33251, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1686, true], [1686, 4885, null], [4885, 7814, null], [7814, 10629, null], [10629, 12696, null], [12696, 15662, null], [15662, 18480, null], [18480, 21406, null], [21406, 25411, null], [25411, 28283, null], [28283, 30929, null], [30929, 33251, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 33251, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 33251, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 33251, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 33251, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 33251, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 33251, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 33251, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 33251, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 33251, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 33251, null]], "pdf_page_numbers": [[0, 1686, 1], [1686, 4885, 2], [4885, 7814, 3], [7814, 10629, 4], [10629, 12696, 5], [12696, 15662, 6], [15662, 18480, 7], [18480, 21406, 8], [21406, 25411, 9], [25411, 28283, 10], [28283, 30929, 11], [30929, 33251, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 33251, 0.11538]]}
olmocr_science_pdfs
2024-11-27
2024-11-27
19f826f01fb01b5f3c65f7d905879d4b29dfb003
Learning and Knowledge Generation in General Games Shiven Sharma, Ziad Kobti, Scott Goodwin Abstract—General Game Playing (GGP) aims at developing game playing agents that are able to play a variety of games and in the absence of game specific knowledge, become proficient players. Most GGP players have used standard tree-search techniques enhanced by automatic heuristic learning. In this paper we explore knowledge representation and learning in GGP using Reinforcement Learning and Ant Colony Algorithms. Knowledge is created by simulating random games. We test the quality of the knowledge by comparing the performance of players using the knowledge in a variety of games. The ideas presented in this paper provide the potential for a framework for learning and knowledge representation, given the total absence of any prior knowledge. I. INTRODUCTION Historically, game playing agents were designed to be good in specific games. Knowledge and heuristics were designed by experts in that game and programmed into these agents. However, even though these players excelled in games that they were designed for, they could not play any other games. General Game Playing (GGP) focuses on the creation of agents that are able to accept rules of a game, and use them to learn how to play it, eventually displaying a high level of competence in it. This approach to game playing opens up many areas of challenging research, since the design of a successful game player must take into account aspects such as learning, knowledge representation, reasoning and pattern recognition. A. Early attempts at General Game Playing. A class of games for which a GGP approach was taken were positional games, which were formalised by [1]. Some examples of positional games include Tic-Tac-Toe, Hex and the Shannon switching games. A positional game can be defined by three sets, \( P, A, B \). Set \( P \) is a set of positions; with set \( A \) and \( B \) both containing subsets of \( P \). In other words, sets \( A \) and \( B \) represent a collection of subsets of \( P \), with each subset representing a specific positional situation of the game. The game is played with two players, with each player alternating in moves, which consist of choosing an element from \( P \). The chosen element cannot be chosen again. The aim for the first player is to construct one of the sets belonging to \( A \), whereas the aim for the second player is to construct one of the sets belonging to \( B \). Programs that are capable of accepting rules of positional games and, with practice, learn how to play the game have been developed. [1] constructed a program that is able to learn important board configurations in a 4 x 4 x 4 Tic-Tac-Toe game. This program plays about 12 times before it learns and is effectively able to play and start defeating opponents. A set of board configurations are described by means of a weighted graph. B. Current approaches to General Game Playing. The annual General Game Playing Competition [2] organised by Stanford University has been instrumental in bringing about renewed interest in GGP. The rules of the games are written in Game Description Language (GDL) [3], which is syntactically similar to prefix KIF [4]. As a consequence, most of the current research in GGP is based on the foundations laid down by the Stanford Group. The tournaments are controlled by the Game Manager (GM) which relays the game information to each Game Player (GP) and checks for legality of moves and termination of the game. Communication between players and the GM takes place in the form of HTTP messages. A more detailed description of the architecture and game rules can be found at [5]. Successful players have mostly focused on automatically generating heuristics based on certain generic features identified in the game. Cluneplayer [6] was the winner of the first GGP competition, followed by Fluxplayer [7]. Both these players, along with UTexas Larg [8] use automatic feature extraction. Evaluation functions are created as a combination of these features and are updated in real-time to adapt to the game. Another approach that has been taken is in [9], where transfer of knowledge extracted from one game to another is explored by means of a TD(\( \lambda \)) based reinforcement learner. CADIA-Player [10] was the first General Game Player to use a simulation based approach, using UCT [11] to search for solutions, and was the winner of the last GGP Competition. [12] also explored a Monte-Carlo approach in which random simulations were generated and the move with the highest win rate was selected. To improve the nature of these simulations, patterns in the sequences were extracted and used to generate new sequences. [13] have discussed a co-evolutionary approach using NEAT [14], an algorithm for automatically evolving neural networks using an evolutionary approach, for GGP. Though a number of players have been created, as discussed above, that are quite effective for General Games, to the best of our knowledge not much research has gone into exploring how to learn and create knowledge for General Games. An advantage of creating and storing knowledge is that when the same game is encountered again, knowledge already learnt can be used to give a better performance. The main aim of this paper is to explore learning and creation of such knowledge from just the game rules given in GDL. More specifically, in this paper we examine the learning. and knowledge generation for General Two-Player turn-based Zero-sum games, which constitute a large part of GGP set. The ideas presented here can be extended to other types of games as well. Random simulations of game play are generated, and Temporal Difference (TD) Learning [15] is used to learn value functions for states. These values indicate the probability of winning from those states. Exploration in these simulations is done using techniques from Ant Colony Optimisation Algorithms [16]. Section 2 provides a short introduction to TD-Learning and ACO algorithms. Section 3 discusses the knowledge representation and creation algorithms. In Section 4 we compare the performance of players using the knowledge in a variety of games. Finally in Section 5, we discuss the conclusions and directions for future work. II. PRELIMINARIES In this section a brief introduction to Reinforcement Learning, Temporal Difference Learning and Ant Colony Optimisation Algorithms (ACO) is given. A. Reinforcement Learning: Temporal Difference Learning Reinforcement Learning (RL) [15] constitutes a general class of learning techniques well suited for learning via interaction with the environment. A key feature of RL is the policy \( \pi \), which tells the agent which action to take from a given state. \( \pi \) can be either stochastic or deterministic. Upon taking an action, the agent receives an immediate reward \( r \). The goal of the agent is to maximise the cumulative reward it receives, starting from a state \( s_0 \). In order to model this goal, value functions are associated with states, denoted by \( V(s) \) and state-action pairs, denoted by \( Q(s,a) \). The functions represent the total reward (discounted or undiscounted, depending on the problem formulation) the agent can obtain from state \( s \) and following policy \( \pi \). In this paper however, we will omit the superscript \( \pi \) for simplicity. RL aims at learning \( \pi^* \), an optimal policy, that will give the agent the maximum reward. Temporal Difference (TD) Learning algorithms are a family of RL algorithms that learn through errors in the value functions at each temporal step in the state sequence. The simplest algorithm is TD(0), which updates the value functions at each temporal step in the state sequence. \[ V(s) \leftarrow V(s) + \alpha \left[ r + \gamma V(s') - V(s) \right] \quad \text{target for TD(0)} \] \( \alpha \) is called the learning rate, and usually decreases over time. \( r \) is the reward received after transitioning from \( s \) to \( s' \). The update can be thought of as moving the previous value function for \( s \) towards the value given by the target. The update shown in Equation (1) is used to learn state value functions. Algorithms such as SARSA [15] and Q-Learning [17] are used to learn action-value functions. Value functions are typically represented as tables, with one entry for each state or state-action pair. However, in problems with large state spaces, this is not practical. In such cases, function approximation techniques are used with parameterised functional forms of states, using a parameter vector \( \theta \). State values are therefore calculated entirely from this vector, and changes are made to the parameters instead of each individual state. The representation of the parameter vector depends on the problem formulation. One of the most famous applications of TD Learning to games is TD-Gammon [18], a backgammon player, which uses TD(\( \lambda \)), a TD Learning algorithm. Neural Networks (NN) are used to approximate the value functions of states, with each node in the NN corresponding to a single parameter. Using a number of simulated self-play games, TD gammon was able to reach the level of grandmasters in backgammon. B. Ant Colony Optimisation Algorithms Ant Colony Optimisation Algorithms (ACO) were developed by [19]. They take inspiration from the behaviour of ants in nature. In nature, ants wander randomly, searching for food. Once they have found food, they return to their colony while laying down pheromone trails. These act as a guide for other ants in the future. When other ants find such a path, instead of wandering around randomly, they are more likely to follow the trail and further reinforce it by their pheromone deposits if they are successful. Since pheromone evaporates over time, shorter paths are more likely to have a stronger concentration of deposits. As a consequence, over time, short paths get favoured by more and more ants. This approach is applied in computer science to solve optimisation and path finding problems, such as in [20], using multiple agents (the ants) that move around in the problem space in search of the desired solutions. We now describe the basic idea behind ACO algorithms. Two key parameters that determine the state transitions are the desirability (or attractiveness), \( \eta_{ij} \), and the pheromone level, \( \tau_{ij} \), of the path (or arc) between the two states \( i \) and \( j \). \( \eta_{ij} \) is usually represented by a predefined heuristic, and therefore indicates an a priori fitness of the path. On the other hand, \( \tau_{ij} \) indicated the past success of the move, and therefore represents a posteriori fitness of the path. The update for \( \tau_{ij} \) take place once all the ants have finished foraging. Given these two parameters, the probability of selecting a path \( p_{ij} \) between states \( i \) and \( j \) is given by (2) \[ p_{ij} = \frac{\left( \tau_{ij}^\alpha \right) \left( \eta_{ij}^\beta \right)}{\sum_{s \in M} \left( \tau_{is}^\alpha \right) \left( \eta_{is}^\beta \right)} \] \( \alpha \) and \( \beta \) are user-defined parameters that determine how much influence should be given to the trail strength and desirability respectively. \( M \) is the set of all legal moves that can be made from state \( i \). Once all the ants have finished foraging through the state space, the trails are updated as \[ \Delta \tau_{ij}(t) = \rho \tau_{ij}(t-1) + \Delta \tau_{ij} \] \( \Delta \tau_{ij} \) is the cumulative accumulation of pheromone by each ant that has passed between \( i \) and \( j \) and \( t \) represents the time step. $\rho$ is called the *evaporation* parameter, and determines by what value the previous trail level decreases. This gradual evaporation prevents the ants from converging to a locally optimal solution, and also assists in exploration. ### III. Knowledge Representation and Learning For GGP, in the context of RL, the basic goal can be thought of as learning a policy (and consequently, a value function) that, given a state, returns the action (move) which gives us the greatest probability of winning. TD(0) learning is used to learn these values, and ACO ideas are used to strengthen paths between states so as to guide future simulations for learning. In our previous work, we explored using Monte-Carlo RL for training features (without dividing them temporally) along with historic values of moves [21] and using ACO algorithms for GGP by using states explicitly instead of features [22]. This paper builds upon the ideas and results seen from these approaches. In this section we discuss in detail how learning takes place using simulations, and how knowledge is represented and created. We begin by first describing the knowledge representation scheme. Then we discuss the learning algorithms, and how the learnt knowledge can be used. #### A. Knowledge Representation We first consider the problem of representing the states. Since the number of states in most games is extremely large, using a table with an entry for a value function of each state is impractical. Therefore, we approximate the state representations by using features to represent each state. In the context of the game descriptions given in GDL, this can be done as follows. States in GDL are represented as a set of ordered tuples, each of which specifies a certain feature of the state. For example, in Tic-Tac-Toe, $mark(1, 1, X)$ specifies that the cell in row 1 and column 1 is marked with an X. Therefore, a state in Tic-tac-Toe is represented as a set of 9 such tuples, each specifying whether a cell is blank or contains an X or an O. Figure 1 given as example of a state in Tic-Tac-Toe and the corresponding features associated with it. Note that the elements of the feature vector in Figure 1 are represented as strings for clarity. In reality, each element $\theta$ of the vector can be viewed as a 2-tuple $< \varsigma, \upsilon >$, consisting of the string $\varsigma$ representing the feature and its corresponding value $\upsilon \in \mathbb{R}$. From now on, whenever we talk about features, whether we are referring to the string or the value will be clear depending on the context. These feature values are used to give an approximation of the value of the state. For example, given a state $s$ represented by a feature vector $\vec{\theta}$. The value of the state is given as $$V(S) = \sigma \left( \sum_{\upsilon \in \theta} \upsilon \right)$$ (4) where the sigmoid function, a special form of the logistic function, is defined as $$\sigma(t) = \frac{1}{1 + e^{-t}}$$ (5) The sigmoid function squashes the value of the summation to be between 0 and 1. As a result, it becomes natural to consider the value of a state as the probability of winning from that state. For example, with initial values of 0 for all features, the value of a state as a result of the operations described is 0.5, indicating an equal chance for a win or a loss. TD(0) learning is used to learn the values for each feature. Figure 2 illustrates how the knowledge is represented and used. #### B. Temporal Segmentation of Features We have seen how to represent the state space by using features from the game description. However, consider the effect of using a single set of all the features for the entire state space. Since a single feature may be shared by many states, a change in the value of a single feature affects the value of all the states that share that feature. In most cases, the change improves the value of some states (a positive effect), while degrading the value of other states (a negative effect). Since the representation discussed above is linear, it is impossible for all states to be classified accurately by the features. The best we can do is try to minimise the negative effects of changes in feature values. This is done by not using a single set of features for the entire state space, but using a set of features to represent states at a unique temporal level. Each temporal level in the context of games is a turn the player is in. Figure 3 illustrates this idea. The tree shown is an example of a game tree. The circular nodes are the states the player is in, and the square nodes are the afterstates, i.e. the states resulting after the player makes a move. A temporal level is associated with each level of the afterstates in the game tree. Using sets of features for each temporal level allows for the features to be associated with a smaller set of states, thereby minimising the negative effects of changes in feature values during TD(0) learning. ![Figure 3. Temporal segmentation of features. Circular nodes are nodes from which the player makes moves. Square nodes are the states that occur as a result of these moves (the afterstates).](image) C. Path Information We now discuss how to use ideas from ACO algorithms to strengthen moves between states to guide simulations during learning. The ACO approach for GGP (with pheromone and desirabilities) specifies a model for agent communication, providing a way for players to communicate with each other regarding previously seen paths and their confidence in those paths. As we have discussed before, ants transition from one state to the next based on the pheromone levels and desirabilities of the paths between the states. In the context of GGP, each ant is considered to be a player assigned a specific role (for example, black or white in Chess). Just as the features for states are associated with a particular temporal level, so are all the moves that have been made from that level. For example in Tic-Tac-Toe, for player X (player marking X), temporal level 1 will have 9 moves (one for each cell to be marked with X). Let’s see how to calculate the pheromone and desirabilities for each state. Pheromone levels in traditional ACO algorithms are represented as the reciprocal of the length of the path travelled. In the GGP case, pheromone for a path (or move) \( m \), \( \tau_m \), is represented as the average score attained through \( m \). Pheromone is not just associated with a move, but with all the features in the afterstate resulting from that move. The overall calculation of the pheromone deposit for both features and move after a series of forages (plays) has been made is shown in Equation (6) \[ \tau_m = \frac{\sum_{s \in \text{Ant}_m} \chi_s}{N_m} \quad \sum_{\theta \in \theta_{\text{Ant}_m}} \chi_s = N_{\theta} \] Ant\(_m\) is the set of all ants \( a \) that went foraging and made move \( m \). \( \chi_s \) is the final score associated with each game sequence that includes \( m \). \( N_m \) and \( N_{\theta} \) are the number of times during a forage the move and feature were seen. \( \theta_{L,s} \) is the set of features in state (more specifically, the afterstate) \( s \) at temporal level \( L \). Pheromone evaporation follows the formula in Equation (3). The desirability of a move \( m \) and feature \( \theta \) is simply the historic average score. It is similar to the way pheromone is represented, but while the pheromone is calculated as the average score per forage set, the desirability is the average score accumulated throughout the learning. In order to calculate the pheromone and desirability during action selection for learning, the average of the pheromone and desirability values for the action and the features of the resulting afterstate is taken. D. TD(0) Update The final update to be considered is the update of value functions of states using TD(0) learning. The update of the value function is in essence the update of a set of features. Given a state \( s_l \) at temporal level \( l \) and a state \( s_{l'} \) at the next temporal level \( l' \), the update for feature value \( v_s \) of each feature \( \chi_s \) present in \( s \) is done as shown in Equation (7). Note that \( \gamma \) is set to 1 and \( r \) is defined as 0 for each step, except at the final time step when it is equal to the final outcome of the game. \( V(s_{l'}) \) becomes 0 if \( s_{l'} \) is a terminal state. \( |s_l| \) is the number of features in \( |s_l| \). \[ \delta = \frac{r + V(s_{l'}) - V(s_l)}{|s_l|} \Rightarrow v_s = v_s + \alpha \delta \] E. The Learning Algorithm Now we present the algorithm for learning. The entire algorithm is given in Algorithm (1). Various implementation details regarding updates are omitted as they follow from the equations presented in the preceding subsections. State features and moves are added on-the-fly to the corresponding temporal level as and when they are observed during simulations. Knowledge is created for both players. During simulations, moves are selected using \( \epsilon - \text{greedy} \) selection. With probability \( 1 - \epsilon \), the move maximising \( V(s) \times \tau_s \times \eta_s^{\theta} \) is selected. With probability \( \epsilon \), moves are selected using Equation (2). This is expressed implicitly in line 12 of Algorithm (1). In line 10, moves are selected greedily. The probability of querying the opponents’ knowledge base is controlled by a user defined variable. Trails in line 20 is... a tuple $\langle$afterstate, move$\rangle$, consisting of the move and the corresponding afterstate reached by making that move. **Algorithm 1** GGP-Knowledge 1: Initialise each $Ant \in Ants$ with a unique role 2: Initialise KB as an empty set 3: Initialise allGameSequences as an empty list 4: while numberOfForages \leq totalForages do 5: for all $Ant \in Ants$ do 6: currentState $\leftarrow$ current state of the game 7: gameSequence $\leftarrow$ empty list 8: while terminal state of game is not reached do 9: if not turn of $Ant$.role then 10: make random move $m$ or consult KB for move $m$ 11: else if turn of $Ant$.role then 12: select move $m \in legalMoveList$ using KB 13: end if 14: currentState $\leftarrow$ updateState(currentState, $m$) 15: gameSequence.add(currentState, $m$) 16: end while 17: allGameSequences.add(gameSequence) 18: Perform TD(0) update on gameSequence 19: end for 20: for all Trails $t \in allGameSequences$ do 21: updatePheromone(t) 22: updateDesire(t) 23: end for 24: end while **IV. EXPERIMENTAL RESULTS** In order to test the general quality of the knowledge, 1000 matches of several games are played between a player using the knowledge and a uniform random player (player makes moves randomly with a uniform distribution). To compare the effectiveness, we also present results of 2500 matches of the same games against two uniform random players. The games played are standard 3-by-3 Tic-Tac-Toe (3 T-T-T), large 5-by-5 Tic-Tac-Toe (5 T-T-T), Connect-4, Breakthrough, Checkers and Minichess. The results are divided by role, with knowledge being used by each player. Player 1 refers to the player who makes the first move at the start of the game. The players were all written in Java. The game rules in GDL are converted to Prolog, and YProlog [23], a Prolog inference engine in Java, is used. The learning rate was set to 0.99, and was decreased by a factor of 0.01 after each forage. The pheromone and desirability influence factors were set to 0.6 and 0.8 respectively. Opponent query probability was 0.5. 40 ants were created, which went collectively into 150 forages (for a total of 6000 simulations). Table I shows the results of 2500 games when both players play randomly. A large number of games is used so as to get a fairly accurate distribution of outcomes between the two players. The results are expressed as a percentage. **Table I** <table> <thead> <tr> <th>Games</th> <th>Player 1</th> <th>Player 2</th> </tr> </thead> <tbody> <tr> <td></td> <td>Win</td> <td>Loss</td> </tr> <tr> <td>3 T-T-T</td> <td>57.84</td> <td>30.28</td> </tr> <tr> <td>5 T-T-T</td> <td>23.44</td> <td>15.48</td> </tr> <tr> <td>Connect-4</td> <td>54.7</td> <td>45.3</td> </tr> <tr> <td>Breakthrough</td> <td>51.3</td> <td>48.7</td> </tr> <tr> <td>Checkers</td> <td>41.8</td> <td>41.6</td> </tr> <tr> <td>Minichess</td> <td>4.36</td> <td>95.64</td> </tr> </tbody> </table> Now we consider the results when knowledge is being used. Table II shows the results when Player 1 uses knowledge and Player 2 plays randomly. Table III shows the results when Player 2 uses knowledge and Player 1 plays randomly. The results are expressed as a percentage. Players using the knowledge select moves greedily. As can be clearly seen, the knowledge results in a huge improvements in the playing abilities of the player using it. It is also interesting to note from Table I that learning can be biased for each player depending on which player makes the first move, as the percentage of winning sequences is not (relatively) evenly distributed for each player in all games. Perhaps the most interesting result is that in Minichess, where in a random case, player 1 looses quite badly compared to player 2, but outperforms player 2 when knowledge is being used (as compared to when player 2 uses knowledge). It can be argued that in a competitive scenario, players are not going to be purely random. This is indeed true, but the main aim of our experiments is to test the quality of knowledge and consequently, its impact on game playing. performance. Playing against a standard, random player gives a basic, fairly accurate, comparison and test. However, it is also true that for a more thorough testing of the quality of the knowledge, games need to be played against a larger variety of players. Unfortunately, we did not have access to other GGP players that have been developed and deployed in the competitions. We hope to get in touch with the authors in the very near future and try to get access to them. It is also important to note that in most cases, the knowledge cannot be simply used by greedily selecting moves that maximise the combination of the value functions, pheromone and desirabilities. Having established that the knowledge does indeed work, it is important to explore ways in which it can complement other existing techniques for GGP. One such approach, which we ourselves use, is the UCT (Upper Confidence bound applied to Trees) algorithm [11]. UCT, which is inspired from the UCB algorithm [24], is a simulation-based algorithm which explores trees in an asymmetric manner using Monte-Carlo sampling. It has proven to be extremely effective for games, as the current world computer Go champion Mo-Go [25] and the winner of the last GGP competition CADIA-Player [10], both use UCT in their respective frameworks. CADIA-Player actually uses basic knowledge in the form of a move-history heuristic [26] in its simulations. We attempted to use the knowledge generated as described in this paper with UCT. Knowledge in UCT can be applied in two parts, each of which corresponds to a phase in the UCT simulation. The first part in which it can be applied is when selecting nodes to descend to the next level. Typically, UCT selects all unvisited nodes at least once. Knowledge can be used to bias this selection. In the second part, upon reaching a node which has not been yet visited, a Monte-Carlo simulation is performed from that node onwards till the end (i.e. the terminal state), and a value is assigned to that node based on the outcome. Knowledge can again be used to guide the simulation, for example, by using an $\epsilon$-greedy selection with a relatively high value of $\epsilon$ (to prevent the simulation for being too biased and deterministic). The results of these preliminary experiments are shown in Table IV. A total of 100 games are played, with roles equally distributed for using the knowledge. Matches are between a player using standard UCT, $UCT_2$, and a player using knowledge for simulations and node selection, $UCT_K$. Node selection for unvisited nodes is done relative to the values learnt for that node from the knowledge. The games used were those for which the state-space is relative large, as in smaller games the differences in performance were not high. The results are promising, as there is a slight improvement in performance. However, we believe performance can indeed be improved further by exploring more efficient ways of using the knowledge with UCT. Finally, we provide the size of knowledge files created to give an idea of the memory usage. Table V lists the sizes in kilobytes. The knowledge was represented as a Java Vector with one element for each role. Each element itself consisted of a Vector of temporal levels, with each level having a Vector of features and moves. V. CONCLUSIONS AND FUTURE WORK This paper presented an answer to an interesting question: How to learn and generate an effective knowledge representation in an unknown domain? The unknown domain in this case is the set of General Two-player turn-based Zerosum games. TD(0) learning along with ACO algorithms are used to learn value functions for states. These value functions represent the probability of winning a game from that state, and are used in conjunction with the pheromone and desirability values to direct game play. Value functions are represented using linear function approximation, with states being represented as a set of features. Feature sets are associated with each temporal level (i.e. a turn in the game) to allow for a more concise representation of states. The results of the matches against a random player show a significant increase in performance of the player using the learnt knowledge, and preliminary experiments with UCT also show promise. The approach presented here can easily be extended to other types of general games. An alternative to the linear representation presented in this paper is to use a non-linear function approximator, such as a neural network. This can potentially avoid the division of features into temporal levels. For example, TD-Gammon, which uses neural networks along with Reinforcement Learning, is a prime example of how non-linear function approximators can be used effectively in games with large state spaces. An obvious advantage of using knowledge is that it can use past experience to play a better game. It is also possible to keep learning and improving the knowledge during game play, and consequently improve performance. In a UCT player knowledge can be continually trained during the Monte-Carlo play out phase. An important direction of future work will concern how to effectively utilise this knowledge with existing GGP player. architectures. An example of this was presented in the preceding section in which we used it along with a UCT player. It is possible to further improve performance by exploring ways in which it can be effectively combined with UCT. [27] observes that, for UCT-based Go, random simulations using pre-defined patterns outperform simulations using other types of knowledge. We are also looking into the automatic generation of state patterns to be used in conjunction with UCT search. For example, recognising forcing states, as described in [1], is one direction to look into. Two major assumptions are made in our approach. One is that the game descriptions use the same lexicon during game play. In the Stanford GGP competition, the lexicon is changed. We have developed a mechanism to recognise a game based on the underlying game logic, independent of the lexicon used to describe the rules, and are currently testing it thoroughly. Another assumption is that sufficient time is given to generate the knowledge. In the Stanford GGP competition, a fixed amount of time is given before start of play and to make each move, making knowledge generation prior to game play, especially for large games, difficult. However, simulation-based approaches, like the one used to generate knowledge in our approach, are easy to parallelise. [10] was parallelised during the final GGP matches in the last competition, and won the tournament. Therefore, another important direction in our work will involve looking into ways to parallelise the knowledge generation algorithm. Time taken during training can also be significantly reduced by using hashing for feature retrieval. Knowledge transfer in game playing is also an interesting direction to look into. If knowledge learnt in one game can be somehow used to boost performance in similar (but not identical) games, then that would be very useful. This has been explored in [9]. Ideally, a game player should have both game-specific and general-game knowledge. We hope to explore this avenue in the future. GGP presents a multitude of challenges that spans disciplines such as Machine Learning, Knowledge Representation, Reasoning, Planning and Pattern Recognition. This paper looked into tackling the challenge of learning and representing knowledge. One can consider GGP to be a special case of the larger area of General Problem Solving (GPS). Though we are still far away from constructing a perfect General Problem Solver, research and exploration into GGP can provide some insights into larger, more daunting questions, especially those pertaining to GPS. ACKNOWLEDGMENTS This work was funded in part by an NSERC Discovery grant. REFERENCES
{"Source-Url": "http://www.site.uottawa.ca/~sshar009/cig08.pdf", "len_cl100k_base": 7472, "olmocr-version": "0.1.50", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 26077, "total-output-tokens": 9306, "length": "2e12", "weborganizer": {"__label__adult": 0.001941680908203125, "__label__art_design": 0.0012292861938476562, "__label__crime_law": 0.0024356842041015625, "__label__education_jobs": 0.005336761474609375, "__label__entertainment": 0.0008969306945800781, "__label__fashion_beauty": 0.0010852813720703125, "__label__finance_business": 0.0011749267578125, "__label__food_dining": 0.0025997161865234375, "__label__games": 0.28076171875, "__label__hardware": 0.003782272338867187, "__label__health": 0.0027141571044921875, "__label__history": 0.0017919540405273438, "__label__home_hobbies": 0.0005288124084472656, "__label__industrial": 0.00243377685546875, "__label__literature": 0.0017461776733398438, "__label__politics": 0.0014095306396484375, "__label__religion": 0.001809120178222656, "__label__science_tech": 0.2177734375, "__label__social_life": 0.0003616809844970703, "__label__software": 0.00943756103515625, "__label__software_dev": 0.4521484375, "__label__sports_fitness": 0.003725051879882813, "__label__transportation": 0.0018911361694335935, "__label__travel": 0.0008945465087890625}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 37322, 0.03786]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 37322, 0.56979]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 37322, 0.93815]], "google_gemma-3-12b-it_contains_pii": [[0, 5486, false], [5486, 11708, null], [11708, 15963, null], [15963, 21239, null], [21239, 25400, null], [25400, 30625, null], [30625, 37322, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5486, true], [5486, 11708, null], [11708, 15963, null], [15963, 21239, null], [21239, 25400, null], [25400, 30625, null], [30625, 37322, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 37322, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 37322, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 37322, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 37322, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 37322, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 37322, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 37322, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 37322, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 37322, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 37322, null]], "pdf_page_numbers": [[0, 5486, 1], [5486, 11708, 2], [11708, 15963, 3], [15963, 21239, 4], [21239, 25400, 5], [25400, 30625, 6], [30625, 37322, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 37322, 0.05806]]}
olmocr_science_pdfs
2024-12-03
2024-12-03
1b2c19b2465f56c32a4f6cdd956e00a762b7291f
Synchronizing Data Structures Overview - caches and atomics - list-based set - memory reclamation - Adaptive Radix Tree - B-tree - Bw-tree - split-ordered list - hardware transactional memory modern CPUs consist of multiple CPU cores and - per-core registers - per-core write buffers - per-core caches (L1, L2) - shared cache (L3) - shared main memory Cache Organization - caches are organized in fixed-size chunks called *cache lines* - on Intel CPUs a cache line is 64 bytes - data accesses go through cache, which is transparently managed by the CPUs - caches implement a replacement strategy to evict pages - associativity: how many possible cache locations does each memory location have? Cache Coherency Protocol - although cores have private caches, the CPU tries to hide this fact - CPU manages caches and provides the illusion of a single main memory using a *cache coherency protocol* - example: MESI protocol, which has the following states: - *Modified*: cache line is only in current cache and has been modified - *Exclusive*: cache line is only in current cache and has not been modified - *Shared*: cache line is in multiple caches - *Invalid*: cache line is unused - Intel uses the MESIF protocol, with an additional *Forward* state - *Forward* is a special *Shared* state indicating a designated “responder” Optimizations - both compilers and CPUs reorder instructions, eliminate code, keep data in register, etc. - these optimizations are sometimes crucial for performance - for single-threaded execution, compilers and CPUs guarantee that the semantics of the program is unaffected by these optimizations (as if executed in program order) - with multiple threads, however, a thread may observe these “side effects” - in order to write correct multi-threaded programs, synchronization primitives must be used Example ```c++ int global(0); void thread1() { while (true) { while (global%2 == 1); // wait printf("ping\n"); global++; } } void thread2() { while (true) { while (global%2 == 0); // wait printf("pong\n"); global++; } } ``` C++11 Memory Model - accessing a shared variable by multiple threads where at least thread is a writer is a race condition - according to the C++11 standard, race conditions are *undefined behavior* - depending on the compiler and optimization level, undefined behavior may cause *any* result/outcome - to avoid undefined behavior when accessing shared data one has to use the `std::atomic` type \[1\] - atomics provide atomic load/stores (no torn writes), and well-defined ordering semantics \[1\] `std::atomic` is similar to Java’s `volatile` keyword but different from C++’s `volatile` Atomic Operations in C++11 • compare-and-swap (CAS): `bool std::atomic_compare_exchange_strong(T& expected, T desired)` • there is also a weak CAS variant that may fail even if expected equals desired, on x86-64 both variants generate the same code • exchange: `std::exchange(T desired)` • arithmetic: addition, subtraction • logical: and/or/xor Naive Spinlock (Exchange) ```cpp struct NaiveSpinlock { std::atomic<int> data; NaiveSpinlock() : data(0) {} void lock() { while (data.exchange(1)==1); } void unlock() { data.store(0); // same as data = 0 } }; ``` Naive Spinlock (CAS) ```c++ struct NaiveSpinlock { std::atomic<int> data; NaiveSpinlock() : data(0) {} void lock() { int expected; do { expected = 0; } while (!data.compare_exchange_strong(expected, 1)); } void unlock() { data.store(0); // same as data = 0 } }; ``` Sequential Consistency and Beyond - by default, operations on `std::atomic` types guarantee *sequential consistency* - non-atomic loads and stores are not reordered around atomics - this is often what you want - all `std::atomic` operations take one or two optional `memory_order` parameter(s) - allows one to provide less strong guarantees (but potentially higher performance), the most useful ones on x86-64 are: - `std::memory_order::memory_order_seq_cst:` sequentially consistent (the default) - `std::memory_order::memory_order_release` (for stores): may move non-atomic operations before the store (i.e., the visibility of the store can be delayed) - `std::memory_order::memory_order_relaxed:` guarantees atomicity but no ordering guarantees - nice tutorial: [https://assets.bitbashing.io/papers/lockless.pdf](https://assets.bitbashing.io/papers/lockless.pdf) --- 2 sometimes useful for data structures that have been built concurrently but are later immutable Spinlock ```cpp struct Spinlock { std::atomic<int> data; Spinlock() : data(0) {} void lock() { for (unsigned k = 0; !try_lock(); ++k) yield(k); } bool try_lock() { int expected = 0; return data.compare_exchange_strong(expected, 1); } void unlock() { data.store(0, std::memory_order::memory_order_release); } void yield(); }; ``` Yielding // adapted from Boost library void Spinlock::yield(unsigned k) { if (k < 4) { } else if (k < 16) { _mm_pause(); } else if ((k < 32) || (k & 1)) { sched_yield(); } else { struct timespec rqtp = { 0, 0 }; rqtp.tv_sec = 0; rqtp.tv_nsec = 1000; nanosleep(&rqtp, 0); } } Lock Flavors - there are many different lock implementations - C++: `std::mutex, std::recursive_mutex` - pthreads: `pthread_mutex_t, pthread_rwlock_t` - on Linux blocking locks are based on the `futex` system call - [https://www.threadingbuildingblocks.org/docs/help/tbb_userguide/Mutex_Flavors.html](https://www.threadingbuildingblocks.org/docs/help/tbb_userguide/Mutex_Flavors.html): <table> <thead> <tr> <th>TBB type</th> <th>Scalable</th> <th>Fair</th> <th>Recursive</th> <th>Long Wait</th> <th>Size</th> </tr> </thead> <tbody> <tr> <td>mutex</td> <td>OS dependent</td> <td>OS dependent</td> <td>no</td> <td>blocks</td> <td>≥ 3 words</td> </tr> <tr> <td>recursive_mutex</td> <td>OS dependent</td> <td>OS dependent</td> <td>yes</td> <td>blocks</td> <td>≥ 3 words</td> </tr> <tr> <td>spin_mutex</td> <td>no</td> <td>no</td> <td>no</td> <td>yields</td> <td>1 byte</td> </tr> <tr> <td>speculative_spin_mutex</td> <td>HW dependent</td> <td>no</td> <td>no</td> <td>yields</td> <td>2 cache lines</td> </tr> <tr> <td>queuing_mutex</td> <td>yes</td> <td>yes</td> <td>no</td> <td>yields</td> <td>1 word</td> </tr> <tr> <td>spin_rwlock_mutex</td> <td>no</td> <td>no</td> <td>no</td> <td>yields</td> <td>1 word</td> </tr> <tr> <td>speculative_spin_rwlock_mutex</td> <td>HW dependent</td> <td>no</td> <td>no</td> <td>yields</td> <td>3 cache lines</td> </tr> <tr> <td>queuing_rwlock_mutex</td> <td>yes</td> <td>yes</td> <td>no</td> <td>yields</td> <td>1 word</td> </tr> <tr> <td>null_mutex</td> <td>moot</td> <td>yes</td> <td>yes</td> <td>never</td> <td>empty</td> </tr> <tr> <td>null_rwlock_mutex</td> <td>moot</td> <td>yes</td> <td>yes</td> <td>never</td> <td>empty</td> </tr> </tbody> </table> Atomics on x86-64 - atomic operations only work on 1, 2, 4, 8, or 16 byte data that is aligned - atomic operations use lock instruction prefix - CAS: `lock cmpxchg` - exchange: `xchg` (always implicitly locked) - read-modify-write: `lock add` - memory order can be controlled using fences (also known as barriers): `_mm_lfence()`, `_mm_sfence()`, `_mm_mfence()` - locked instructions imply full barrier - fences are very hard to use, but atomics generally make this unnecessary x86-64 Memory Model - x86-64 implements Total Store Order (TSO), which is a strong memory model - this means that x86 mostly executes the machine code as given - loads are not reordered with respect to other loads, writes are not reordered with respect to other writes - however, writes are buffered (in order to hide the L1 write latency), and reads are allowed to bypass writes - a fence or a locked write operations will flush the write buffer (but will not flush the cache) - important benefit from TSO: sequentially consistent loads do not require fences Weakly-Ordered Hardware - many microarchitectures (e.g., ARM) are weakly-ordered - on the one hand, on such systems many explicit fences are necessary - on the other hand, the CPU has more freedom to reorder - ARMv8 implements acquire/release semantics in hardware (lda and str instructions) - https://en.wikipedia.org/wiki/Memory_ordering: <table> <thead> <tr> <th></th> <th>Alpha</th> <th>ARM v7</th> <th>IBM POWER</th> <th>zArch</th> <th>SPARC RMO</th> <th>PSO</th> <th>TSO</th> <th>Intel x86</th> <th>Intel x86-64</th> <th>Intel IA-64</th> </tr> </thead> <tbody> <tr> <td>Loads reord. after loads</td> <td>Y</td> <td>Y</td> <td>Y</td> <td>Y</td> <td>Y</td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>Loads reord. after stores</td> <td>Y</td> <td>Y</td> <td>Y</td> <td>Y</td> <td>Y</td> <td>Y</td> <td>Y</td> <td></td> <td></td> <td>Y</td> </tr> <tr> <td>Stores reord. after stores</td> <td>Y</td> <td>Y</td> <td>Y</td> <td>Y</td> <td>Y</td> <td>Y</td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>Stores reord. after loads</td> <td>Y</td> <td>Y</td> <td>Y</td> <td>Y</td> <td>Y</td> <td>Y</td> <td>Y</td> <td>Y</td> <td></td> <td></td> </tr> <tr> <td>Atomic reord. with loads</td> <td>Y</td> <td>Y</td> <td>Y</td> <td>Y</td> <td>Y</td> <td>Y</td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>Atomic reord. with stores</td> <td>Y</td> <td>Y</td> <td>Y</td> <td>Y</td> <td>Y</td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>Dependent loads reord.</td> <td>Y</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>Incoh. instr. cache pipel.</td> <td>Y</td> <td>Y</td> <td>Y</td> <td>Y</td> <td>Y</td> <td>Y</td> <td>Y</td> <td>Y</td> <td></td> <td></td> </tr> </tbody> </table> Concurrent List-Based Set - operations: `insert(key)`, `remove(key)`, `contains(key)` - keys are stored in a (single-)linked list sorted by key - `head` and `tail` are always there ("sentinel" elements) Why CAS Is Not Enough - thread A: remove(7) - thread B: insert(9) Coarse-Grained Locking - use a single lock to protect the entire data structure + very easy to implement - does not scale at all Lock Coupling - also called “hand-over-hand locking” or “crabbing” - hold at most two locks at a time - interleave lock acquisitions/release pair-wise - may use read/write locks to allow for concurrent readers + easy to implement + no restarts - does not scale Optimistic - traverse list optimistically without taking any locks - lock 2 nodes (predecessor and current) - validate: traverse list again and check that predecessor is still reachable and points to current - if validation fails, unlock and restart + lock contention unlikely - must traverse list twice - readers acquire locks Optimistic Lock Coupling - general technique that can be applied to many data structures (e.g., ART, B-tree) - associate lock with update counter - write: - acquire lock (exclude other writers) - increment counter when unlocking - do not acquire locks for nodes that are not modified (traverse like a reader) - read: - do not acquire locks, proceed optimistically - detect concurrent modifications through counters (and restart if necessary) - can track changes across multiple nodes (lock coupling) + easy to implement + scalable - restarts Non-Blocking Algorithms - killing a thread at any point of time should not affect consistency of the data structure (this precludes locks) - non-blocking data structures may be beneficial for (soft) real-time applications - classification: - wait-free: every operation is guaranteed to succeed (in a constant number of steps) - lock-free: overall progress is guaranteed (some operations succeed, while others may not finish) - obstruction-free: progress is only guaranteed if there is no interference from other threads Read-Optimized Write Exclusion (Lazy) - contains is wait-free - add/remove traverse list only once (as long as there is no contention) - add marker to each node for *logically* deleting a key - invariant: every unmarked node is reachable - contains: no need to validate; if a key is not found or is marked, the key is not in the set - add/remove: 1. lock predecessor and current 2. check that both are unmarked and that predecessor points to current 3. remove marks first, then updates next pointer of predecessor + no restarts + scalable - insert/remove lock Lock-Free List - insert and remove are lock-free, contains is wait-free - remove: marks node for deletion, but does not physically remove it - marker is stored within the next pointer (by stealing a bit of the pointer) - insert and remove: - do not traverse marked node, but physically remove it during traversal using CAS - if this CAS fails, restart from head - contains traverses marked nodes (but needs same check as Lazy variant) + contains always succeeds + scalable - insert/remove may restart ## Synchronization Paradigms <table> <thead> <tr> <th></th> <th>complexity</th> <th>scalability</th> <th>overhead</th> </tr> </thead> <tbody> <tr> <td>Coarse-Grained Locking</td> <td>+</td> <td>--</td> <td>+</td> </tr> <tr> <td>Lock Coupling</td> <td>+</td> <td>-</td> <td>~</td> </tr> <tr> <td>Optimistic</td> <td>-</td> <td>+</td> <td>-</td> </tr> <tr> <td>Optimistic Lock Coupling</td> <td>+</td> <td>+</td> <td>+</td> </tr> <tr> <td>ROWEX</td> <td>-</td> <td>+</td> <td>+</td> </tr> <tr> <td>Lock-Free</td> <td>--</td> <td>++</td> <td>--</td> </tr> </tbody> </table> ABA Problem - a compare-and-swap on a pointer structure may succeed even though the pointer has been changed in the mean time (from A to B back to A) - this is a correctness issue for some lock-free data structures (e.g., queues) - whether this problem occurs depends on data structure and the memory reclamation strategy Memory Reclamation for Lock-free Data Structures - after deleting a node in a lock-free data structure, readers might still be accessing that node - reusing that node immediately can cause correctness problems and/or crashes - one must not physically delete a node unless it is ensured that no threads can access that node - how long should one wait until the node is physically deleted? - garbage-collected languages usually do not have this problem Reference Counting - associate every node with an atomic counter + easy to use - does not scale Hazard Pointers - observation: most lock-free operations are only require a bounded number of node pointers at any point in time - during traversal, one can store these \textit{hazard} pointers into thread-local locations - before physically removing a node, check if any thread has a hazard pointer on it + non-blocking - high overhead due to required fences - error-prone (easy to miss a pointer) Epoch-Based Memory Reclamation - global epoch counter (incremented infrequently) - per-thread, local epoch counters - associate nodes to be deleted with current global epoch - defer physically deleting nodes - it is safe deleting nodes are older than the minimum of all local epochs + low overhead - a single slow thread may prevent any memory reclamation References - *The art of multiprocessor programming*, Herlihy and Nir Shavit, Morgan Kaufmann, 2008 - *The adaptive radix tree: ARTful indexing for main-memory databases*, Leis and Kemper and Neumann, ICDE 2013 - *The Bw-Tree: A B-tree for new hardware platforms*, Levandoski and Lomet and Sengupta, ICDE 2013 - *The ART of practical synchronization*, Leis and Scheibner and Kemper and Neumann, DaMoN 2016
{"Source-Url": "https://db.in.tum.de/teaching/ws1718/dataprocessing/chapter3.pdf", "len_cl100k_base": 4354, "olmocr-version": "0.1.53", "pdf-total-pages": 34, "total-fallback-pages": 0, "total-input-tokens": 42302, "total-output-tokens": 5055, "length": "2e12", "weborganizer": {"__label__adult": 0.0003807544708251953, "__label__art_design": 0.00038743019104003906, "__label__crime_law": 0.0004029273986816406, "__label__education_jobs": 0.0003247261047363281, "__label__entertainment": 6.812810897827148e-05, "__label__fashion_beauty": 0.00017750263214111328, "__label__finance_business": 0.00019550323486328125, "__label__food_dining": 0.0004470348358154297, "__label__games": 0.0006155967712402344, "__label__hardware": 0.004425048828125, "__label__health": 0.0005631446838378906, "__label__history": 0.00031447410583496094, "__label__home_hobbies": 0.00016701221466064453, "__label__industrial": 0.0007696151733398438, "__label__literature": 0.00019931793212890625, "__label__politics": 0.0003104209899902344, "__label__religion": 0.0005655288696289062, "__label__science_tech": 0.045196533203125, "__label__social_life": 7.277727127075195e-05, "__label__software": 0.006153106689453125, "__label__software_dev": 0.93701171875, "__label__sports_fitness": 0.0004317760467529297, "__label__transportation": 0.0007357597351074219, "__label__travel": 0.00025653839111328125}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 15469, 0.00972]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 15469, 0.33719]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 15469, 0.8134]], "google_gemma-3-12b-it_contains_pii": [[0, 30, false], [30, 193, null], [193, 354, null], [354, 697, null], [697, 1337, null], [1337, 1840, null], [1840, 2131, null], [2131, 2724, null], [2724, 3071, null], [3071, 3328, null], [3328, 3632, null], [3632, 4609, null], [4609, 5024, null], [5024, 5368, null], [5368, 6869, null], [6869, 7348, null], [7348, 7909, null], [7909, 9561, null], [9561, 9765, null], [9765, 9832, null], [9832, 9967, null], [9967, 10230, null], [10230, 10564, null], [10564, 11120, null], [11120, 11647, null], [11647, 12215, null], [12215, 12722, null], [12722, 13336, null], [13336, 13659, null], [13659, 14111, null], [14111, 14215, null], [14215, 14616, null], [14616, 14976, null], [14976, 15469, null]], "google_gemma-3-12b-it_is_public_document": [[0, 30, true], [30, 193, null], [193, 354, null], [354, 697, null], [697, 1337, null], [1337, 1840, null], [1840, 2131, null], [2131, 2724, null], [2724, 3071, null], [3071, 3328, null], [3328, 3632, null], [3632, 4609, null], [4609, 5024, null], [5024, 5368, null], [5368, 6869, null], [6869, 7348, null], [7348, 7909, null], [7909, 9561, null], [9561, 9765, null], [9765, 9832, null], [9832, 9967, null], [9967, 10230, null], [10230, 10564, null], [10564, 11120, null], [11120, 11647, null], [11647, 12215, null], [12215, 12722, null], [12722, 13336, null], [13336, 13659, null], [13659, 14111, null], [14111, 14215, null], [14215, 14616, null], [14616, 14976, null], [14976, 15469, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 15469, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 15469, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 15469, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 15469, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 15469, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 15469, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 15469, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 15469, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 15469, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 15469, null]], "pdf_page_numbers": [[0, 30, 1], [30, 193, 2], [193, 354, 3], [354, 697, 4], [697, 1337, 5], [1337, 1840, 6], [1840, 2131, 7], [2131, 2724, 8], [2724, 3071, 9], [3071, 3328, 10], [3328, 3632, 11], [3632, 4609, 12], [4609, 5024, 13], [5024, 5368, 14], [5368, 6869, 15], [6869, 7348, 16], [7348, 7909, 17], [7909, 9561, 18], [9561, 9765, 19], [9765, 9832, 20], [9832, 9967, 21], [9967, 10230, 22], [10230, 10564, 23], [10564, 11120, 24], [11120, 11647, 25], [11647, 12215, 26], [12215, 12722, 27], [12722, 13336, 28], [13336, 13659, 29], [13659, 14111, 30], [14111, 14215, 31], [14215, 14616, 32], [14616, 14976, 33], [14976, 15469, 34]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 15469, 0.09646]]}
olmocr_science_pdfs
2024-12-08
2024-12-08
16ce648845acd448fd02d9ed0d1d27a45c7014bb
[REMOVED]
{"Source-Url": "https://www.rug.nl/research/portal/files/64559463/faas_mubenchmark.pdf", "len_cl100k_base": 7284, "olmocr-version": "0.1.50", "pdf-total-pages": 16, "total-fallback-pages": 0, "total-input-tokens": 36025, "total-output-tokens": 8697, "length": "2e12", "weborganizer": {"__label__adult": 0.0003650188446044922, "__label__art_design": 0.0005431175231933594, "__label__crime_law": 0.00040221214294433594, "__label__education_jobs": 0.0008516311645507812, "__label__entertainment": 0.00014078617095947266, "__label__fashion_beauty": 0.00019562244415283203, "__label__finance_business": 0.0016155242919921875, "__label__food_dining": 0.00041031837463378906, "__label__games": 0.0005173683166503906, "__label__hardware": 0.00205230712890625, "__label__health": 0.0007200241088867188, "__label__history": 0.00041794776916503906, "__label__home_hobbies": 0.000125885009765625, "__label__industrial": 0.000518798828125, "__label__literature": 0.0003826618194580078, "__label__politics": 0.0003859996795654297, "__label__religion": 0.0004105567932128906, "__label__science_tech": 0.1573486328125, "__label__social_life": 0.00012254714965820312, "__label__software": 0.0225830078125, "__label__software_dev": 0.80859375, "__label__sports_fitness": 0.0002484321594238281, "__label__transportation": 0.0007076263427734375, "__label__travel": 0.00026297569274902344}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 35385, 0.03972]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 35385, 0.12866]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 35385, 0.90119]], "google_gemma-3-12b-it_contains_pii": [[0, 0, null], [0, 2351, false], [2351, 5668, null], [5668, 8690, null], [8690, 11789, null], [11789, 14342, null], [14342, 17095, null], [17095, 19724, null], [19724, 20374, null], [20374, 22245, null], [22245, 23666, null], [23666, 24933, null], [24933, 26598, null], [26598, 29446, null], [29446, 32494, null], [32494, 35385, null]], "google_gemma-3-12b-it_is_public_document": [[0, 0, null], [0, 2351, true], [2351, 5668, null], [5668, 8690, null], [8690, 11789, null], [11789, 14342, null], [14342, 17095, null], [17095, 19724, null], [19724, 20374, null], [20374, 22245, null], [22245, 23666, null], [23666, 24933, null], [24933, 26598, null], [26598, 29446, null], [29446, 32494, null], [32494, 35385, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 35385, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 35385, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 35385, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 35385, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 35385, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 35385, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 35385, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 35385, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 35385, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 35385, null]], "pdf_page_numbers": [[0, 0, 1], [0, 2351, 2], [2351, 5668, 3], [5668, 8690, 4], [8690, 11789, 5], [11789, 14342, 6], [14342, 17095, 7], [17095, 19724, 8], [19724, 20374, 9], [20374, 22245, 10], [22245, 23666, 11], [23666, 24933, 12], [24933, 26598, 13], [26598, 29446, 14], [29446, 32494, 15], [32494, 35385, 16]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 35385, 0.23649]]}
olmocr_science_pdfs
2024-11-30
2024-11-30
649211e400e05adc2dc889ac60449f2601521ca7
COMPLETE SEARCH + DYNAMIC PROGRAMMING + GREEDY COMP 321 – McGill University These slides are mainly compiled from the following resources. - Professor Jaehyun Park’ slides CS 97SI - Top-coder tutorials. - Programming Challenges books. Greedy • It makes locally optimal choice at each step with the hope of finding the optimal solution. • Key ingredients to make greedy works. • It has optimal sub-structures. • Optimal solution to the problem contains optimal solutions to the sub-problems. • It has a greedy property (remark: hard to prove its correctness!). • If we make a choice that seems best at the moment and solve the remaining subproblems later, we still reach optimal solution. We never have to reconsider our previous choices. Greedy – example 1 • Suppose we have a large number of coins with different denominations, i.e. 25, 10, 5, and 1 cents. We want to make change with the least number of coins used. • Ex. if the denominations are {25, 10, 5, 1} cents and we want to make a change of 42 cents, we can do: 42-25 = 17 → 17-10 = 7 → 7-5 = 2 → 2-1 = 1 → 1-1 = 0, of total 5 coins. This is optimal. Greedy – example 1 • Lets check the key ingredients. • It has optimal sub-structures. • We have seen that in the original problem to make 42 cents, we have to use 25+10+5+1+1. • This is an optimal 5 coins solution to the original problem! • Now, the optimal solutions to its sub-problems are contained in this 5 coins solution, i.e. • a. To make 17 cents, we have to use 10+5+1+1 (4 coins), • b. To make 7 cents, we have to use 5+1+1 (3 coins), etc Greedy – example 1 • Lets check the key ingredients. • It has a greedy property. • Given every amount $V$, we greedily subtract it with the largest denomination of coin which is not greater than this amount $V$. It can be proven that using other strategy than this will not lead to optimal solution. Greedy – example 1 • PLEASE NOTE THAT this greedy algorithm does not work for all sets of coin denominations. • e.g. {1, 3, 4} cents. To make 6 cents with that set, a greedy algorithm would choose 3 coins {4, 1, 1} instead of the optimal solution using 2 coins {3, 3}. Greedy – example 2 - Problem: - Job j starts at $s_j$ and finishes at $f_j$. - Two jobs compatible if they don't overlap. - Goal: find maximum subset of mutually compatible jobs. Greedy – example 2 • Greedy template. Consider jobs in some natural order. • Take each job provided it's compatible with the ones already taken. • [Earliest start time] Consider jobs in ascending order of $s_j$. [Counterexample for earliest start time] Greedy – example 2 - Greedy template. Consider jobs in some natural order. - Take each job provided it's compatible with the ones already taken. - [Shortest interval] Jobs in ascending order of $f_j - s_j$. [Counterexample for shortest interval] Greedy – example 2 - Greedy template. Consider jobs in some natural order. - Take each job provided it's compatible with the ones already taken. - [Fewest conflicts] For each job $j$, count the number of conflicting jobs $c_j$. Schedule in ascending order of $c_j$. [Counterexample for fewest conflicts] Greedy – example 2 - Greedy template. Consider jobs in some natural order. - Take each job provided it's compatible with the ones already taken. - [Earliest finish time] Consider jobs in ascending order of $f_j$. ``` EARLIEST-FINISH-TIME-FIRST (n, s_1, s_2, ..., s_n, f_1, f_2, ..., f_n) SORT jobs by finish time so that $f_1 \leq f_2 \leq ... \leq f_n$ A \leftarrow \emptyset \quad \text{set of jobs selected} FOR \ j = 1 \ TO \ n IF job j is compatible with A A \leftarrow A \cup \{j\} RETURN A ``` Greedy – example 3 • Problem: • Lecture j starts at $s_j$ and finishes at $f_j$. • Goal: find minimum number of classrooms to schedule all lectures so that no two lectures occur at the same time in the same room. • Ex. This schedule uses 4 classrooms to schedule 10 lectures. Greedy – example 3 - **Problem:** - Lecture $j$ starts at $s_j$ and finishes at $f_j$. - Goal: find minimum number of classrooms to schedule all lectures so that no two lectures occur at the same time in the same room. - Ex. This schedule uses 3 classrooms to schedule 10 lectures. Greedy – example 3 - Greedy template. Consider lectures in some natural order. - Assign each lecture to an available classroom (which one?); allocate a new classroom if none are available. - [Earliest finish time] Consider lectures in ascending order of $f_j$. (solution of the previous example.) Greedy – example 3 - Greedy template. Consider lectures in some natural order. - Assign each lecture to an available classroom (which one?); allocate a new classroom if none are available. - [Shortest interval] Consider lectures in ascending order of $f_j - s_j$. ``` counterexample for shortest interval 3 2 1 ``` Greedy – example 3 • Greedy template. Consider lectures in some natural order. • Assign each lecture to an available classroom (which one?); allocate a new classroom if none are available. • [Fewest conflicts] For each lecture \( j \), count the number of conflicting lectures \( c_j \). Schedule in ascending order of \( c_j \). Greedy – example 3 - Greedy template. Consider lectures in some natural order. - Assign each lecture to an available classroom (which one?); allocate a new classroom if none are available. - [Earliest start time] Consider lectures in ascending order of $s_j$. \[ \text{EARLIEST-START-TIME-FIRST} \left( n, s_1, s_2, \ldots, s_n, f_1, f_2, \ldots, f_n \right) \] \begin{align*} \text{SORT} & \text{ lectures by start time so that } s_1 \leq s_2 \leq \ldots \leq s_n. \\ \text{ } & \\ \text{ } & d \leftarrow 0 \quad \text{number of allocated classrooms} \\ \text{FOR } j = 1 \text{ TO } n \\ \text{IF lecture } j \text{ is compatible with some classroom} \\ \text{Schedule lecture } j \text{ in any such classroom } k. \\ \text{ELSE} \\ \text{Allocate a new classroom } d + 1. \\ \text{Schedule lecture } j \text{ in classroom } d + 1. \\ \text{ } & d \leftarrow d + 1 \\ \text{RETURN } & \text{ schedule.} \end{align*} Greedy – example 4 Given $1 \leq C \leq 5$ chambers which can store 0, 1, or 2 specimens, $1 \leq S \leq 2C$ specimens, and $M$: a list of mass of the $S$ specimens, determine in which chamber we should store each specimen in order to minimize IMBALANCE. \[ IMBALANCE = \sum_{i=1}^{C} |X_i - A| \quad \text{i.e. sum of differences between the mass in each chamber w.r.t } A. \text{ where } X_i \text{ is the total mass of specimens in chamber} \] \[ A = \left( \sum_{j=1}^{S} M_j \right)/C, \quad A \text{ is the average of all mass over } C \text{ chambers} \] \[ C = 3, \ S = 4, \ M = \{5, 1, 2, 7\} \\ \text{Average mass / chamber} \\ A = \left( 5 + 1 + 2 + 7 \right) / 3 = 5 \] \[ IMBALANCE = \lvert\lvert 5 - 5 \rvert + \lvert 1 - 5 \rvert + \lvert 2 - 5 \rvert = 7 + 3 + 4 = 14 \] Greedy – example 4 • Observations. • If there exists an empty chamber, at least one chamber with 2 specimens must be moved to this empty chamber! Otherwise the empty chambers contribute too much to IMBALANCE! \[ \text{IMBALANCE} = |(7+1)-5| + |(2+5)-5| + |0-5| = 3 + 2 + 5 = 10 \] Greedy – example 4 - Observations. If $S > C$, then $S-C$ specimens must be paired with one other specimen already in some chambers. If we already assign 3 specimens to 3 chambers, the 4th specimen and beyond must be paired... \[ A = 5 \] \[ \text{IMBALANCE} = |7-5| + |2-5| + |(5+1)-5| = 2 + 3 + 1 = 6 \] Greedy – example 4 • Observations. If $S < 2C$, add dummy $2C - S$ specimens with mass 0. • For example, $C = 3, S = 4, M = \{5, 1, 2, 7\} \rightarrow C = 3, S = 6, M = \{5, 1, 2, 7, 0, 0\}$. • Then, sort these specimens based on their mass such that $M_1 \leq M_2 \leq \ldots \leq M_{2C-1} \leq M_{2C}$ • For example, $M = \{5, 1, 2, 7, 0, 0\} \rightarrow \{0, 0, 1, 2, 5, 7\}$. Greedy – example 4 • By adding dummy specimens and then sorting them, a greedy strategy ‘appears’. We can now: • Pair the specimens with masses $M_1$ & $M_{2C}$ and put them in chamber 1, then • Pair the specimens with masses $M_2$ & $M_{2C-1}$ and put them in chamber 2, and so on . . . ![Diagram showing specimen pairing and chamber distribution](image1) **IMBALANCE** $\text{IMBALANCE} = |(0 + 7) - 5| + |(0 + 5) - 5| + |(1 + 2) - 5| = 2 + 0 + 2 = 4 \text{ (OPTIMAL)}$ If you swap any two specimens from two different chambers, you will always have worse/equal solution. Tips • Using Greedy solutions in programming contests is usually risky. • A greedy solution normally will not encounter TLE response, as it is lightweight, but tends to get WA response. • Proving that a certain problem has optimal sub-structure and greedy property in contest time may be time consuming, so a competitive programmer usually do this. • Look at the input size. If it is ‘small enough’ for the time complexity of either Complete Search or Dynamic Programming, he will use one of these approaches as both will ensure correct answer. • Use Greedy solution if you know for sure that the input size is too large. • A problem that seems extremely complicated on the surface might signal a greedy approach. Wrapping the examples Abridged problem statement: Given different models for each garment (e.g. 3 shirts, 2 belts, 4 shoes, ...), *buy one model of each garment*. As the budget is *limited*, we cannot spend more money than the budget, but we want to spend *the maximum possible*. But it is also possible that we cannot buy one model of each garment due to that small amount of budget. The input consist of two integers $1 \leq M \leq 200$ and $1 \leq C \leq 20$, where $M$ is the budget and $C$ is the number of garments that you have to buy. Then, there are information of the $C$ garments. For a garment\_id $\in [0 \ldots C-1]$, we know an integer $1 \leq K \leq 20$ which indicates the number of different models for that garment\_id, followed by $K$ integers indicating the price of each model $\in [1 \ldots K]$ of that garment\_id. The output should consist of one integer that indicates the maximum amount of money necessary to buy one element of each garment *without exceeding the initial amount of money*. If there is no solution, print “no solution”. Wrapping the examples For example, if the input is like this (test case A): M = 20, C = 3 3 models of garment_id 0 → 6 4 8 // see that the prices are not sorted in input 2 models of garment_id 1 → 5 10 4 models of garment_id 2 → 1 5 3 5 Then the answer is 19, which **may** come from buying the **underlined** items (8+10+1). Note that this solution is not unique, as we also have (6+10+3) and (4+10+5). However, if the input is like this (test case B): M = 9 (**very limited budget**), C = 3 3 models of garment_id 0 → 6 4 8 2 models of garment_id 1 → 5 10 4 models of garment_id 2 → 1 5 3 5 Then the answer is “no solution” as buying all the cheapest models (4+5+1) = 10 is still > M. Wrapping the examples • **Approach 1: Complete Search.** - Start with money_left = M and garment_id = 0. Try all possible models in that garment_id = 0 (max 20 models). If model i is chosen, then subtract money_left with model i’s price, and then recursively do the same process to garment_id = 1 (also can go up to 20 models), etc. Stop if the model for the last garment_id = C - 1 has been chosen. - If money_left < 0 before we reach the last garment_id, prune this partial solution. - Among all valid combinations, pick one that makes money_left as close to 0 as possible yet still ≥ 0. Wrapping the examples • Approach 1: Complete Search. • This solution works correctly, but very slow! • In the largest test case, garment id 0 have up to 20 choices; garment id 1 also have up to 20 choices; ...; and the last garment id 19 also have up to 20 choices. Therefore, Complete Search like this runs in $20 \times 20 \times \ldots \times 20$ of total 20 times in the worst case, i.e. $20^{20} = a$ very very large number Wrapping the examples • Approach 2: Greedy. • Since we want to maximize the budget spent, why don’t we take the most expensive model in each garment_id which still fits our budget? • This greedy strategy ‘works’ for test cases A+B above and produce the same optimal solution \((8 + 10 + 1) = 19\) and “no solution”, respectively. • It also runs very fast, which is \(20 + 20 + \ldots + 20\) of total 20 times = 400 operations in the worst case. • But greedy does not work for many other cases. \[ M = 12, \ C = 3 \] 3 models of garment_id 0 → 6 4 8 2 models of garment_id 1 → 5 10 4 models of garment_id 2 → 1 5 3 5 • Greedy wrongly reports “nosolution”. The optimal solution is actually \((4 + 5 + 3 = 12)\), which use all our budget. Wrapping the examples • Approach 3: Top-Down DP. • This problem has optimal sub-structures. • This is shown in Complete Search recurrence above: solution for the sub-problem is part of the solution of the original problem. Although optimal sub-structure are the same ingredient to make a Greedy Algorithm work, this problem lacks the ‘greedy property’ ingredient. • This problem has overlapping sub-problems. • This is the key point of DP! The search space is actually not as big as $20^{20}$ analyzed in Complete Search discussion above as many sub-problems are actually overlapping! • Think in two models in certain garment_id with the same price p. Wrapping the examples • Approach 3: Top-Down DP. • how many distinct sub-problems (a.k.a. states) are there in this problem? • The answer is, only 201 \times 20 = 4,020. As there are only 201 possible money_left (from 0 to 200, inclusive) and 20 possible garment_id (from 0 to 19, inclusive). Wrapping the examples • Approach 3: Top-Down DP. • Implementation (we already have the recursive backtracking). • 1. Initialize a DP ‘memo’ table with dummy values, e.g. ‘-1’. • The dimension of the DP table must be the size of distinct sub-problems. • 2. At the start of recursive function, simply check if this current state has been computed before. • (a) If it is, simply return the value from the DP memo table, O(1). • (b) If it is not, compute as per normal (just once) and then store the computed value in the DP memo table so that further calls to this sub-problem is fast.
{"Source-Url": "http://www.cs.mcgill.ca/~dbecer/courses/Fall2017/321/Lecture5.pdf", "len_cl100k_base": 4169, "olmocr-version": "0.1.53", "pdf-total-pages": 31, "total-fallback-pages": 0, "total-input-tokens": 41228, "total-output-tokens": 5462, "length": "2e12", "weborganizer": {"__label__adult": 0.0004134178161621094, "__label__art_design": 0.0004353523254394531, "__label__crime_law": 0.0004253387451171875, "__label__education_jobs": 0.00787353515625, "__label__entertainment": 8.767843246459961e-05, "__label__fashion_beauty": 0.00021529197692871096, "__label__finance_business": 0.0003933906555175781, "__label__food_dining": 0.0005292892456054688, "__label__games": 0.0009255409240722656, "__label__hardware": 0.0011205673217773438, "__label__health": 0.0005664825439453125, "__label__history": 0.00037169456481933594, "__label__home_hobbies": 0.00021970272064208984, "__label__industrial": 0.0007634162902832031, "__label__literature": 0.0003631114959716797, "__label__politics": 0.0003190040588378906, "__label__religion": 0.0005593299865722656, "__label__science_tech": 0.0377197265625, "__label__social_life": 0.0002084970474243164, "__label__software": 0.00566864013671875, "__label__software_dev": 0.939453125, "__label__sports_fitness": 0.00042057037353515625, "__label__transportation": 0.0008292198181152344, "__label__travel": 0.00027751922607421875}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 14310, 0.03539]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 14310, 0.57262]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 14310, 0.83622]], "google_gemma-3-12b-it_contains_pii": [[0, 236, false], [236, 753, null], [753, 1129, null], [1129, 1593, null], [1593, 1896, null], [1896, 2169, null], [2169, 2355, null], [2355, 2611, null], [2611, 2860, null], [2860, 3167, null], [3167, 3687, null], [3687, 3970, null], [3970, 4259, null], [4259, 4557, null], [4557, 4882, null], [4882, 5213, null], [5213, 6136, null], [6136, 6928, null], [6928, 7213, null], [7213, 7523, null], [7523, 7910, null], [7910, 8493, null], [8493, 9214, null], [9214, 10281, null], [10281, 10972, null], [10972, 11569, null], [11569, 12001, null], [12001, 12755, null], [12755, 13414, null], [13414, 13710, null], [13710, 14310, null]], "google_gemma-3-12b-it_is_public_document": [[0, 236, true], [236, 753, null], [753, 1129, null], [1129, 1593, null], [1593, 1896, null], [1896, 2169, null], [2169, 2355, null], [2355, 2611, null], [2611, 2860, null], [2860, 3167, null], [3167, 3687, null], [3687, 3970, null], [3970, 4259, null], [4259, 4557, null], [4557, 4882, null], [4882, 5213, null], [5213, 6136, null], [6136, 6928, null], [6928, 7213, null], [7213, 7523, null], [7523, 7910, null], [7910, 8493, null], [8493, 9214, null], [9214, 10281, null], [10281, 10972, null], [10972, 11569, null], [11569, 12001, null], [12001, 12755, null], [12755, 13414, null], [13414, 13710, null], [13710, 14310, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 14310, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, true], [5000, 14310, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 14310, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 14310, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 14310, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 14310, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 14310, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 14310, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 14310, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 14310, null]], "pdf_page_numbers": [[0, 236, 1], [236, 753, 2], [753, 1129, 3], [1129, 1593, 4], [1593, 1896, 5], [1896, 2169, 6], [2169, 2355, 7], [2355, 2611, 8], [2611, 2860, 9], [2860, 3167, 10], [3167, 3687, 11], [3687, 3970, 12], [3970, 4259, 13], [4259, 4557, 14], [4557, 4882, 15], [4882, 5213, 16], [5213, 6136, 17], [6136, 6928, 18], [6928, 7213, 19], [7213, 7523, 20], [7523, 7910, 21], [7910, 8493, 22], [8493, 9214, 23], [9214, 10281, 24], [10281, 10972, 25], [10972, 11569, 26], [11569, 12001, 27], [12001, 12755, 28], [12755, 13414, 29], [13414, 13710, 30], [13710, 14310, 31]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 14310, 0.0]]}
olmocr_science_pdfs
2024-12-06
2024-12-06
4f3cf8df566965832718d50069f3d1752429115f
[REMOVED]
{"Source-Url": "https://inria.hal.science/hal-00949560/file/978-3-642-45065-5_20_Chapter.pdf", "len_cl100k_base": 6930, "olmocr-version": "0.1.50", "pdf-total-pages": 18, "total-fallback-pages": 0, "total-input-tokens": 36921, "total-output-tokens": 9109, "length": "2e12", "weborganizer": {"__label__adult": 0.00036025047302246094, "__label__art_design": 0.0005245208740234375, "__label__crime_law": 0.0002982616424560547, "__label__education_jobs": 0.0011425018310546875, "__label__entertainment": 0.00015652179718017578, "__label__fashion_beauty": 0.00018990039825439453, "__label__finance_business": 0.0006966590881347656, "__label__food_dining": 0.00033926963806152344, "__label__games": 0.0007171630859375, "__label__hardware": 0.0019550323486328125, "__label__health": 0.00064849853515625, "__label__history": 0.0004038810729980469, "__label__home_hobbies": 0.00011974573135375977, "__label__industrial": 0.0004703998565673828, "__label__literature": 0.000423431396484375, "__label__politics": 0.0002417564392089844, "__label__religion": 0.0004224777221679687, "__label__science_tech": 0.19775390625, "__label__social_life": 0.00013744831085205078, "__label__software": 0.033905029296875, "__label__software_dev": 0.7578125, "__label__sports_fitness": 0.0002512931823730469, "__label__transportation": 0.0005769729614257812, "__label__travel": 0.00026154518127441406}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 36423, 0.02955]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 36423, 0.40492]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 36423, 0.86983]], "google_gemma-3-12b-it_contains_pii": [[0, 1224, false], [1224, 3911, null], [3911, 6899, null], [6899, 8789, null], [8789, 11395, null], [11395, 12984, null], [12984, 14530, null], [14530, 17452, null], [17452, 19719, null], [19719, 21403, null], [21403, 23149, null], [23149, 26177, null], [26177, 27520, null], [27520, 27766, null], [27766, 29789, null], [29789, 32386, null], [32386, 35613, null], [35613, 36423, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1224, true], [1224, 3911, null], [3911, 6899, null], [6899, 8789, null], [8789, 11395, null], [11395, 12984, null], [12984, 14530, null], [14530, 17452, null], [17452, 19719, null], [19719, 21403, null], [21403, 23149, null], [23149, 26177, null], [26177, 27520, null], [27520, 27766, null], [27766, 29789, null], [29789, 32386, null], [32386, 35613, null], [35613, 36423, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 36423, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 36423, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 36423, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 36423, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 36423, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 36423, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 36423, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 36423, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 36423, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 36423, null]], "pdf_page_numbers": [[0, 1224, 1], [1224, 3911, 2], [3911, 6899, 3], [6899, 8789, 4], [8789, 11395, 5], [11395, 12984, 6], [12984, 14530, 7], [14530, 17452, 8], [17452, 19719, 9], [19719, 21403, 10], [21403, 23149, 11], [23149, 26177, 12], [26177, 27520, 13], [27520, 27766, 14], [27766, 29789, 15], [29789, 32386, 16], [32386, 35613, 17], [35613, 36423, 18]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 36423, 0.0]]}
olmocr_science_pdfs
2024-11-29
2024-11-29
8b6af144496c0a508fbdf4f652d0ffdb859aa403
J2EE-based Middleware for Low Latency Service Enabling Platforms Bruno Van Den Bossche, Filip De Turck, Bart Dhoedt, Piet Demeester Ghent University - IBBT - IMEC Department of Information Technology Gaston Crommenlaan 8 bus 201, 9050 Gent, Belgium Gerard Maas, Johan Moreels, Bert Van Vlieren, Thierry Polet Alcatel Research & Innovation Copernicuslaan 50, 2018 Antwerpen, Belgium Abstract—While the Java programming language and the J2EE platform are increasingly popular for implementing business logic on backend platforms, new emerging Java technologies such as JAIN SLEE and SIP Servlet are focusing on the development of low latency Java applications. As J2EE mainly focuses on enterprise applications with complex long lasting transactions, this technology is considered unsuitable for applications with low latency and high throughput characteristics. This paper compares these telecom oriented Java technologies to J2EE both in terms of functionality and through a detailed performance evaluation. JVM performance tuning has been studied as well and is explained in the paper. We performed a SIP Proxy benchmark with strict low latency requirements of which the results are presented. Furthermore, design guidelines for J2EE applications are discussed to optimize for low latency behavior together with an interpretation of the obtained performance results. I. INTRODUCTION Java and J2EE are increasingly popular for developing large scale backend applications. An important advantage of using J2EE is that it simplifies managing complex transactions, allows for a fast development of complex applications and it is platform independent. Another feature of Java with important implications is the use of a garbage collector. Java includes automatic memory management (garbage collection) as a part of the Java runtime. This means that very common errors made by developers related to memory management cannot occur. Since the garbage collection is part of the Java runtime it is not completely under the control of the application developer. One of the side effects of the garbage collection is that the application execution can be paused, at unpredictable times, to allow for garbage collection. These pauses are highly undesirable when dealing with low latency services such as Voice over IP (VoIP) offerings. Thus, the question arises whether Java in general, and J2EE in particular are suitable for applications with strict low latency requirements. Apart from J2EE two new Java Application Frameworks have emerged, namely JAIN SLEE and SIP Servlet. Both are part of the Java APIs for Integrated Networks (JAIN [1]) which provide us with an extensive set of standardized APIs to facilitate the development and deployment of telecom services. Telecom applications often have very strict requirements regarding throughput (e.g. the number of VoIP call setups a softswitch can process per second) and latency (e.g. the setup of a call should be very fast). In this paper we will evaluate SIP Servlet as well as JAIN SLEE and compare them against J2EE, which was not originally designed for this type of applications, but has the advantage it is a mature, well known technology. The structure of this paper is as follows: firstly the Session Initiation Protocol (SIP) and the use case for the benchmark is briefly explained in Section II. Next a description of the technologies is presented in Section III, highlighting the different architectures and features. A more detailed description of the J2EE implementation of the selected use case is given in Section IV. Section V details the test setup used, followed by the actual test results and design guidelines in Section VI. Final conclusions and future work are discussed in Section VII. II. LOW LATENCY SERVICES A. Motivation Easy deployment of services and combining existing services is getting more important in current software and platform architectures. For example the IP Multimedia Subsystem (IMS) is an open standardized multi-media architecture for mobile and fixed IP services [2]. It is a VoIP implementation based on a variant of SIP, and runs over IP. The aim of IMS is not only to provide new services but to provide all the services, current and future, that the Internet offers. Massively Multiplayer Online Gaming will be an important domain requiring low latency and high throughput capabilities. Online virtual worlds will become more pervasive and are already stretching out into the real world through auctions of in-game properties and game characters contacting you in real life thus having the same requirements of existing telecom applications. Convergence of these types of applications are a domain where Service Enabling Platforms can play an important role. In this paper we evaluate a VoIP use case with strict low latency and high throughput requirements. B. Session Initiation Protocol (SIP) The Session Initiation Protocol is defined in RFC 3261 [3] and describes an application-layer control (signaling) protocol for creating, modifying and terminating sessions with one or more participants. These sessions include Internet telephone calls, multimedia distribution, and multimedia conferences. RFC 3261 also defines the use of SIP proxies and how they should interact with other SIP applications and proxies. The scenario used for testing is the Proxy 200 test, shown in Figure 1 and defined in the SIPtest benchmark [4]. We are interested in the time it takes to set up a call. This is the time it takes from the initial INVITE of Alice till she receives an OK from Bob, indicating the call is set up. Subsequently Alice will send an acknowledgment to Bob saying she received the OK and the media session (e.g. voice or video conference) can start. When benchmarking the call was immediately terminated by the caller and no media session was initiated. ![Proxy 200 test](attachment:image.png) **Fig. 1.** Proxy 200 test used for the performance evaluation of the discussed technologies The SIP Proxy use case was chosen as it is an important step in setting up a typical SIP Session and the requirements are very well defined. Both low latency requirements and high throughput requirements can be evaluated using this example. III. TECHNOLOGY DESCRIPTION All technologies discussed are component based and offer a container for the applications to be deployed and run in. A major function of the container is the life cycle management of the application (i.e. starting and stopping the application or application components). Also a number of non-functional are delegated to the container in stead of the actual application (e.g. logging, authentication, management of external resources etc). The global overview of a container managed framework is shown in figure 2. In the container multiple applications and/or application components are deployed. These components can interact with each other and other data sources, such as a database. Clients may interact directly with the application or may interact with the application container through the use of “Resource Adapters” (RAs) which manage communication with the outside of the container. The following sections describe each application framework and a comparative overview is presented in table I. For each platform a SIP Proxy implementation has been evaluated. A detailed description of the J2EE implementation is given in Section IV. A. J2EE A typical J2EE Application Server consists of both an Application Container and a Web Container. The Web Container hosts all web related application components such as HTTP Servlets, Java Server Pages, etc. The application container hosts J2EE applications composed of Enterprise Java Beans (EJBs). There are three type of EJBs: Session Beans which usually contain business logic, Entity Beans which represent data and Message-Driven Beans which allow for asynchronous communication. J2EE supports communication with clients through its web container, using HTTP, or application clients can interact directly with application components using a J2EE application client which performs Remote Method Invocation. Apart from this there is also support for deploying J2EE Connector Architecture Resource Adapters (RA) [5] into the application server. Through the use of these RAs, which can be deployed on any J2EE application server, it is possible to extend the application server and support extra methods of communication. A well known example using the JCA is the Java Message System (JMS). The J2EE Connector Architecture was originally designed for implementing RAs to interface with existing (legacy) systems, but it can be used in a more general context to extend the J2EE application server with extra protocol stacks. B. SIP Servlet The primary goal of the SIP Servlet API [6] is to simplify the development of SIP enabled applications. By using the existing servlet architecture it is relatively easy for developers who are familiar with HTTP Servlets to create SIP enabled applications. For each type of SIP Message a method is defined to handle it. One example is a “doInvite” method which will TABLE I COMPARISON OF THE MAIN CHARACTERISTICS OF J2EE, SIP SERVLET AND JAIN SLEE <table> <thead> <tr> <th>Design Goal</th> <th>J2EE</th> <th>SIP Servlet</th> <th>JAIN SLEE</th> </tr> </thead> <tbody> <tr> <td>Manage complex business transactions and data management.</td> <td>Simplify SIP development.</td> <td>Applications which require high throughput and low latency event processing.</td> <td></td> </tr> <tr> <td>Architecture</td> <td>Component based, Object Oriented architecture. Unit of logic is the EJB Support for composition and reuse</td> <td>Based on HTTP Servlets. Unit of application logic is the Servlet. No standard model for composition and reuse.</td> <td>Component based, Object Oriented architecture. Unit of logic is the SBB Support for composition and reuse.</td> </tr> <tr> <td>Protocol Support</td> <td>Limited to RMI and HTTP by default. But can be extended through the use of the J2EE Connector Architecture.</td> <td>Limited to SIP and HTTP. Can not be extended by application programmers.</td> <td>No protocols supported (protocol agnostic) out of the box. Any protocol can be added through the use of Resource Adapters.</td> </tr> <tr> <td>Clustering</td> <td>Vendor specific extensions for clustering multiple application servers.</td> <td>Vendor specific extensions for clustering multiple application servers.</td> <td>Replication in cluster defined in the specification.</td> </tr> </tbody> </table> handle SIP INVITE messages. This technology is targeted specifically toward SIP applications and is less generic than J2EE or JAIN SLEE. In the container multiple applications can be deployed, each consisting of one or more SIP Servlets. Each application also contains a deployment descriptor which describes the application and tells the container which SIP message it should direct to which servlets. The servlets can then process the SIP messages and if necessary pass them on to other servlets. Furthermore multiple servlets may process the same SIP message. The proxy implementation used for evaluating the platform consists of one SIP Servlet and made use of the proxy component part of the SIP Servlet specification. The SIP communication is completely managed by the application server and does not require any additional components. C. JAIN SLEE The JAIN Service Logic Execution Environment (SLEE) specification [7] provides an application server tailored for telecom. Applications are composed of Service Building Blocks (SBBs) which are the equivalent of the J2EE EJBs. One of the key features of the JAIN SLEE application container is the use of asynchronous communication. Internally almost all communication in the SLEE happens by using events. The idea behind the event based communication between SBBs is that every SBB performs its own task and then hands the result off to the next SBB in line. One could compare this to an assembly line in a factory. The internal routing is completely taken care of by the application server. A key component in the routing of events is the Activity Context which manages the links between logically connected SBB entities. When an initial event (e.g., a SIP INVITE) enters the SLEE an Activity Context is created. The SBBs processing this event will be attached to this Activity Context and all following events which logically belong together (e.g., all events related to the same SIP call) will be fired on the same Activity Context and processed by the same SBB entity. This is important as the SBB entities can share data on this Activity Context. Communication with the outside world happens through RAs. For example we have an RA for SIP related communications which accepts incoming SIP messages, parses them and turns them into events understandable by the SLEE. Through the use of RAs the SLEE can be protocol agnostic. This means that any protocol can be supported by adding an appropriate RA. To perform the SIP Proxy test a SIP Resource Adapter was deployed in the application server together with a proxy SBB. The proxy implementation consisted of one SBB which accepted incoming SIP events and performed the necessary routing. IV. J2EE SIP PROXY ARCHITECTURE This section will give a detailed overview of the SIP Proxy Design in J2EE. To build a functional proxy, two key components are required. A Resource Adapter to extend J2EE with SIP capabilities and one or more components to implement the actual proxy logic. An overview of the J2EE SIP Proxy application is given in figure 3. A. SIP Resource Adapter Implementing an RA requires fulfilling a number of system level contracts regarding the management of connections, transactions and security. Furthermore, a listener interface needs to be defined which listening application components (Message Driven Beans) have to implement to receive incoming events. If required, custom event types can be defined as well. In order to send outgoing messages a connection interface must be defined which application components (an J2EE component type) can use to connect to the RA. To implement the SIP RA we used the publicly available JAIN SIP [8] stack and exposed its API to the J2EE application components. It is however possible to insert an extra layer of abstraction and define a new API for SIP communications, just like SIP Servlet does. B. Proxy Message-Driven Bean The proxy logic of the implementation is embedded in a Message-Driven Bean. This component registers itself to the SIP RA and listens for any incoming SIP Messages. Upon receiving a SIP Message it is determined which call it is part of and the necessary routing is performed. Any responses or forwarded messages are sent using the SIP RA. Message Driven Beans are stateless components and can easily be pooled by the application server. Hence, if it is necessary to maintain a certain state over multiple SIP Messages it is required to keep this state manually. This can be done either on the application side or inside the RA, which then needs to provide the necessary methods to access this information. In the current implementation all state considering the SIP Sessions is maintained by the SIP RA. C. Event Filtering Based on the description so far, all SIP Messages that arrive at the SIP RA will be sent to every application component. This is usually not desirable and it can be a cause of overhead. Furthermore, not every application or service is interested in receiving every SIP Message. A billing component for example only needs to know when a call is started and when it is ended. All intermediate messages, are of no use and can be discarded. To allow this, an Event Filter was implemented which accepts regular expressions that are added to the applications deployment descriptor and can be used to filter out any unwanted messages. V. TEST SETUP Before we discuss the obtained results, a short overview of the test setup used, is presented. A. Software Setup For benchmarking purposes SIPp [9] is used. SIPp is a free Open Source test tool/traffic generator for the SIP protocol. It allows generating SIP traffic and establishing and releasing multiple calls. It can also read custom XML scenario files, describing from very simple to complex call flows. It includes a few basic SIPstone defined test setups. All tests in this paper were performed using SIPp and the previously specified scenario. B. Hardware Setup All tests were performed using a dual Opteron 242 (1.6GHz) HP DL 145 with 2GB of memory for the proxy. The two clients were run on AMD athlonXP 1600+ machines with everything interconnected in a 100Mbit switched ethernet network. All platforms were running Debian GNU/Linux with a 2.6 kernel and the Sun JDK 1.4.2. C. Platform Tuning For all the presented test results extensive tuning of the JVM and garbage collector was performed. Without tuning of the JVM the garbage collector initiated pauses in the execution of the application which resulted in calls to timeout, even at low call rates. With appropriate tuning, these pauses can be minimized and thus the obtained results significantly improved. The basic set of tuning options used for all platforms is shown in table II. Detailed results of JVM tuning were previously reported on in [10]. <table> <thead> <tr> <th>Option</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>-Xms512m</td> <td>(1)</td> </tr> <tr> <td>-XX:NewSize=128</td> <td>(2)</td> </tr> <tr> <td>-XX:MaxNewSize=32m</td> <td>(3)</td> </tr> <tr> <td>-XX:MaxTenuringThreshold=0</td> <td>(4)</td> </tr> <tr> <td>-XX:SurvivorRatio=128</td> <td>(5)</td> </tr> <tr> <td>-XX:+UseParNewGC</td> <td>(6)</td> </tr> <tr> <td>-XX:+UseC HeapSweepGC</td> <td>(7)</td> </tr> <tr> <td>-XX:+CMSIncrementalMode</td> <td>(8)</td> </tr> <tr> <td>-XX:+CMSIncrementalPacing</td> <td>(9)</td> </tr> <tr> <td>-XX:CMSIncrementalMaxCycle=0</td> <td>(10)</td> </tr> <tr> <td>-XX:CMSIncrementalMaxCycle=10</td> <td>(11)</td> </tr> </tbody> </table> TABLE II VIRTUAL MACHINE TUNING OPTIONS FOR LOW LATENCY BEHAVIOR. The options specified in table II are specific to the Sun JVM, but other virtual machines offer similar tuning options which can be used to achieve the same effect. The memory managed by the virtual machine is divided into multiple generations (Young, Tenured and Perm), depending on the age of the objects. As objects live longer they are moved into the next generation after a certain amount of time or a number of garbage collections. By specifying the sizes of the generations (1-3) and limiting the amount of time before an object is promoted to the next generation (4-5), we can achieve that objects lasting the whole call are moved to an older generation very fastly. This is beneficial as the older generations do not need to be garbage collected as often since the the majority of objects die very young. The garbage collector itself can also be tuned (6-11) to use multiple threads on multi-cpu machines. and to work concurrently with the application execution for as long as possible. This allows to limit the time the execution of the virtual machine needs to be paused completely for garbage collection. VI. EVALUATION RESULTS This section gives an overview of the obtained test results. All platforms were submitted to a number of subsequent test runs that allowed us to evaluate and interpret the obtained data. Although setting up a session using SIP is not bound by the same latency requirements of the VoIP media session itself, it is necessary to achieve a low latency behavior as typically 6 to 7 hops, such as proxies, need to be traversed in the network. Considering additional network delays when setting up a SIP call using the specified scenario (see figure 1), 95% of the acknowledgments for the INVITE messages should arrive within 50ms and 50% should arrive within 25ms. Furthermore, design guidelines are proposed to optimize the architecture and implementation of J2EE applications for low latency behavior. A. Performance Results Figure 4 shows the performance results of the tested application servers. The graphs show the average response time, the 90th percentile and the 95th percentile plotted against the average cpu load at the given call rate. As all tests were performed on a dual cpu machine the cpu load is the average of the load of the two cpus during the test. During each test every call rate, starting at 10 calls per second (cps) was run for 5 minutes. Then there was a pause of 1 minute after which the subsequent call rate was tested. The call rates were increased for as long the system under test could sustain the tested call rate. Each such test run was repeated three times to check consistency among the different test runs. Before every test run a dummy run was performed to allow the JVM to "warm up". This is necessary as the Virtual Machine will perform internal optimizations, try to reuse allocated memory resources etc. which could influence the measurements. There is a significant difference in the maximum call rate all the application servers can sustain that lies within the specified requirements. For J2EE the maximum achievable call rate is approximately 150 caps (at higher call rates some calls did timeout), for JAIN SLEE this is 190 caps (at higher call rates the latency requirements are not met anymore) and for SIP Servlet this is 240 caps (at higher call rates some calls did timeout). A general remark is that all application servers are able to meet the low latency requirements for a certain call rate. At a call rate of 150 caps, J2EE even shows the best results regarding latency, although it is supposed to be the slowest technology. It is important to note that both the J2EE test the load was not equally distributed over the two cpus. We assume this is due to limitations of the SIP stack used. The implementation of the JAIN SIP Stack used is a reference implementation, not optimized for production use. Tests, previously reported on in [11], show that an example proxy implementation based on the same stack could only sustain a call rate of approximately 30 caps. This is also the reason why the cpu load does not increase above 70% as the SIP Stack is overloading one cpu. In the tests with the other application servers the load was distributed more equally over the two cpus. Figure 5 shows the response time distribution for a call rate of 100 caps for each tested platform. The ceiling for the number of calls completed, plotted on the Y-axis, has been limited to a maximum of 1000 calls for clarity. For all platforms the majority of the calls is answered within a few milliseconds. This also shows in figure 4. The tail of the distribution does show some distinct differences between the tested platforms. For J2EE (figure 5(a)) it is very short and the vast majority of the calls is answered within 30ms. For JAIN SLEE (figure 5(c)) and SIP Servlet (figure 5(b)) the tail is much longer, however they are capable of sustaining higher call rates. A possible cause for this behavior is the J2EE Server used as different implementations could have an influence on the application latency. However, we verified the results by deploying the SIP RA on other J2EE servers which performed similarly, excluding the J2EE server as a possible cause of this result. Our feeling is that the shorter tail of the distribution is caused by a difference in the implementation of SIP Resource Adapter. The management of SIP transactions and SIP dialogs is all included in the J2EE SIP RA, whereas this is (partially) handled by application components for SIP Servlet and JAIN SLEE. B. J2EE Design Guidelines An RA is responsible for its own thread and resource management, it is in fact the only J2EE software component allowed to create and manage threads by itself. However, it is suggested to use existing features such as the Work Manager which allows the RA to submit Work units. These Work units are then scheduled and executed automatically, not requiring the RA to explicitly manage the actual threads. As much actual processing possible should be done inside Work units and the processing in the RA should be limited to the receiving and sending of messages. By using this approach the RA implementation is simplified as no manual thread management needs to be performed and the actual core of the RA is restricted to receiving and sending messages over the network. An additional benefit is that it allows the J2EE application server to optimize the scheduling of work for the entire application server whereas local thread management inside the RA is limited to the threads and resources managed by the RA itself. Depending on the application and the services to be provided it can also be beneficial to embed more (or less) responsibilities inside the RA. The SIP Proxy could for example be embedded in the RA. Or the RA could be used to interact with existing platforms. For example, to develop a billing service it would be enough to be notified when a SIP call starts and when it ends. All intermediate SIP Messages do not necessarily need to be processed inside the J2EE container but could be handled either inside a SIP Proxy RA or in an existing Proxy platform. VII. CONCLUSIONS In this paper we described the use of J2EE for low latency use cases and compared it to both JAIN SLEE and SIP Servlet. Based on the obtained results we can conclude that Java technologies in general are suitable for low latency, high throughput applications. All tested platforms were able to meet the low latency requirements and could sustain a significant call rate in the proxy 200 test. The test results also show J2EE (although being limited by the SIP Stack used) being capable of producing satisfying results for this type of applications. As all technologies are capable of achieving low latency performance, increasing the capacity is possible by clustering multiple application servers. Improving the low latency behavior usually is much more complicated. Depending on the type of application or Service Enabling platform to create, J2EE, JAIN SLEE, SIP Servlet or a combination of the different platforms are all suitable candidates and decisions should be made based on the required base functionality, service complexity and available development time. ACKNOWLEDGMENT We would like to thank OpenCloud for providing us with a license for their JAIN SLEE implementation Rhino and BEA for providing us with a license for their Communications platform. The research presented in this paper is partially funded by the IBBT T-Case project. F. De Turck is a postdoctoral Fellow of the Fund for Scientific Research - Flanders (F.W.O. - Vlaanderen). REFERENCES
{"Source-Url": "https://biblio.ugent.be/publication/356239/file/571877.PDF", "len_cl100k_base": 5523, "olmocr-version": "0.1.53", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 7483, "total-output-tokens": 6376, "length": "2e12", "weborganizer": {"__label__adult": 0.0004451274871826172, "__label__art_design": 0.0002739429473876953, "__label__crime_law": 0.0003914833068847656, "__label__education_jobs": 0.0003993511199951172, "__label__entertainment": 0.0001143813133239746, "__label__fashion_beauty": 0.0001723766326904297, "__label__finance_business": 0.0005717277526855469, "__label__food_dining": 0.0003762245178222656, "__label__games": 0.0006208419799804688, "__label__hardware": 0.005218505859375, "__label__health": 0.0006604194641113281, "__label__history": 0.0002932548522949219, "__label__home_hobbies": 8.034706115722656e-05, "__label__industrial": 0.0007944107055664062, "__label__literature": 0.00016319751739501953, "__label__politics": 0.0002715587615966797, "__label__religion": 0.0004563331604003906, "__label__science_tech": 0.1185302734375, "__label__social_life": 7.230043411254883e-05, "__label__software": 0.0196990966796875, "__label__software_dev": 0.8486328125, "__label__sports_fitness": 0.0004336833953857422, "__label__transportation": 0.0008335113525390625, "__label__travel": 0.0002689361572265625}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 28690, 0.0167]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 28690, 0.23492]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 28690, 0.91628]], "google_gemma-3-12b-it_contains_pii": [[0, 5150, false], [5150, 9139, null], [9139, 14533, null], [14533, 19213, null], [19213, 25473, null], [25473, 28690, null], [28690, 28690, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5150, true], [5150, 9139, null], [9139, 14533, null], [14533, 19213, null], [19213, 25473, null], [25473, 28690, null], [28690, 28690, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 28690, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 28690, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 28690, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 28690, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 28690, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 28690, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 28690, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 28690, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 28690, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 28690, null]], "pdf_page_numbers": [[0, 5150, 1], [5150, 9139, 2], [9139, 14533, 3], [14533, 19213, 4], [19213, 25473, 5], [25473, 28690, 6], [28690, 28690, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 28690, 0.16807]]}
olmocr_science_pdfs
2024-12-06
2024-12-06
c10088557e0ff8b7ab95f0e508f2b0a3c66b6302
Abstract The interface between an Intelligent Tutoring System (ITS) and the person being tutored is critical to the success of the learning process. If the interface to the ITS is confusing or non-supportive of the tutored domain, the effectiveness of the instruction will be diminished or lost entirely. Consequently, the interface to an ITS should be highly integrated with the domain to provide a robust and semantically rich learning environment. In building an ITS for ZetaLISP on a LISP Machine, a Desktop Interface was designed to support a programming learning environment. Using the bitmapped display, windows, and mouse, three desktops were designed to support self-study and tutoring of ZetaLISP. Through organization, well-defined boundaries, and domain support facilities, the desktops provide substantial flexibility and power for the student and facilitate learning ZetaLISP programming while screening the student from the complex LISP Machine environment. The student can concentrate on learning ZetaLISP programming and not on how to operate the interface or a LISP Machine. Introduction Artificial Intelligence techniques are now beginning to be applied to the area of education, in particular to the development of Intelligent Computer Assisted Instruction (ICAI). Frequently, the ICAI is in the form of Intelligent Tutoring Systems. Figure 1 depicts a typical ICAI architecture [9]. The area of the ITS most frequently addressed to date has been the student model. By contrast, the interface has been minimally addressed. Yet the interface is the student's contact with every component of the tutor. If the student cannot get past the interface, the quality of the student model or of any other component of the ITS will not matter. Consequently, the interface must be a high priority in the development of any ICAI [17]. This paper will describe the implementation of an ICAI interface, referred to as the Desktop Interface, for a ZetaLISP Intelligent Tutoring Assistant (ZITA). To date the ZITA student model has been only minimally implemented, while the emphasis has been on developing an interface which would support and encourage learning to program in ZetaLISP on a LISP Machine. In fact, the Desktop Interface is intended to provide much more than a typical user interface; it is to provide a Programming Learning Environment (PLE) [19]. Moreover, the Desktop Interface is presented as an authoring vehicle for developing programming language tutors for languages in addition to ZetaLISP. In promoting the ITS interface, we are not advocating a position of ignoring components of ICAI other than the interface or of producing a glittering interface with no underlying substance. Ideally, all the components would be highly integrated. However, up to this point, more attention has been devoted to the more glamorous components: the Student Model and the Domain Knowledge. We do not want the gains made in these latter components diminished or lost because the learning environment does not foster and facilitate learning. Unpleasant experiences with frustrating, difficult interfaces will not advance ICAI, but rather retard it. Our ideal tutoring environment is one which seems invisible to the student but which supports the intuitive operational expectations of the student relative to the domain being tutored. **Background** In the past five years important advances in graphical presentation capability have made possible a new, powerful method of communication. Bitmapped, graphical windows and the mouse have resulted in proven techniques for reliable, high-bandwidth information exchange between people and computers [21] which more closely model human cognitive processes, especially with the use of metaphor and frames [5]. With these capabilities we can move far beyond the limitations imposed by static CRT screens with 25 lines of 80 characters. Previously such capabilities have required expensive, multi-MIPS computers. But the decreasing cost and increasing power of microcomputers now make such capabilities readily available for ICAI. Indeed, we should demand windows and mice, and refuse to consider systems limited to complicated keystroke patterns and displaying a few lines of text. **Criteria for Developing Tutoring Environments** While the tutoring environment must be designed with the specific domain in mind, some general criteria for developing tutoring environments have begun to emerge [24]. Environments should be intuitive, obvious and fun. The use of metaphor, icons, and the mouse should take advantage of student intelligence, experience and resourcefulness. Environments should provide high-bandwidth communication between the student and the tutor. Designers should be motivated by teaching and cognitive knowledge about how experts perform tasks in the subject domain. Environments should isolate key tools for attaining expertise in the domain. Environments should maintain fidelity with the real world (in learning programming, the student should be able to run both examples and problem solutions). Environments should be responsive, permissive, and consistent based on skills students already have rather than forcing them to learn new skills. Finally, all tools should be based on similar interface devices such as menus, mouse clicks, etc. **A ZetaLISP Tutor** We currently have a task with the Artificial Intelligence Section of the Mission Planning and Analysis Division (MPAD) of NASA's Johnson Space Center (JSC) to provide training in AI topics (Common LISP, ZetaLISP, LISP Machines, CLIPS, ART). The ZetaLISP tutor has been developed on an as-time-permits basis to complement our ZetaLISP class. In designing the ZetaLISP tutor, two goals were established. First, we wanted an effective environment for tutoring ZetaLISP on a LISP Machine. Secondly, we wanted to develop a general programming learning environment for computer applications languages. In particular, we wanted a PLE which could be duplicated on workstations and the upcoming, more powerful personal computers. One must make a number of assumptions when implementing a tutor. Ours were as follows: the student would be a technical professional employed by NASA or its contractors; the student would have the equivalent of 40 hours of Common LISP training and 8 hours of hands-on training in the use of a LISP Machine; the tutor would supplement our classroom ZetaLISP training; the tutor could evolve to be used by persons who had completed the ZetaLISP training (about 45 hours) and were interested in obtaining more experience or were seeking examples to help in their current tasks. The coaching system of ZITA evaluates the student's performance through a differential modeling technique, comparing the student's progress to an ideal solution step-by-step, intervening immediately when it perceives the student has made a mistake [4], [18]. At this stage of development, the immediate intervention issued by the tutor primarily points out syntactic errors and noise level errors made by the student presumably due to negligence and fatigue. Based on the previous assumption of the student's background, these errors are not considered to have resulted from misconceptions in learning. Learning to Program and the PLE How could an appropriately structured environment facilitate the acquisition of programming skills [16]? In order to answer this question, we first investigated some of the aspects of learning to program. Three aspects of learning to program were to be supported by our PLE [1]. First, the PLE was to help the student organize and compile problem-solving operators for programming. Learning to program involves recognizing appropriate goals and decomposing the goals into subgoals until goals are reached which correspond to code. Secondly, the PLE was to represent the relevant knowledge, both declarative and procedural, in ways which correspond to the cognitive representations of programmers, because one's representation of a problem has strong impact on one's problem-solving ability. Thirdly, the PLE was to act as an external memory device for programmers to reduce the impact of human memory limitations. Approximately 50 percent of LISP novices' time is spent recovering from errors of memory [1]. By reducing student working memory load, the PLE will minimize student errors due to memory limitations. Good programmers are made, not born [23]. B.S. Bloom found that 98 percent of the students with private tutors performed better than the average classroom student. He also found that the greatest learning gains were for the poorest students [2]. The average college graduate is not prepared to perform professional programming tasks without additional training when he or she first arrives on the job in industry. Large sums of money are spent training and retraining programmers with widely varying results. We can improve this process greatly by developing intelligent tutors for learning programming which will provide consistent, cognitively modeled tutoring when and where needed, and at significant cost savings. The PLE of our ZetaLISP tutor addresses the three aspects of learning programming described above in four ways: a) Learning by example [20], [10], [4]; b) Facilitating knowledge representation; c) Reducing student working memory requirements; d) Unleashing the power of the computer on the ICAI interface. The PLE is based on learning by example. Examples are critical to learning and to the structure of knowledge and memory. Learning by example provides the student with early, positive experiences and lays down a solid foundation on which to build. Examples help the student organize and compile the use of appropriate operators for programming. Examples illustrate goals and subgoals appropriate to a particular language but which may not transfer to or from other languages. Techniques recalled from examples help reduce the number of steps to produce a solution in similar problems. Novices use examples to generalize solutions, set limits to those generalizations, make recipes for standard tasks, and as a basis for retrieval and modification approach to generating other examples. Adult students only acquire effective use of problem-solving knowledge by practicing with a series of examples and problems [19]. Adults prefer learning by doing rather than watching because it makes the subject immediately useful and meaningful [22]. Studies by the Xerox Corporation confirm that learning occurs 50 percent faster with active, hands-on training than when the learning is passive [13]. Adult learners seek a focused, applicable treatment of the subject so they can transfer the concept to their work. Generalities are acceptable only when they lead to specific information and ideas. Adults are highly motivated to apply their learning to their work and are willing to assume responsibility for learning. Adult learning uses experience as a resource. Adults feel rewarded when the learning enriches their experience. Material that provides options is more appealing to adults than material that locks in one approach. Examples reinforce and strengthen the link between the concept and application transfer, rewarding the learning experience and disposing the student toward further knowledge. The PLE facilitates programming knowledge representation as used by the expert. Not only is syntactic knowledge represented, but more importantly, much implicit semantic knowledge, acquired over many years of experience, is presented to the student. Techniques illustrating when, what, and how to extend specific knowledge in the examples to solve new problems (extrapolate) [15] must be taught. Human learning occurs as a search in a problem space [12] and the desktop interface of the PLE helps constrain and focus the search. Each learning state and operators are well defined for each desktop in the PLE. Chunking is well suited to learning because it is a recorder of goal-based experience; it caches the processing of a subgoal in such a way that a chunk can substitute for the normal, possibly complex, processing of the subgoal the next time the same or a similar subgoal is generated [11]. Each exercise is a chunking process of storing both knowledge and links to appropriate, related knowledge. Memory load is minimized by the PLE. Each desktop of the PLE organizes information by chunking into easily recognized areas, minimizing student memory requirements. Each desktop is self-contained; the information necessary to perform required actions on the desktop is present in a window. Transitions from one desktop to another are accomplished with a simple mouse click on a clearly marked box. By using direct manipulation techniques with the mouse and menus, options are clearly delineated and selected in obvious, foolproof ways. Examples and problems help clearly separate details from general principles and establish limitations when extending operators. Finally, each student can use as much or as little of the instructions and explanations as desired, thus both avoiding information overload and frustration from too little information. Students fail to learn from ICAI only when there are negative forces set up against learning [23] such as unfriendly, difficult interfaces. By unleashing the power of the computer in creating a seemingly invisible desktop tutorial interface, we provide an ideal programming learning environment. The format of the PLE defines boundaries unobtrusively while leaving the horizons of the domain open for the student to acquire the desired knowledge. Bitmapted windows, the mouse, and high-powered (MIPS, memory, windowing operating systems), low-cost, microprocessor-based computers have made possible high-bandwidth, self-evident ICAI interfaces. The Desktop Interface Implementation of the PLE The Desktop Interface implemented for the ZetaLISP PLE resembles a desk with relevant documents spread out neatly on it; because there are several discrete stages in the PLE, there is a separate desktop for each stage. Each desktop is divided into four or five parts (windows) with each part representing one document; if a document cannot be seen completely in its window, the window scrolls (using the mouse) to permit unseen sections to be read. People can deal with from four to seven chunks of data at one time [8]. The division of the desktop into less than seven chunks is designed to fit this cognitive model and thereby to limit the student working memory load. Desktops and windows are consistent in format and function. Each desktop must be self-contained so that the student can concentrate on learning the desired knowledge of the domain and not on operating the interface or searching books for additional information. All options are selected with the mouse. Code for examples and problem solutions can be executed by clicking the mouse on an appropriate menu item. The student can hardcopy the window contents for easier reading, making notes, or for future reference [23]. Four desktops comprise the Desktop Interface for this PLE. The first three have been implemented; the fourth has not been designed. The first desktop is the Selections Desktop (Figure 2). In the Selections Desktop the student selects, with the tutor’s assistance (based on past performance), the topic of study by selecting an example topic with the mouse. This desktop also contains a LISP listener where the student can enter and execute LISP code if desired for any reason. When an example topic is agreed on between the tutor and the student, the student is taken to the second desktop, the Study Desktop (Figure 3). In the Study Desktop, the student is presented with instructions for the desktop, the code for the selected example topic, explanations for the topic, and a LISP listener. Because so much information about programming is conveyed only by executing programs, the student can execute the code for the example being studied by selecting a box with the mouse at the bottom of the LISP listener (Figure 4). When the student has finished studying the example, he or she can work problems posed by the tutor which are variations of the code of the example studied by selecting a box with the mouse at the bottom of the LISP listener. In this case, the student is taken to the third desktop, the Tutorial Desktop. As before, there are instructions for this desktop and the code of the example from the Study Desktop. In the Tutorial Desktop, the student clicks the mouse on the menu item “Show Variation Choices” and is then presented with a list of available problems. Once the student selects a problem to work, the code of the problem, which is a variation of the example studied, is loaded in a window (code which the student is to supply is missing, from a few lines to whole functions). Guidelines for working the problems appear in reverse video and a reverse video window appears over the example code window for the student to enter the missing code according to the guidelines (Figure 5). The student enters ZetaLISP code and the tutor 4. The instructions for studying the example you selected are in the Instructions window (this window). 5. To RETURN to the example Selections, click the mouse on the indicated box to the right in the Listener window. 6. To TRYOUT variations of this example, click the mouse on the indicated box to the right in the Listener window. 7. To RUN the example you selected, click the mouse on the Study Explanations Window. Command: Figure 2. The Selections Desktop of the Desktop Interface. **Figure 3.** The Study Desktop of the Desktop Interface. 4. The instructions for studying the example you selected are in the Instructions Window (this window). 5. To RETURN to the example Selections, click the mouse on the indicated box to the right in the Listener window. 6. To TRYOUT variations of this example, click the mouse on the indicated box to the right in the Listener window. 7. To RUN the example you selected, click the mouse on the indicated box to the right in the Listener window. Study Instructions Window Study Display Window 1. This window will explain the momentary popup menu example you have selected to study. The menu which appears in this example remains on the screen only as long as the mouse remains in it. If the mouse is moved outside the popup window, the window disappears. The window also disappears when a selection is made; then a selection is made, a value assigned to that selection is returned as the side effect. If the mouse is moved outside the window without making a selection, NIL is returned as the side effect. 2. The code for this example appears in the Code Window at the lower right. There are many permutations of this window, some of which can be made less or more bold, more items can be added, the label can be changed, the text can be presented in different fonts and so forth. Notice that nothing in the code defines the size of the window or where it is to appear. The default size is that which is large enough to hold the list box and title, given the specified font sizes, the number and length of menu items, the default position of appearance is at the mouse cursor position. Notice also that the window contents below the popup menu is preserved, i.e., when the popup window disappears, the contents of the window below remain intact. 3. Refer to pages 213-228 of Volume 7, Programming the User Interface for further details. NIL Study Explanations Window Figure 4. Student executing code for the example being studied on the Study Desktop. attempts to diagnose bugs and offer corrective dialogue. When the student successfully completes the problem, the tutor inserts the code into the variation code window and the student can execute the problem solution (Figure 6) by clicking the mouse on the menu item "Run Variation with User Code". The student may then select another problem on the current topic or return to the Selections Desktop to choose another topic. The fourth desktop, the Planning and Goals Help Desktop, has not been implemented yet. Because successful programming requires knowledge of how to both recognize recurring operations and make goals and plans to perform those operations, unsuccessful programmers will exhibit a lack of such abilities. Consequently, the tutor will have to help not only with syntax but also with establishing programming goals and plans. Overcoming this inability is critical if the student is to learn programming [18], [14], [6], [7]. Thus, when the student demonstrates an inability to form correct programming goals and plans, he or she will be transferred to this desktop and will be assisted by the tutor in devising successful goals and plans for the selected problem before being returned to the Tutorial Desktop. Once back in the Tutorial Desktop, the tutor will assist the student in writing code based on the goals and plans developed in the Planning and Goals Help Desktop. Expectations for an ICAI PLE We expect the PLE to satisfy a number of sound cognitive principles. The actual layout of the PLE is not important so long as the underlying structure makes the semantics of the domain evident, that is, makes it easy to carry out actions in the domain, and to see and understand the results and implications of those actions. It must support students as they acquire an understanding of the complex semantic domain of programming, minimizing the gap between expectations and actions supported. Certainly it is specialized, highly integrated with the domain and semantically rich with high-bandwidth information transfer between interface and student. It avoids low-bandwidth, semantically weak interfaces which greatly complicate the diagnosis problem. By offering a good match to goals and plans of the student as they... Figure 5. Student entering code to solve the problem posed by the ZetaLISP tutor on the Tutorial Desktop. Figure 6. Student executing code for their solution to the problem posed by the ZetaLISP tutor. learn to program, it accommodates stages of student conceptualization of the domain and how movement from one stage to another takes place. It reflects the task of learning programming, the information that must be presented, and ways in which students may interact with the information, that is, how good programmers organize knowledge and use operators. Serving as an external memory system, the PLE uses the desktop metaphor to organize, standardize, define boundaries, reduce memory requirements, obviate actions/results, and convey a feeling of control. Conclusions We now need, and will continue to need, many well-trained programmers. The current method of training programmers is expensive, haphazard, and not founded on an understanding of how to learn programming. Over the past five years we have obtained much knowledge of how to learn programming and, at the same time, computers and software have advanced dramatically in capability while their cost has declined substantially. At this point we have the knowledge and tools available to develop an ICAI Programming Learning Environment and deliver uniform, semantically rich, and cognitively based tutors to train the necessary programmers. The Desktop Interface is a candidate authoring vehicle for such an ICAI PLE. We are continuing, as time permits, to develop and test the Desktop Interface and the Student Model in the ZetaLISP tutor. References
{"Source-Url": "https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19880007841.pdf", "len_cl100k_base": 4526, "olmocr-version": "0.1.53", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 25228, "total-output-tokens": 6179, "length": "2e12", "weborganizer": {"__label__adult": 0.0007047653198242188, "__label__art_design": 0.0012903213500976562, "__label__crime_law": 0.0006651878356933594, "__label__education_jobs": 0.281982421875, "__label__entertainment": 0.00020706653594970703, "__label__fashion_beauty": 0.0004239082336425781, "__label__finance_business": 0.001026153564453125, "__label__food_dining": 0.0008435249328613281, "__label__games": 0.0012636184692382812, "__label__hardware": 0.00231170654296875, "__label__health": 0.0010957717895507812, "__label__history": 0.0007300376892089844, "__label__home_hobbies": 0.00048232078552246094, "__label__industrial": 0.0010852813720703125, "__label__literature": 0.0009055137634277344, "__label__politics": 0.0005879402160644531, "__label__religion": 0.0011720657348632812, "__label__science_tech": 0.03253173828125, "__label__social_life": 0.0005555152893066406, "__label__software": 0.0194244384765625, "__label__software_dev": 0.64794921875, "__label__sports_fitness": 0.00063323974609375, "__label__transportation": 0.0014820098876953125, "__label__travel": 0.00049591064453125}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27545, 0.02322]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27545, 0.79374]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27545, 0.92902]], "google_gemma-3-12b-it_contains_pii": [[0, 2523, false], [2523, 7248, null], [7248, 12130, null], [12130, 17124, null], [17124, 17675, null], [17675, 21884, null], [21884, 22087, null], [22087, 26045, null], [26045, 27545, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2523, true], [2523, 7248, null], [7248, 12130, null], [12130, 17124, null], [17124, 17675, null], [17675, 21884, null], [21884, 22087, null], [22087, 26045, null], [26045, 27545, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 27545, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27545, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27545, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27545, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27545, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27545, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27545, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27545, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27545, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27545, null]], "pdf_page_numbers": [[0, 2523, 1], [2523, 7248, 2], [7248, 12130, 3], [12130, 17124, 4], [17124, 17675, 5], [17675, 21884, 6], [21884, 22087, 7], [22087, 26045, 8], [26045, 27545, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27545, 0.0]]}
olmocr_science_pdfs
2024-12-07
2024-12-07
bf01144bdbcf578409d6adf6debf5100747e4223
THE EDUCATION COLUMN BY JURAJ HROMKOVIČ Department of Computer Science ETH Zürich Universitätstrasse 6, 8092 Zürich, Switzerland juraj.hromkovic@inf.ethz.ch An Elementary Approach Towards Teaching Dynamic Programming Hans-Joachim Böckenhauer Department of Computer Science, ETH Zürich hjb@inf.ethz.ch Tobias Kohn University of Cambridge tk534@cam.ac.uk Dennis Komm Pädagogische Hochschule Graubünden, Chur Department of Computer Science, ETH Zurich dennis.komm@inf.ethz.ch Giovanni Serafini Department of Computer Science, ETH Zürich giovanni.serafini@inf.ethz.ch Abstract Dynamic programming has its firm place in the toolbox of a computer scientist. Its educational value, however, goes far beyond the border of our discipline. The example of dynamic programming illustrates how such an important algorithm design principle, and more generally algorithmic thinking skills, can be applied to solve problems in other fields. We describe our experiences with an approach towards teaching dynamic programming without a formal introduction to recursion, which allowed us to successfully introduce it to first-semester students of natural sciences with almost no background in computer science. 1 Introduction For many non-majors in disciplines related to mathematics, natural sciences and engineering, computer science is a mandatory part of the university curriculum. The objective of such a course is typically to introduce the students to those aspects of algorithmic thinking that may be needed for further studies and possibly for research in their fields. In addition to teaching the basics of programming in a language such as Python or Matlab, we feel it is a necessity to also convey a basic understanding of algorithmic design principles, with particular focus on the efficiency of algorithms. Efficiency of algorithms is one of the most fundamental pillars of computer science. For many problems, a naive approach becomes quickly infeasible, and stronger methods are needed – even though such stronger methods might not always exist. Since our classes address non-majors, a discussion of these principles is most fruitful when based on actual problems and examples, if possible even taken from a field familiar to the students. As an important algorithmic design principle, we teach dynamic programming, which is the method of breaking down complex problems into smaller problems, which are easier solved, and then lead to a solution to the original complex problem. Typically, dynamic programming is strongly related to recursion. However, due to our constraints, recursion is not formally covered in the introductory programming classes. Accordingly, we were not able to build a discussion of dynamic programming on this major programming principle. In this paper, we present our approach to include dynamic programming into the introductory programming course for natural science students. After covering the basics of both Python and Matlab, we discuss dynamic programming in class, based on the alignment problem for DNA sequences. 1.1 Dynamic Programming and Recursion Dynamic programming can serve as an example for a widely useful technique that illustrates the power of clever algorithm design. In many standard textbooks providing an introduction to algorithm design, dynamic programming is discussed after the principle of recursion and motivated by analyzing the drawbacks of a recursive solution to certain problems such as computing the Fibonacci numbers or some scheduling problem. The central task in dynamic programming, namely building solutions for larger subproblems from those for smaller ones, is often explicitly coined in terms of recursion. For a detailed discussion of how to teach dynamic programming via recursion, see also the paper by Forišek. Inspired by the classical textbooks by Aho et al., we chose another, more elementary approach, and centered our lecture around constructing and filling out the dynamic programming table. We found that analyzing these tables on the one hand enables an intuitive approach to analyze the time complexity of an algorithm and on the other hand is well-suited for training in a matrix-based programming language such as Matlab. 1.2 The DNA Alignment Problem Since it offered the largest common ground for our students, we motivated dynamic programming with examples from biology. Here, we describe one such approach, which deals with the following scenario. One of the most basic tasks in computational biology is to measure the similarity of biological molecules such as DNA or proteins, e.g., for the purpose of measuring the evolutionary distance between two given individuals or for handling error-prone data. DNA molecules are formed by long chains of four different small building blocks, the so-called nucleotides. The genetic information carried by a DNA molecule is fully determined by the sequence of these nucleotides; thus, it is convenient to encode a DNA molecule by a string over a four-letter alphabet \{A, C, G, T\}, where the letters stand for the four nucleotides Adenin, Cytosin, Guanin, and Thymin, respectively. This reduces the task of comparing molecules to the much easier task of comparing long strings. For a deeper insight into the biological background and the area of string algorithms, we refer to the textbooks by Gusfield [9] or Böckenhauer and Bongartz [3, 4]. In our lectures, we discuss only one very basic string comparison task. It is easy to argue, while only using simple arguments, that a straightforward brute-force approach towards solving this problem is infeasible. Consequently, this example provides a rather impressive opportunity to point out the power of dynamic programming by again using rather simple and straightforward arguments. One of the main points raised is to compare exponential and polynomial time complexity. 1.3 Classroom Experience We taught the following material at various occasions, the largest being a first-semester course of students of biology, pharmacology, environmental sciences, health sciences and technology, agriculture, geology, and nutritional sciences. The class typically lasts 90 minutes and takes place at one of the largest halls at our university, with the audience usually consisting of several hundred students. The chosen teaching method is direct instruction, enriched by carefully planned questions that are expected to increase participation and initiate discussion. Other occasions at which the material was presented include a course on computational biology at a community college, and various high school classes. Although age and prior knowledge of the students may differ across the groups, the didactic approach, the content as well as the learning objectives are generally the same. 1.4 Didactical Aspects Since computer science is yet just one among several concurring optional subjects at high school in our country, we are not allowed to assume any pertinent prior knowledge in concepts and methods of programming. A survey in the first week of the lecture confirms that the majority of the students is used to office applications and social media, but lacks even a minimal scientific background in computer science when entering university. When presenting this teaching unit on dynamic programming, our students are assumed to already understand the basics of programming in Matlab, including variables, conditional execution, and simple loops, but no recursion. Furthermore, they have themselves designed simple algorithms of around ten lines of code, and carried out some hands-on analyses of their algorithms with respect to both correctness and running time. In general terms, the teaching unit aims at introducing the students to the notion of an algorithm design technique as a generalized method to approach the solution of a given problem. We expect the students to become aware that algorithm design techniques are special instances of problem solving strategies [15], and that dynamic programming is only one among several such paradigms [11]. Accordingly, we want our students to first search for adequate design techniques when facing new computational problems in their field of study or research subject. The specific goals of our teaching materials and our lecture are the following. 1. Analyzing the time complexity of algorithms, explaining the drawbacks of brute-force strategies and the need for clever algorithm design. 2. Introducing dynamic programming as an example of a clever algorithm design technique. 3. Modeling real-world problems, e.g., from biological applications, as computer science tasks. 4. Training programming skills, especially dealing with (multidimensional) arrays in Matlab or Python. 2 Designing the Algorithm In the following, we describe the setting and our approach towards teaching dynamic programming in an elementary way. 2.1 Modeling: The DNA Alignment Problem We motivate the task as described above while usually giving a little more context and, e.g., background information on how the DNA is obtained, etc. At first, of course, we have to think of an accurate way to express how similar two given strings are; in particular, simply taking the Hamming distance of two strings, say, ACCTACGATACGT and CGTACGTACGTA, suggests that they are not similar at all, although this probably does not reflect reality. This is a good opportunity to talk about interdisciplinary approaches and the process of modeling a biological problem in terms of computer science. The two most important events that can happen to a DNA sequence are point mutations, leading to the change of a single letter of the corresponding string, and insertions or deletions of short subsequences. One of the most straightforward, yet very meaningful approaches to define a distance measure based on these two events is to consider the so-called edit distance, which is due to Levenshtein [12], and which can be explained easily to students, even without any background in computer science. Here, we allow the operation of inserting spaces into the two strings in order to align them; every inserted space yields a penalty of 1. Furthermore, whenever two different letters are at the same position, this is called a mismatch, which also results in a penalty of 1. The sum of all the penalties yields the cost of the given alignment, and the cost of a best (i.e., cheapest) such alignment is called the edit distance of the two strings. Consider, e.g., the two strings \( s = \text{GACGATTATG} \) and \( t = \text{GATCGAATAG} \) over \{A, C, G, T\}. There are different ways to align them, e.g., \[ \begin{align*} \text{GA=CGATTATG} & \quad \text{GAC=GATTATG} \quad \text{and} \quad \text{GACGAT=-----TA=TG} \\ \text{GATCGAATAG} & \quad \text{GATCGAATAG} \quad \text{and} \quad \text{-----GATCGAATAG} \\ \end{align*} \] where we marked positions that cause penalties by a gray background. The three alignments result in penalties of 3, 5, and 10, respectively. Here, the first alignment yields the best result of the three; the resulting cost is 3, and it is easy to see that there is no better way of aligning \( s \) and \( t \) with respect to this distance measure. As a result, \( s \) and \( t \) have edit distance 3. 2.2 A Brute-Force Approach In what follows, the task is to find a best alignment for given \( s \) and \( t \). After explaining the problem like this in class, we start by analyzing the simplest approach possible, namely to try out all possibilities and pick a best among them. It is easy to explain, on an intuitive level, why this means trying out exponentially many possibilities: Note that an alignment of two strings is unambiguously defined by the positions where gaps are inserted into the two strings. Counting the number of alignments that have to be considered thus means counting the number of possibilities to insert the gaps. Suppose both strings have the same number \( n \) of letters, i.e., \( s = s_1 s_2 \ldots s_n \) and \( t = t_1 t_2 \ldots t_n \), for \( s_i, t_i \in \{A, C, G, T\} \) with \( 1 \leq i \leq n \). For the resulting string, every position \( i \) can be aligned as \[ \begin{align*} s_i, & \quad s_i- \\ t_i, & \quad -t_i, \quad \text{or} \quad -s_i - t_i \end{align*} \] which leads to \( 3^n \) different alignments. Of course, this only gives a very loose lower bound on the total number of possible alignments; there are many other possibilities to align \( s \) and \( t \). Without any formal introduction to running time analysis or polynomial-time complexities, we can argue that \( n \) is usually a string of some thousands of characters and therefore it is not possible to find a best alignment by this brute-force approach; hence, we need to come up with something more clever. ### 2.3 The Dynamic Programming Idea This is the point where we introduce the concept of dynamic programming as an indispensable part of the algorithmic toolbox. The general idea of computing the solution to a given instance from the solutions for smaller (sub-)instances is intuitively very plausible and easy to understand even with very little previous knowledge. Nevertheless, finding the right set of smaller instances to solve is not trivial in this case and nicely illustrates the work of an algorithm designer. In the case of the alignment problem with respect to the edit distance, this creative work was first done by Needleman and Wunsch [13]. The idea is to compute the edit distance for all pairs of prefixes of the two given strings, including the empty prefix. This might be surprising at first glance since it seems to require much extra work. Why is it necessary to compute a quadratic number of optimal alignments instead of only one? From the point of view of an experienced computer scientist, this question is easiest investigated in terms of a recursive procedure. We reduce the task of computing the alignment of two given strings to the task of computing it recursively for three different prefix pairs of strictly smaller total length. This basic idea behind the algorithm can be illustrated as follows. Again, let us consider two strings \( s \) and \( t \) with \( n \) letters each. Now consider the last letters \( s_n \) and \( t_n \). There are three options to align those: (1) we insert a space beneath \( s_n \) inducing a penalty of 1; (2) we insert a space above \( t_n \) again leading to an additional cost of 1; or (3) we write $s_n$ above $t_n$, which causes no penalty if $s_n = t_n$, and a penalty of 1 otherwise. Observe that there is always an optimal alignment in which there are no two spaces beneath each other; thus, this option is ignored. As an example, consider the two strings $s = ATG$ and $t = TAG$, and in particular the third position. The three possibilities are: $$ \begin{array}{|c|c|} \hline \text{AT} & \text{G} \\ \text{TAG} & = \\ \text{ATG} & = \\ \text{TA} & \text{G} \\ \text{AT} & \text{G} \\ \text{TA} & \text{G} \\ \hline \end{array} $$ The penalties are 1, 1, and 0, respectively. Hence, the value of an optimal alignment for $s$ and $t$ can be computed recursively from the three alignments for the remaining string pairs after cutting off the last column of the alignment, i.e., from the penalties for aligning AT and TAG, aligning ATG and TA, and aligning AT and TA, respectively. However, the main idea behind the dynamic programming approach is to perform this recursive computation not via recursive function calls, but by using a bottom-up approach of filling a table of penalty values. Since the actual computation is only concerned with filling this table, we can explain the algorithm without explicitly mentioning the concept of recursion. Cutting off the last column of any possible alignment of the given strings $s$ and $t$ can be motivated as follows. Assume we had a possibility to compute the alignments for the three smaller instances; then we could also solve our actual task. In this case, the only difficulty that is left is to find some sufficiently easy small cases to start with, which will be the alignments of some string with the empty string. In the following, we describe the procedure in more detail. ### 2.4 Computing the Penalty Table The common approach is to use a table $P$ (for “penalties”) in order to both illustrate and implement this idea. To be more general, we allow that $s$ and $t$ have different lengths; say, $s = s_1 \ldots s_m$ and $t = t_1 \ldots t_n$. In this case, $P$ has a size of $(m + 1) \times (n + 1)$, and the cell $(i, j)$ of $P$ with $0 \leq i \leq m$ and $0 \leq j \leq n$ contains the smallest penalty for aligning the first $i$ letters of $s$ with the first $j$ letters of $t$; we denote this value by $P(i, j)$. The special cases of the first row and column (with index 0) need to be explained carefully. These represent aligning some prefix of one of the two strings with the empty string $\varepsilon$ that contains zero letters. Aligning any prefix of $s$ or $t$ with $\varepsilon$ results in $$s_1s_2 \ldots s_i \quad \text{or} \quad t_1t_2 \ldots t_j,$$ where $s_i$ and $t_j$ are in position $i$ and $j$, respectively. with penalties \(i\) and \(j\), respectively. The concept of empty strings is in general unknown to the target audience and might appear a little confusing to the students at first glance. However, from this example, where it provides a very easy and elegant way to define the base cases for our bottom-up dynamic programming approach, the students can usually be easily convinced that empty strings are a very helpful concept. We now demonstrate how to fill out \(P\) cell by cell using the two strings \(s = \text{ACTTG}\) and \(t = \text{CCTG}\) as an example. We start with the first row and column, which get a penalty equal to the length of the string that is aligned with \(\emptyset\); see Figure 1a. Next, we fill out cell \((1, 1)\), which contains the minimum penalty to align the two first letters of \(s\) and \(t\). As described above, there are three possibilities for the last column of this alignment; again, see Figure 1a. 1. In this last column, we can insert a space beneath the first letter \(s_1\) of \(s\), i.e., into \(t\). This way, we obtain a penalty of 1, the first letter of \(s\) is written down, but no letter of \(t\). This leaves us with the subproblem of aligning the empty prefix \(\emptyset\) of \(s\) with the prefix \(t_1\) of \(t\), yielding \[ \begin{array}{c|c} \emptyset & A \\ C & \\ \end{array} \] and the penalty to align \(\emptyset\) with \(t_1 = C\) can already be found in \(P\) in cell \((0, 1)\), i.e., one row above the cell we are about to fill out. We already know that this penalty is 1, and thus we get a total penalty of 2 in this case. 2. Conversely, we can insert a space into \(s\) in the last column of the alignment, which yields \[ \begin{array}{c|c} A & = \\ \varepsilon & = \\ \end{array} \] This again causes a penalty of 1 plus an additional penalty of 1 to align \(s_1\) with \(\varepsilon\), which is already written down in \((1,0)\). Hence, we get a penalty of 2 also in this case. 3. Finally, we can create a mismatch, i.e., we let the last column of the alignment contain the letters \(s_1 = A\) and \(t_1 = C\), resulting in \[ \begin{array}{c|c} \varepsilon & = \\ \varepsilon & = \\ \end{array} \] This mismatch also causes a penalty of 1, and it leaves us with the subproblem of aligning \(\varepsilon\) with \(\varepsilon\), which causes no penalty, as can be looked up in cell \((0,0)\). The total penalty in this case is therefore 1. In all three cases, the penalty for the candidate solution can be easily computed from the already known penalty values in the table. The smallest cost to align \(s_1\) and \(t_1\), (i.e., the value in \((1,1)\)) is then given by the minimum of the three values just described, i.e., \[ P(1,1) = \min\{P(0,1) + 1, P(1,0) + 1, P(0,0) + 1\} = 1. \] This procedure can then be repeated for computing the remaining cells in the table. Let us consider the cell \((2,1)\) of \(P\), i.e., aligning the first two letters of \(s\) with the first one of \(t\). We again have three cases; see Figure 1b 1. Inserting a space into \(t\) in the last alignment column gives \[ \begin{array}{c|c} A & = \\ C & = \\ \end{array} \] and the penalty to align \(s_1\) and \(t_1\) can be found in cell \((1,1)\). 2. Inserting a space into \(s\) in the last column yields \[ \begin{array}{c|c} AC & = \\ \varepsilon & = \\ \end{array} \] and the penalty to align \(s_1s_2\) with \(\varepsilon\) can be found in cell \((2,0)\). 3. Aligning the two last letters, i.e., $s_2$ and $t_1$, with each other gives \[ \begin{array}{c|c} A & C \\ \varepsilon & C \\ \end{array} \] and the penalty to align $s_1$ with $\varepsilon$ is written in cell $(1, 0)$. Since the last option does not cause a mismatch, we obtain \[P(2, 1) = \min\{P(1, 1) + 1, P(2, 0) + 1, P(1, 0)\} = 1,\] and we observe that we look at the same relative cells as before, namely that one row above, that one column to the left, and the one above left. Generalizing this strategy, we get \[P(i, j) = \min\{P(i - 1, j) + 1, P(i, j - 1) + 1, P(i - 1, j - 1) + p_{ij}\},\] where $p_{ij}$ is 1 if and only if a mismatch is created in the last option, and 0 otherwise. The cell $(m, n)$ finally contains the cost of a best alignment of $s$ and $t$, i.e., the edit distance of the two input strings. At this point, especially in smaller classes, we ask the students to try to fill out the rest of the table for themselves, which takes around five to ten minutes. The complete table is shown in Figure 1c. This way, they quickly discover themselves that the work carried out is rather repetitive. It becomes obvious that a computer can be easily told to do this instead. ### 3 Implementation of the Algorithm Now that the high-level description of the algorithm is produced, we can start with the practical part. #### 3.1 Implementation in Matlab Another nice thing about reducing the problem to filling out a table is that it can be implemented rather easily in Matlab. One of the reasons is that Matlab handles 2-dimensional arrays without much syntactical overhead. We can essentially follow the above high-level description and translate the algorithm into code right away. As noted above, the students know at this point conditional execution and loops; not much more is needed. The only unfortunate inconvenience is that, in Matlab, vector indices start with 1 instead of 0. [Algorithm 1](#) shows our implementation, which initializes the input strings $s$ and $t$ and the penalty Algorithm 1: Computing the penalty matrix $P$ matrix $P$ in lines 1 to 11, and fills out the latter in lines 12 to 24. This block follows exactly our description. In lines 14 to 18, we compute whether a match or mismatch happens if the two letters are written beneath each other; the minimum of the three values is computed in lines 19 to 20, and stored in $P$ in line 21. 3.2 Backtracing After the implementation shown in Algorithm 1 is understood, we can discuss in class that the output of the algorithm indeed gives the smallest cost to align the two input strings, but does not tell us what the actual alignment looks like. In this context, it is very comfortable that Matlab’s minimum function returns a two-component vector, namely the minimum and the index from which the minimum stems. We save these two values as $smin$ and $imin$ in line 20 of Algorithm 1 but only use the first one so far. For every entry of $P$, we now just compare the minimum of three values, which correspond to three adjacent cells. At least one of those gives the minimum, and in turn corresponds to one of the three options we have already described. 1. Inserting a space into \( t \); this corresponds to the cell in the row above and the first entry of the vector \( x \) in line 19 of [Algorithm 1]. 2. Inserting a space into \( s \), which corresponds to the column to the left and thus the second entry of \( x \). 3. Writing the two letters underneath each other, which corresponds to the third entry of \( x \). We now save which of the three values actually is the minimum; of course, this is not necessarily unique, and ties are broken in favor of the smaller index. This is the index of the entry of \( x \) with minimum value; we have stored this value as \( \text{imin} \) in line 20 of [Algorithm 1], and we now additionally save it in the corresponding cell of a matrix \( B \) (for “backtracing”). Hence, we add the line \[ B(i,j) = \text{imin}; \] 22. to [Algorithm 1]. \( B \) has the same size as \( P \), and it stores one possible optimal alignment in the following way: The cell \((i,j)\) of \( B \) contains a 1 if and only if a space was inserted into \( t \), a 2 if and only if a space was inserted into \( s \), and a 0 if and only if both letters were written underneath each other, with respect to this particular alignment. Again, the first row and column need to be handled in a special manner. In the first column, all entries are 1 since there is no column to the left, and spaces can only be inserted into \( t \); likewise, all entries in the first row are 2. The cell in the upper-left corner is assigned value 0. The backtracing matrix for our sample strings \( s = \text{ACTTG} \) and \( t = \text{CCTG} \) is shown in Figure 2a, where arrows indicate how the numbers are interpreted. In this example, the algorithm computes the alignment \[ \begin{align*} \text{ACTTG} \\ \text{--CCTG}, \end{align*} \] which indeed contains one space and one mismatch and thus has a penalty of 2 as computed in Figure 1c. Furthermore, we create a 2-dimensional vector \( \text{result} \), whose first row corresponds to the aligned string \( s \) and whose second row corresponds to the aligned string \( t \), by marking spaces with “-.” We fill \( \text{result} \) from the right to the left as shown in [Algorithm 2]. We start in cell \((m,n)\) of \( B \); recall that this is cell \((m+1,n+1)\) in Matlab, thus the variables \( i \) and \( j \) are initialized as \( m+1 \). and \( m+1 \), respectively. If we find a 1 in this cell, we write the last letter of \( s \) in the first line of \( \text{result} \) and a space in the second line of \( \text{result} \), since this means that a space was inserted into \( t \). Likewise, if there is a 2, we write a space in the first row and the last letter of \( t \) in the second row of \( \text{result} \). Last, if there is a 0, we write the last letters of \( s \) and \( t \) at the first and second row of \( \text{result} \), respectively. According to the entry, we continue in the indicated cell and repeat the procedure until we arrive at cell \((0,0)\). Once we reach this cell, \( \text{result} \) contains a representation of an optimal alignment of \( s \) and \( t \) (preceded by some empty cells). 4 Analysis of the Time Complexity The correctness of the algorithm of Needleman and Wunsch follows from our discussion at the beginning. We do not formally prove it in class. Analyzing the time complexity of the algorithm is again straightforward, since its main work is to fill out the tables \( P \) and \( B \) of size \((m+1) \times (n+1)\) each. Computing the value of any cell only involves a constant number of comparisons and elementary arithmetic operations, and we therefore get a running time in \( O(m \cdot n) \) for this part. Computing the actual alignment as shown in Algorithm 2 can be done in time \( O(\max\{m, n\}) \). Note that we are not using the \( O \)-notation in our lecture since the students are not familiar with it. Instead, we just count the comparisons and assignments in the Matlab code. It follows that dynamic programming for the alignment problem induces an exponential improvement over the brute-force approach discussed at the beginning. It Algorithm 2: Computing the alignment using the backtracing matrix $B$ is therefore a good candidate to discuss polynomial versus exponential time. To illustrate the impact of the difference, we usually show a graph as in Figure 2b. 5 Exercises and Extensions The presented alignment algorithm is very robust in the sense that it can be used to solve also many variants of the basic problem. In the lecture, we discuss two of these extensions if time permits. Implementing these extensions in Matlab can serve as a good exercise for the students. First, the algorithm can be easily adapted to more complex distance functions, for example choosing different penalties for different mismatching pairs of letters. This is very helpful, e.g., when comparing protein sequences which are comprised of 20 different amino acids some of which are chemically more similar than others. Second, the results of the alignment algorithm are biologically meaningful only in the case when both strings are of approximately the same size. Consider the strings $s = \text{TAAGGT}$ and $t = \text{AGTTTATAGCCTGGT}$. An optimal alignment according to the edit distance measure is \[ \begin{array}{c} \text{----TA-A----GGT} \\ \text{AGTTTATAGCCTGGT} \end{array} \] with a penalty of 9. However, from a biological point of view, the following alignment is better motivated, although it induces a penalty of 10, because the smaller string is aligned to a compact region of the longer string: \[ \begin{array}{c} \text{----TA-AGG-T---} \\ \text{AGTTTATAGCCTGGT} \end{array} \] To adapt the algorithm such that it finds the second alignment rather than the first one, we have to make sure that gap symbols at the beginning and the end of the shorter string do not cause any penalty. This can be done (if, without loss of generality, $s$ is the shorter string) by initializing the first row of $P$ with all zeros, and taking as a result not necessarily the value in the lower-right corner cell of the table, but the minimum value in the last row. \section{Conclusion} In this paper, we described our approach towards teaching dynamic programming in an elementary way to students without a strong background in computer science. Our general goal is to teach algorithmic thinking as early as possible \cite{10}, and the described way allows the students to realize one of the most essential principles of algorithm design without much syntactical overhead and especially without a formal introduction to recursion. The presented alignment algorithm is of large practical importance as it lies at the heart of all implementations that are actually used for sequence comparisons in biology (although a lot of heuristic rules are added in practice to reduce the running time from quadratic to linear while keeping the error small). Especially for our students from biology and related sciences, it is highly motivating to see how algorithmic thinking can help to solve basic problems from their field. Implementing this algorithm is also well-suited with respect to the goal of teaching Matlab programming since handling the dynamic programming table fits very well into Matlab’s easy syntax for matrices. References
{"Source-Url": "http://bulletin.eatcs.org/index.php/beatcs/article/download/587/593", "len_cl100k_base": 7370, "olmocr-version": "0.1.53", "pdf-total-pages": 17, "total-fallback-pages": 0, "total-input-tokens": 43388, "total-output-tokens": 8999, "length": "2e12", "weborganizer": {"__label__adult": 0.0007028579711914062, "__label__art_design": 0.0015516281127929688, "__label__crime_law": 0.000946044921875, "__label__education_jobs": 0.15625, "__label__entertainment": 0.0002359151840209961, "__label__fashion_beauty": 0.0005025863647460938, "__label__finance_business": 0.0009927749633789062, "__label__food_dining": 0.0011701583862304688, "__label__games": 0.001186370849609375, "__label__hardware": 0.0019702911376953125, "__label__health": 0.002132415771484375, "__label__history": 0.0012979507446289062, "__label__home_hobbies": 0.0006041526794433594, "__label__industrial": 0.0019025802612304688, "__label__literature": 0.00112152099609375, "__label__politics": 0.0010271072387695312, "__label__religion": 0.0012874603271484375, "__label__science_tech": 0.332275390625, "__label__social_life": 0.0005788803100585938, "__label__software": 0.00954437255859375, "__label__software_dev": 0.4794921875, "__label__sports_fitness": 0.0008625984191894531, "__label__transportation": 0.0018100738525390625, "__label__travel": 0.0005273818969726562}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 33052, 0.0138]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 33052, 0.72013]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 33052, 0.89824]], "google_gemma-3-12b-it_contains_pii": [[0, 160, false], [160, 1363, null], [1363, 4087, null], [4087, 6611, null], [6611, 8885, null], [8885, 11683, null], [11683, 14414, null], [14414, 17166, null], [17166, 18839, null], [18839, 20593, null], [20593, 22623, null], [22623, 23602, null], [23602, 26123, null], [26123, 27892, null], [27892, 28441, null], [28441, 30872, null], [30872, 33052, null]], "google_gemma-3-12b-it_is_public_document": [[0, 160, true], [160, 1363, null], [1363, 4087, null], [4087, 6611, null], [6611, 8885, null], [8885, 11683, null], [11683, 14414, null], [14414, 17166, null], [17166, 18839, null], [18839, 20593, null], [20593, 22623, null], [22623, 23602, null], [23602, 26123, null], [26123, 27892, null], [27892, 28441, null], [28441, 30872, null], [30872, 33052, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 33052, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 33052, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 33052, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 33052, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 33052, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 33052, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 33052, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 33052, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 33052, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 33052, null]], "pdf_page_numbers": [[0, 160, 1], [160, 1363, 2], [1363, 4087, 3], [4087, 6611, 4], [6611, 8885, 5], [8885, 11683, 6], [11683, 14414, 7], [14414, 17166, 8], [17166, 18839, 9], [18839, 20593, 10], [20593, 22623, 11], [22623, 23602, 12], [23602, 26123, 13], [26123, 27892, 14], [27892, 28441, 15], [28441, 30872, 16], [30872, 33052, 17]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 33052, 0.0]]}
olmocr_science_pdfs
2024-12-07
2024-12-07
0246b325f6d41f1703d8f9d6e6b15374e6a1ccbc
Comparative Evaluation of Packet Classification Algorithms for Implementation on Resource Constrained Systems Gianluca Varenni*, Federico Stirano***, Elisa Alessio**, Mario Baldi*, Loris Degioanni*, Fulvio Risso* * Politecnico di Torino, Dipartimento di Automatica e Informatica, Torino, Italy ** Telecom Italia Labs - System On Chip, Torino, Italy *** Istituto Superiore Mario Boella, Torino, Italy {gianluca.varenni@mario.baldi,loris.degioanni@polito.it; stirano@ismb.it; elisa.alessio@tilab.com Abstract – This paper provides a comparative evaluation of a number of known classification algorithms that have been considered for both software and hardware implementation. Differently from other sources, the comparison has been carried out on implementations based on the same principles and design choices. Performance measurements are obtained by feeding the implemented classifiers with various traffic traces in the same test scenario. The comparison also takes into account implementation feasibility of the considered algorithms in resource constrained systems (e.g., embedded processors on special purpose network platforms). In particular, the comparison focuses on achieving a good compromise between performance, memory usage, flexibility and code portability to different target platforms. I. INTRODUCTION A vast literature on classification algorithms and their performance does exist, but our work is necessary, hence relevant since existing evaluations do not allow a significant comparison based on real-life data. In fact, a comparison based on existing literature could be carried out only according to analytical worst-case bounds. Even though figures on the performance of classification algorithms implementations in real-life scenarios can be found, they are part of studies on a single algorithm: the measurement scenarios are different and the implementations are not uniform, consequently the results are not comparable. This work studies known classification algorithms with respect to their suitability for being (i) deployed for common networking applications (i.e., not optimized for a specific one), and (ii) implemented in embedded systems, i.e., systems with strict requirements, limited resource availability, and no specific hardware support, such as content addressable memories. A (packet) classifier is a collection of rules — usually called ruleset — that is used to partition network traffic into different groups, sometimes called flows or buckets. Every rule specifies a subset of the network traffic, for example “IP traffic”, or “traffic sent from host 1.2.3.4”, thus somehow characterizing packets grouped into that flow. When a packet satisfies a rule, the packet is said to match the given rule. A classification algorithm determines whether a packet matches at least one rule of a classifier. Packet classifiers are widely used in IP networking where rules usually involve one or more packet header fields (e.g. IP source address, TCP destination port). Each rule $R$ is composed of $i$ components, so that each component $R[i]$ applies to a specific header field. When more than one field is considered, the classifier is said to be multifield. As an example, Table 1 shows a small multifield ruleset that includes value/mask rules on the source and destination IP addresses. Packet classifiers are widely used for various network applications, many of which related to quality of service (QoS) provision, and consequently in several types of network devices that might be implemented as or composed of embedded systems. Examples of QoS related applications of packet classifiers are: - Traffic conditioning and shaping appliances; they use multifield classifiers, usually on session tuples, to separate traffic flows in order to be able to apply on them admission, marking and shaping policies. Traffic conditioning appliances or functionality are fundamental whenever in the deployment of both the IntServ [1] and DiffServ [2][3] approach. - IntServ routers; they use multifield classifiers, usually on session tuples, to separate traffic flows in order to store packets in different queues on which scheduling algorithms suitable to provide the required QoS are applied. - DiffServ routers; they use single field classifiers based with a limited ruleset concerning the value of the DS (Differentiated Services) field [3] to separate packets belonging to different traffic classes in order to handle them according to the corresponding per-hop behavior (PHB). This work aims at identifying classification algorithms that can be effectively implemented on embedded systems and deployed in any of the above listed applications. Execution in embedded systems imposes strict limits on the characteristics of the algorithms, such as simple (static) memory management, limited code size, limited CPU usage requirements, limited data storage necessities, <table> <thead> <tr> <th>IP source</th> <th>IP destination</th> </tr> </thead> <tbody> <tr> <td>Rule 1</td> <td>Value = 130.192.1.0</td> </tr> <tr> <td>Rule 2</td> <td>Value = 130.192.2.0</td> </tr> <tr> <td>Rule 3</td> <td>Value = 130.192.0.0</td> </tr> </tbody> </table> TABLE 1. SAMPLE MULTIFIELD RULESET adaptability to various hardware platforms and architectures. Our work, and this paper describing it, was organized as follows. The various algorithms proposed in the literature (Section B) as well as the metrics commonly deployed to evaluate them (Section A) are first surveyed. The implementation objectives and the guidelines followed to develop software for embedded systems are then shown in Section III. Based on this, selection criteria (Section A) are formulated and are used to identify a limited set of algorithms on which to perform a more detailed and targeted comparative evaluation. Section IV provides the results of the comparative evaluation conducted with real-life traffic traces and final conclusive remarks are provided in Section V. II. THEORETICAL ANALYSIS OF CLASSIFICATION ALGORITHMS Among the others [5], the comparative survey of classification algorithms by Gupta and McKeown [4] provides a detailed comparison of the most important known algorithms for multfield classification. Even though this work represents a complete and interesting tutorial on classification algorithms, it does not present any performance comparison based on real-world network traffic. Our work leverages some of the criteria and results presented by Gupta and McKeown to select a reduced set of classification algorithms that best fit to be implemented in embedded systems. Another contribution of our work lies in the detailed and homogeneous evaluation of such selected algorithms that have been implemented with common criteria and evaluated in a common test bed using real traffic captures. A. Evaluation metrics and parameters The metrics adopted are the ones commonly used by various authors [6][7][8][9][11][12] in literature, including Gupta and McKeown in [4]: search time, memory consumption, and update time. Search time (T), i.e. the amount of time needed to classify a packet, is the most obvious metric; in order to devise a measurement at least partially independent from the particular test bed, the search time is measured in terms of CPU clock cycles. Memory consumption (M) is the amount of memory needed to store the ruleset in some specific data structure in memory, computed either at instantiation or run time. Memory consumption is an excellent indicator of the compression capability of the algorithm measured as the ratio between the ruleset size (i.e. number of rules and number of fields) and its footprint in memory. The update time (U) is the amount of time necessary to insert, delete, or modify a rule in the running ruleset. An interesting metric is represented by the number of memory accesses performed by the algorithm, but it is not widely used because getting this data is far from being trivial. The three metrics previously described generally depend on the following parameters: - The number of rules N in the ruleset - The number of fields d globally used within the RI[i] components of each rule - The length of each field, in bits, called Wi. In order to simplify the evaluation of the algorithms, we will use a new fictitious parameter W, defined as W=max(Wi) Section A will provide some insight in the implications of such simplification on the comparative evaluation presented later. B. Theoretical complexity of some well-known algorithms In order to have a first general comparison of the classification algorithms and select which to adopt for a more thorough analysis, the theoretical worst-case bounds for the metrics identified in Section A were taken into consideration. Table 2 shows the formulas expressing the bound for each of the metrics. Such formulas were either taken directly from the literature, when available, or inferred from a paper describing the corresponding algorithm. <table> <thead> <tr> <th>Algorithm</th> <th>Search time (T)</th> <th>Memory usage (M)</th> <th>Update time (U)</th> </tr> </thead> <tbody> <tr> <td>Linear search</td> <td>N</td> <td>N</td> <td>1</td> </tr> <tr> <td>Cross producting [7]</td> <td>dW</td> <td>N_d^N</td> <td>N/A</td> </tr> <tr> <td>Tuple Space Search [8]</td> <td>N</td> <td>N</td> <td>N</td> </tr> <tr> <td>Recursive Flow Classification [12]</td> <td>D</td> <td>N_d^N</td> <td>N/A</td> </tr> </tbody> </table> Hardware based [14] and ad-hoc algorithms [10] were not included in this evaluation since either the selected metrics cannot be applied to them, or a comparison based on them is meaningless due to the particular nature of such algorithms. Instead, the linear algorithm was included because it is widely used by software based firewalls (e.g. Linux netfilter/iptables [13]) and it is an excellent baseline against which other algorithms can be compared to, especially in the implementation and testing part of this work. The bound on the update time is not shown for some of the algorithms since they do not explicitly support dynamic updates to the running ruleset. This stems from the fact that these algorithms preprocess the ruleset into a specific custom data structure that does not support insertion or removal of rules. Instead, in order to cope with ruleset changes the whole ruleset must be re-processed thus yielding a new data structure. Such an approach is usually inefficient, since the preprocessing time is typically quite high. C. Practical issues with the theoretical complexity The worst cases in Table 2 show quite clearly that the linear search algorithm outperforms the other algorithms in terms of memory consumption and update time. Its search time performance is comparable to the other algorithms when the number of rules is not large; for example, when classifying UDP flows or TCP connections \((d=5 \text{ and } W=32)\) the break point is one or two hundreds rules. In fact, the search time of the other algorithms depends on the total number of bits \(dW\) of the various fields in each rule because the classification algorithm processes the classification fields bit by bit— in particular, this is the approach used by all the algorithms based on tries. Consequently, the linear algorithm might be particularly interesting in cases, IPv6 addresses, in which the total number of bits \(dW\) is high. As a matter of fact, the theoretical analysis previously conducted is limited by several factors: - The performance of many classification algorithms when used with real traffic might be very different from the theoretical results shown in Table 2; this is particularly true for heuristics, that are engineered to achieve good performances in the average case, and not in the worst case. - The theoretical complexities shown in Table 2 have been devised assuming that all fields used for the classification have the same length, equal to the length of the largest one; this simplification can bring to unrealistic theoretical results (e.g. in the case of IPv6 session identifiers, we consider the length of a TCP/UDP port to be 128 bit, and this is completely misleading). A solution to this problem could be to re-formulate each metric taken into consideration using the various fields’ lengths \(W_i\), but this out of the scope of this paper. III. IMPLEMENTATION An objective of this work is to identify and evaluate the packet classification algorithms that are more suitable for an implementation on resource constrained systems. When writing software for an embedded system, specific constraints have to be taken into account in order to grant good performances and flexibility in terms of code portability to different target platforms: hence, several aspects have been considered while implementing the above mentioned algorithms. First of all, the main goal of our work was to write a code portable to different target platforms, independent from the processor and the operating system used. To accomplish this objective, we developed a software library made up of pure ANSI C, trying to avoid any use of OS/compiler support functions that could not be available on special purpose processors. The crucial point in generating portable code is to separate the coding of functional modules from the one related to the specific target environment. This can be achieved by defining some sort of API, which avoids the use of platform dependent functions directly inside the code. A second consideration is that the code should use static memory allocation, since a dynamic allocation infrastructure is not granted to be present on all the target platforms. Another requirement is that the code should avoid the use of explicit pointers in the raw data structures containing the ruleset; in fact, sometimes the code creating and initializing the data structure and the code that classifies packets using this structure run either on different processors (e.g. network processors using multiple processing units) or within different address spaces (e.g. code running partially at kernel level and partially at user level on a general purpose PC). A commonly used solution to the problem is to make use of indirect addressing, using only displacement pointers in the data structure, and the base pointer outside it. In a network embedded system we can distinguish among data-plane functions (related to packet processing functionalities, with high performance requirements) that usually run on specific processor engines and control-plane functions (for data structure initialization and configuration, usually with high memory requirements) that may run on a general purpose processor. Thus, one general issue is that the code be as deeply as possible, trying to separate the main algorithms functionalities, which may have high performance requirements, from the control and configuration functions that may run on a different processor. A. Selecting the algorithms to be implemented Given previous considerations and taking into account the practical issues enlightened in Section 2, we decided which algorithms to implement to meet our objectives. 1. We excluded Cross-Producing and Set-Pruning Tries, because their memory consumption grows as \(N^d\), which is extremely critical even with rather low values of \(N\) and \(d\) (e.g. with \(N=100\) rules and \(d=4\) fields memory consumption is about \(10^6\)). While RFC and HiCuts have the same worst case memory consumption, they are heuristic algorithms, therefore this value is not enough to get rid of them. 2. We excluded Heap on Tries and Binary trees on Tries, because their memory consumption and search time is proportional to \(W^d\) which is too large (e.g. this value is larger that \(10^3\), when the maximum field size \(W\) is 128 bits and the number of fields \(d\) is 5); moreover the paper presenting these algorithms does not give any hint about any working implementation of them. Although the Hierarchical Tries algorithm has the same search time as the two previous ones, it has not been excluded because of its excellent characteristics referred to memory consumption. 3. We excluded HiCuts, because this algorithm is patent pending. 4. Tuple Space Search was excluded essentially because it was decided that the comparative study would include a single heuristic algorithm and from the information we gathered in the literature the implementation details of RFC seemed clearer. In summary, we decided to implement the Linear algorithm, to be used as a baseline for the comparison, the Hierarchical Tries algorithm (the only remaining non-heuristic algorithm after the screening described above), and the Recursive Flow Classification algorithm. IV. PERFORMANCE EVALUATION Although our implementation is targeted to both general and special purpose platforms, so far it has been validated through extensive tests only on a standard personal computer. We did not consider tests on special purpose platforms in the context of this work since it specifically aims at giving a homogeneous comparison between the implementation of various algorithms by measuring their performance in real-life working conditions. Moreover, the obtained experimental results are compared against... the theoretical worst-case results. However, tests on special purpose platforms will be carried out as a future work in an effort to evaluate the performance disparities on different platforms. A. Testbed The tests were conducted using a network trace taken from our university link to the Italian trans-university backbone. This trace has the following characteristics: - duration: 6 hours - total packets: 24 millions - total bytes: 13 GBytes - average traffic: 5 MBps, 1100 pps. The implemented algorithms have been compiled with the Microsoft Visual C++ 6.0 SP 5 compiler. We used an Intel Pentium IV 2GHz workstation with 1GB RAM, running Microsoft Windows XP. The measurements were taken with the x86 assembler instruction RDTSC (Read TimeStamp Counter), which gives the number of CPU clock ticks from the machine bootstrap. We used the ruleset running on the router connected to the same link on which we captured the network trace (the packets were captured immediately before the router classifier); this ruleset is formed of 349 rules, each rule working on these fields: - source / destination IPv4 address - Layer 4 protocol (TCP/UDP/ICMP/any) - source / destination TCP/UDP port. In order to evaluate the algorithms with rulesets of different size, we extrapolated some fictitious ruleset from the original one. These are the new rulesets we defined: - 2 rulesets formed of 50 rules (rules 1-50 and 51-100 of the original ruleset) - 2 rulesets formed of 100 rules (rules 1-100 and 101-200 of the original ruleset) - 1 ruleset formed of 200 rules (rules 1-200 of the original ruleset). B. Search time test results This test aims at measuring the average packet classification time for the various rulesets; the results are shown in Table 3. The results of this test show that the mean search time grows linearly with the number of rules in the case of the linear algorithm; in the case of the Hierarchical Tries algorithm, the search time seems to grow linearly, too, but the trend is much lower than the linear one. The RFC algorithm, instead, shows a mean search time that is independent on the number of rules in the ruleset. By comparing the results in Table 3 and the worst cases in Table 3, we can note that: - the linear algorithm performs worse than the other two algorithms in our tests, compared to the theoretical results; - the Hierarchical Tries algorithm seems to be loosely dependent on the number of rules N, while its worst case is independent from this parameter. This behavior could be due to the fact that the number of recursive visits of the tries grows with the number of rules N. C. Memory consumption test results We measured the amount of memory needed to store the raw data structure containing the ruleset for each algorithm. The results of this test are shown in Table 4. D. Preprocessing time test results The last test attempts to measure the amount of time needed to process the various rulesets and create the internal data structures used by each classification algorithm. The results of this test are shown in Table 5. The outcome of this test shows that the trend is roughly linear in the number of rules for the linear and Hierarchi- cal Tries algorithm; moreover the latter is about 100 times slower than the former one, but the overall time to process the original ruleset containing 349 rules seems to be acceptable (less than 10 ms on the test platform). The RFC algorithm shows instead a rather interesting behavior: the trend is roughly linear on the number of rules up to 200 rules, with a cost that is about three orders of magnitude more expensive than the Hierarchical Tries algorithm; when we compute the data structure with the entire ruleset of 349 rules, the preprocessing time literally explodes to about 20 minutes. This explosion is generally due to two main factors: 1. It is a heuristic algorithm, so each metric normally depends on the particular ruleset used for the test. 2. Some experiments on this algorithm have shown that this behavior is largely due to rules containing a large number of “any” values in their components. V. CONCLUSIONS A continuously growing number of network appliances are deploying packet classifiers to implement Quality of Service, security, traffic engineering functionalities. As a consequence, in the last years several authors have proposed novel algorithms to achieve better results in terms of classification time and memory consumption. Many works provided case studies of such algorithms applied to a large number of real-life rulesets and network traffic traces. However, a fair comparison with common criteria and test cases has not yet been provided. Our main contribution in this work is filling this gap, by providing a homogeneous evaluation of three classification algorithms that have been implemented following the same criteria. Our tests have shown that the Recursive Flow Classification algorithm outperforms, as expected, the other two algorithms in terms of search time. In fact, its heuristics is able to effectively exploit the characteristics of the real-life rulesets considered. However, it is known that this algorithm does not support dynamic updates, and our tests have shown that its preprocessing time is unpredictable. The Hierarchical Tries algorithm shows acceptable performance in terms of classification time, being less than one order of magnitude worse than RFC. Instead it features low memory consumption, outperforming RFC for more than one order of magnitude. In practice, we have shown that the Hierarchical Tries algorithm is preferable over RFC when memory consumption and preprocessing time are more critical than classification time alone. Finally, our tests confirm that the linear algorithm, despite the worst classification time with large rulesets, is the one that assures the lowest memory consumption, the fastest preprocessing phase, and the most flexible support for dynamic updates. VI. REFERENCES
{"Source-Url": "https://iris.polito.it/retrieve/handle/11583/1494576/46995/05Contel-Classifiers.pdf", "len_cl100k_base": 4681, "olmocr-version": "0.1.50", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 18881, "total-output-tokens": 5723, "length": "2e12", "weborganizer": {"__label__adult": 0.0004305839538574219, "__label__art_design": 0.00029397010803222656, "__label__crime_law": 0.0007224082946777344, "__label__education_jobs": 0.0006170272827148438, "__label__entertainment": 0.00015747547149658203, "__label__fashion_beauty": 0.0002009868621826172, "__label__finance_business": 0.0003333091735839844, "__label__food_dining": 0.0004096031188964844, "__label__games": 0.0009059906005859376, "__label__hardware": 0.005466461181640625, "__label__health": 0.0010156631469726562, "__label__history": 0.0005273818969726562, "__label__home_hobbies": 9.691715240478516e-05, "__label__industrial": 0.0008378028869628906, "__label__literature": 0.0003333091735839844, "__label__politics": 0.0004734992980957031, "__label__religion": 0.0005688667297363281, "__label__science_tech": 0.45458984375, "__label__social_life": 0.00011110305786132812, "__label__software": 0.0249481201171875, "__label__software_dev": 0.50537109375, "__label__sports_fitness": 0.0004804134368896485, "__label__transportation": 0.00107574462890625, "__label__travel": 0.00026679039001464844}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 25174, 0.02507]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 25174, 0.61142]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 25174, 0.91784]], "google_gemma-3-12b-it_contains_pii": [[0, 0, null], [0, 5328, false], [5328, 10804, null], [10804, 17349, null], [17349, 20545, null], [20545, 25174, null]], "google_gemma-3-12b-it_is_public_document": [[0, 0, null], [0, 5328, true], [5328, 10804, null], [10804, 17349, null], [17349, 20545, null], [20545, 25174, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 25174, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 25174, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 25174, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 25174, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 25174, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 25174, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 25174, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 25174, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 25174, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 25174, null]], "pdf_page_numbers": [[0, 0, 1], [0, 5328, 2], [5328, 10804, 3], [10804, 17349, 4], [17349, 20545, 5], [20545, 25174, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 25174, 0.11765]]}
olmocr_science_pdfs
2024-11-30
2024-11-30
cefc741462916168b0798b033f226bb9bc8c81ed
PARALLEL QUERY OPTIMIZATION: PIPELINED PARALLELISM SCHEDULING AND GOLDEN NUMBER Carmen Elena ODUBĂŞTEANU¹, Călin Aurel MUNTEANU² Pipelined parallelism scheduling problem is very important in the area of parallel query optimization. To model the problem it is used a POT (Pipelined Operator Tree), which is a tree whose nodes represent query operators that can be run in parallel and edges represent communication between adjacent operators; we must find a schedule for the POT that minimizes the total response time, a problem which has been shown to be NP-hard. This paper presents algorithms for pipelined parallelism scheduling and compares their performances by simulating their behaviors. Some of the algorithms are proposed by the authors; two of them are based on Golden Number. Keywords: query optimization, parallel databases, pipeline parallelism scheduling, Golden Number 1. Introduction Today we are challenged with sophisticated applications on parallel database systems, such as decision support systems and data mining. Therefore, the minimization of the query response time is more than ever necessary. The complexity of this problem is reduced if we used a two-phase approach [1], [2]: join ordering and query rewriting followed by parallelization and scheduling. In the second phase, atomic units of the query (operators) are extracted and then ¹ Assistant, Department of Computer Science, University POLITEHNICA of Bucharest, Romania, e-mail: carmen_od@yahoo.com ² Assistant, Department of Automatics and Industrial Information, University POLITEHNICA of Bucharest, Romania, e-mail: mc_aurel@yahoo.com scheduled to provide the minimum response time. One of the most important issues that must be considered is the parallelism-communication trade-off [3], [4]. A query will be represented as a weighted operator tree in which each node represents an operator and each edge represents the timing constraints between operators [5], [6]. A timing constraint is either a precedence or parallel constraint. The parallel constraint introduces a pipelined parallelism and requires that the two adjacent nodes start and terminate their works approximately at the same time, behaving as a producer-consumer system. Algorithms for managing pipelined parallelism are an essential component of an optimizer because pipelining is sometimes the only way of speeding up a query not just a useful supplement to partitioned parallelism [3]. For example, when each reduced relation of a query that join a large number (say 10) of relations and apply external functions, grouping and aggregation is small, partitioned parallelism ceases to be a viable option and pipelined parallelism is the only source of speedup. Scheduling of a Pipelined Operator Tree (POT - weighted operator tree in which all edges represent parallel constraints [6]) is different from the classical scheduling problems because of the communication. Brute force algorithms are impractical for scheduling pipelines due to the extremely large search space. A query that joins 10 relations leads to an operator tree with about 20 nodes. The number of ways of scheduling 20 operators on 20 processors exceeds $5 \times 10^{13}$. Algorithms that simply ignore communication overhead are unlikely to yield good results. Communication cost is saved if adjacent nodes are assigned to one processor but this would decrease the degree of parallelism. This optimization problem can also be viewed as to find a schedule that minimizes the maximum load of the processors where load of a processor is the sum of the weights of the operators assigned to it plus the weight of the edges that connect nodes on this processor to the nodes on other processors. POT scheduling problem was first introduced by Hasan and Motwani for identical processor systems and was shown to be NP-hard [1], [6]. They proposed several approximation algorithms. Five of them are presented and compared from different points of view. These algorithms are: Modified LPT, BalancedCuts, Hybrid, LocalCuts and BoundedCuts. Also, in this paper are described four recent algorithms OptimBalancedCuts, OptimHybrid, FiLocalCuts and FiBoundedCuts designed by us. FiLocalCuts and FiBoundedCuts are based on Golden Number. The paper is organized as follows: it begins with an overview of the model and problem definition. Then, nine algorithms for scheduling pipelines parallelism are presented. Finally, the experimental results are presented and analyzed. Also, a short presentation of Golden Number is made in this paper. 2. A model for the problem The following definitions are based on earlier models presented in [1], [6], [7]. A POT is represented as a weighted operator tree \( P = (V, E) \) with \( n \) nodes. The weight \( t_i \) of the node \( i \) is the time to run the operator in isolation assuming all communications are local. The weight \( c_{ij} \) of the edge from node \( i \) to node \( j \) is the additional CPU overhead that both \( i \) and \( j \) will incur for inter-operation communication if they are scheduled on different processors. A schedule of \( P \) on \( p \) processors is a partition of \( V \), the set of \( n \) nodes, into \( p \) sets \( F_1, F_2, \ldots, F_p \) such that set \( F_k \) is assigned to processor \( k \). The load of processor \( k \), or \( L_k \), is the cost of executing all nodes in \( F_k \) plus the overhead for communicating with nodes on other processors. That is, \( L_k = \sum_{j \in F_k} t_j + \sum_{l \not\in F_k} c_{lj} \). \( L \) is \( \max_{1 \leq k \leq p} L_k \). Two operations are used to modify the POT: collapse \((i, j)\) is to replace adjacent nodes \( i \) and \( j \) by a single node \( i' \) having weight of \( t_{i'} = t_i + t_j \). Operation cut \((i, j)\) is to delete edge \((i, j)\) and add its weight to those of node \( i \) and \( j \). Collapse and cut operations should be interpreted as decisions to allocate nodes to the same or distinct processors respectively. As shown in [6], we can convert each POT into a POT with no worthless edges, called monotone tree, by collapsing all its worthless edges using the GreedyChase algorithm that “chases down” and removes parallelism that is “worthless” irrespective of the number of processors. A GreedyChase algorithm is used as a pre-processing step in all described algorithms. Then we schedule the monotone tree. In a monotone tree we use also the following notations: \( R_i = t_i + \sum_{j \in V} c_{ij} \), \( R = \max_{1 \leq i \leq p} R_i \) and \( W = \sum_{i \in V} t_i \). 3. Pipelined scheduling algorithms Scheduling pipelined operator tree is an intractable problem [8] and the space of schedules is super exponentially large. Thus any algorithm that finds the optimal is likely to be too expensive to be usable. The following algorithms are fast heuristics that produce near-optimal schedules. **Modified LPT Algorithm** Modified LPT algorithm [9] simply pre-processes away worthless parallelism by running GreedyChase before running LPT [8]. LPT assigns the job with the largest running time to the least loaded processor, repeating this step until all jobs are assigned. The algorithm is still oblivious to the tradeoff between parallelism and communication. Edges in a monotone path can have high weights and the algorithm is unaware of the savings that can occur when two nodes connected by an edge with a large weight are assigned the same processor. **BalancedCuts algorithm** BalancedCuts algorithm [9], is finding the optimal connected schedule. A connected schedule requires the nodes assigned to any processor to be a connected set. The algorithm for finding the optimal connected schedule for trees in which all edge weights has two steps repeated until the resulting number of fragments is no more than p: 1. B will be set to a lower bound on the response time 2. Given a bound B and a number of processors p, the BPSchedule algorithm [8] will be run to find a connected schedule with a response time of at most B, if such a schedule exists. Algorithm simply picks a mother node (a node is a mother node if all adjacent nodes with at most one exception are leaves) and traverses the children in the order of non-increasing $t_i - c_{im}$. Then, children are collapsed into the mother node as long as the weight of the mother stays below B and then cut off the rest. The process is repeated until no more mother nodes are left. If the resulting number of fragments is no more than p, a (B,p)-bounded schedule was found, otherwise no such schedule is possible. For an unsuccessful run of BpSchedule we will revise B as being the minimum of $B_i$ (for each fragment $F_i$ produced by BpSchedule, let $B_i$ be the cost of the fragment plus the weight of the next node that was not included in the fragment). **OptimBalancedCuts algorithm** OptimBalancedCuts algorithm is an optimization of the BalancedCuts algorithm introduced by authors in [10]. A more careful analysis (and implementation) of the following idea gives us a bound of $O(np)$. Whenever the B value is updated, the total work done in finding a new candidate solution can be charged to the nodes which migrate from a component to a previous one. It is easy to verify that the implementation cost works out to be $O(1)$ for each such node migration. Since any one node can migrate at most p times, the total work can be bounded by $O(np)$. The algorithm picks a mother node, traverses the children in the order of non-increasing $t_i - c_{im}$, collapses them into the mother node as long as the weight of the mother stays below B and then cut off the rest saving for each node the context (defined by the current mother node, the current son, the tree and the number of cuts) before the corresponding cutting step. The process is repeated until no more mother nodes are left or the number of cuts is not p-1. If the cost of the last fragment is no more than B, a (B,p)-bounded schedule was found, otherwise no such schedule is possible. B is revised by minimum of $B_i$ and we repeat the process of collapsing nodes to their mothers beginning from the context corresponding to the node C. (the one chosen for the new B value, which has the minimum value from the last iteration cutting nodes). So, the algorithm is run directly from the iteration corresponding to the mother node of C, skipping that way the steps already made before the cutting of the node C. **Hybrid Algorithm** BalancedCuts performs poorly on stars since the constraint of connected schedules is at odds with load balancing [9]. While the algorithm is cognizant of communication costs, it is poor at achieving balanced loads. On the other hand, LPT is very good at balancing loads but unaware of communication costs. The Hybrid algorithm [9] resulted by combining these two algorithms: BalancedCuts to cut the tree into many fragments and then schedule the fragments using LPT. LPT can be expected to “cleanup” cases such as stars on which connected schedules are a bad approximation. **OptimHybrid Algorithm** Hybrid algorithm has the best performance ratio in our experiments. Also, it has the worst execution time. So, we developed OptimHybrid algorithm [11], based on Hybrid, which has a better complexity. OptimHybrid uses OptimBalancedCuts algorithm instead of BalancedCuts algorithm to cut the tree into fragments which are then scheduled using LPT. Algorithm OptimHybrid: 1. \( T' = \text{GreedyChase} \) 2. for \( i = p \) to \( n \) do 3. \( F_1,..., F_i = \text{OptimBalancedCuts}(T', i) \) 4. \( \text{schedule} = \text{LPT}({F_1,..., F_i }, P) \) 5. end for 6. return best of schedules found in steps 2 to 5 **Approximation algorithms** For approximation algorithms we use a two-stage approach: fragmentation, and the actual scheduling. For scheduling, it was used LPT algorithm. In order to obtain better performances we used the Golden Number, (known also as Fibonacci number, Divine section, Phi or \( \Phi \)) which has an approximate value of 1.618. This number is often met all around the world, from the ancient and modern art and architecture to the organization of nature, including human beings too. It is said that Phi represents a measure for harmony, a divine proportion known and used from the antiquity. In the next section a short presentation of Golden Number is introduced. LocalCuts and FiLocalCuts algorithms LocalCuts [1] repeatedly picks up a leaf and determines whether to cut or collapse the edge from the leaf to its parent. It selects proper operation based on the ratio of the leaf weight to the weight of the edge to its parent. If the ratio is greater than an input parameter $\alpha > 1$, it will cut the edge, since this operation does not considerably increase the weight of the resulting fragments. If the ratio is less than $\alpha$, the leaf is collapsed to the parent node. This is because the weight of the parent node will not increase substantially. In the algorithm, a mother node is defined as a node that all its children are leaves. In FiLocalCuts algorithm we used for $\alpha$ Golden Number based values. Algorithm FiLocalCuts: 1. $T' =$ GreedyChase 2. while there exists a mother node $m$ with child $j$ do 3. If $t_j > \alpha c_{jm}$ then cut($j,m$) 4. else collapse($j,m$) 5. end-while 6. return schedule BoundedCuts and FiBoundedCuts algorithms The second algorithm that we modify is BoundedCuts [1]. If $R$ is small compared to $M^*$, LocalCuts may cut expensive edges needlessly (maximum weight of fragments produced by LocalCuts is bounded by $\alpha R$). It uses a uniform bound $B$ for each mother node. BoundedCuts fragments POT based on three parameters $\alpha$, $\beta$ and $B$ that satisfy $\beta \geq \alpha > 1$ and $B \geq R$. This algorithm cuts off light edges in a manner similar to LocalCuts. But it collapses edges based on $\alpha B$ bound. We extended BoundedCuts algorithm choosing in FiBoundedCuts values based on Golden Number for $\alpha$ and $\beta$. Algorithm FiBoundedCuts: 1. while there exist a mother node $m$ do 2. partition children of $m$ into sets $N_1$ and $N_2$ such that child $j \in N_1$ iff $t_j / c_{mj} \geq \beta$ 3. cut($m,j$) for all $j \in N_1$; ($\beta$ rule) 4. if $R_m + \sum_{j \in N_2} (t_j - c_{mj}) \leq \alpha B$ then collapse($m,j$) for all $j \in N_2$; 5. else cut($m,j$) for all $j \in N_2$; ($\alpha$ rule) 6. end-while 7. return schedule 4. Experimental Results Based on experimental data, the presented algorithms will be compared in this section from different points of view. Over 5000 trees were generated for experiments, from which, after applying the algorithm for conversion into monotone trees, only those who have 10 nodes were kept, meaning 1000 trees. The generated trees have a value domain ranging from 1 to 20 both for each node weight and for edge’s weight. All presented algorithms were simulated for every monotone tree and for a number of processors $p$ ranging from 1 to maximum 10. The approximation algorithms were tested for different values of their parameters, including Golden Number based values. For performance analysis of each algorithm, performance ratio was defined as the ratio between experimental value and optimal value. The optimal value was considered the maximum values from $R = \max_{i \in V} R_i$ and $(W+C_E)/p$ where $C_E$ is the sum of the weights of the cheapest $p-1$ edges [9]. Performance ratio The results for average performance ratio are presented in a graphical (comparison) form in Fig. 1. The most efficient algorithms are Hybrid and OptimHybrid (same performance ratio). Also, Modified LPT, FiBoundedCuts and FiLocalCuts present good performances, closed to Hybrid. In Fig. 2 we have a graphical comparison for LocalCuts and FiLocalCuts algorithms tested with different values for parameter $\alpha$. Notice that: - Best values (the smallest ones) for performance ratio are obtained for $\Phi/2$, for $p \geq 4$. - For $\alpha = \Phi$, medium performance ratio is relatively very good for any number of processors (performance ratio is in domain $[1, 1.18]$; for $\Phi/2$ domain is $[1, 1.22]$). - Same minimum interval $[1, 1.18]$ is obtained for $\alpha$ in $[1.6, 2]$ but, more closed parameter value is by $\Phi$ better performance ratio are obtained for $p \geq 3$. - For $p=2$ we have good performances for bigger values of parameter $\alpha$ (for example, for $\alpha=3.56$ performance ratio is 1.1; for $\Phi$ is 1.17). Fig. 1. Performance Ratio for Modified LPT, BalancedCuts, Hybrid, LocalCuts, FiLocalCuts, BoundedCuts, FiBoundedCuts Fig. 2. Performance Ratio for different values of parameter $\alpha$ for LocalCuts, FiLocalCuts Values for performance ratio for BoundedCuts and FiBoundedCuts for different values of parameters $\alpha$, respectively $\beta$ are presented in Fig. 3. Notice that: - Best values (the smallest ones) for performance ratio are obtained for $\alpha=\Phi$ and $\beta=\Phi$, for $p \geq 4$. - For $p = 3$ best values are obtained for $\alpha=\Phi$ and $\beta=2\Phi$. - For $p=2$ very good values are obtained for $\alpha=\Phi$ and $\beta=3\Phi$. - For bigger values of $\beta$ we have better performance ratio for a small number of processors and for smaller values of $\beta$ for a bigger number of processors ($p \geq 4$). Also, the performance ratio for original algorithms LocalCuts, BoundedCuts and newly FiLocalCuts and FiBoundedCuts are presented in Fig. 4. In conclusion, FiLocalCuts and FiBoundedCuts present better performance ratio than LocalCuts, respectively BoundedCuts, the algorithms which are derived from and the use of Golden Number based values for parameters $\alpha$ and $\beta$ was a good idea. Minimum, respectively maximum values and domain range for performance ratio For all the 1000 tested trees, the minimum performance ratio value was 1 for all the presented algorithms. The maximum performance ratio values (and the number of processors for which are obtained) are in table 1. Also, the interval length for performance ratio is detailed. Hybrid and OptimHybrid present the minimum for both maximum performance ratio (1.53) and domain length (0.53). Same values are obtained by FiBoundedCuts which dramatically improved BoundedCuts performances (worst values both for performance ratio (2.42) and domain length (1.42)). A closed value (0.59) for domain length is also obtained by FiLocalCuts which presents a significant improvement from this point of view relative to LocalCuts (1.15). <table> <thead> <tr> <th>Algorithm</th> <th>P</th> <th>Max</th> <th>Max-Min</th> </tr> </thead> <tbody> <tr> <td>ModLPT</td> <td>p = 3</td> <td>1.74</td> <td>0.74</td> </tr> <tr> <td>BalancedCuts, OptimBalanced</td> <td>p = 3</td> <td>1.84</td> <td>0.84</td> </tr> <tr> <td>Hybrid, OptimHybrid</td> <td>p = 3</td> <td>1.53</td> <td>0.53</td> </tr> <tr> <td>LocalCuts</td> <td>p = 4, 5, 6, 9, 10</td> <td>2.15</td> <td>1.15</td> </tr> <tr> <td>BoundedCuts</td> <td>p = 4, 5</td> <td>2.42</td> <td>1.42</td> </tr> <tr> <td>FiLocalCuts</td> <td>p = 7, 8</td> <td>1.59</td> <td>0.59</td> </tr> <tr> <td>FiBoundedCuts</td> <td>p = 4</td> <td>1.53</td> <td>0.53</td> </tr> </tbody> </table> Average time for generating the solution From this point of view, the following values (presented in the next figure and table) were obtained: ![Fig. 5. Execution Time](image) The best time is obtained by LocalCuts and FiLocalCuts. Notice that OptimBalancedCuts has an execution time (1.8) much better than BalancedCuts (4.1), the algorithm which is derived from. So, the execution time for OptimHybrid was also decreased with approximately 32% reporting to the Hybrid execution time. <table> <thead> <tr> <th>Algorithm</th> <th>Execution time</th> </tr> </thead> <tbody> <tr> <td>LocalCuts, FiLocalCuts</td> <td>1.6</td> </tr> <tr> <td>Modified LPT</td> <td>1.68</td> </tr> <tr> <td>OptimBalancedCuts</td> <td>1.8</td> </tr> <tr> <td>OptimHybrid</td> <td>30.4</td> </tr> <tr> <td>Hybrid</td> <td>44.4</td> </tr> </tbody> </table> Algorithm complexity From this point of view, the values presented in table 3 were obtained. <table> <thead> <tr> <th>Algorithm</th> <th>Complexity</th> </tr> </thead> <tbody> <tr> <td>Modified LPT, UniformLPT</td> <td>$O(n \log(n))$</td> </tr> <tr> <td>LocalCuts, FiLocalCuts</td> <td>$O(np \log(n))$</td> </tr> <tr> <td>BoundedCuts, FiBoundedCuts</td> <td>$O(np \log(n))$</td> </tr> <tr> <td>OptimBalancedCuts</td> <td>$O(np)$</td> </tr> <tr> <td>BalancedCuts</td> <td>$O(n^p)$</td> </tr> <tr> <td>OptimHybrid, UniformHybrid</td> <td>$O(n^p)$</td> </tr> <tr> <td>Hybrid</td> <td>$O(n^p)$</td> </tr> </tbody> </table> Notice that OptimBalancedCuts complexity (O(np)) was decreased reporting to the BalancedCuts complexity (O(n²p)). Also, OptimHybrid and UniformHybrid complexity (O(n³p)) was decreased reporting to the Hybrid complexity (O(n³p)), due to the decreasing of OptimBalancedCuts complexity. 5. Conclusions Nine algorithms regarding inter-operator parallelism (processors allocation phase for pipeline operator trees) are presented and analyzed in this paper. From [9], Modified LPT, BalancedCuts and Hybrid; from [1], LocalCuts and BoundedCuts, then OptimBalancedCuts and OptimHybrid designed by authors in [10], [11] and two new extended algorithms FiLocalCuts and FiBoundedCuts. From the simulations results, the best performance ratio is obtained by OptimHybrid very closed by FiLocalCuts, Modified LPT and FiBoundedCuts performances. Annexes A – Golden Number The Golden Number [12], or Golden Ratio, or Golden Mean or Fibonacci Number is one of these mysterious irrational numbers, like e or \(\pi\). It is often called \(\Phi\) or Phi. \(\Phi\) is said to be the divine proportion, the ratio of beauty. Indeed, it has been found in some nature constructions, later re-used in architecture and paintings. The value of \(\Phi\) The positive result of the equation "\(X^2 = X + 1\)" gives \(\Phi\) value: \[ \Phi = \frac{1 + \sqrt{5}}{2} = 1.61803398874989484820... \] \[ \varphi = \frac{1 - \sqrt{5}}{2} = -0.61803398874989484820... \] \(\Phi\) is also the limit of the ratio of Fibonacci series numbers: \[ \lim_{n \to \infty} \left( \frac{U[n+1]}{U[n]} \right) = \Phi, \] where \(U\) (Fibonacci series) is defined as follow: \[U[n+2]=U[n+1]+U[n], \ U[0]=0, \ U[1]=1.\] \(U[n]\) values are: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, etc. Mathematical properties of \(\Phi\) In both arithmetic and geometry, \(\Phi\) has many properties that we cannot develop here. The basic knowledge to keep in mind with the Golden Number is: \[ \Phi^2 = \Phi + 1. \] \(\Phi\) and \(\varphi\) are very close as far as their decimal part is identical and they have the following properties: Parallel query optimization: pipelined parallelism scheduling and golden number \[ \Phi \cdot \phi = -1, \] \[ \Phi + \phi = 1, \text{ etc.} \] Geometrically, \( \Phi \) is defined as in Fig. 6. Euclid (~300BC) called this geometrical drawing "to divide a line in mean & extreme ratio". ![Fig. 6. Golden Section](image) It is important to know that \( \Phi \) is particularly present in the geometry of Pentagon (2D), Pentagram (2D) and Dodecahedron (3D) (Fig. 7): ![Fig. 7. Pentagon, Pentagram, Dodecahedron](image) The use of Golden Number, Phi for FiLocalCuts and FiBoundedCuts improves LocalCuts, respectively BoundedCuts performances for both maximum performance ratio and its domain length. Thus, this first use of Golden Number in pipelined parallelism scheduling problem was a successful one and it proves that Golden Number implications in pipelined parallelism are alike to the implications which appears in other domains (an “harmonious distribution” for performance ratio values was obtained). **The Golden Number everywhere** Here are some famous examples of use of \( \Phi \) in the nature: - The Nautilus shell (Nautilus pompilius) grows larger on each spiral by \( \Phi \) (Fig. 8) - The sunflower has 55 clockwise spirals overlaid on either 34 or 89 counterclockwise spirals, a \( \Phi \) proportion - For a coneflower (Fig. 9) you can see that the orange "petals" seem to form spirals curving both to the left and to the right. At the edge of the picture, if you count those spiraling to the rights as you go outwards, there are 55 spirals. A little further towards the centre and you can count 34 spirals. You will see that the pair numbers (counting spirals in curing left and curving right) are neighbours in the Fibonacci series. - The drone genealogy follow the Fibonacci series (so is linked to $\Phi$), etc. Φ has also been used by artists (painters, sculptors...) who were trying to rationalize aesthetic and understand what make us think whether a shape is nice / harmonious / pleasant or not. It has been used at Keops in Egypt, at the Parthénon in Athens, at Epidaure (Greece), etc. See Fig. 10, Fig. 11 and Fig. 12. How to use quickly the Golden Number? When you take the first ratio coming from Fibonacci series, for instance $5/3=1.66...$, $8/5=1.6$ and $13/8=1.625$, you have an approximation of Φ for not precise works (for instance painting). Squaring of 3, 5 or 8 are easy to draw when preparing material for painting, and the previous ratio can help you quickly use "divine proportions". Another solution to quickly use Golden Number is to use a Golden Compass, as provided by Robert Losson for example. Where we also met Golden Number: - **architecture** - The Parthenon and Greek Architecture - Modern Architecture - The Eden Project's new Education Building - California Polytechnic Engineering Plaza - The United Nations Building in New York - **art** - Leonardo's Art - Modern Art - Graham Sutherland's Tapestry in Coventry Cathedral - in fashioning Furniture - **films** - **human body** - **poetry** - Stress, Metre and Sanskrit Poetry - Virgil's Aeneid - **music** - Golden sections in Violin construction - Did Mozart use the Golden mean? - Phi in Beethoven's Fifth Symphony? - Bartók, Debussy, Schubert, Bach and Satie - **miscellaneous, amusing and odd places** - TV stations in Halifax, Canada - Turku Power Station, Finland REFERENCES
{"Source-Url": "https://www.scientificbulletin.upb.ro/rev_docs/arhiva/full8081.pdf", "len_cl100k_base": 6753, "olmocr-version": "0.1.50", "pdf-total-pages": 16, "total-fallback-pages": 0, "total-input-tokens": 36176, "total-output-tokens": 8004, "length": "2e12", "weborganizer": {"__label__adult": 0.0003199577331542969, "__label__art_design": 0.0006136894226074219, "__label__crime_law": 0.0004513263702392578, "__label__education_jobs": 0.0010957717895507812, "__label__entertainment": 0.00013816356658935547, "__label__fashion_beauty": 0.0001982450485229492, "__label__finance_business": 0.0006213188171386719, "__label__food_dining": 0.0004227161407470703, "__label__games": 0.0005593299865722656, "__label__hardware": 0.0018758773803710935, "__label__health": 0.0009512901306152344, "__label__history": 0.0004782676696777344, "__label__home_hobbies": 0.00016498565673828125, "__label__industrial": 0.0010156631469726562, "__label__literature": 0.0003647804260253906, "__label__politics": 0.0003647804260253906, "__label__religion": 0.0006351470947265625, "__label__science_tech": 0.4697265625, "__label__social_life": 0.00011420249938964844, "__label__software": 0.0165252685546875, "__label__software_dev": 0.501953125, "__label__sports_fitness": 0.000270843505859375, "__label__transportation": 0.0006313323974609375, "__label__travel": 0.0002455711364746094}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27864, 0.02573]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27864, 0.49376]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27864, 0.89766]], "google_gemma-3-12b-it_contains_pii": [[0, 1627, false], [1627, 4560, null], [4560, 7464, null], [7464, 10179, null], [10179, 12375, null], [12375, 14435, null], [14435, 16490, null], [16490, 16704, null], [16704, 17722, null], [17722, 19026, null], [19026, 20389, null], [20389, 22478, null], [22478, 24133, null], [24133, 25132, null], [25132, 25914, null], [25914, 27864, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1627, true], [1627, 4560, null], [4560, 7464, null], [7464, 10179, null], [10179, 12375, null], [12375, 14435, null], [14435, 16490, null], [16490, 16704, null], [16704, 17722, null], [17722, 19026, null], [19026, 20389, null], [20389, 22478, null], [22478, 24133, null], [24133, 25132, null], [25132, 25914, null], [25914, 27864, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 27864, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27864, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27864, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27864, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27864, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27864, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27864, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27864, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27864, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27864, null]], "pdf_page_numbers": [[0, 1627, 1], [1627, 4560, 2], [4560, 7464, 3], [7464, 10179, 4], [10179, 12375, 5], [12375, 14435, 6], [14435, 16490, 7], [16490, 16704, 8], [16704, 17722, 9], [17722, 19026, 10], [19026, 20389, 11], [20389, 22478, 12], [22478, 24133, 13], [24133, 25132, 14], [25132, 25914, 15], [25914, 27864, 16]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27864, 0.11682]]}
olmocr_science_pdfs
2024-11-27
2024-11-27
04d046e862358f38f279be92c7cffc4f48528d74
[REMOVED]
{"len_cl100k_base": 6703, "olmocr-version": "0.1.53", "pdf-total-pages": 11, "total-fallback-pages": 0, "total-input-tokens": 33592, "total-output-tokens": 8277, "length": "2e12", "weborganizer": {"__label__adult": 0.000308990478515625, "__label__art_design": 0.001537322998046875, "__label__crime_law": 0.0003123283386230469, "__label__education_jobs": 0.0010824203491210938, "__label__entertainment": 0.00018715858459472656, "__label__fashion_beauty": 0.00017023086547851562, "__label__finance_business": 0.0006012916564941406, "__label__food_dining": 0.0003192424774169922, "__label__games": 0.0004291534423828125, "__label__hardware": 0.0022602081298828125, "__label__health": 0.0004482269287109375, "__label__history": 0.00046753883361816406, "__label__home_hobbies": 0.0001270771026611328, "__label__industrial": 0.0007600784301757812, "__label__literature": 0.0003361701965332031, "__label__politics": 0.00024628639221191406, "__label__religion": 0.0004906654357910156, "__label__science_tech": 0.194091796875, "__label__social_life": 0.00012969970703125, "__label__software": 0.047760009765625, "__label__software_dev": 0.7470703125, "__label__sports_fitness": 0.00019168853759765625, "__label__transportation": 0.0006365776062011719, "__label__travel": 0.00027298927307128906}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 38200, 0.0192]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 38200, 0.35807]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 38200, 0.89581]], "google_gemma-3-12b-it_contains_pii": [[0, 3250, false], [3250, 7810, null], [7810, 11479, null], [11479, 15121, null], [15121, 19231, null], [19231, 20689, null], [20689, 22972, null], [22972, 25813, null], [25813, 30488, null], [30488, 34850, null], [34850, 38200, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3250, true], [3250, 7810, null], [7810, 11479, null], [11479, 15121, null], [15121, 19231, null], [19231, 20689, null], [20689, 22972, null], [22972, 25813, null], [25813, 30488, null], [30488, 34850, null], [34850, 38200, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 38200, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 38200, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 38200, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 38200, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 38200, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 38200, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 38200, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 38200, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 38200, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 38200, null]], "pdf_page_numbers": [[0, 3250, 1], [3250, 7810, 2], [7810, 11479, 3], [11479, 15121, 4], [15121, 19231, 5], [19231, 20689, 6], [20689, 22972, 7], [22972, 25813, 8], [25813, 30488, 9], [30488, 34850, 10], [34850, 38200, 11]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 38200, 0.0]]}
olmocr_science_pdfs
2024-12-12
2024-12-12
c3e60c0a063c8dbea9e2e90f737c1647a8c9a433
An Architecture for Multi-User Software Development Environments Israel Z. Ben-Shaul Gail E. Kaiser George T. Heineman Department of Computer Science Columbia University, New York, NY 10027 We present an architecture for multi-user software development environments, covering general, process-centered and rule-based MUSDEs. Our architecture is founded on componentization, with particular concern for the capability to replace the synchronization component — to allow experimentation with novel concurrency control mechanisms — with minimal effects on other components while still supporting integration. The architecture has been implemented for the MARVEL SDE. 1 Introduction Software Development Environments (SDEs) emerged in an attempt to address the problems associated with developing, maintaining and managing large scale software projects. One of the main issues in SDE research is how to construct environments that are integrated, while at the same time flexible and extensible. Although there have been numerous proposals for cooperative transaction models [4], little has been achieved regarding flexibility and extensibility of such synchronization mechanisms for multi-user SDEs from the system-architecture point of view. Throughout the paper we refer to this aspect of an SDE as the “multi-user” property. The architectures of process-centered SDEs include process enactment engines, which enable a programmable approach to defining the behavior of an environment to support a particular software development process [22]. The process enactment engine and the corresponding process modeling language must be extended with a notion of concurrency consistency and corresponding synchronization primitives to support multi-user environments, where the process as well as the data is shared. In many process-centered SDEs, the process is defined in terms of rules and enactment is achieved through rule chaining. Examples include CLF [24], Oikos [1] and Merlin [30]. Such SDEs must support synchronization among automated chains of activities as well as activities directly invoked by users. In any multi-user SDEs, the architecture must also support interprocess communication, scheduling and context switching, transaction and lock management, and other facilities on which synchronization depends. This paper presents an architecture for multi-user SDEs (MUSDEs) that is intended to support the requirements of general, process-centered and rule-based MUSDEs. The emphasis is on identification of the system’s components and on the interfaces and interrelations among them rather than on application of specific synchronization policies. We have implemented the architecture for MARVEL, which was previously a single-user system [20]. This work is complementary but orthogonal to the research done by Barghiouti and Kaiser on cooperative transaction management for SDEs in general and MARVEL in particular. The focus of their work has been on modeling coordination and cooperation, whereas here we focus on the architectural facilities that enable the implementation of such sophisticated synchronization mechanisms. In section 2, we give the necessary requirements that an MUSDE must fulfill, by definition, and additional desired properties. Section 3 introduces the architecture, its main characteristics and functionality. Section 4 explains the rationale behind the architecture. Section 5 describes the implementation for MARVEL and our experience, including changing and tailoring some of the components. Section 6 compares to related work. Section 7 briefly evaluates the architecture and summarizes our contributions. 2 Requirements Data-sharing - We distinguish between “product” data and “control” data: the former represents the actual data elements under development (i.e., source files, object files, design documents, etc.), while the latter represents the data used by the SDE to manage the project. Examples of control data for a source file include its version, compilation status, reservation status, etc. Product data may be integrated with con- control data (e.g., an object is defined as having “control” state attributes and file attributes that point to “product” items) or may be maintained separately. In general SDEs, control data represents the state with respect to a hard-coded policy, whereas in process-centered SDEs, control data reflects the state of the specific process in action. Data-consistency - An MUSDE synchronizes concurrent access to the SDE's data to maintain its consistency, e.g., it prevents data from being garbled by conflicting accesses (such as multiple independent updates) to the same or related data items. Product data can be maintained either by the SDE or in the file system; however, control data must be maintained by the SDE. But access to both must be synchronized, either in a centralized or a distributed fashion, and in the latter case can be tightly integrated within each user's workspace or separate in a DBMS. Process-sharing and process-consistency - In addition to data-consistency as above, which is required for all MUSDEs, process-centered SDEs must maintain process-consistency, as specified in the process modeling language. Thus, the process engine must maintain a global view of the process. Again, this can be done in either a centralized fashion, or in each user's workspace provided that the necessary information is replicated among users. For example, consider a constraint taken from the “ISPW problem” [13], where a member of group PROGRAMMER cannot make any code changes before some or all members of the Configuration Control Board have given approval. The MUSDE must ensure that the constraint is applied to all involved participants (or at least programmers and CCB members). Whereas the above characteristics are required in MUSDEs of the indicated classes – by definition – the following represent additional properties desired in an MUSDE. These properties together form the basis for the rationale behind our architecture. Perhaps the most important property from the architectural point of view is flexibility in selection and application of synchronization mechanisms. The idea is to be able to replace or modify concurrency control policies, both globally (i.e., for all users of the system) and locally (among selected groups of users). Some proposed concurrency control models, such as transaction groups [15], support this capability to a limited extent in that the policy for each group can be specified in a formalism supplied by the implementation. What we have in mind is more general: The architecture should be constructed such that the entire synchronization component can be replaced with minimal (preferably no) code changes to other parts of the system. This enables to conduct cost-effective experimentation, which is important in such a novel research area. The architecture should support synchronization components whose transaction models range from classical atomicity and serializability to long, interactive operations and cooperation. Any synchronization mechanism for an MUSDE must take into account that many activities in software development are long – conventional atomic and serializable transactions are not suitable, and interactive – response time is more important than overall throughput. Cooperation is needed to enable sharing and exchange of information during parallel development. Extensibility and broad scope of application - An MUSDE should be able to be extended with new tools, including tools not specifically developed for the MUSDE. High Visibility - An MUSDE implemented on a window-based platform should provide users with graphical visualization of at least the control data, and preferably the product data as well. Since SDEs often support complex and highly structured data models, it is especially desirable to be able to display the types and relationships of all objects of the environment. This means that an MUSDE has to maintain up-to-date information as it is dynamically changed by multiple users. Recovery - Persistence of product data can be provided by the host file system, but persistence of control data must be provided by the MUSDE. Recovery is an important aspect that ensures consistency of persistent data in case of external and internal failures. We distinguish between concurrency control, which is required by definition, and recovery, which – although not mandatory – is a highly desired property for industrial-strength environments. Traditionally, these two functions are both carried out by the “transaction manager”. 3 The Architecture Two major principles underlie the overall design: componentization and layering. According to the componentization principle, a complex system should be built from independent, loosely-coupled and replaceable components. These components must have flexible interfaces and support a variety of different policies potentially employed by alternative interacting components (i.e., components that provide the same services in different ways). Layering is a paradigm in which each component provides services only to the next higher layer and receives services only from lower levels. Layering lowers complexity by reducing inter-component linkages. Componentization is becoming popular in operating systems (e.g., the replaceable pager in Mach) and databases [25], and the layering approach has been followed in many areas such as communication protocols [9] and databases [6]. The combination seems especially promising for SDE technology, which is by nature subject to changes [28]. We suggest the potential to revise any system component (although with differing degrees of difficulty). Our major concern here is to be able to modify the synchronization mechanism with minimal effects on task management and the re- The server mediates access to both control and product data, and modifies control data according to the environment specifications. The architecture distinguishes between normal users and an environment administrator. The administrator's role resembles that of the Data Base Administrator in DBMSs. The administrator uses a privileged client to define the data model (schema) and any integrity constraints on the data; the process model, if any; and the programmable aspects of the synchronization policy, if any. 3.1 Task Management Translators - Any SDE that allows to define the data model for the control and/or product data must have a data definition translator. In process-centered environments, a process model translator is also needed. MUSDEs with programmable synchronization require yet another translator. Translation can be on-line, in which case this component acts as a loader for other interpretive components, or off-line, in which case it "compiles" the specifications into internal form and is not actively involved at run-time. Scheduler (SC) - Schedules requests from clients for services, including context-switching. Before a client is serviced, SC makes two contexts active: the client's session-context and the specific task-context. Session Manager (SEM) - Encapsulates an entire session between a specific client and the server, that is, all requests that occur from invocation to exit of the client. SEM can: (1) maintain the user-specific environment and operating system parameters for general configuration purposes; and (2) store enforcement information that pertains to the entire session (as opposed to task-specific information). For example, users might explicitly "attach" to a specific subprocess to perform during that session. Task Controller (TC) - This is the central component of the environment, which provides most of the services to the client. A task is defined as any activity initiated by a client together with all the derived operations carried out by the environment, such as automation and enforcement actions. For example, an SDE might have a constraint that when an interface to a function F is modified, all source files that call F must be marked for modification. The modification of F and the marking of dependent files is considered one task. In a general MUSDE, TC may degenerate to a command interpreter, perhaps with a query processor. In process-centered environments, this component includes the process engine, in charge of enacting the process. TC operates in the context of the current session, but maintains a task context for each active task in the system. 3.2 Data Management Transaction Manager (TM) - Maintains the integrity of the data in case of concurrent access and failures. In process-centered MUSDEs, TM also maintains process-consistency. However, it is not responsible for detecting any conflicts due to concurrent access, but only for resolving them. A “transaction” can map to a single activity or to a single task, but usually not to a session, since this would imply coarse-grained concurrency. There are no specific guidelines for the implementation of concurrency control or recovery, except for the restriction to locking-based mechanisms. For example, an environment may use a “blocking with deadlock resolution” mechanism or a “non-blocking with abort” mechanism, or a combination of both. Also, TM may use flat transactions or nested transactions that model the nesting of activities and subtasks within a task. **TM-TC interface** - The interface between TC and TM is a critical issue as it bridges between the task level and the data level. It is desirable for TM to be independent of any specific task model and for TC to be independent of any specific transaction model, so that either can be replaced with minimal overhead. A predefined set of transaction primitives known to TC must be supported by any TM, with the set flexible enough to support many synchronization policies. However, semantics-based concurrency control inherently requires some knowledge of the task level to resolve conflicts that are context-sensitive. This implies that the TC-TM interface may need to be augmented with a mediator component that reconciles information from both levels. **Lock Manager (LM)** - Usually considered a subcomponent of the transaction manager, LM is treated in our architecture as a separate component. Its main role is to detect any potential violations of the data-consistency constraints, as defined by a lock-compatibility matrix. LM must permit a broad range of lock modes to enable TM the freedom to choose those that meet its needs. But the separation of LM, TM and OM makes it impossible to predict what lock set and compatibility will be needed. However, viewing LM merely as a “mechanical” conflict detector enables it to be table-driven, with the tables loaded during system initialization. This means customizations of TM affect LM only through the tables. An additional property of LM is to be able to hold multiple locks on objects, on insistence from TM, even when they violate the defined compatibility. This is useful for implementation of non-conventional concurrency control policies. For example, transaction groups may allow several transactions in the same group to share transient results. ObServer [26] is a multi-user data server with a rich lock set, including communication modes (for notification), which is capable of supporting transaction groups. This approach provides flexibility in transaction management but is not extensible. In contrast, we regard lock management as a mechanism to detect conflicts only, for an arbitrary set of lock modes; ObServer’s communication modes can be implemented in LM with proper support from TM as part of conflict resolution. **Object Manager (OM)** - Implements the data model, provides persistence, and performs all requests for access and modification of both control and product data. We assume a generic object-based data model with optional class (“is-a”) hierarchy, composition (“is-part-of”) hierarchy, and arbitrary relationships between objects (“links”). An object may represent purely control data, an encapsulation of product data, or a combination. **OM-EM interface** - For componentization to work, it is important that OM provide the upper layers with an object abstraction that avoids concern with internal representation. Further, upper layers should not know whether objects are in main or secondary memory. The main difficulty with separating OM and LM is that data-consistency specifications may need to be extended for a specific data model. For example, composite objects and links among objects may require “intention” lock modes for ancestor and linked objects, respectively. This predefined set of lock “extensions” is understood by LM, allowing a wide variety of object-oriented data models but precluding the possibility of replacing objects with a radically different form such as relations (such a change would also seriously affect the upper layers, notably query processing in TC, impeding componentization). **Storage and File Manager (SM and FM)** - SM is responsible for low-level disk and buffer management for control data. It manages untyped, raw data, and interacts with the underlying operating system. If the MUSDE uses file-based tools and maintains its product data in ordinary files, FM is responsible for accessing the files requested by OM (in a shared file system such as NFS only path names need be passed). When product data is encapsulated within control data, objects usually abstract the file system by providing typing and relationship information. In this case SM is responsible for both, and FM degenerates into a mapping function between objects and files. The separation between storage, object, lock and transaction management distinguishes our architecture from most other systems that provide data management. 3.3 The Client **User Interface and Objectbase Display Manager (UI)** - Provides the human user interface to all environment services, including a display of the entire objectbase structure (subsets can be viewed via browsing). This feature introduces the challenge of keeping the display up-to-date, since the objectbase is dynamically changed by multiple users, including modifying, adding and deleting objects and/or relationships between objects. **Activity Executor (AE)** - Interacts with tools in an environment-specific manner. This might include interaction with the operating system for spawning child processes with suitable command lines and transforming data to/from objectbase and tool formats. There may or may not be communication between the AE and the activity and between the AE and the server while activity execution is in progress. Command Preprocessor (CPP) - This component is open-ended. It includes formatting of requests for services so that they conform to the interface specifications of the various service providers in the server (framed by TC), and executes local services that do not affect other users or the software development process. An example of the former is an ad-hoc query parser that performs syntax checking and passes to the server a parsed query. An example of the latter is the “help” facility. CPP has no significant impact on the overall architecture. Message Server (MS) - Transfers information between the client and the server over the communication medium. MS must preserve the object abstraction so that both ends can refer to objects identically, which means it must provide linearization and delinearization of the objectbase structure. Mapping our architecture to the “toaster” model, data integration and repository management services are in the server, and user interface services are in the clients, as expected. The interesting mapping is that of task management. We divide this between the client and the server, where the client is responsible for “activity execution” and the server for the rest. 4 Decisions and Justifications 4.1 Client-Server Separation The first issue to consider is the degree of distribution. The two obvious alternatives are to fully centralize services or to fully distribute them among clients. In the first case there would still be minimal clients, at least operating system shells, to allow multiple users to communicate with the environment; but all control and product operations would take place in the server. In the second case there would be no dedicated server at all, but only clients, with all control and product operations executed in a client and shared only via communication directly among clients. We chose a hybrid approach, in which clients are responsible for long duration activities and the server is responsible for relatively short term task control and synchronization. Maintaining data- and process-consistency internal to the server reduces communication overhead, while farming out interactive and/or computation-intensive activities to the relevant clients keeps computation overhead low and response time high. This division of labor seems to best exploit today’s high performance workstations and high capacity server machines. Locating task control in the server does not preclude the possibility of different “views” for different clients: they can be managed by the server as part of the session context. Further, the server-client separation does not prevent distribution of the server itself into multiple server processes, with communication among themselves to handle decentralized data, process and synchronization. Our intent is to instead make an inherent distinction between the roles of clients and server(s). 4.2 Transaction and Lock Management The main reason for decoupling TM and LM is to distinguish conflict detection from conflict resolution, where the former is a mechanical procedure that reports any violations of the defined consistency and the latter is an elaborate procedure that decides how to resolve a conflict when it arises. This separation enables to modify and/or replace synchronization policies without affecting the underlying conflict detection. Furthermore, the fact that LM has no knowledge of the semantics of the various lock modes enables to implement LM in a way that it can be reconfigured externally via tables, without any code changes. The decoupling of transaction management from lower levels also brings TM closer to task management, enabling semantic-based concurrency-control without concern for low-level data management. This separation contributes perhaps more than anything else to the flexibility of the system with respect to concurrency control. 4.3 Tunable Lock Management The alternatives are: (1) a non-locking policy, where concurrency control is optimistic (as in NSE [18]); (2) a hard-coded lock set and lock-compatibility matrix; and (3) a dynamic lock set and lock-compatibility matrix. We addressed hard-coding versus externally-defined lock tables in section 3.2. Optimistic concurrency control may be useful when conflicts are known to be rare, provided that the “resolution” is done by “merging” changes from conflicting operations, since rolling back long and/or interactive operations would be unacceptable in most situations. However, an effective merging procedure for source code is still beyond the state of the art (as evidenced by [19]), and there is no general way to merge two versions of a data file created by conflicting operations (although [14] gives some hope of advances). 4.4 Objectbase Visibility The two obvious alternatives are to keep an entire replica of the objectbase at each client, or to display only those objects that are actually used by a client. Note that in any case control data is manipulated in the server, so the issue is not where to modify the data, but rather how to display it. The main problem with keeping entire replicas is that it is expensive and unnecessary, since objects in a MUSDE can be very large and may change frequently, causing tremendous communication overhead. On the other hand, displaying only objects in current use does not fulfill the “high visibility” property. We chose an intermediate approach, in which the structure of the objectbase is maintained, but not its contents. For each object, we maintain a cache of its name, type, unique ID and relationships to other objects. This provides sufficient information for viewing the entire objectbase, while still compact in volume for transmission by MS. Another consideration is the display-refresh policy. The alternatives are to: (1) broadcast every change to all active clients; (2) refresh periodically; and (3) refresh “on demand”, as determined by the server, by “piggybacking” the refreshed image on the next message sent to the client. The third alternative is preferred as it saves communication overhead while keeping information reasonably up to date. 5 Implementation for Marvel The Marvel 3.x architecture is illustrated in Figure 2. It can be viewed as a rule-based instance of the generic MUSDE architecture of Figure 1. The client structure is essentially the same. The server reflects TC in three sub-components: query processor (QP), command processor for built-in commands (CP), and rule processor (RP) responsible for process enactment. It also adds a Coordination Manager (CM) as a mediator between TM and TC. Marvel’s translation and loading component is collectively called Loader. Tool envelopes and data, process and coordination models are written (by the administrator) in various notations and loaded (again by the administrator) using a privileged client, tailoring the environment’s behavior according to these specifications. The Marvel daemon, not shown, automatically starts a server on the appropriate objectbase when its first client logs in, and shuts down the server after the last client has exited. 5.1 Process Modeling and Enaction The process is defined in terms of rules, each representing a single activity. Each rule consists of a name; a list of typed parameters; a condition that represents the properties that must hold on actual parameters and other objects bound in the condition for the rule to fire; an activity that specifies a “product” activity and its arguments; and a set of mutually exclusive effects consisting of assertions to the objectbase that reflect the possible results of executing the activity. Rules are implicitly related to each other through matches between a predicate in the condition of one rule and an assertion in the effect of another rule. Process enaction in RP is done through chaining. When an activity is requested, the condition of the corresponding rule is evaluated. If not satisfied, RP attempts to satisfy it by backward chaining to other rules whose effects may satisfy the user-invoked rule. This is done recursively, until the condition is satisfied or all possibilities are exhausted, in which case the activity cannot be executed. When the activity returns from the client (assuming the rule’s condition was satisfied), RP asserts the effect indicated by the status code returned from AE and then recursively forwards chains to all rules whose conditions have become satisfied. Marvel distinguishes between consistency and automation chains, which are specified by annotations on condition predicates and effect assertions in the rules [5]. Consistency chains propagate changes and are by definition mandatory and atomic. Automation chains automate activities and are by definition optional; they may be terminated at any point or “turned off” entirely. 5.2 Task Management Marvel’s scheduler implements a simple FCFS non-preemptive scheduling policy. However, non-preemptive scheduling does not imply that an entire session, or even an entire task, is handled by the server atomically. Instead, we exploit the natural “breaks” within and among tasks, at which points the server performs a context switch and turns to the next client request. That request might resume an in-progress task or initiate a new task. RP is the heart of task management. A task consists of all rules executed during backward chaining, followed by the user-invoked rule (which caused the backward chain), followed by all rules executed during forward chaining. RP operates in a specific task context, consisting of information necessary for maintaining the state of the task. The main data structure is the rule stack, one per task. Since backward chaining is multiply-recursive and generates an AND/OR tree (i.e., in some cases a rule's condition may be satisfiable only by application of a set of rules, and in other cases by any one of many possible rules), the rule stack is implemented as a multi-level stack, where each level consists of an ordered set of rules that correspond only to the first rule in the previous level, and are not related to other rules in the previous level. The same stack is used for forward chaining, although here a standard stack mechanism is sufficient. One problem of multi-tasking rule processing is that multiple instances of the same rule may be fired concurrently by the same or different clients, and since they all fire in the context of one RP (i.e., one address space), rules cannot contain any private data. This problem is solved by making rules reentrant. Each invocation entails creation of a rule-frame, which consists of a pointer to the (read-only) rule and a dynamically allocated data section, which it retains throughout the entire life cycle of a rule chain. 5.3 Data Management TM supports a nested transaction model in which a task is modeled as a top-level transaction, each consistency chain is a subtransaction consisting of a further level of subtransactions corresponding to individual rules, and each rule in an automation chain is an independent subtransaction on its own. By definition, an entire consistency chain is executed to completion or rolled back as if it never started, while the latest rule in an automation chain can be aborted without affecting the rest of the chain. In MARVEL 3.1, CM will serve as a mediator between data and task management; CM-RP and CM-TM interfaces have already been partially implemented. MARVEL's composition hierarchy is based on ORION [21], using intention locks for ancestors. When object O is locked, all O's ancestors are locked in the corresponding intention mode. Intention locks are generally weaker than the corresponding descendant locks, and their goal is to protect objects from being affected by an operation on an ancestor. For example, when object O is locked in L mode, IL locks are placed on all its ancestors, where IL is compatible with any operation that would not affect O. In particular, it is compatible with another IL lock. This idea can be extended to linked objects as well as ancestors, but this is not supported in MARVEL. LM reads three tables when initialized: compatibility matrix, ancestor table and power matrix. The compatibility matrix defines the set of lock modes and the compatibility of any two lock modes. The ancestor table indicates which lock to apply to the ancestors of the object being locked in a certain mode. The power matrix determines which lock has precedence given two locks requested by the same transaction. SM uses the Unix dbm package. Although more sophisticated data management strategies can be supported by dbm, SM loads the entire objectbase (but not files) into memory at server startup. FM is implemented by a collection of system calls that map the object name-space to the file system name-space, and perform operations on a "hidden" file system rooted at a directory representing the populated objectbase of an environment. MS uses Internet sockets. 5.4 Client and Loader UI includes both graphical and command line interfaces with the former providing full objectbase browsing capability (conceptually communicating with OM directly) and the latter supporting batch processing scripts as well as dumb terminals. CPP includes an ad-hoc query parser. AE is the most complex component of the client. It is in charge of spawning child processes for executing envelopes, basically shell scripts, for the various tools defined in the environment. AE communicates with envelopes through pipes in a "black-box" fashion: inputs are provided at the beginning of activity execution, and output and a status code are collected at the end [16]. The Loader generates a static rule network from the process model, which is used at runtime to determine chaining. This network is loaded into RP, to define process-consistency. The data and process models are tied in the sense that rule parameters and local bindings in the conditions of rules are typed according to classes. The data model is used by OM and QP. The various lock tables (a degenerate coordination model) are loaded into LM, to specify data-consistency. A full coordination model using the Control Rule Language syntax described by Barghouti [3] can already be loaded, but is not included in the current release. 5.5 Experience We started with the standard shared and exclusive locks, and intention locks (Figure 3-a), but then modified the lock tables several times. The final change added two new lock modes and removed one, and changed the compatibility of old modes. The purpose was to provide semantics-based locking by distinguishing between operations that affect only a single object (e.g., write on a simple attribute) and operations that might affect related objects (e.g., the delete operation removes an object and all its children). Strong Exclusive (SX) and Strong Shared (SS) locks were added, and X and S became compatible with any intention lock (see Figure 3-b). The ancestor table was modified to include intention locks for the new modes. This required no code changes to LM and only minor changes to TM to replace requests for locks according to the new semantics. Even these code changes would not have been needed for MARVEL 3.1, where the specific lock modes to use for particular arguments of activities and rules will be specified in external tables, as part of the coordination model. Thus, a dramatic change in conflict detection can be achieved with very small overhead. We also started with a flat transaction model, in which an entire chain executed as a single transaction. This made it impossible to treat different subsets of a task differently. For example, we could not abort an automation subchain without rolling back consistency subchains descended from the same user-invoked rule. We replaced TM with nested transactions. Each rule triggered during an automation chain, together with any consistency subchains emanating from it, is a subtransaction that can be aborted without affecting the top-level transaction or other subtransactions. Again, this major change had no impact whatsoever on LM, and required only trivial changes to RP. CM is being developed to support programmable conflict resolution for MARVEL 3.1. The administrator will be able to define an optional set of control rules to specify scenarios when the default policy above may be relaxed, and prescribe appropriate actions in each such case. We have already built a facility whereby CM accesses RP's rule stacks, since control rule scenarios require inspection of conflicting rule chains. TM already requests CM to try to match its control rules, but we are still investigating the desirable operations for the actions, so the semantics of a non-empty control rule base are undefined. We will have to add to TM a "marking" phase, to annotate objects left temporarily inconsistent by control rule actions that suspend or terminate in-progress consistency chains, and an "unmarking" phase to attempt to restore consistency when access to such objects is requested. We anticipate no other changes to TM, small if any to RP, and none to other components. 5.6 Status MARVEL is implemented in C and runs on SparcStations (SunOS 4.1.1) and DECStations (Ultrix 4.2), using X11R4 Windows. MARVEL 3.0 and 3.0.1 have been licensed to about 25 educational institutions and industrial sponsors since December 1991. 3.0.1 includes all the features presented in this paper, except where noted, and was the first version fully developed and maintained using C/MARVEL, a MARVEL process for team programming in C. We are currently using C/MARVEL to develop MARVEL 3.1, planned for release in 1993. In addition to the enhancements explained above, 3.1 will include: An XView user interface, limited data and process evolution for existing objectbases, and integration of built-in commands with the rule chaining engine. 6 Related Work Gypsy (aka SMS) [8] is an extended version control system that is tightly integrated with an extended operating system. Synchronization is manual, and users work in isolation, each in his/her own "workspace". Although Gypsy provides a mechanism for multiple users to access data objects concurrently by specifying a list of users that can attach to a workspace, it provides no means for coordinating their access. Arcadia [29, 23] is a process-programming environment based on research in SDE technology underway by the Arcadia consortium. Like our architecture, it is constructed out of layered components that are intended to be replaceable. However, although process-consistency from the process-programming point of view is addressed extensively by Sutton [27], an independent synchronization component is conspicuously absent from the architecture. We guess that multi-user synchronization is provided by the object management system. Melmac [16] is a process-centered environment with a client-server architecture, in which the server is primarily concerned with data management and provides a simple transaction mechanism, and the clients are responsible for process enactment. One shortcoming evidenced by the examples given in [17] is that since process management is detached from the server, it seems that rule chains cannot be interleaved even during activity execution, which might degrade response time significantly. Oikos is a rule-based MUSDE that supports concurrency using a hierarchy of blackboards that resemble Linda's tuple spaces. Oikos enables to specify a wide range of services as part of process enactment, including database schemas and transactions. However, while concurrency is an inherent aspect in the Oikos architecture, concurrency control is not, and it is not clear what range of synchronization policies can be supported, nor how these might be supported. CLF is a rule-based MUSDE that distinguishes between consistency and automation, but through separate classes of rules rather than annotations on rule predicates as in MARVEL. CLF employs a form of optimistic concurrency control based on merging, with inconsistency tolerated by automatically placing guards on inconsistent data [2], similar to our notion of "marking". Changes are grouped into evolution steps, which can be undone or redone [7]. Merlin is the closest system to MARVEL. From the process modeling viewpoint, the main difference may be that Merlin distinguishes forward and backward chaining styles of rules while MARVEL has a single rule base and a symmetric chaining model. There are substantial architectural differences, however: Merlin employs a simple checkin/checkout model, using an object's state as determined by the rules as a lock; there is no support for multiple locking modes; and the objectbase display is limited to each user's working context (although there is a refresh mechanism). It appears that chaining operates in each user's working context (client) as opposed to a centralized server. 7 Evaluation and Contributions Semantics-based concurrency control and componentization are, in some sense, conflicting goals: how can the transaction manager be semantics-based when the semantics are hidden in the task controller? For example, in our work towards programmable concurrency control, we will have to develop a richer interface between the rule processor and the coordination manager than was previously needed for the transaction manager. It seems unlikely that a sufficiently rich general interface – without a sophisticated mediator – can be developed between the task controller and the transaction manager to allow replacement of either without affecting the other. Our architecture provides no direct interface between clients and the synchronization components. However, users will need to place explicit requests for notification, if not other purposes; we anticipate changes would be required for the command preprocessor as well as the coordination and/or transaction managers. The most significant drawback of our architecture is that the single centralized server does not scale up to very large numbers of clients. As more clients are added and the objectbase grows, the likelihood of noticeable waits increases. This is an important area for future research. But there are many advantages of our architecture. At the user interface level, the structural display facility provides for high visibility without the overhead of maintaining complete replica at the clients. At the task management level, the separation between activity execution and task control provides for process sharing while enabling local execution of tools. At the data management level, we have made several architectural decisions we believe are unique as well as fruitful: (1) A table-driven lock manager allows to modify data-consistency policies with no code changes. (2) The separation between transaction and lock management allows definition and monitoring of data-consistency independent of the synchronization policy, with minimal overhead. Moreover, this enables to implement sophisticated coordination models, with little effect on other components. (3) The decision to separate transaction management from object management emphasizes our view of support for advanced synchronization models. Essentially, we moved synchronization away from low-level data integration and closer to the semantic, task level. We do not know of any other MUSDE with such functionalities. Acknowledgments We would like to thank Naser Barghouti for his numerous contributions to the MARVEL project; conversations with Bill Riddle, Brian Nejmeh and Steve Gaede helped shape the functionality of multi-user MARVEL; Mark Gisi, John Hinsdale, Tim Jones, Will Marrero, Moshe Shapiro and Mike Sokolsky participated in the implementation effort; Hideyuki Miki, Steve Popovich and students in the E6123 Programming Environments and Software Tools course helped by testing MARVEL as users. References pages 199–212, Martha’s Vineyard MA, September 1990. Morgan Kaufmann.
{"Source-Url": "http://web.cs.wpi.edu/~heineman/PDF/usenix93.pdf", "len_cl100k_base": 8111, "olmocr-version": "0.1.53", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 11430, "total-output-tokens": 10261, "length": "2e12", "weborganizer": {"__label__adult": 0.00025343894958496094, "__label__art_design": 0.0003972053527832031, "__label__crime_law": 0.00020933151245117188, "__label__education_jobs": 0.000461578369140625, "__label__entertainment": 4.2319297790527344e-05, "__label__fashion_beauty": 0.00010317564010620116, "__label__finance_business": 0.00016641616821289062, "__label__food_dining": 0.0002378225326538086, "__label__games": 0.0003540515899658203, "__label__hardware": 0.0006804466247558594, "__label__health": 0.00026416778564453125, "__label__history": 0.0001800060272216797, "__label__home_hobbies": 5.877017974853515e-05, "__label__industrial": 0.0002586841583251953, "__label__literature": 0.00014269351959228516, "__label__politics": 0.00015687942504882812, "__label__religion": 0.0003204345703125, "__label__science_tech": 0.007427215576171875, "__label__social_life": 5.233287811279297e-05, "__label__software": 0.005466461181640625, "__label__software_dev": 0.98193359375, "__label__sports_fitness": 0.00017964839935302734, "__label__transportation": 0.0003292560577392578, "__label__travel": 0.00016295909881591797}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 48549, 0.02841]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 48549, 0.4082]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 48549, 0.91883]], "google_gemma-3-12b-it_contains_pii": [[0, 4096, false], [4096, 9870, null], [9870, 12623, null], [12623, 18545, null], [18545, 23989, null], [23989, 28069, null], [28069, 33885, null], [33885, 38337, null], [38337, 43586, null], [43586, 48549, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4096, true], [4096, 9870, null], [9870, 12623, null], [12623, 18545, null], [18545, 23989, null], [23989, 28069, null], [28069, 33885, null], [33885, 38337, null], [38337, 43586, null], [43586, 48549, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 48549, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 48549, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 48549, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 48549, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 48549, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 48549, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 48549, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 48549, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 48549, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 48549, null]], "pdf_page_numbers": [[0, 4096, 1], [4096, 9870, 2], [9870, 12623, 3], [12623, 18545, 4], [18545, 23989, 5], [23989, 28069, 6], [28069, 33885, 7], [33885, 38337, 8], [38337, 43586, 9], [43586, 48549, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 48549, 0.0]]}
olmocr_science_pdfs
2024-12-12
2024-12-12
6acc7de5716ae57bfd04d0d77d14521e8ae52294
Abstract—Artificial Intelligence (AI) has become an integral part of our lives, finding applications across various industries. Search algorithms play a crucial role in AI. This paper focuses on the comparison of different search algorithms within the context of path-planning in the UC Berkeley's PAC-Man's game. The algorithms under consideration include Depth-First Search (DFS), Breadth-First Search (BFS), Uniform Cost Search (UCS), Iterative Deepening Depth First Search (IDDFS), and $A^*$ Search. The objective is to identify the most effective algorithm in terms of path-finding performance. The study’s findings reveal that the $A^*$ search algorithm outperforms the others in terms of score, cost, and node expansion, making it the most suitable choice for finding the shortest path in the PAC-Man’s game. Index Terms—Artificial Intelligence, Search Algorithms, Path Finding, PAC-MAN Game I. INTRODUCTION Artificial Intelligence (AI) has revolutionized the gaming industry by enhancing game mechanics and creating more immersive and intelligent experiences for players. One area where AI has made significant strides is in the development and application of search algorithms in games [1], [2]. These algorithms play a crucial role in enabling game characters to navigate game worlds, find optimal paths, and make intelligent decisions in real-time. Search algorithms in games involve the exploration of game states and the identification of the most favorable actions or paths to achieve specific objectives. By employing AI techniques, game developers can create intelligent agents capable of efficiently searching through complex environments, avoiding obstacles, and making informed decisions. The application of search algorithms in games is particularly evident in path-finding, where game characters need to navigate through intricate game worlds to reach their goals. These algorithms enable characters to determine the shortest or most optimal paths while considering various factors such as obstacles, terrain, and dynamic changes in the environment. Different search algorithms have been developed and applied in games, each with its strengths and limitations. Algorithms such as Depth-First Search (DFS) and Breadth-First Search (BFS) offer simple yet effective approaches for path-finding. DFS explores paths depth-wise, while BFS explores paths breadth-wise. These algorithms provide a foundation for understanding search techniques and serve as benchmarks for more advanced algorithms. The Uniform Cost Search (UCS) algorithm considers the cost associated with each path and selects the one with the lowest cumulative cost. It is particularly useful in games where movement costs vary or where characters need to reach specific locations efficiently. The $A^*$ search algorithm is widely used in games due to its ability to find the shortest path while considering both the cost and heuristic estimation of reaching the goal. $A^*$ combines the advantages of UCS and heuristic search, making it a powerful tool for path-finding in dynamic game environments. Moreover, Iterative Deepening Depth-First Search (IDDFS) combines depth-first search with iterative deepening, allowing for efficient exploration of large search spaces while also finding optimal paths. By applying these search algorithms, game developers can create intelligent game characters that can navigate complex environments, avoid obstacles, and make strategic decisions based on their objectives and surroundings. A search problem includes many items including the search space, start state, goal, search tree, actions, transition model, path cost, and optimal solution. Search algorithms have certain properties that are used to determine their efficiencies, such as completeness, optimality, time-complexity, and space-complexity. These algorithms are divided into two categories. The blind search that has not have any prior information about the search space such as BFS, UCS, DFS and IDDFS. The heuristic search that has information about the search space and the goal state such as $A^*$, Fig. I illustrates the categories of search algorithms [3]. ![Types of Search Algorithms](image) **Fig. 1: Types of search algorithms.** This paper explores the application of search algorithms in the context of the widely popular and classic Japanese video game, PAC-Man [4] [5]. The game is to guide PAC-Man through a closed maze, consuming all the dots, while evading the ghosts that relentlessly pursue him. Beyond its entertainment value, PAC-Man provides an intriguing problem environment for testing and evaluating search algorithms. By leveraging the challenges presented in PAC-Man, this paper delves into the exploration of search algorithms, aiming to analyze their effectiveness and performance within the game's context. The structure of this article is as follows. Section II gives a description of five search algorithms. Section III gives a description about the used mazes and the implementation of the search algorithms. Section IV demonstrates the simulation results, with discussion. Lastly, section V concludes the work. II. SEARCH ALGORITHMS A. Depth-First Search The DFS algorithm explores a tree by traversing as far as possible along each branch before backtracking. It starts at an initial node and explores deeper into the tree by visiting adjacent nodes until it reaches a dead end. It then backtracks to the previous node and continues exploring any unvisited adjacent nodes until all nodes have been visited. Fig. 2 illustrates the DFS algorithm. First, the searching starts at the root node S and then goes to the branch where node A is present. Then, it goes to node B, followed by node D. However, after node D there is no children, so it retraces the path in which it traversed and reach node B but now it goes through the un-traced path to E, and repeats the same process until reaching the goal node G. While DFS has its advantages in terms of simplicity, memory efficiency, and exploration of deep paths, it also has limitations such as lack of completeness, suboptimal solutions, and potential inefficiency on wide and balanced trees. The suitability of DFS depends on the specific problem domain and the characteristics of the graph being explored. In [6], DFS was compared to other algorithms such as BFS and $A^*$ to determine the shortest path between nodes for a mobile robot within various mazes. The authors concluded that DFS did perform well in finding the shortest path and it may provide longer paths. In [7], the authors presented the design and development of a line maze solver robot based on DFS. The results were acceptable and the robot was able to solve a looped maze in 63.40 seconds and a non-looped maze in 84.97 seconds. However, the robot fails to complete the looped maze under certain conditions. B. Breadth-First Search The BFS is a graph traversal algorithm used to explore and search for nodes in a tree. It starts at a given source node and explores all the neighboring nodes at the current depth level before moving to the nodes at the next depth level. It iterates layer by layer until the goal is reached, using a queue data structure that follows first-in first-out. Fig. 3 demonstrates the iterations and decisions taken by BFS. It starts with the source node S at layer 0 and visits all nodes of current layer then traversing through the remaining layers to perform the same operation until the goal node is reached [8]. BFS is complete as it guarantees finding a solution if one exists, given that the tree is finite and connected. Since it explores nodes in a breadth-first manner, it guarantees that the first occurrence of a node during traversal is the shortest path to reach that node. It only requires enough memory to store the nodes in the current level being explored. It does not store information about the entire graph or tree, which makes it memory-efficient compared to other graph traversal algorithms like DFS. While BFS is memory-efficient during execution, it requires additional memory to keep track of visited nodes and the queue data structure. In graphs with a large number of nodes and complex connections, the memory requirements can be significant. In dense graphs, where the number of edges is close to the maximum possible, BFS can have a higher time complexity compared to other algorithms like DFS. This is because BFS visits all neighbors of a node before moving to the next level, resulting in a larger number of nodes in the queue. It explores nodes in a breadth-first manner, which means it can be inefficient for large graphs with a high branching factor. The number of nodes to be visited can grow exponentially with the depth of the graph, leading to slower execution times. It is not designed to find optimal solutions in graphs with weighted edges. It does not consider the edge weights and assumes all edges have the same cost. Bidirectional BFS is an optimization of the standard BFS algorithm. It performs two separate BFS searches: one starting from the source node and the other starting from the target node. The searches proceed simultaneously, with each search exploring one level of nodes at a time. The algorithm terminates when a node is discovered that has been visited by both searches, indicating the shortest path has been found. It is a powerful optimization for finding the shortest path between two nodes in an unweighted graph. However, it may not be suitable for graphs with complex edge weights or when there are multiple target nodes [9]. C. Uniform Cost Search The UCS traversal algorithm finds the path with the lowest cost between a source node and a goal node in a weighted graph. Unlike BFS or DFS, it takes into account the cost associated with each transition between nodes. It is commonly used in various applications, such as route planning, navigation systems, and resource allocation, where finding the lowest-cost path is crucial [10]. Fig. 4 shows the way that UCS calculates the total cost from the initial node, S, to any of the destination nodes [G1, G2, G3]. The directed vertices represent the direction and cost of the path adding up to the overall cost of the path which is a sum of all the paths. The UCS is an optimal and complete algorithm when space is an issue and requires no heuristics. It is used in maze problems since it prioritizes the minimum cumulative cost while the DFS algorithm gives maximum priority to maximum depth [11]. Its main drawback is that it is only concerned about the cost of the path and completely neglects the number of steps involved in searching which can cause it to be stuck in an infinite loop. Since UCS solely focuses on minimizing the cost, it may continue to explore paths with lower costs indefinitely, even if the number of steps required becomes unreasonably large. This can occur when there are cycles or loops in the graph, causing the algorithm to repeatedly revisit nodes and never terminate. D. Iterative Deepening Depth-First Search The IDDFS is an uniformed search algorithm that combines the benefits of DFS and BFS. Fig. 5 illustrates the operation of the IDDFS among a tree. This algorithm performs DFS up to a certain specified depth limit [12]. If a goal is not found at a specified limit, then the search process will terminate. The limit will be incremented by one, and the process will start again until the goal is reached. In the case shown in Fig. 5, the algorithm will find the goal after the fourth iteration. The IDDFS is complete, and memory-efficient algorithm that provide Optimal solution for unit-cost paths. Unfortunately, it performs redundant work by re-exploring nodes at each depth level, does not perform well in graphs with a high branching factor, does not take advantage of memory sharing between iterations, and does not consider edge weights or costs, which can lead to suboptimal solutions or inefficient exploration in such scenarios [13]. The authors in [14] compared IDDFS with Monte Carlo Tree Search (MCTS). The algorithms were compared on the premise of playing multi-agent visibility based pursuit-evasion games. Results showed that both perform well while being as algorithms for the pursuers, but IDDFS performs better as algorithm for the evader. The difference in performance comes down to the branching factor, IDDFs is better with smaller branching factors, while MCTS is better with larger branching factors. **E. A* Search** The A* search is widely used for finding the shortest path between two nodes in a graph, taking into account both the cost of the path and an estimated heuristic value to guide the search [15]. It is quick and accurate when estimating a path. The heuristic function value is represented by \( f(n) = g(n) + h(n) \), where \( g(n) \) is the cost that is required to reach a target node from the the root, and \( h(n) \) is the heuristic value. Closed list and open list refer to two distinct data structures used to keep track of the nodes during the A* search process. The open list, known as fringe or frontier, holds the nodes that have been discovered but not yet fully explored. These are the nodes that are potential candidates for expansion and further exploration. The open list is typically implemented as a priority queue, where the nodes are ordered based on their estimated total cost (the sum of the cost to reach the node from the start node and the estimated cost to reach the goal node). The node with the lowest estimated total cost is selected for expansion first. The closed list, explored set, stores the nodes that have been fully expanded or explored. Once a node is expanded, it is moved from the open list to the closed list to indicate that it has been processed. The closed list is used to avoid revisiting nodes that have already been explored, preventing redundant exploration and potential infinite loops. It helps ensure that each node is expanded only once during the search. During the A* search algorithm, the open list is initially populated with the start node, and the closed list is empty. The algorithm then proceeds by iterative selecting the node with the lowest estimated total cost from the open list, expanding it, and adding its neighboring nodes to the open list. As nodes are expanded, they are moved from the open list to the closed list. Both lists are illustrated in Fig. 7, and 6. The A* search is complete and optimal, but it consumes a huge amount of memory as each explored node to be kept in memory, resulting in a space complexity. In [16], the authors used a combination of A* and Navigation mesh to optimize the shortest path-finding problem on enemies/ghosts of the PAC-Man game. The results showed that the movement of ghosts in catching PAC-Man using the A* algorithm was good in terms of the ghosts taking less steps to reach the goal. **III. PROPOSED ALGORITHM** This work examined the performance of the five search algorithms, mentioned in section II, with respect to the different types of mazes in the PAC-Man game. The best path is to be selected based on the cost in each algorithm. The A* search algorithm is demonstrated by the code that follows. Prior to the main function, the code specifies a heuristic function since A* is an informed search. In the event that there is no route cost, this heuristic function is null and has only one line that returns a zero. A suite of utilities are included in the fringe package, which has been used to implement the primary function. The least-cost path from a given (initial - goal) node may be found with this package. Expanded nodes are then pushed to the visited queue after a queue and array are created to hold the visited nodes. When one state remains after all nodes have been verified and popped from the isEmpty list, the goal state is returned. If not, the visited list iterates continuously. ```python def nullHeuristic(state, problem=None): """ A heuristic function estimates the cost from the current state to the nearest goal in the provided SearchProblem. """ return 0 def aStarSearch(problem, heuristic=nullHeuristic): """Search the node that has the lowest combined cost and heuristic first.""" # create fringe to store nodes fringe = util.PriorityQueue() # track visited nodes visited = [] # push initial state to fringe fringe.push((problem.getStartState(), [], 0), heuristic(problem.getStartState(), problem)) while not fringe.isEmpty(): node = fringe.pop() state = node[0] actions = node[1] # goal check if problem.isGoalState(state): return actions if state not in visited: visited.append(state) # visit child nodes successors = problem.getSuccessors(state) for child in successors: child_state = child[0] childaction = child[1] if child_state not in visited: # add child nodes childact = actions + [childact] cost = problem.getCostOfActions(childact) fringe.push((child_state, childact, 0), cost + heuristic(child_state, problem)) ``` ### IV. Simulation Results The path finding algorithms: DFS, BFS, UCS, IDDFS, and $A^*$ are implemented to navigate tiny, medium, and big PAC-Man mazes, shown in Fig. 8a, 8b, and 8c; respectively. **a) Tiny Maze:** The algorithms BFS, UCS, and $A^*$ followed the yellow path to traverse the maze and consume the dot marked in green, which is their objective, whereas DFS and IDDFS take the aqua path. Table I provides the outcomes of each algorithm. **b) Medium Maze:** In order to navigate the medium maze and attain the goal of eating the green-circled dot, the BFS, UCS, IDDFS, and $A^*$ algorithms followed the yellow path, whereas DFS followed the aqua path. Table I provides the outcomes of each algorithm. **c) Big Maze:** The five algorithms traversed the big maze using the identical yellow path in order to reach the objective and consume the green-circled dot. Table I provides the outcomes of each algorithm. The three top-performing algorithms in the tiny maze, $A^*$, BFS, and UCS, each had a cost of 8 and a score of 502, according to the results. However, $A^*$ stood out due to its reduced number of expanded nodes, which was 14. The same three algorithms: BFS, UCS, and $A^*$ had the highest score of 442 for the medium maze. However, the $A^*$ search performed best, with a lower cost of 68 and the fewest expanded nodes (219). But in the big maze, all five algorithms—DFS, BFS, UCS, IDDFS, and $A^*$ search—had the same score of 300 and cost of 210. DFS, however, fared the best because it had the fewest expanded nodes—390—while $A^*$ search had the most expanded nodes—538, to be exact. This demonstrates how the DFS works better in expansive settings with solutions located far from the source. ### V. Conclusion AI-driven search algorithms are now a basic feature of game development, allowing avatars to traverse virtual environments and choose the best path. Search algorithms, ranging from basic techniques like DFS and BFS to more complex methods like UCS, $A^*$, and IDDFS, are essential to the development of intelligent and dynamic gaming experiences. PAC-Man is still a fun game for players to play, but it also provides an invaluable framework for assessing and contrasting search algorithms, which makes it a fascinating and difficult problem environment for AI researchers and game developers. In this paper, we used AI search algorithms to present a path-finding computer game inspired by PAC-MAN. We described each algorithm in detail and compiled the simulation TABLE I: Five search algorithms performance in the three mazes. <table> <thead> <tr> <th>Search Algorithm</th> <th>Tiny maze</th> <th>Med maze</th> <th>Big maze</th> </tr> </thead> <tbody> <tr> <td></td> <td>Score</td> <td>Cost</td> <td>Extended Nodes</td> </tr> <tr> <td>DFS</td> <td>500</td> <td>10</td> <td>15</td> </tr> <tr> <td>BFS</td> <td>502</td> <td>8</td> <td>15</td> </tr> <tr> <td>UCS</td> <td>502</td> <td>8</td> <td>15</td> </tr> <tr> <td>IDDFS</td> <td>500</td> <td>10</td> <td>86</td> </tr> <tr> <td>A*</td> <td>502</td> <td>8</td> <td>14</td> </tr> </tbody> </table> results for all path-finding algorithms across various environments according to how well they performed in terms of score, cost, and node expansion, which showed how much memory was used. The A* algorithm proved to be the most effective in two of the environments and was deemed efficient in the third, according to the findings. Beyond gaming, these algorithms are offering solutions to path-finding, optimization, and search problems in a wide range of fields, including web crawling, social network analysis, compiler design, routing, resource allocation, planning, robotics, and puzzle solving. Their efficient and effective exploration of search spaces makes them valuable tools in various real-world applications. It is important to consider the trade-off between time complexity and memory consumption when selecting an algorithm based on the specific problem requirements and constraints, which can be covered in a further work. REFERENCES
{"Source-Url": "https://repository.effatuniversity.edu.sa/bitstream/handle/20.500.14131/1396/2023348996.pdf?sequence=1", "len_cl100k_base": 4427, "olmocr-version": "0.1.53", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 18658, "total-output-tokens": 5880, "length": "2e12", "weborganizer": {"__label__adult": 0.0010786056518554688, "__label__art_design": 0.0007491111755371094, "__label__crime_law": 0.0015811920166015625, "__label__education_jobs": 0.001850128173828125, "__label__entertainment": 0.00043582916259765625, "__label__fashion_beauty": 0.0006256103515625, "__label__finance_business": 0.0007367134094238281, "__label__food_dining": 0.00109100341796875, "__label__games": 0.0311279296875, "__label__hardware": 0.0032482147216796875, "__label__health": 0.0014963150024414062, "__label__history": 0.001132965087890625, "__label__home_hobbies": 0.0002505779266357422, "__label__industrial": 0.0016565322875976562, "__label__literature": 0.0010728836059570312, "__label__politics": 0.0007767677307128906, "__label__religion": 0.0011034011840820312, "__label__science_tech": 0.31494140625, "__label__social_life": 0.00019669532775878904, "__label__software": 0.00884246826171875, "__label__software_dev": 0.62158203125, "__label__sports_fitness": 0.0016841888427734375, "__label__transportation": 0.0021839141845703125, "__label__travel": 0.0005364418029785156}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 24784, 0.02125]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 24784, 0.59943]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 24784, 0.91391]], "google_gemma-3-12b-it_contains_pii": [[0, 3947, false], [3947, 8360, null], [8360, 12346, null], [12346, 15752, null], [15752, 19860, null], [19860, 24784, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3947, true], [3947, 8360, null], [8360, 12346, null], [12346, 15752, null], [15752, 19860, null], [19860, 24784, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 24784, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 24784, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 24784, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 24784, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 24784, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 24784, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 24784, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 24784, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 24784, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 24784, null]], "pdf_page_numbers": [[0, 3947, 1], [3947, 8360, 2], [8360, 12346, 3], [12346, 15752, 4], [15752, 19860, 5], [19860, 24784, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 24784, 0.0708]]}
olmocr_science_pdfs
2024-12-09
2024-12-09
a30365ff4070dacc06a15321366afa948482d81c
Proof-of-Possession Key Semantics for CBOR Web Tokens (CWTs) draft-ietf-ace-cwt-proof-of-possession-03 Abstract This specification describes how to declare in a CBOR Web Token (CWT) that the presenter of the CWT possesses a particular proof-of-possession key. Being able to prove possession of a key is also sometimes described as being the holder-of-key. This specification provides equivalent functionality to "Proof-of-Possession Key Semantics for JSON Web Tokens (JWTs)" (RFC 7800), but using CBOR and CWTs rather than JSON and JWTs. Status of This Memo This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." This Internet-Draft will expire on December 31, 2018. Copyright Notice Copyright (c) 2018 IETF Trust and the persons identified as the document authors. All rights reserved. 1. Introduction This specification describes how a CBOR Web Token (CWT) [RFC8392] can declare that the presenter of the CWT possesses a particular proof-of-possession (PoP) key. Proof of possession of a key is also sometimes described as being the holder-of-key. This specification provides equivalent functionality to "Proof-of- Possession Key Semantics for JSON Web Tokens (JWTs)" [RFC7800], but using CBOR [RFC7049] and CWTs [RFC8392] rather than JSON [RFC7159] and JWTs [JWT]. 2. Terminology The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here. This specification uses terms defined in the CBOR Web Token (CWT) [RFC8392], CBOR Object Signing and Encryption (COSE) [RFC8152], and Concise Binary Object Representation (CBOR) [RFC7049] specifications. These terms are defined by this specification: Issuer Party that creates the CWT and binds the claims about the subject to the proof-of-possession key. Presenter Party that proves possession of a private key (for asymmetric key cryptography) or secret key (for symmetric key cryptography) to a recipient. In context of OAuth this party is also called OAuth Client. Recipient Party that receives the CWT containing the proof-of-possession key information from the presenter. In context of OAuth this party is also called OAuth Resource Server. 3. Representations for Proof-of-Possession Keys By including a "cnf" (confirmation) claim in a CWT, the issuer of the CWT declares that the presenter possesses a particular key and that the recipient can cryptographically confirm that the presenter has possession of that key. The value of the "cnf" claim is a CBOR map and the members of that map identify the proof-of-possession key. The presenter can be identified in one of several ways by the CWT, depending upon the application requirements. For instance, some applications may use the CWT "sub" (subject) claim [RFC8392], to identify the presenter. Other applications may use the "iss" claim to identify the presenter. In some applications, the subject identifier might be relative to the issuer identified by the "iss" (issuer) claim [RFC8392]. The actual mechanism used is dependent upon the application. The case in which the presenter is the subject of the CWT is analogous to Security Assertion Markup Language (SAML) 2.0 [OASIS.saml-core-2.0-os] SubjectConfirmation usage. 3.1. Confirmation Claim The "cnf" claim in the CWT is used to carry confirmation methods. Some of them use proof-of-possession keys while others do not. This design is analogous to the SAML 2.0 [OASIS.saml-core-2.0-os] SubjectConfirmation element in which a number of different subject confirmation methods can be included (including proof-of-possession key information). The set of confirmation members that a CWT must contain to be considered valid is context dependent and is outside the scope of this specification. Specific applications of CWTs will require implementations to understand and process some confirmation members in particular ways. However, in the absence of such requirements, all confirmation members that are not understood by implementations MUST be ignored. This specification establishes the IANA "CWT Confirmation Methods" registry for these members in Section 7.2 and registers the members defined by this specification. Other specifications can register other members used for confirmation, including other members for conveying proof-of-possession keys using different key representations. The "cnf" claim value MUST represent only a single proof-of-possession key. At most one of the "COSE_Key" and "Encrypted_COSE_Key" confirmation values defined in Figure 1 may be present. Note that if an application needs to represent multiple proof-of-possession keys in the same CWT, one way for it to achieve this is to use other claim names, in addition to "cnf", to hold the additional proof-of-possession key information. These claims could use the same syntax and semantics as the "cnf" claim. Those claims would be defined by applications or other specifications and could be registered in the IANA "CBOR Web Token Claims" registry [IANA.CWT.Claims]. <table> <thead> <tr> <th>Name</th> <th>Key</th> <th>Value type</th> </tr> </thead> <tbody> <tr> <td>COSE_Key</td> <td>1</td> <td>COSE_Key</td> </tr> <tr> <td>Encrypted_COSE_Key</td> <td>2</td> <td>COSE_Encrypt or COSE_Encrypt0</td> </tr> <tr> <td>kid</td> <td>3</td> <td>binary string</td> </tr> </tbody> </table> Figure 1: Summary of the cnf names, keys, and value types 3.2. Representation of an Asymmetric Proof-of-Possession Key When the key held by the presenter is an asymmetric private key, the "COSE_Key" member is a COSE_Key [RFC8152] representing the corresponding asymmetric public key. The following example (using CBOR diagnostic notation) demonstrates such a declaration in the CWT Claims Set of a CWT: ``` { /iss/ 1 : "coaps://server.example.com", /aud/ 3 : "coaps://client.example.org", /exp/ 4 : 1361398824, /cnf/ 8 :{ /COSE_Key/ 1 :{ /kty/ 1 : /EC/ 2, /crv/ -1 : /P-256/ 1, /x/ -2 : h'd7cc072de2205bdc1537a543d53c60a6acb62eccd890c7fa27c9e354089bbe13', /y/ -3 : h'f95e1d4b851a2cc80fff87d8e23f22afb725d535e515d020731e79a3b4e47120' } } } ``` The COSE_Key MUST contain the required key members for a COSE_Key of that key type and MAY contain other COSE_Key members, including the "kid" (Key ID) member. The "COSE_Key" member MAY also be used for a COSE_Key representing a symmetric key, provided that the CWT is encrypted so that the key is not revealed to unintended parties. The means of encrypting a CWT is explained in [RFC8392]. If the CWT is not encrypted, the symmetric key MUST be encrypted as described in Section 3.3. 3.3. Representation of an Encrypted Symmetric Proof-of-Possession Key When the key held by the presenter is a symmetric key, the "Encrypted_COSE_Key" member is an encrypted COSE_Key [RFC8152] representing the symmetric key encrypted to a key known to the recipient using COSE_Encrypt or COSE_Encrypt0. The following example (using CBOR diagnostic notation, with linebreaks for readability) illustrates a symmetric key that could subsequently be encrypted for use in the "Encrypted_COSE_Key" member: ``` The COSE_Key representation is used as the plaintext when encrypting the key. The COSE_Key could, for instance, be encrypted using a COSE_Encrypt0 representation using the AES-CCM-16-64-128 algorithm. The following example CWT Claims Set of a CWT (using CBOR diagnostic notation, with linebreaks for readability) illustrates the use of an encrypted symmetric key as the "Encrypted_COSE_Key" member value: ``` { /iss/ 1 : "coaps://server.example.com", /sub/ 2 : "24400320", /aud/ 3 : "s6BhdRkqt3", /exp/ 4 : 1311281970, /iat/ 5 : 1311280970, /cnf/ 8 : { /COSE_Encrypt0/ 2 : [ /protected header/ / h'A1010A' /{ /alg/ 1:10 \AES-CCM-16-64-128\}/, /unprotected header/ / { / iv / 5 : h'636898994FF0EC7BF6D3F95B' }, /ciphertext/ h'0573318A3573EB983E55A7C2F06CAD0796C9E584F1D0E3EAB8C5B052592A8B2694BE9654F0431F38D5BBC8049FA7F13F' ] } } ``` The example above was generated with the key: ``` h'6162630405060708090a0b0c0d0e0f10' ``` ### 3.4. Representation of a Key ID for a Proof-of-Possession Key The proof-of-possession key can also be identified by the use of a Key ID instead of communicating the actual key, provided the recipient is able to obtain the identified key using the Key ID. In this case, the issuer of a CWT declares that the presenter possesses a particular key and that the recipient can cryptographically confirm proof of possession of the key by the presenter by including a "cnf" claim in the CWT whose value is a CBOR map with the CBOR map containing a "kid" member identifying the key. The following example (using CBOR diagnostic notation) demonstrates such a declaration in the CWT Claims Set of a CWT: ```json { /iss/ 1 : "coaps://server.example.com", /aud/ 3 : "coaps://client.example.org", /exp/ 4 : 1361398824, /cnf/ 8 : { /kid/ 2 : "h'dfd1aa976d8d4575a0fe34b96de2bfad" } } ``` The content of the "kid" value is application specific. For instance, some applications may choose to use a cryptographic hash of the public key value as the "kid" value. 3.5. Specifics Intentionally Not Specified Proof of possession is often demonstrated by having the presenter sign a value determined by the recipient using the key possessed by the presenter. This value is sometimes called a "nonce" or a "challenge". The means of communicating the nonce and the nature of its contents are intentionally not described in this specification, as different protocols will communicate this information in different ways. Likewise, the means of communicating the signed nonce is also not specified, as this is also protocol specific. Note that another means of proving possession of the key when it is a symmetric key is to encrypt the key to the recipient. The means of obtaining a key for the recipient is likewise protocol specific. 4. Security Considerations All of the security considerations that are discussed in [RFC8392] also apply here. In addition, proof of possession introduces its own unique security issues. Possessing a key is only valuable if it is kept secret. Appropriate means must be used to ensure that unintended parties do not learn private key or symmetric key values. Applications utilizing proof of possession SHOULD also utilize audience restriction, as described in Section 4.1.3 of [JWT], as it provides additional protections. Proof of possession can be used by recipients to reject messages from unauthorized senders. Audience restriction can be used by recipients to reject messages intended for different recipients. A recipient might not understand the "cnf" claim. Applications that require the proof-of-possession keys communicated with it to be understood and processed MUST ensure that the parts of this specification that they use are implemented. CBOR Web Tokens with proof-of-possession keys are used in context of an architecture, such as the ACE OAuth Framework [I-D.ietf-ace-oauth-authz], in which protocols are used by a presenter to request these tokens and to subsequently use them with recipients. To avoid replay attacks when the proof-of-possession tokens are sent to presenters, a security protocol, which uses mechanisms such as nonces or timestamps, has to be utilized. Note that a discussion of the architecture or specific protocols that CWT proof-of-possession tokens are used with is beyond the scope of this specification. As is the case with other information included in a CWT, it is necessary to apply data origin authentication and integrity protection (via a keyed message digest or a digital signature). Data origin authentication ensures that the recipient of the CWT learns about the entity that created the CWT since this will be important for any policy decisions. Integrity protection prevents an adversary from changing any elements conveyed within the CWT payload. Special care has to be applied when carrying symmetric keys inside the CWT since those not only require integrity protection but also confidentiality protection. As described in Section 6 (Key Identification) and Appendix D (Notes on Key Selection) of [JWS], it is important to make explicit trust decisions about the keys. Proof-of-possession signatures made with keys not meeting the application’s trust criteria MUST NOT be relied upon. 5. Privacy Considerations A proof-of-possession key can be used as a correlation handle if the same key is used with multiple parties. Thus, for privacy reasons, it is recommended that different proof-of-possession keys be used when interacting with different parties. 6. Operational Considerations The use of CWTs with proof-of-possession keys requires additional information to be shared between the involved parties in order to ensure correct processing. The recipient needs to be able to use credentials to verify the authenticity, integrity, and potentially the confidentiality of the CWT and its content. This requires the recipient to know information about the issuer. Likewise, there needs to be agreement between the issuer and the recipient about the claims being used (which is also true of CWTs in general). When an issuer creates a CWT containing a Key ID claim, it needs to make sure that it does not issue another CWT containing the same Key ID with a different content, or for a different subject, within the lifetime of the CWTs, unless intentionally desired. Failure to do so may allow one party to impersonate another party, with the potential to gain additional privileges. Likewise, if PoP keys are used for multiple different kinds of CWTs in an application and the PoP keys are identified by Key IDs, care must be taken to keep the keys for the different kinds of CWTs segregated so that an attacker cannot cause the wrong PoP key to be used by using a valid Key ID for the wrong kind of CWT. 7. IANA Considerations The following registration procedure is used for all the registries established by this specification. Values are registered on a Specification Required [RFC5226] basis after a three-week review period on the cwt-reg-review@ietf.org mailing list, on the advice of one or more Designated Experts. However, to allow for the allocation of values prior to publication, the Designated Experts may approve registration once they are satisfied that such a specification will be published. [[ Note to the RFC Editor: The name of the mailing list should be determined in consultation with the IESG and IANA. Suggested name: cwt-reg-review@ietf.org. ]] Registration requests sent to the mailing list for review should use an appropriate subject (e.g., "Request to Register CWT Confirmation Method: example"). Registration requests that are undetermined for a period longer than 21 days can be brought to the IESG’s attention (using the iesg@ietf.org mailing list) for resolution. Criteria that should be applied by the Designated Experts include determining whether the proposed registration duplicates existing functionality, determining whether it is likely to be of general applicability or whether it is useful only for a single application, and evaluating the security properties of the item being registered and whether the registration makes sense. It is suggested that multiple Designated Experts be appointed who are able to represent the perspectives of different applications using this specification in order to enable broadly informed review of registration decisions. In cases where a registration decision could be perceived as creating a conflict of interest for a particular Expert, that Expert should defer to the judgment of the other Experts. 7.1. CBOR Web Token Claims Registration This specification registers the "cnf" claim in the IANA "CBOR Web Token Claims" registry [IANA.CWT.Claims] established by [RFC8392]. 7.1.1. Registry Contents - Claim Name: "cnf" - Claim Description: Confirmation - JWT Claim Name: "cnf" - Claim Key: TBD (maybe 8) - Claim Value Type(s): map - Change Controller: IESG - Specification Document(s): Section 3.1 of [[ this document ]] 7.2.2. Initial Registry Contents - Confirmation Method Name: "COSE_Key" - Confirmation Method Description: COSE_Key Representing Public Key - JWT Confirmation Method Name: "jwk" - Confirmation Key: 1 - Confirmation Value Type(s): map - Change Controller: IESG - Specification Document(s): Section 3.2 of [[ this document ]] - Confirmation Method Name: "Encrypted_COSE_Key" - Confirmation Method Description: Encrypted COSE_Key - JWT Confirmation Method Name: "jwe" - Confirmation Key: 2 - Confirmation Value Type(s): array (with an optional COSE_Encrypt or COSE_Encrypt0 tag) - Change Controller: IESG - Specification Document(s): Section 3.3 of [[ this document ]] - Confirmation Method Name: "kid" - Confirmation Method Description: Key Identifier - JWT Confirmation Method Name: "kid" - Confirmation Key: 3 - Confirmation Value Type(s): binary string - Change Controller: IESG - Specification Document(s): Section 3.4 of [[ this document ]] 8. References 8.1. Normative References [IANA.CWT.Claims] IANA, "CBOR Web Token Claims", <http://www.iana.org/assignments/cwt>. IANA, "CBOR Web Token Claims", <http://www.iana.org/assignments/cwt>. 8.2. Informative References [I-D.ietf-ace-oauth-authz] [IANA.JWT.Claims] IANA, "JSON Web Token Claims", <http://www.iana.org/assignments/jwt>. [JWS] Jones, M., Bradley, J., and N. Sakimura, "JSON Web Signature (JWS)", RFC 7515, May 2015, [JWT] Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token (JWT)", RFC 7519, DOI 10.17487/RFC7519, May 2015, Acknowledgements Thanks to the following people for their reviews of the specification: Roman Danyliw, Michael Richardson, and Jim Schaad. Ludwig Seitz and Goeran Selander worked on this document as part of the CelticPlus project CyberWI, with funding from Vinnova. Document History -03 - Addressed review comments by Jim Schaad, see https://www.ietf.org/mail-archive/web/ace/current/msg02798.html - Removed unnecessary sentence in the introduction regarding the use any strings that could be case-sensitive. - Clarified the terms Presenter and Recipient. - Clarified text about the confirmation claim. -02 - Changed "typically" to "often" when describing ways of performing proof of possession. - Changed b64 to hex encoding in an example. - Changed to using the RFC 8174 boilerplate instead of the RFC 2119 boilerplate. - Now uses CBOR diagnostic notation for the examples. - Added a table summarizing the "cnf" names, keys, and value types. - Addressed some of Jim Schaad’s feedback on -00. - Created the initial working group draft from draft-jones-ace-cwt-proof-of-possession-01. Authors’ Addresses Michael B. Jones Microsoft Email: mbj@microsoft.com URI: http://self-issued.info/ Ludwig Seitz RISE SICS Scheellevaegen 17 Lund 223 70 Sweden Email: ludwig@ri.se Goeran Selander Ericsson AB Faeroegatan 6 Kista 164 80 Sweden Email: goran.selander@ericsson.com Samuel Erdtman Spotify Email: erdtman@spotify.com Hannes Tschofenig ARM Ltd. Hall in Tirol 6060 Austria Email: Hannes.Tschofenig@arm.com
{"Source-Url": "https://tools.ietf.org/pdf/draft-ietf-ace-cwt-proof-of-possession-03.pdf", "len_cl100k_base": 4839, "olmocr-version": "0.1.50", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 29902, "total-output-tokens": 5793, "length": "2e12", "weborganizer": {"__label__adult": 0.0004067420959472656, "__label__art_design": 0.0004193782806396485, "__label__crime_law": 0.00263214111328125, "__label__education_jobs": 0.0006122589111328125, "__label__entertainment": 0.00011205673217773438, "__label__fashion_beauty": 0.0002200603485107422, "__label__finance_business": 0.0020847320556640625, "__label__food_dining": 0.0003948211669921875, "__label__games": 0.0006861686706542969, "__label__hardware": 0.00250244140625, "__label__health": 0.0006709098815917969, "__label__history": 0.00033092498779296875, "__label__home_hobbies": 0.00011789798736572266, "__label__industrial": 0.000751495361328125, "__label__literature": 0.0004355907440185547, "__label__politics": 0.0006012916564941406, "__label__religion": 0.0005741119384765625, "__label__science_tech": 0.1488037109375, "__label__social_life": 0.00011539459228515624, "__label__software": 0.06866455078125, "__label__software_dev": 0.767578125, "__label__sports_fitness": 0.0002856254577636719, "__label__transportation": 0.0005936622619628906, "__label__travel": 0.0002033710479736328}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 20213, 0.05292]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 20213, 0.29119]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 20213, 0.86246]], "google_gemma-3-12b-it_contains_pii": [[0, 1350, false], [1350, 1832, null], [1832, 3934, null], [3934, 6082, null], [6082, 7847, null], [7847, 9394, null], [9394, 11365, null], [11365, 13791, null], [13791, 16327, null], [16327, 16823, null], [16823, 18008, null], [18008, 18693, null], [18693, 19441, null], [19441, 20126, null], [20126, 20213, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1350, true], [1350, 1832, null], [1832, 3934, null], [3934, 6082, null], [6082, 7847, null], [7847, 9394, null], [9394, 11365, null], [11365, 13791, null], [13791, 16327, null], [16327, 16823, null], [16823, 18008, null], [18008, 18693, null], [18693, 19441, null], [19441, 20126, null], [20126, 20213, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 20213, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 20213, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 20213, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 20213, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 20213, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 20213, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 20213, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 20213, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 20213, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 20213, null]], "pdf_page_numbers": [[0, 1350, 1], [1350, 1832, 2], [1832, 3934, 3], [3934, 6082, 4], [6082, 7847, 5], [7847, 9394, 6], [9394, 11365, 7], [11365, 13791, 8], [13791, 16327, 9], [16327, 16823, 10], [16823, 18008, 11], [18008, 18693, 12], [18693, 19441, 13], [19441, 20126, 14], [20126, 20213, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 20213, 0.02326]]}
olmocr_science_pdfs
2024-11-29
2024-11-29
03bc3eae2d7ebddb1092346341426d94fb32931c
ICE: A TESSERAL P2P SUBSTRATE TECHNICAL REPORT 617 DANIEL CUTTING AND BJÖRN LANDFELDT SCHOOL OF INFORMATION TECHNOLOGIES THE UNIVERSITY OF SYDNEY AARON QUIGLEY SCHOOL OF COMPUTER SCIENCE & INFORMATICS UNIVERSITY COLLEGE DUBLIN AUGUST, 2007 ICE: a tesseral P2P substrate Daniel Cutting, Björn Landfeldt School of Information Technologies University of Sydney, Australia {dcutting,bjornl}@it.usyd.edu.au Aaron Quigley School of Computer Science and Informatics University College Dublin, Ireland aquigley@ucd.ie Abstract This technical report describes a novel peer-to-peer (P2P) substrate called ICE. It offers two features upon which a variety of P2P applications can be founded: hierarchical tesseral addressing of a logical surface divided between peers; and efficient amortised routing for delivering messages to multiple regions of the surface. This paper details the ICE philosophy and algorithms used, and presents results of experiments exploring its routing ability. ICE was originally developed as the basis of SPICE, an implicit group messaging (IGM) implementation using a tag-based modelling language. 1 The ICE philosophy This report introduces a novel substrate called ICE based around tesseral addressing and an efficient amortised multicast routing algorithm. ICE is a useful fundament for building P2P systems and has just two functions: to organise the peers into a structured overlay over the physical network; and to provide an efficient routing algorithm for delivering messages from source peers to multiple destination peers. Figure 1 illustrates the layered approach. Peers are organised on the $d$-dimensional surface of a $d$-torus. The entire surface is claimed by peers; there are no “holes”. Each peer “owns” an exclusive region of the surface and communicates directly only with peers that own bordering regions (maintained in a neighbourhood table). Messages are routed across the surface by passing them from neighbour to neighbour in the direction of the destination. Figure 2 shows the 2-dimensional surface of a 2-torus. The projected surface is considered to adjoin continuously on all edges. Peers become part of the surface by routing a join request to a chosen region on the surface from an arbitrary bootstrap peer. The peer that owns the chosen region handles the join request by halving its region, returning a join acknowledgement to the new peer, and informing its neighbours. The only state information stored by an ICE peer is its neighbour table. The number of neighbours a peer has is dependent on the dimensionality of the surface. Because the surface is randomly partitioned between peers, each peer has approximately one bordering neighbour for each face of its region, or two neighbours for each axis of surface dimensionality. Thus, the storage complexity of ICE is related only to the dimensionality of the surface, i.e., $O(d)$. The number of peers does not affect the state stored by any individual peer. The ICE surface is superficially similar to CAN [6]. However, there is a crucial difference. Unlike CAN which uses a Cartesian coordinate space, ICE surfaces use hierarchical tesseral addressing. The distinction is motivated by the intended usage: CAN is designed to support point-to-point routing whereas ICE is inherently a multipoint routing substrate. 2 Tesseral addressing Hierarchical tesseral addressing is a compact and elegant addressing scheme that describes regions of space instead of Cartesian points. It is particularly useful for arbitrarily decomposing a space to different granularities and is used to decompose the ICE surface. The general idea is to efficiently decompose a plane by subdividing it into a regular tessellated pattern, so that each element can completely contain another such division. Squares and triangles have this property. Figure 2 illustrates a hierarchical tesseral address space based on squares; such a structure is often referred to as a quadtree. Hierarchical tesseral addressing has been applied to many domains including geographic data storage and querying, computer graphics and robotics [7]. It has not been used to decompose the address space of a structured P2P network, although some systems have stored such structures over existing structured networks [9]. The properties of hierarchical tesseral addressing are crucial to the routing algorithm used in ICE to deliver messages to multiple peers (Section 3). ICE regions are addressed by strings of \( d \)-bit digits (of base \( 2^d \)). These regions are termed extents, and each digit represents a progressive index into the hierarchically addressed surface. Extents may be large and coarse-grained or extremely small and fine-grained. The depth of an extent is the number of digits in its address. Deeper extents are necessarily smaller than shallow extents. The solitary extent of zero length is the universal extent (denoted \( U \)) and represents the entire surface. Figure 2 illustrates the addressing scheme, ordered left-to-right and top-to-bottom. For example, the address 0 specifies the top-left quadrant of a 2-dimensional surface, and address 3032 specifies a small extent towards the bottom-right corner. This mapping approach can be applied to surfaces of arbitrary dimensionality without loss of generality. A set of extents is called a tract. Tracts can represent arbitrary regions of the surface by composing several extents, both contiguous and disparate. For example, the tract \( \{0, 2\} \) is the entire left half of a 2-dimensional surface. Every instance of a tract has a definite representation (i.e., a specific set of extents), although there are infinitely many such sets which can define the same tract. Tracts can be subtracted from one another but unlike ordinary set difference, the result is a new tract that describes the remaining region of the surface. For example, on a 2-dimensional surface, \( \{0, 2\} - \{20\} = \{0, 21, 22, 23\} \). Hierarchical tesseral addressing has some important features that make it suitable for describing an overlay surface. Its hierarchical nature allows a deep address to naturally scale to increasingly large covering extents simply by omitting digits from its tail. Similarly, its self-similar properties means an address can easily be translated across the surface by replac- ing its head with digits from another extent. It is important to note that although this addressing scheme is hierarchical, there is no need for a global data structure to be maintained across peers. In particular there is no “root” peer. It simply affords compact descriptions of large and small regions of the surface, and is a convenient way for peers to store surface information and communicate with one another. For instance, the region of the surface that each peer owns is represented as a tract. Likewise, peers’ neighbourhood tables map extents adjacent to their tract to the peers that own them. The versatile hierarchical and self-similar properties of tesseral addressing are a core part of the multicast routing algorithm now described in Section 3. 3 Amortised routing Besides tesseral addressing, the other major component of ICE is an efficient amortised multicast routing algorithm. Payloads are routed from a source peer to a destination tract by passing messages from neighbour to neighbour. All peers that own tracts intersecting the destination tract receive a copy of the message. 3.1 Point-to-point routing ICE can emulate point-to-point routing by delivering to a very small destination tract that is covered by the tract of a single peer. Messages are routed geometrically across the surface between neighbouring peers. At each hop, peers forward the message to a neighbour that owns an extent nearer to the destination. Figure 3(a) shows an example of a message routed across a 2-dimensional surface. For the purposes of finding a neighbour closer to the destination, a distance metric between extents is required. This is achieved by mapping extents from their tesseral addresses to bounding hypercubes in a Cartesian space. To do this, the surface is assumed to be wholly contained within a unit hypercube, within which extents are converted to sub-hypercubes. The distance between two extents is defined as the length of the minimum interval connecting their bounding hypercubes. For example, the distance between extents 3032 and 23 on a 2-dimensional surface is 0.125 (see Figure 2). The message complexity of point-to-point routing depends on the dimensionality of the surface and the number of peers. An equally partitioned surface has \( n^{\frac{1}{2}} \) distinct peers arranged along each edge of the surface. The longest route a message can take is from a corner of the surface to its centre (due to the surface wrapping on all sides). The surface is “quantised” by the peers so the message takes a Manhattan (“city block”) path. Point-to-point routing over the ICE surface is thus \( O(dn^{\frac{1}{2}}) \) overlay hops. Figure 3(b) confirms this in simulation by routing messages between two random extents. As expected, higher dimensionality requires fewer hops to route between two parts of the surface. In practice, actual routing performance can be improved by considering the physical link latency between neighbours when selecting the next hop, in addition to the distance from the destination. The “best” hop is chosen to be the one with the greatest distance progress to link latency ratio which tends to favour low latency links, when all else is equal. Listing 1 shows this fragment of the ICE routing algorithm. The technique is one of the routing optimisations used in CAN [6], but other routing possibilities exist. For example, peers could attempt to minimise total load on neighbours over time, avoid known malicious peers, or monitor the reliability of neighbours in order to bias route selection. 3.2 Multipoint routing The ICE routing algorithm is not restricted to point-to-point routing; it delivers copies of a message to all peers with tracts intersecting a destination tract. The destination tract may be a small contiguous region of the surface but this is not a requirement. A tract can specify any region of the surface whether contiguous or not. There are times when it is useful for a message to be delivered to disparate parts of a surface. For instance, a resilient storage layer built atop ICE could use the routing algorithm to copy data to multiple regions of a surface. The algorithm is given a destination tract and a Routing across a 2D surface. (a) Routing across a 2D surface. (b) Point-to-point routing is \(O(dn^{\frac{1}{2}})\) overlay hops. Figure 3: ICE point-to-point routing. Table 1: Object structure for ICE algorithms. (a) An ICE Peer object. <table> <thead> <tr> <th>ICE Peer</th> <th>tract</th> <th>neighbourhood</th> <th>handled?</th> </tr> </thead> </table> (b) A Route object. | Route | destination_tract | branch_factor | payload | Listing 1 The “next hop” fragment of the ICE routing algorithm. ```python def next_hop(p, tract): current_dist = p.tract.distance_to(tract) hops = p.neighbourhood.distances_to(tract) progress = hops.map do |neighbour, next_dist| {'neighbour' => neighbour, 'progress' => (current_dist - next_dist) / p.neighbourhood.latency_to(neighbour)} end max_progress = progress.max { |x,y| x['progress'] <=> y['progress'] } max_progress['neighbour'] ``` 4 payload. A peer routes the message by forwarding it to the neighbouring extent that is closest to any part of the destination tract. At each hop, the peer handling the route delivers the payload to the application layer if its tract intersects the destination tract. Its tract is then subtracted from the destination, reducing the total region left to visit. The remaining tract is then recursively visited in the same way. When a tract is not contiguous, it is quicker to route separate copies of a message to each region instead of visiting each in turn. However, routing separate copies of a message from the source is inefficient if part of the route is the same for each copy. Because Ice is a structured overlay and the surface is a geometric construct, the routing algorithm clusters parts of the destination tract based on their direction away from the source in order to amortise the routing cost. If several lie in the same direction away from a source, it is sufficient for a single copy to be routed that way. This technique is recursively applied. Not only is the destination tract clustered from the initial source, it is clustered again at each hop. This results in messages taking a tree-like route from the source to all peers with tracts that intersect the destination tract. Initially the route has few branches but as the message approaches individual peers it branches as necessary to balance the total number of messages against direct individual routes. Figure 4 shows an example of amortised routing delivering a message to a highlighted destination tract (comprising two distinct regions). A divisive hierarchical clustering algorithm is applied to the remaining destination tract at each hop resulting in a set of clustered sub-tracts. Each of these clusters is then individually routed a copy of the message. Thus, the message branches when there is more than one cluster but continues in a point-to-point fashion otherwise. Divisive clustering transforms a single set of objects into a number of clustered sets. It works by first finding the maximum “distance” between two elements in a set and creating a cluster for each. Each remaining element is then assigned to the cluster to which it is closest. This continues until each element is in its own cluster, or the maximum distance between every element is below a threshold. For example, the following set of five numbers is clustered according to their difference, resulting in first level clusters of two and three elements, and so on until each is individually clustered. <table> <thead> <tr> <th>13568</th> </tr> </thead> <tbody> <tr> <td>13</td> </tr> <tr> <td>568</td> </tr> <tr> <td>1</td> </tr> <tr> <td>3</td> </tr> <tr> <td>56</td> </tr> <tr> <td>8</td> </tr> </tbody> </table> Recall that a tract is simply expressed as a set of extents; the clustering algorithm groups these extents according to the angular difference between their centres as measured from the point of view of the current peer’s tract. Those with an angular difference larger than a threshold are placed in separate clusters. This threshold is called the branch factor, expressed in radians and taking a value in the range $0–\pi$. Due to parallax, distant extents are more likely to be clustered together than nearby extents. A branch factor of 0 means messages are never amortised; every extent in a destination tract is considered its own cluster and individually approached using point-to-point routing. A value of $\pi$ means the entire destination tract is always treated as one cluster such that the message never branches but visits each extent in turn. The advantage of a high branch factor is that a minimal total number of messages are needed, which in turn reduces the incoming and outgoing load on peers and network links. The drawback is that messages take longer to reach their destinations on average, because more circuitous routes are taken. Listing 2 presents the complete ICE routing algorithm, building upon the “next hop” fragment implemented in Listing 1. Since ICE is designed as a general basis for P2P applications, it provides callback hooks that an application can use to modify the default multipoint routing behaviour. In particular, two callbacks may be implemented by an application: callback_deliver (Line 9 of Listing 2) and callback_branch (Line 20). These are called prior to the delivery of a payload to an application, and prior to forwarding a payload to a cluster of the destination tract. They may be used to alter the payloads that are delivered, or veto them altogether. The default implementations (Lines 32 and 38) behave as described above, delivering the same payload to every peer in a destination tract. The effect of surface dimensionality and branch factor on multipoint routing are investigated via simulation. 1000 messages are routed from random sources to random destination tracts intersecting \( \approx 500 \) peers of 1000 on an ICE surface. The total number of messages needed for each delivery and the average number of hops to each destination peer per message are measured. Figure 5(a) shows that the branch factor has a very significant effect on the total number of messages. By increasing amortisation of packets (with a higher branch factor), the number drops to approximately 1000 irrespective of surface dimensionality, just twice the minimum number of messages needed to directly contact each destination peer from the source. Increasing the surface dimensionality generally increases the total number of messages because there are intuitively more directions in higher dimensions and destinations are less likely to be clustered. However by increasing the branch factor beyond approximately \( \frac{\pi}{3} \) the total number of messages can be reduced even in these higher dimensions because the algorithm is more permissive in what constitutes a “similar” direction. Higher dimensionality also dramatically reduces the average number of hops to destinations (Figure 5(b)) because the number of hops between two parts of the surface is reduced (as shown previously in Figure 3(b)). A lower branch factor also delivers messages in fewer hops since they do not follow longer generalised routes to many destinations. A branch factor of less than \( \frac{\pi}{3} \) tends to produce the most direct routes to destinations. Based on these results, a surface dimensionality of 3 and branch factor of \( \frac{\pi}{3} \) offer the best compromise between low total messages and average hops to each destination. 4 Overlay mapping It is theoretically appealing to order or arrange peers randomly in the address space of a structured overlay, as uniform randomness simplifies design and permits assumptions of system behaviour and costs at the overlay level. However, such randomness does not consider physical network locality. Because neighbouring peers may be physically separated by intercontinental distances, such overlays may exhibit appalling performance. Therefore, it is beneficial for the overlay surface to map well to the physical underlying network, although this must be tempered by the desirable properties of random placement. Many systems offer functionality to aid creation of overlays that map well to physical networks. These are generally based upon measuring the latency of connections to other peers, or to a set of well-known “landmarks” around the network and include the ping-based Vivaldi [2], Madhyastha et al’s traceroute-based approach [4] and CAN’s landmark binning scheme [5]. Any of these approaches may be applied to the construction of the ICE overlay. **Listing 2** The ICE routing algorithm. ```python # Peer p routes 'route'. def handle_route(p, route): # Deliver the payload to this peer if it's in the destination tract. if route.destination_tract.intersects?(p.tract) and not p.handled?(route): # A callback allows an application to alter what payload is delivered to the peer, and what continues to be routed to the remainder of the destination tract. route.payload = callback_deliver(p, route) do |deliver,payload| p.deliver(p, deliver,payload) end end # Subtract this peer's tract from the destination tract. remaining_tract = route.destination_tract - p.tract unless remaining_tract.empty? # Cluster the remaining destination tract. clusters = p.tract.cluster(remaining_tract, route.branch_factor) # A callback allows an application to alter what payload is routed to each cluster. callback_branch(p,route,clusters) do |cluster_payload,cluster| route.dup = route.dup route.dup.tract = cluster route.dup.payload = cluster_payload hop = next_hop(p,cluster) p.send(hop,route.dup) end end p.handled(route) end # By default, don't alter the payload. def callback_deliver(p,route) # Yield to Ice to deliver the payload. return route.payload # Return the payload unaltered. end # By default, deliver the same payload to each cluster. def callback_branch(p,route,clusters) clusters.each { |cluster| yield route.payload,cluster } end ``` 5 Self-stabilisation The unreliable nature of peers in a P2P system guarantees that some peers will unexpectedly fail or leave the system over time. When designing a structured overlay such as the ICE surface, it is important to consider how it will cope with structural damage when it is encountered and how it will repair itself despite peer flux. ICE does not inherently support data storage — it is implemented by higher layers if needed — so the only impact of a failed peer is routing over the surface. To ensure messages are not interrupted by holes in the ICE surface (unclaimed tracts), the routing algorithms must be capable of routing around failed peers. Additionally, peers should detect and repair holes. This section sketches how the ICE surface can be made “self-stabilising”. Self-stabilisation [8] is the process of converging a system to a stable state from an arbitrary starting state. This can be expressed as a set of invariants and rules that move the system state towards satisfying these invariants. In ICE, a stable surface is defined by three invariants. Firstly, the entire surface must be claimed by peers. Secondly, the tracts claimed by peers must not intersect. Thirdly, every extent adjacent to a peer’s tract must be described by exactly one mapping in its neighbourhood table. ICE is suited to the correction-on-change and correction-on-use approach to self-stabilisation [3]. In this technique, problems are corrected as they are detected during normal routing operations, rather than through the use of periodic beacons. This greatly limits the amount of maintenance traffic required and is especially applicable to ICE because the failure of a peer affects only $O(d)$ neighbours. Correction-on-use dictates that each message routed across the surface includes maintenance information about intermediate source and destination peers. This allows peers to verify that their neighbourhood state agrees with the sender’s. Deterministic agreements can ensure that any conflicts arising (such as two peers claiming intersecting extents) are resolved. Furthermore, the very act of receiving a route from a peer indicates the sender’s existence and allows the recipient to ensure neighbourhood information is correct. When routing messages, peers will occasionally detect failed peers. In these cases the message must be alternately routed. A message may be greedily routed around the periphery of a hole on an ICE surface by probing the “next best” neighbour, or more general techniques from sensor networking or geocasting. may be applied, such as the FACE protocols [1]. In addition to routing around holes, the correction-on-change protocol repairs the hole by deterministically assigning it to a new peer. Detections of the hole by different peers routing messages result in a deterministic marshalling peer being informed. This peer can then claim the hole itself, or delegate it to a neighbour. Finally, update information can be delivered to neighbours so they can update their neighbourhood tables. If a marshalling peer has also failed, the technique may be recursively applied. It is clear from this sketch that implementing self-stabilising algorithms is not problematic, but note that a stabilised Ice surface does not negate the need for applications using Ice to employ their own data integrity algorithms. Ice’s only guarantee is to route messages to all peers within a destination tract. Any application-specific stabilisation must build on this. 6 Conclusion This report has described the Ice surface, a novel structured overlay network design based on hierarchical tesseral addressing and an efficient amortised multicast routing algorithm. Ice is a very lightweight basis for building more complex P2P systems. Its only functionality is to maintain a logical surface of peers, and allow routing of messages to arbitrary regions of this surface. Acknowledgements The authors would like to acknowledge the support of the Smart Internet Technology CRC. References
{"Source-Url": "http://sydney.edu.au/engineering/it/research/tr/tr617.pdf", "len_cl100k_base": 5051, "olmocr-version": "0.1.50", "pdf-total-pages": 11, "total-fallback-pages": 0, "total-input-tokens": 29228, "total-output-tokens": 6128, "length": "2e12", "weborganizer": {"__label__adult": 0.00031948089599609375, "__label__art_design": 0.0002884864807128906, "__label__crime_law": 0.0004482269287109375, "__label__education_jobs": 0.0008153915405273438, "__label__entertainment": 0.00017631053924560547, "__label__fashion_beauty": 0.00015175342559814453, "__label__finance_business": 0.0004131793975830078, "__label__food_dining": 0.00041556358337402344, "__label__games": 0.0008287429809570312, "__label__hardware": 0.00319671630859375, "__label__health": 0.0006480216979980469, "__label__history": 0.0004267692565917969, "__label__home_hobbies": 0.0001176595687866211, "__label__industrial": 0.0005879402160644531, "__label__literature": 0.00041961669921875, "__label__politics": 0.00037550926208496094, "__label__religion": 0.0004825592041015625, "__label__science_tech": 0.442138671875, "__label__social_life": 0.00019979476928710935, "__label__software": 0.053009033203125, "__label__software_dev": 0.4931640625, "__label__sports_fitness": 0.000331878662109375, "__label__transportation": 0.0006475448608398438, "__label__travel": 0.0002505779266357422}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 26529, 0.03088]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 26529, 0.8515]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 26529, 0.91681]], "google_gemma-3-12b-it_contains_pii": [[0, 243, false], [243, 3456, null], [3456, 6339, null], [6339, 10544, null], [10544, 11456, null], [11456, 14827, null], [14827, 18954, null], [18954, 20532, null], [20532, 23094, null], [23094, 26529, null], [26529, 26529, null]], "google_gemma-3-12b-it_is_public_document": [[0, 243, true], [243, 3456, null], [3456, 6339, null], [6339, 10544, null], [10544, 11456, null], [11456, 14827, null], [14827, 18954, null], [18954, 20532, null], [20532, 23094, null], [23094, 26529, null], [26529, 26529, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 26529, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 26529, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 26529, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 26529, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 26529, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 26529, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 26529, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 26529, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 26529, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 26529, null]], "pdf_page_numbers": [[0, 243, 1], [243, 3456, 2], [3456, 6339, 3], [6339, 10544, 4], [10544, 11456, 5], [11456, 14827, 6], [14827, 18954, 7], [18954, 20532, 8], [20532, 23094, 9], [23094, 26529, 10], [26529, 26529, 11]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 26529, 0.0719]]}
olmocr_science_pdfs
2024-11-30
2024-11-30
7fa40099ea4e6ba03984867e7fee0336c4d39e9e
Enhancing the Updatability of Projective Views Citation for published version: Link: Link to publication record in Edinburgh Research Explorer Document Version: Peer reviewed version Published In: Enhancing the Updatability of Projective Views (Extended Abstract) Paolo Guagliardo\textsuperscript{1}, Reinhard Pichler\textsuperscript{2}, and Emanuel Sallinger\textsuperscript{2} \textsuperscript{1} KRDB Research Centre, Free University of Bozen-Bolzano \textsuperscript{2} Vienna University of Technology 1 Introduction Updating a database by means of a set of views is a classical problem in database research, known as the \textit{view update problem}. It consists in “pushing back” the changes introduced into view relations by an update to the underlying database relations over which the view relations are defined. In very recent years, the view update problem has received renewed interest and attention \cite{Christmann1995,Christmann1996,Guagliardo2000,Guagliardo2001}. View updates can be consistently and univocally propagated under the condition that the mapping between database and view relations is \textit{lossless}, that is, the views provide the same amount of information as the database itself. Clearly, this is quite a strong requirement, as in common practical scenarios user views are created with the aim of allowing access only to specific portions of the database and thus, being lossy by design, such views are not directly updatable. The solution to this problem consists in using additional information, transferred by a so-called \textit{view complement}, that is missing from the original view but needed to propagate the updates. However, under what is known as the \textit{constant complement principle} \cite{Guagliardo2001}, this complementary information must be invariant during the update process, that is, it must not be modified – directly or indirectly – by the view update. Therefore, the amount of information transferred by the view complement should be kept as small as possible. To the best of our knowledge, in the relational setting, the only case studied in the literature is the one where the initial view consists of a single projection and the complement to be constructed is also restricted to a single projection \cite{Gehrke2000}. A natural extension of the above, not investigated so far, is the case in which we are given a view as a \textit{set of projections} and we want to construct a complement that consists of a set of projections too. The goal of our work is to initiate the generalization of the study of view complements in this direction. Contribution and Outline. To properly choose a “good” view complement, we need a measure of how much information a complement provides w.r.t. another, together with an appropriate notion of \textit{minimality}. In \cite{Gehrke2000}, where views and complements consist of a single projection, a minimal complement is one with the least number of attributes. Clearly, this notion of minimality is no longer \footnotesize{The research of R. Pichler and E. Sallinger is supported by the Austrian Science Fund (FWF):P25207-N23.} suitable when dealing with sets of projections. In Section 3, we thus start with the function-based order introduced in [3], and we observe that it coincides with the recently introduced information transfer order [2] on functional mappings. We show that, in general, there always exists a unique (up to information transfer equivalence) complement for any given view. However, this complement may not be expressible in a concrete view definition language, as is the case when views are defined by (even single) projections. In Section 4, we restrict our attention to a setting where functional dependencies (FDs) are given on the source data and views are defined as sets of projections. We study in depth the information transferred by such views. For views defined by a single projection, the information transfer order between two views is easily reduced to the subset-relation between the sets of attributes of the two projections. To generalize this result to sets of projections, we present an algorithm that, in general, allows us to augment the set of attributes of the involved projections by taking the interaction between them into account. Finally, in Section 5, we investigate the complement of a set of projections. To this end, we show that it may be beneficial to split a complement consisting of a single projection, as in [6], into a set of smaller projections. We thus present an algorithm that refines a single-projection complement and yields a set of projections that, in general, transfers less (or the same, but never more) information than the initial complement. 2 Preliminaries A schema is a finite set of relation symbols. Let dom be an arbitrary (possibly infinite) set of domain values. An instance $I$ of a schema $S$ maps each relation symbol $S$ in $S$ to a relation $S'$ on dom of appropriate arity, called the extension of $S$ under $I$. The set of elements of dom that occur in an instance $I$ is called the active domain of $I$ and is denoted by adom($I$). All instances in this paper are finite, that is, have a finite active domain. A view from $R$ to $V$ is a function associating instances of a database schema $R$ with instances of a view schema $V$ disjoint with $R$. A view is specified in a query language $\mathcal{L}$ when each view symbol $V \in V$ is defined by an $\mathcal{L}$-query over $R$. For a set of integrity constraints $\Sigma$ on the database schema $R$, we denote by $R_\Sigma$ the set of instances of $R$ satisfying $\Sigma$, and we refer to such instances as legal. Then, a view under $\Sigma$ associates legal instances of $R$ with instances of $V$. In what follows, unless otherwise specified, views are assumed to be from the same database schema to distinct view schemas disjoint with each other, e.g., $f$ and $g$ are from $R$ to $V$ and from $R$ to $W$, respectively, with $V$ and $W$ disjoint with each other (and with $R$). The amount of information that a view transfers from the source database w.r.t. another view can be measured as follows: Definition 1 ([3]). Let $f$ and $g$ be views under $\Sigma$. Then, $f$ is less informative than $g$ (written $f \leq g$) if, for every $I, I' \in R_\Sigma$, $g(I) = g(I')$ implies $f(I) = f(I')$. 2 We refer to the preorder $\leq$ as the *information-transfer order*, and we denote by $\equiv$ the associated equivalence relation ($f \equiv g$ if and only if $f \leq g$ and $g \leq f$). Observe that $f \leq g$ if and only if there exists a function $h$ such that $f = h \circ g$, thus $\leq$ coincides with the order $\preceq_\ast$ of [2] for mappings that are functional. A view loses information when it associates distinct database instances with the same view instance. This loss of information can be recovered by a view that “complements” the original one by separating instances the latter does not. **Definition 2 (View complement [3]).** Let $f$ and $g$ be views under $\Sigma$. Then, $g$ is a complement of $f$ if, for every distinct $I, I' \in R_\Sigma$, $g(I) \neq g(I')$ whenever $f(I) = f(I')$. Moreover, $g$ is minimal if, for every complement $h$ of $f$, $g \leq h$ whenever $h \leq g$. Note that the above notion is symmetric, in that if $g$ is a complement of $f$, then $f$ is a complement of $g$. For this reason, sometimes we simply say that two views $f$ and $g$ are complementary. ### 3 Minimal Complements In this section we present some general results about the minimality of complements, without committing to any particular language for specifying views. First, we show that a minimal complement complements the original view only when needed, as formally stated below. **Proposition 1.** Let $f$ be a view under $\Sigma$, and let $g$ be a minimal complement of $f$. Then, for every distinct $I, I' \in R_\Sigma$, $g(I) \neq g(I')$ whenever $f(I) = f(I')$. This characterisation allows us to prove that there always exists a unique (up to information-transfer equivalence) minimal complement of any given view. **Theorem 1 (Unique minimal complement).** Let $f$ be a view, and let $g$ and $h$ be minimal complements of $f$. Then, $g \equiv h$. In general, the unique minimal complement might not be expressible in the concrete language used for specifying views. In this case, we are interested in complements which are minimal among those expressible within the language. For a class $\mathcal{C}$ of views specified in a language $\mathcal{L}$, minimal complements within $\mathcal{C}$ are referred to as $\mathcal{C}$-minimal. A unique $\mathcal{C}$-minimal complement might no longer exist, as we show below for projective views, that is, views specified by projections. **Proposition 2.** Let $\mathcal{C}$ be the class of projective views. There exist constraints $\Sigma$ and views $f$, $g$ and $h$ in $\mathcal{C}$ under $\Sigma$ such that $g$ and $h$ are $\mathcal{C}$-minimal complements of $f$ which are incomparable under $\leq$. **Proof.** Let $R$ be a relation symbol on attributes $A, B, C$, and let $\Sigma$ consist of the FDs $A \rightarrow C$ and $B \rightarrow C$. Let the view symbols $V_1$, $V_2$ and $V_3$ be defined by projections on $AB$, $BC$ and $AC$, respectively, and for $i \in \{1, 2, 3\}$ let $f_i$ be the corresponding views under $\Sigma$ from $R = \{R\}$ to $V_i = \{V_i\}$. Then, $f_2$ and $f_3$ are both complements of $f_1$ because $R$ is equivalent to the natural join of $V_1$ with $V_2$ and of $V_1$ with $V_3$, due to the FDs in $\Sigma$. The projection on $ABC$ is obviously not minimal since it includes the attributes of $V_2$ and $V_3$, and no other projection is a complement. Hence, $f_2$ and $f_3$ are minimal. Let $I = \{R(a, b, c)\}$, $I' = \{R(a', b, c)\}$ and $I'' = \{R(a, b', c)\}$. Since $f_2(I) = f_2(I')$ and $f_3(I) \neq f_3(I')$, we have that $f_3 \not\leq f_2$ and, as $f_3(I) = f_3(I'')$ and $f_2(I) \neq f_2(I'')$, we also have that $f_3 \not\leq f_2$. Therefore, $f_2$ and $f_3$ are incomparable under $\leq$. 4 Information Transferred by Projective Views In the rest of the paper, we consider a database schema consisting of only one relation symbol $R$ on a set $U$ of attributes, view symbols defined by projections on subsets of $U$ and database constraints $\Sigma$ given by FDs. W.l.o.g. we assume the FDs to be of the form $X \rightarrow A$, with $X \subseteq U$ and $A \in U$. We denote by $f_{X_1,\ldots,X_n}^\Sigma$ the view under $\Sigma$ specified by the $n$ projections on the sets of attributes $X_1,\ldots,X_n$. For ease of notation, we omit the superscript whenever there is no need to explicitly mention the set of FDs under consideration. First we observe that, when views are single projections, the order $\leq$ can be characterised in terms of inclusion between the sets of attributes in the projections. **Proposition 3.** $f_X \leq f_Y$ if and only if $X \subseteq Y$. To compare the information transferred by several views defined by sets of projections it suffices to consider a single projection on the left-hand side. **Proposition 4.** $f_{X_1,\ldots,X_n} \leq f_{Y_1,\ldots,Y_m}$ iff $f_{X_i} \leq f_{Y_1,\ldots,Y_m}$ for each $i \in \{1,\ldots,n\}$. Towards an effective criterion for checking $\leq$, let us examine $S = \bigcup_{i=1}^m \pi_{Y_i}(I)$ for some instance $I$. In particular, the join can be computed by (1) picking $m$ tuples $t_1,\ldots,t_m$ from $I$, (2) projecting them on the respective $Y_i$, i.e., $\pi_{Y_i}(t_1),\ldots,\pi_{Y_m}(t_n)$ and (3) checking the join conditions. Let $k = |\bigcup_{i=1}^m Y_i|$, then $$S = \{(s_1,\ldots,s_k) \mid \exists t_1,\ldots,t_m \in I \text{ s.t. } \forall Y_i, A_j : A_j \in Y_i \implies t_i[A_j] = s_j \}$$ The above characterisation of $S$ in terms of the equalities between a result tuple $(s_1,\ldots,s_k)$ and the attributes of the $t_i$’s motivates Algorithm 1, which has the following property. **Theorem 2.** Let $\{Y_1^*,\ldots,Y_m^*\} = \text{Saturate}(\{Y_1,\ldots,Y_m\}, \Sigma)$. If for every $i \in \{1,\ldots,n\}$ there is a $j \in \{1,\ldots,m\}$ s.t. $X_i \subseteq Y_j^*$, then $f_{X_1,\ldots,X_n}^{Y_1^*,\ldots,Y_m^*} \leq f_{X_1,\ldots,X_n}^{Y_1,\ldots,Y_m}$. As a corollary of the preceding theorem, it follows that Algorithm 1 preserves the information-transfer order. **Corollary 1.** Let $\{Y_1^*,\ldots,Y_m^*\} = \text{Saturate}(\{Y_1,\ldots,Y_m\}, \Sigma)$. Then it holds that $f_{Y_1^*,\ldots,Y_m^*} \leq f_{Y_1,\ldots,Y_m}$. 4 Algorithm 1 Saturation INPUT: Sets of attributes $Y_1, \ldots, Y_n$ and a set of FDs $\Sigma$. OUTPUT: Saturated sets of attributes $Y_1^*, \ldots, Y_n^*$. 1: procedure Saturate($\{Y_1, \ldots, Y_n\}, \Sigma$) 2: for all $i \in \{1, \ldots, n\}$ and $j \in \{1, \ldots, r\}$, where $r$ is the arity of $R$ do 3: if $A_j \in Y_i$ then 4: \hspace{1em} $t_i[A_j] = a_j$ \hspace{1em} // a constant 5: else 6: \hspace{1em} $t_i[A_j] = x_{i,j}$ \hspace{1em} // a fresh existential variable 7: end if 8: end for 9: Let $\{t_1^*, \ldots, t_n^*\} = \text{chase}(\{t_1, \ldots, t_n\}, \Sigma)$ 10: for all $i \in \{1, \ldots, n\}$ do 11: Let $Y_i^* = \{A_j \mid t_i[A_j] = a_j\}$ 12: end for 13: return $\{Y_1^*, \ldots, Y_n^*\}$ 14: end procedure Note that Theorem 2 corresponds to the soundness of Algorithm 1. Yet, we conjecture that the following holds: Conjecture 1. $f_X \leq f_{Y_1, \ldots, Y_m}$ if and only if, for every legal instance $I$ holds $$\pi_X(I) \supseteq \pi_X(\pi_{Y_1}(I) \bowtie \ldots \bowtie \pi_{Y_m}(I))$$ \hspace{1em} (1) This would amount to the completeness of Algorithm 1. We have a proof of Conjecture 1 for the special case $m = 2$, i.e., the right-hand side is given by two projections. The general form of Conjecture 1 as given above is an open question for future work. 5 Complements of Projective Views Checking whether a view $f_{X_1, \ldots, X_n}$ is lossless under a set $\Sigma$ of full dependencies (that is, EGDs and full TGDs) amounts to checking whether $\Sigma$ entails the join dependency $\bowtie [X_1, \ldots, X_n]$ (we use the notation of [1]). As this can be done in polynomial time [1], we get the following. Proposition 5. When view complements are restricted to a single projection, a minimal complement of a view $f_{X_1, \ldots, X_n}$ under full dependencies can be found in polynomial time. Proof. The algorithm is the same as for finding a minimal one-projection complement of a one-projection view [6]: Start with the trivial complement $f_U$ and, examining the attributes in some arbitrary order, repeatedly remove any one of them that can be removed without affecting complementarity. Algorithm 2 Refine complement INPUT: Sets of attributes $X_1, \ldots, X_n$ and $Y$, and a set of FDs $\Sigma$. OUTPUT: Refined sets of attributes $Y_1, \ldots, Y_m$. 1: procedure Refine($\{X_1, \ldots, X_n\}, Y, \Sigma$) 2: Set $Y$ to $\{Y\}$ 3: while There exist $Z \in Y$, $Z' \subset Z$ and $A \in Z \setminus Z'$ such that $\Sigma \models Z' \to A$ do 4: Remove $Z$ from $Y$ 5: if There is no $i \in \{1, \ldots, n\}$ such that $(Z' \cup \{A\}) \subseteq X_i$ then 6: Add $Z' \cup \{A\}$ to $Y$ 7: end if 8: if There is no $i \in \{1, \ldots, n\}$ such that $(Z\setminus\{A\}) \subseteq X_i$ then 9: Add $Z\setminus\{A\}$ to $Y$ 10: end if 11: end while 12: return $Y$ 13: end procedure The following example shows the benefit of splitting a complement into smaller pieces w.r.t. the propagation of updates. **Example 1.** Let $R$ be on $ABCDE$, let $\Sigma$ consist of the FDs $B \to C$ and $D \to E$, and consider the view $f_{ABD}$. It can be checked that $f_{BCDE}$ and $f_{BC,DE}$ are both complements of $f_{ABD}$. Let $I$ be the instance such that $R_I = \{(a,b,c,d,e), (a, b', c', d', e')\}$. The insertion of $(a, b, d')$ into $\pi_{ABD}(I)$ can be propagated back only by inserting $(a, b, c, d', e')$ into $I$, for which $\pi_{BC}(I)$ and $\pi_{DE}(I)$ remain unchanged, but $\pi_{BCDE}(I)$ is required to include $(b, c, d', e')$. Hence, under the constant complement principle, the insertion of $(a, b, d')$ into $\pi_{ABD}(I)$ is translatable \([7,3]\) w.r.t. $f_{BC,DE}$, whereas it is not w.r.t. $f_{BCDE}$. Algorithm 2 refines a view complement consisting of a single projection by computing one that consists of multiple projections and, although not minimal in general, transfers less (or the same) information. **Theorem 3.** Let $f_{X_1,\ldots,X_n}$ and $f_Y$ be complementary views and let $\{Y_1, \ldots, Y_m\}$ be the result of Refine($\{X_1, \ldots, X_n\}, Y, \Sigma$) according to Algorithm 2. Then, (1) $f_{Y_1,\ldots,Y_m}$ is a complement of $f_{X_1,\ldots,X_n}$; and (2) $f_{Y_1,\ldots,Y_m} \leq f_Y$. Intuitively, Algorithm 2 works as follows: first, the set $Y$ of attributes is recursively split into smaller sets according to the FDs in $\Sigma$; then, all the redundant sets, contained in one of the input sets $X_1, \ldots, X_n$, are discarded. The two steps are combined into a single one for efficiency reasons, in order to discard redundant sets at an earlier stage and so avoid unnecessary splittings. In the situation of Example 1, Refine($\{ABD\}, BCDE, \Sigma$) returns the sets of attributes $BC$ and $DE$ as expected. 6 Conclusion For views defined by a single projection, we have established an easy correspondence between the information transfer order and the subset-relationship between the sets of attributes onto which the projections are defined. For sets of projections, we have shown with our new Saturation algorithm in Section 4 how the sets of attributes may possibly be augmented without changing the information transfer. Theorem 2 can be seen as stating the soundness of the Saturation algorithm. We conjecture that the opposite direction in Theorem 2 also holds, which amounts to claiming the completeness of the Saturation algorithm. Proving this conjecture remains as an open problem for future work. Similarly, the Refine complement algorithm in Section 5 aims at transforming a complement given by one or several projections into another set of projections with smaller information transfer. Actually, one could easily further strengthen the algorithm by first applying the Saturation algorithm to the sets $X_1, \ldots, X_n$, which possibly increases these sets and thus may allow the deletion of more sets by the if-statements in the Refine complement algorithm. We conjecture that the resulting algorithm would then be guaranteed to return a view defined by a set of projections which is minimal w.r.t. information transfer. Again, the proof of this claim remains as an open problem for future work. References
{"Source-Url": "http://www.research.ed.ac.uk/portal/files/19429007/Guagliardo_Pichler_ET_AL_2013_Enhancing_the_Updatability_of_Projective_Views.pdf", "len_cl100k_base": 5323, "olmocr-version": "0.1.50", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 28561, "total-output-tokens": 6412, "length": "2e12", "weborganizer": {"__label__adult": 0.0004458427429199219, "__label__art_design": 0.0004661083221435547, "__label__crime_law": 0.0005903244018554688, "__label__education_jobs": 0.00135040283203125, "__label__entertainment": 8.565187454223633e-05, "__label__fashion_beauty": 0.00022399425506591797, "__label__finance_business": 0.0005445480346679688, "__label__food_dining": 0.0005521774291992188, "__label__games": 0.0005917549133300781, "__label__hardware": 0.0007100105285644531, "__label__health": 0.0014791488647460938, "__label__history": 0.0003902912139892578, "__label__home_hobbies": 0.00019538402557373047, "__label__industrial": 0.0006508827209472656, "__label__literature": 0.0005869865417480469, "__label__politics": 0.00029206275939941406, "__label__religion": 0.000568389892578125, "__label__science_tech": 0.122802734375, "__label__social_life": 0.00015485286712646484, "__label__software": 0.0172119140625, "__label__software_dev": 0.84912109375, "__label__sports_fitness": 0.00033092498779296875, "__label__transportation": 0.0006351470947265625, "__label__travel": 0.0002713203430175781}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 20266, 0.0542]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 20266, 0.35073]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 20266, 0.84563]], "google_gemma-3-12b-it_contains_pii": [[0, 579, false], [579, 3523, null], [3523, 6748, null], [6748, 9721, null], [9721, 12910, null], [12910, 15058, null], [15058, 17631, null], [17631, 20266, null]], "google_gemma-3-12b-it_is_public_document": [[0, 579, true], [579, 3523, null], [3523, 6748, null], [6748, 9721, null], [9721, 12910, null], [12910, 15058, null], [15058, 17631, null], [17631, 20266, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 20266, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 20266, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 20266, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 20266, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 20266, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 20266, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 20266, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 20266, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 20266, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 20266, null]], "pdf_page_numbers": [[0, 579, 1], [579, 3523, 2], [3523, 6748, 3], [6748, 9721, 4], [9721, 12910, 5], [12910, 15058, 6], [15058, 17631, 7], [17631, 20266, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 20266, 0.0]]}
olmocr_science_pdfs
2024-11-30
2024-11-30
c36a3f78dc7fdd2e707ef515f7950cea7e11b612
Semantic Interoperability of Heterogeneous Semantic Resources Catarina Ferreira Da Silva, Lionel Médini, Samer Abdul Ghafour, Patrick Hoffmann, Parisa Ghodous Lyon Research Center for Images and Intelligent Information Systems Claude Bernard Lyon 1 University, Villeurbanne, France Celson Lima Centre Scientifique et Technique du Btiment Dpartement TIDS – Technologies de l’Information et Diffusion du Savoir CSTB BP209, 06904 Sophia Antipolis, France Abstract This paper presents a three-step approach to enhance interoperability between heterogeneous semantic resources. Firstly, we construct homogeneous representations of these resources in a pivot format, namely OWL DL, with respect to the semantics expressed by the original representation languages. Secondly, mappings are established between concepts of these standardised resources and stored in a so-called articulation ontology. Thirdly, an approach for ranking those mappings is suggested in order to best fit users’ needs. This approach is currently being implemented in the Semantic Resources “Interoperabilisation” and Linking System (SRILS). The mapping results as well as the work to be done are discussed. Keywords: heterogeneous semantic resources, ontologies, interoperability, mapping, ranking, description logics, subsumption algorithms, OWL. 1 Introduction The growing use of the Web for collaborative and distributed work, associated to the standardisation of the languages and tools related to the Semantic Web, have led to the availability of multiple terminological and syntactical resources in numerous professional domains using the Internet. Different types of resources such as taxonomies, vocabularies, thesauri or ontologies, have been elaborated according to different existing standards. They treat different topics and approach them from different viewpoints, techniques and objectives. The existence, availability and complementariness of these resources on the Web initiated new usages which could benefit from their simultaneous use, for as various applications as electronic commerce, information retrieval or collaborative design. The simultaneous use of those resources requires them to be interoperable. Interoperability – i.e. “the ability to exchange information and use the information which has been exchanged”\(^2\) – can be treated at several levels such as technical and semantic. Basically, achieving technical interoperability is a matter of enabling distributed applications to work, taking into account syntactical and structural heterogeneity issues between different resources. However, this can cause serious “misinterpretations” of data and lead to misunderstandings between users, calculation errors, or even system failure, depending on the regarded application. At an upper level, semantic interoperability consists in preventing these problems from happening, while taking into account the semantics associated to the data, and ensuring exchanged information share the same meaning. To achieve both syntactical and semantic interoperability, we herein suggest an “interoperabilisation” approach for heterogeneous semantic resources (SR), based on three steps. Firstly, we make the SR representation formats homogeneous, considering the expressiveness of the source and target languages to preserve the meanings of the resources for the further steps. Secondly we align those resources by mapping SR entities. Thirdly, to rank by relevance the mappings obtained in the previous stage, we suggest a personalized and contextualized measure of these mappings. This paper first presents a state of the art of different existing interoperability approaches between heterogeneous SR. Then, our approach is presented and its different stages are detailed. The architecture and implementation of the SRILS system, which partially implements this approach, are described. An application example taken from the construction field is presented. Finally, the mapping results, as well as the work to be done are discussed. 2 Existing interoperability approaches between semantic resources Heterogeneity of SR can be considered at different levels, such as representation format level (syntax), data organization level (structure) and different points of view level (semantics). Some authors have treated these levels separately, even if they are not easy to split. Chaudri et al [9] search solutions for resolving the semantic ambiguity at syntax level. Mitra et al [22] describe several types of structural semantics ambiguity. Bowers et al [6] show that using different syntax or structure formalisations is the source of different errors when transforming a representation into another. In the rest of this section, we summarise background work regarding standardisation of representation formats and alignment of SR. 2.1 Standardisation of representation formats In order to make heterogeneous SR interoperable, Kalfoglou et al [17] consider standardisation by translation of resources in a common representation language is often a necessary preliminary stage. The choice of the target language is essential because it should be expressive enough in order to represent explicit and precise knowledge. On the other hand, it is important to compromise between expressiveness and complexity. Jannink et al [16] propose an algebra based on mapping rules in order to achieve that normalization. The OntoMorph system [8] enables to specify syntactic transformations using syntax rewriting mechanisms, rules based on pattern matching and models describing how to apply those syntactic rules. Normalisation treats the syntactic heterogeneity without loosing the expressiveness of the representation languages. Databases and SR are both knowledge representations. However, databases use fewer modelling primitives. Databases researchers face the problem of finding correspondences between different schemas, just as with SR. In relational databases a large number of embedded SR were developed since the 80’s. The logic model of databases allows to organise vast data and formally express relationships among data. The semantics of these resources are implied from the tables structure and integrity constraints. However, a semantically well-defined format representing all integrity constraints in the context of an automatic transformation does not exist. Consequently, a conversion from a database to an OWL ontology is still an ad hoc transformation, dependent of each database schema [4]. Calvanese et al [7] suggested an approach to transform a database into a set of description logics (DL) axioms. This work is a preliminary stage for developing a generic method to convert a relational 2.2 Alignment of semantic resources An alignment can be defined [5] as a set of mappings expressing a correspondence between two entities of different ontologies. Schema matching [25] as well as SR alignment require finding related entities, (i.e. concepts and properties), in two or more knowledge structures [23]. For this, several methods have been used, among which terminological, structural, extensional (i.e. based on instances) or semantic methods. Those methods come from different disciplines such as data analysis, machine learning, language engineering, statistics or knowledge engineering. Their applicability both depends on the type of SR features (e.g. labels, structures, instances, semantics) to be compared and on the expected types of results. Techniques to find inter-ontology relations lean most frequently on instances and schema matching, concept matching and matching of structural elements of the source ontologies [13]. Kalfoglou and Schorlemmer [17] survey a set of frameworks, methods and tools related to ontology mapping, such as the ones shown in the next paragraphs. In the machine-learning discipline, GLUE [11] searches mappings over instances of classes. Given two ontologies, for each concept in one ontology, GLUE finds the most similar concept in the other ontology using probabilistic definitions of several practical similarity measures. It exploits information about the concept instances – such as the words frequency in the text value of instances, the instance names, the value formats, or the characteristics of value distributions – and the taxonomic structure of the ontologies. Nevertheless, machine-learning techniques work better when large sets of instances are available. The OBSERVER [21] system helps users define mappings between concepts of two ontologies by finding pairs of related concepts. It uses the data structures underlying the domain-specific ontologies and the synonymy, hyponymy and hyperonymy relations to detect linguistic matches between concepts. Once the mappings are defined, users ask DL-formatted queries about terms of one of the ontologies, and the system expands the query to the terms of the other ontology. For this, users have to be familiar with DL constructors. Euzenat [12] proposes an alignment API that supplies OWL-compliant functions for helping programmers automatically map ontologies. This API currently uses term-matching techniques that cannot guarantee valid alignments. For instance, matched terms can be homonyms (and have different meanings) or be semantically close without being complete synonyms. A correspondence is constituted of a relation and a trust assessment. 2.3 Semantic methods for ontologies alignment Notwithstanding these efforts, we think that these approaches could benefit from techniques that take into account the semantics associated to concepts definitions. DL-based techniques [2] are appropriate for that, since they rely on the explicit and formal semantics represented by ontologies. When used for comparing ontologies, they ensure the original semantics of the SR entities is preserved and provide an explicit and formal interpretations of both entities being compared and the produced relations. We present in this section a basic DL algorithm and a tool currently used in these methods. More details about the method we used in this work are provided in section 3.2. Standard DL techniques apply subsumption algorithms to establish relationships between concepts. The tableau algorithms are a class of subsumption algorithms that firstly expand each ontology: each occurrence of a name of concept on the right side of a definition is replaced by the concept it stands for. This recursive process of dependency-eliminating substitutions (known as unfolding) is done until no cycle in the set of definitions exist. Thus an unfoldable ontology implies that all axioms are unique and acyclic definitions. Even if the expanded ontology size can increase exponentially compared to its original size, the unfolding process enables to reduce the reasoning process to the computation of subsumption and satisfiability.4 A tableau is a graph which represents a model, with nodes corresponding to individuals (elements of the domain of interpretation $\Delta^T$). Tableau algorithms try to prove the satisfiability of a concept $D$ by constructing an interpretation model $\mathcal{I}$ in which $D^\mathcal{I}$ is not empty (i.e. constructing a tableau starting with a single individual and then inferring the existence of additional individuals or additional constraints on individuals). This kind of reasoning uses a refutation-style proof [15]: $C$ is subsumed by $D$ if it can be shown that the existence of an individual $x$ that is an instance of $C$ ($x \in C^\mathcal{I}$) but is not an instance of $D$ ($x \notin D^\mathcal{I}$) is logically inconsistent. This corresponds to testing the logical (un)satisfiability of the concept $C \sqcap \neg D$ (i.e. $C \subseteq D \iff C \sqcap \neg D$ is not satisfiable). The inference mechanism consists in applying a set of consistency-preserving transformation rules for $\mathcal{ALC}$, known as $\sqcap$-rule, $\sqcup$-rule, $\exists$-rule and $\forall$-rule until no more rules apply; see [15] for details. The algorithm terminates when the graph is complete (no further inference is possible) or when contradictions have been revealed. A concept is unsatisfiable if the graph obtained this way contains a contradiction (called a “clash”) and satisfiable (the graph is consistent) otherwise. 4 A concept $C$ is satisfiable with respect to a Tbox, if it exists an interpretation model $D^\mathcal{I}$ of the Tbox such that $C^\mathcal{I}$ is nonempty The FaCT\textsuperscript{5} inference engine \cite{14} applies DL techniques and allows reasoning over concepts, roles and attributes descriptions, as well as managing concepts hierarchies based on the subsumption relation. FaCT uses a very expressive DL language $SHIQ = \{ALC + \text{number restriction} + \text{role hierarchy} + \text{inverse role} + \text{transitive role}\}$\textsuperscript{6} able to capture a large part of the semantics of knowledge models. This language is equipped with effective reasoning techniques that are sound and complete with respect to the semantics. The ONDIL system \cite{18} reuses the inference mechanisms of FaCT, and also supports the management of several Tboxes\textsuperscript{7}. ONDIL includes three modules, namely ontology management, mediator, and inference engine. The latter uses two kinds of subsumption algorithms: tableau-based algorithms for standard inferences and structural algorithms for non-standard inferences \cite{28}. The inference engine uses pairs of ontologies to deduce new knowledge that essentially consists in relations between ontological concepts. 3 Interoperabilisation approach This stage consists in converting SR to a common format and is prior to any other processing stage. The next stage is to identify correspondences enabling to align the SR. For this, we suggest a hybrid approach combining mapping and contextualisation of relations between entities (concepts and roles). 3.1 Conversion Standardisation of the representation formats enables to solve syntactical issues, as well as part of structural heterogeneities and issues that come from different expressiveness in the encoding languages. The purpose of this step is to standardise dissimilar formats of SR representations, while maintaining their semantics. We mainly deal with three types of SR: taxonomies, non-tree based graphs, and ontologies. The conversion procedure is based on an explicit distinction between different levels of knowledge representation, namely meta-model, model, and data. A meta-model specifies the structure of a knowledge representation language and clarifies its expressiveness. The model level rep- \footnote{\textsuperscript{5}Fast Classification of Terminologies (FaCT) has been developed to assess the feasibility of using optimal subsumption algorithms based on tableau technique \cite{2}.} \footnote{\textsuperscript{6}AL description logic language, (AL stands for Attribute Language), has been introduced by Schmidt-Schaub et al \cite{28}. The other languages of this family are extensions of AL. The ALC language allows to express the negation of concepts \cite{2}.} \footnote{\textsuperscript{7}A Tbox or Terminology is a finite set of definitions, if for every atomic concept $C$ there is at most one axiom in the Tbox whose left side of the definition is $C$.} resents the data structure for each application. This level contains classes, attributes attached to classes, and possible relations between various classes. The instance level gathers the data. In order not to develop specific tools for each of the different representation formats as well as to express the mapping rules in an appropriate one, we chose to use a common representation language, sufficiently expressive to represent all types of given SR. We chose OWL, and more precisely its sub-language based on Description Logics, OWL DL, for two main reasons. Firstly, it is part of the W3C recommendations related to the Semantic Web. It takes advantages of previous work on XML syntax, RDF and RDF Schema (RDFS) formal semantics. Secondly, OWL DL allows maximum expressiveness while retaining computational completeness (all conclusions are guaranteed to be computable) and decidability (all computations will end in finite time) [10]. An OWL (Lite or DL) ontology corresponds to a DL Tbox together with a role hierarchy, describing the domain in terms of classes – corresponding to concepts – and properties – corresponding to roles [3]. The conversion process aims at converting different SR into OWL while maintaining their intrinsic semantics. It consists in (1) elaborating a meta-model representing the constructions and expressiveness of the pivot language OWL; (2) designing meta-models of the available SR representation languages, defined as restrictions of the OWL DL meta-model; (3) converting the SR contents into OWL DL. The latter step is described in the following paragraphs for the three general SR categories considered herein. Taxonomies (XML): (1) Concepts of a taxonomy are considered as OWL classes (syntax: owl:Class). (2) The attributes attached to these concepts are treated as properties in the OWL ontology (owl:Property). The values of the attributes can either be literals (represented with rdfs:Literal) or resources (represented as OWL classes). The latter is tied to the previously defined property by another particular property (rdfs:range). (3) The subsumption relationship between concepts is represented in OWL using the rdfs:subClassOf constructor. Non-tree based graphs (RDF): Graphs represent knowledge by linking concepts with complex relations. RDF is a graph-based language based on statements (Subject, Predicate, Object). The conversion of a graph into OWL is achieved as follows: (1) the subject is represented in OWL by defining it as a class. (2) An object can either be represented as a class or a literal element. --- 8 Ontology Web Language: http://www.w3.org/2004/OWL/ 9 The OWL meta-model is represented in two UML classes schemas: a view of the classes and one of the properties. It is presented in [1] 10 Schemas of these meta-models are as well available in [1] depending on its type. (3) A predicate is represented as an object property (\texttt{owl:ObjectProperty}) if the related object is a resource, or as data type property (\texttt{owl:DatatypeProperty}) when its related object is a literal. \texttt{rdfs:domain} and \texttt{rdfs:range} are used to specify a property. The former specifies the subject, and the latter defines the object of the statement. \textbf{Ontologies (RDFS and DAML + OIL):} Ontologies extend graph based formalisms by providing high level constructions that make the semantics of the graphs explicit (for instance, \texttt{owl:disjointWith} specifies two disjoint classes). As OWL is an extension of RDFS, it inherits characteristics from RDFS, and any document which is valid according to an RDFS schema is also valid as an OWL Full ontology. However, it could not be seen as an OWL DL document. Consequently, converting an RDFS document to OWL DL requires to distinguish the differences between OWL Full and OWL DL [24]. As OWL, DAML+OIL is an ontology language built on RDF and RDFS and it is based on Description Logics, compared to the three sublanguages of OWL, DAML+OIL semantics is the closest to the OWL DL semantics. \subsection{Alignment} This section explains how we apply a semantic method based on DL techniques to discover mappings between concepts of the different homogeneous SR. For this, we use the ONDIL system that can process several ontologies at a time, as well as axioms\footnote{Axioms are previously defined relationships between entities of the two ontologies, that the inference engine can use during the satisfiability test step.} between their respective concepts. Firstly, in order to ensure that ontologies are consistent, they are separately unfolded. This is done by using the ONDIL standard inference services based on a tableau algorithm and on the \texttt{ALC} language. The mapping search process takes as inputs expanded concepts definitions. Let \(o\) and \(o'\) be a pair of ontologies and \(A(x)\) a set of axioms given as inputs. The ontology reasoning services of ONDIL use a tableau algorithm to identify subsumption relationships between concepts of \(o\) and \(o'\), as shown in the following generic example. Let \(C_1 := \forall r. A \land \exists r. B\) be a concept of \(o\), and \(C_2 := \exists r. B\) be a concept of \(o'\). We are now going to test if \(C_1 \sqsubseteq C_2 \iff C_1 \sqcap \neg C_2 \sqsubseteq \bot\). \[ C_1 \sqcap \neg C_2 \equiv \forall r. A \sqcap \exists r. B \sqcap \neg \exists r. B \] applying the De Morgan’s law \(\neg \exists r. B \iff (\forall r. \neg B)\) \[ C_1 \sqcap \neg C_2 \equiv \forall r. A \sqcap \exists r. B \sqcap \forall r. \neg B \] \[ C_1 \sqcap \neg C_2 \equiv \forall r. (A \sqcap \neg B) \sqcap \exists r. B \] ONDIL was modified to accept as inputs two ontologies and the set of axioms. These inputs constitute the knowledge processed by the inference engine module of ONDIL to construct the graph of the above definition. This is done by applying transformation rules as follows. Let the graph be a direct graph in which each node \( x \) is labelled with a set of concepts \( (\mathcal{L}(x) = \{C_1, \ldots, C_n\}) \) and each edge \( (x, y) \) is labelled with a role \( (\mathcal{L}(x, y) = r) \). When a concept \( C \) is in the label of a node \( x \) \( (C \in \mathcal{L}(x)) \), it represents a model in which the individual corresponding to \( x \) is in the interpretation of \( C \). When an edge \( (x, y) \) is labelled \( r \), it represents a model in which the tuple corresponding with \( (x, y) \) is in the interpretation of \( r \). From the \( \cap \)-rule we add to the graph the instances of the concepts \( A \) and \( B \) that compose the definition \( \forall r. (A \cap \neg B) \), i.e. \( A(x) \) and \( \neg B(x) \). From the \( \exists \)-rule we add the following instances to the graph: \( B(x), r(x, y) \). We do not need to further apply the rules because a clash is found: \( \{B(x), \neg B(x)\} \subseteq \mathcal{L}(x) \) results in a contradiction. Thus \( C_1 \cap \neg C_2 \subseteq \bot \) (this means that \( C_1 \cap \neg C_2 \) is not satisfiable) and \( C_1 \subseteq C_2 \). So a subsumption relation was detected between the concepts \( C_1 \) and \( C_2 \). Retrieved correspondences can be equivalences and non-equivalences. If it happens that \( C_1 \subseteq C_2 \) and \( C_2 \subseteq C_1 \), then both concept definitions are equivalent. Equivalences enable to state that the interpretation of two concepts from two different SR is 100% equal. We name non-equivalences “semantic proximities”. These refer to mappings in which only a part of the concepts of the SR is common. This is the case of subsumption and conjunction. Conjunction mappings are consequences of the subsumption ones. Therefore, from input ontologies \( o \) and \( o' \), the axioms \( C \subseteq C' \) and \( C \subseteq C_1 \) with \( C, C_1 \in o \) and \( C' \in o' \) allow to state: \( (C \cap C') \subseteq (C_1 \cap C') \). ### 3.3 Ranking Identified mappings are delivered to users through client applications. Users are specialised in specific activities, and their requests may concern only a limited field of knowledge and particular tasks: their different contexts of work involve different intentions and needs [27]. A measure that would consistently interpret the mappings according to the context of work should improve the reliability of mappings ranking relevance. Though this work is not yet implemented, we present it as it is part of our approach. In order to take context into account when comparing mappings, we need reliable information about the users’ works and environments as well as information about why SR have been developed, and what fields they cover. We intend to take advantage of a context modelling for representing domains, tasks, etc. It will serve as reference for situating all considered SR as well as users’ profiles. We define a fragment of a SR as a concept of this resource and all the concepts of this resource it subsumes. Each fragment is associated with zero, one or more domains, and is allotted as many “contextual vectors” (CV): these are sets of normalized weights depending on the relevance of the SR fragment content for the domain-specific criteria and tasks. Similarly, we associate to a user as many “user domain vectors” (UDV) as there are domains she/he is interested in. These vectors she/he instantiates once depending on the significance she/he assigns to each criterion, and on the importance of each task in her/his activity. Let a user submit a query on a concept $C$ to retrieve all the concepts semantically related. Each concept is included in a SR fragment and is being attached its CV. We compare the CV of $C$ with every other CV by applying a specific measure for each criterion or task that appears in both CV, and storing the result in a “fragment comparison vector” (FCV). Then we interpret these FCV according to the user’s domains: we ponder them by calculating all concepts “User Domain Interpretations” (UDI) constituted of the UDV-pondered FCV and of a computed relevance of the concept for the corresponding domain. Each concept UDI is then ranked depending on these valuations. Concepts are sorted depending on each relevant interpretation of $C$. Outputs are the sorted list of these relevant interpretations with the corresponding concept rankings, and the remaining concepts for which no accepted interpretation held. 4 The SRILS system The development of SRILS has been motivated by an industrial need expressed by the Centre Scientifique et Technique du Bâtiment (CSTB) located in Sophia-Antipolis (France). We have used three different SR from the building and construction (B&C) domain. bcXML is a multilingual taxonomy of concepts, products and services, developed in the eConstruct project [20]. This resource holds 3000 terms, in 6 different european languages. The Edibatec dictionary covers several B&C domains, such as electrical or ventilation equipments. The e-Cognos ontology [19], developed at CSTB, contains 17 000 concepts and relations and covers several parts of the B&C domain. CSTB has also developed an ontology server, named e-COSer [19], that processes queries regarding concepts and relations of different SR and supplies high-level services to different users. In the context of the SRILS system, 12 EDIBATEC dictionary, see http://www.edibatec.org/Accueil/Default4.htm 13 eCOSer – eCognos Ontology Server, http://195.83.41.67/eCOSer/Login.jsp we consider e-COSer as the client application. SRILS relies on four modules and several types of resources (see Fig. 1). The external interface of the system is provided by the queries processing module and targets the integration within a services-oriented architecture. The conversion module is in charge of give back heterogenous SR. The alignment module performs mapping search. The contextual ranking module, still in development, ranks the mappings by relevance. The modular architecture of SRILS enables to emulate non-developed modules in order to supply the expected services to the upper layer. The different kinds of SR used in SRILS are the ones containing data to be aligned (original and converted SR), an “articulation ontology”, where mappings are stored and the specific resources needed for the contextual ranking stage. Detailed descriptions of the different modules are not in the scope of this paper. The next section presents an example of mappings search in the B&C SR presented above. 5 Alignment tests using the mapping search module This section presents the first tests of the mapping search module, using the inference services of ONDIL (Sect. 3.2). The search is performed between two ontologies at a time. Retrieved correspondences can be equivalence relations or semantic proximities (mainly subsumption and conjunction, but also transitivity, which is implied by the subsumption relation). As inference is a time-consuming task that can take several minutes when we deal with large ontologies, mappings search is carried out a priori in order to optimise processing time. After mappings validation by domain experts, the mappings constitute the articulation ontology, which is queried by the queries handling module, and will not change, unless SR are modified and mappings search reprocessed. In order to first prove the correctness of the mapping method, we mapped each SR with itself. Obviously, mapping a SR with itself produces equivalences between the same concepts and only that kind of equivalences. In addition, results for subsumption and conjunction are also obtained, but giving only redundant information, since if $A$ is equivalent to $B$, $A \sqsubseteq B$ and $B \sqsubseteq A$. A typical usage scenario is the following: a user submits a product-centred query about a concept of the bcXML taxonomy, and wants to retrieve documents related to that product. The articulation ontology is queried by the system, since it stores retrieved and validated mappings between the bcBuildingDefinition taxonomy (where the products are really defined) and the e-Cognos ontology (where the concepts that represent the products and that are used to index the documents are defined). We present hereafter a fragment of the articulation ontology showing three examples of subsumption mappings retrieved by ONDIL between eCognos and bcXML SR. <owl:SRILS-ArticulationOntology rdf:about=""/> <rdfs:label> mappings between eCognos and bcXML</rdfs:label> <owl:imports rdf:resource="http://195.83.41.67/eCognos"/> <owl:imports rdf:resource="http://195.83.41.68:8080/bcBuildingDefinition"/> Subsumption mappings are more numerous than equivalences. It is worth noticing that subsumption mappings can depend on the ontology order of mapping calculation. This means that the subsumption mappings of \((O_1, O_2)\) may be different from the subsumption mappings of \((O_2, O_1)\). In other words, this difference comes from the asymmetry of the subsumption relationship between two concepts. More precisely, a subsumption mapping \(C_1 \sqsubseteq C_2\) (where \(C_1 \in O_1\) and \(C_2 \in O_2\)) belongs to the set of mapping of \((O_1, O_2)\) while the set of mapping of \((O_2, O_1)\) may not contain the subsumption mapping \(C_2 \sqsubseteq C_1\). However, equivalence mappings are preserved. 6 Conclusion This paper presents an approach to facilitate interoperability between heterogeneous SR, based on three heterogeneity levels: syntactic, structural and semantic. We apply different “interoperabilisation” approaches to tackle these heterogeneity levels. This approach is partially implemented in the SRILS middleware system: the two former levels are automatically processed. This system is likely to convert taxonomies, graphs and ontologies into OWL DL format, keeping the semantic and expressive power of the original encoding languages. Semantic “interoperabilisation” of SR is done by retrieving mappings between entities of the produced ontologies, using an inference engine and description Logics-based techniques. We briefly present an approach of contextualisation of the retrieved mappings in order to establish a ranking of the mappings relevant to the users. This last stage is being implemented. The use of SRILS is showed by an application in the building and construction domain. We also consider testing other methods for discovering semantic alignments, by using linguistic cor- pus to help find new mappings. Regarding measuring semantic proximity, we consider using fuzzy logic and probabilistic methods. Acknowledgement The authors wish to acknowledge that part of the work presented here is largely due to an intense teamwork, carried out in the eContent European FUNSIEC project, that is a Feasibility study for a UNified Semantic Infrastructure in the European Construction sector, see www.funsiec.org. Special thanks to Celson Lima and Chan Le Duc at CSTB. References
{"Source-Url": "http://www.researchgate.net/profile/Catarina_Ferreira8/publication/222569661_Semantic_Interoperability_of_Heterogeneous_Semantic_Resources/links/0912f5103b57e37bf5000000.pdf", "len_cl100k_base": 6901, "olmocr-version": "0.1.50", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 34672, "total-output-tokens": 9572, "length": "2e12", "weborganizer": {"__label__adult": 0.000339508056640625, "__label__art_design": 0.0008578300476074219, "__label__crime_law": 0.0007543563842773438, "__label__education_jobs": 0.0019178390502929688, "__label__entertainment": 0.00022482872009277344, "__label__fashion_beauty": 0.0002446174621582031, "__label__finance_business": 0.0009684562683105468, "__label__food_dining": 0.0004534721374511719, "__label__games": 0.0008273124694824219, "__label__hardware": 0.0008416175842285156, "__label__health": 0.0007524490356445312, "__label__history": 0.0005693435668945312, "__label__home_hobbies": 0.00017178058624267578, "__label__industrial": 0.0010547637939453125, "__label__literature": 0.0013332366943359375, "__label__politics": 0.0005383491516113281, "__label__religion": 0.0007882118225097656, "__label__science_tech": 0.453125, "__label__social_life": 0.00023174285888671875, "__label__software": 0.06146240234375, "__label__software_dev": 0.47119140625, "__label__sports_fitness": 0.00026607513427734375, "__label__transportation": 0.0007691383361816406, "__label__travel": 0.000274658203125}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 38065, 0.0282]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 38065, 0.68563]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 38065, 0.87106]], "google_gemma-3-12b-it_contains_pii": [[0, 1579, false], [1579, 4109, null], [4109, 6781, null], [6781, 9455, null], [9455, 12513, null], [12513, 15365, null], [15365, 18197, null], [18197, 20991, null], [20991, 24160, null], [24160, 26779, null], [26779, 29536, null], [29536, 29901, null], [29901, 31717, null], [31717, 34631, null], [34631, 38065, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1579, true], [1579, 4109, null], [4109, 6781, null], [6781, 9455, null], [9455, 12513, null], [12513, 15365, null], [15365, 18197, null], [18197, 20991, null], [20991, 24160, null], [24160, 26779, null], [26779, 29536, null], [29536, 29901, null], [29901, 31717, null], [31717, 34631, null], [34631, 38065, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 38065, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 38065, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 38065, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 38065, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 38065, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 38065, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 38065, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 38065, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 38065, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 38065, null]], "pdf_page_numbers": [[0, 1579, 1], [1579, 4109, 2], [4109, 6781, 3], [6781, 9455, 4], [9455, 12513, 5], [12513, 15365, 6], [15365, 18197, 7], [18197, 20991, 8], [20991, 24160, 9], [24160, 26779, 10], [26779, 29536, 11], [29536, 29901, 12], [29901, 31717, 13], [31717, 34631, 14], [34631, 38065, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 38065, 0.0]]}
olmocr_science_pdfs
2024-11-30
2024-11-30
d5dc31218032f9b931553130bf79004c148d4539
PART III: Using Pro64 in Compiler Research and Development Case Studies Outline • General Remarks • **Case Study I**: Integration of new instruction reordering algorithm to minimize register pressure [Govind, Yang, Amaral, Gao2000] • **Case Study II**: Design and evaluation of an induction pointer prefetching algorithm [Stouchinin, Douillet, Amaral, Gao2000] Case I - Introduction of the Minimum Register Instruction Sequence (MRIS) problem and a proposed solution - Problem formulation - The proposed algorithm - Pro64 porting experience - Where to start - How to start - Results - Summary Researchers - R. Govindarajan *(Indian Inst. Of Science)* - Hongbo Yang *(Univ. of Delaware)* - Chihong Zhang *(Conexant)* - José Nelson Amaral *(Univ. of Alberta)* - Guang R. Gao *(Univ. of Delaware)* The Minimum Register Instruction Sequence Problem Given a data dependence graph $G$, derive an instruction sequence $S$ for $G$ that is optimal in the sense that its register requirement is minimum. A Motivating Example Observation: Register requirements drop 25% from (b) to (c)! Motivation • IA-64 style processors – Reduce spills in local register allocation phase – Reduce Local Register Allocation (LRA) requests in Global Register Allocation (GRA) phase – Reduce overall register pressure on a per procedure basis • Out-of-order issue processor – Instruction reordering buffer – Register renaming How to Solve the MRIS Problem? - Register lineages - Live range of lineages - Lineage interference \[ \begin{align*} L1 & = (a, b, f, h); \\ L2 & = (c, f); \\ L3 & = (e, g, h); \\ L4 & = (d, g); \end{align*} \] (a) Concepts (b) DDG (c) Lineages How to Solve the MRIS Problem? - Register lineages - Live range of lineages - Lineage interference Questions: Can L1 and L2 share the same register? How to Solve the MRIS Problem? - Register lineages - Live range of lineages - Lineage interference Questions: Can L1 and L2 share the same register? Can L2 and L3 share the same register? How to Solve the MRIS Problem? - Register lineages - Live range of lineages - Lineage interference Questions: Can L1 and L2 share the same register? Can L2 and L3 share the same register? Can L1 and L4 share the same register? Can L2 and L4 share the same register? L1 = (a, b, f, h); L2 = (c, f); L3 = (e, g, h); L4 = (d, g); (a) Concepts (b) DDG (c) Lineages Lineage Interference Graph (a) Original DDG (b) Lineage Interference Graph (LIG) L1 = (a, b, f, h); L2 = (c, f); L3 = (e, g, h); L4 = (d, g); Question: Is the lower bound of the required registers = 3? Challenge: Derive a “Heuristic Register Bound” (HRB)! Our Solution Method - A “good” construction algorithm for LIG - An effective heuristic method to calculate the HRB - An efficient scheduling method (do not backtrack) Pro64 Porting Experience - Porting plan and design - Implementation - Debugging and validation - Evaluation Implementation - Dependence graph construction - LIG formation - LIG construction and coloring - The reordering algorithm implementation Porting Plan and Design - Understand the compiler infrastructure - Understand the register model (mainly from targ_info) e.g.: - register classes: (int, float, predicate, app, control) - register save/restore conventions: caller/callee save, return value, argument passing, stack pointer, etc. Register Allocation LRA: At block level GRA Assign_Registers Succ? Fix_LRA_Blues Fail? reschedule local code motion spill global or local registers Implementation - DDG construction: use native service routines: e.g. CG_DEP_Compute_Graph - LIG coloring: using native support for set package (e.g. bitset.c) - Scheduler implementation: vector package native support (e.g. cg_vector.cxx) - Access dependence graph using native service functions ARC_succs, ARC_preds, ARC_kind Debugging and Validation • Trace file – tt54:0x1. General trace of LRA – tt45: 0x4. Dependence graph building – tr53. Target Operations (TOP) before LRA – tr54. TOP after LRA Evaluation • Static measurement – Fat point -tt54: 0x40 • Dynamic measurement – Hardware counter in R12k and *perfex* Evaluation • For the MIPS R12K (SPEC95fp), the lineage-based algorithm reduce the number of loads executed by 12%, the number of stores by 14%, and the execution time by 2.5% over a baseline. • It is slightly better than the algorithm in the MIPSPro compiler. Case II Design and Evaluation of an Induction Pointer Prefetching Algorithm Researchers - Artour Stoutchinin (STMicroelectronics) - José Nelson Amaral (Univ. of Alberta) - Guang R. Gao (Univ. of Delaware) - Jim Dehnert (Silicon Graphics Inc.) - Suneel Jain (Narus Inc.) - Alban Douillet (Univ. of Delaware) Motivation The important loops of many programs are pointer-chasing loops that access recursive data structures through induction pointers. Example: ```c max = 0; current = head; while(current != NULL) { if(current->key > max) max = current->key; current = current->next; } ``` Problem Statement How to **identify** pointer-chasing recurrences? How to **decide** whether there are enough processor resources and memory bandwidth to profitably prefetch an induction pointer? How to efficiently **integrate** induction pointer prefetching with loop scheduling based on the profitability analysis? Prefetching Costs - More instructions to issue - More memory traffic - Longer code (disruption in instruction cache) - Displacement of potentially good data from cache Before prefetching: \[ t226 = lw \ 0x34(t228) \] After prefetching: \[ t226 = lw \ 0x34(t228) \] \[ \text{tmp} = \text{subu} \ t226, \ t226s \] \[ \text{tmp} = \text{addu} \ \text{tmp}, \ \text{tmp} \] \[ \text{pref} \ 0x0(\text{tmp}) \] \[ t226s = t226 \] What to Prefetch? When to Prefetch it? A good optimizing compiler should only prefetch data that will actually be referenced. It should prefetch **far enough in advance** to prevent a cache miss when the reference occurs. But, **not too far in advance**, because the data might be evicted from the cache before it is used, or might displace data that will be referenced again. Prefetch Address In order to prefetch, the compiler must calculate addresses that will be referenced in future iterations of the loop. For loops that access regular data structures, such as vectors and matrices, compilers can use static analysis of the array indexes to compute the prefetching addresses. How can we predict future values of induction pointers? Key Intuition Recursive data structures are often allocated at regular intervals. Example: ```c curr = head = (item) malloc(sizeof(item)); while(curr->key = get_key()) != NULL) { curr->next = curr = (item)malloc(sizeof(item)); other_memory_allocations(); } curr -> next = NULL; ``` Pre-Fetching Technique Example: ```c max = 0; current = head; tmp = current; while(current != NULL) { if(current->key > max) max = current->key; current = current->next; stride = current - tmp; prefetch(current + stride*k); tmp = current; } ``` Prefetch Sequence (R10K) In our implementation, the stride is recomputed in every iteration of the loop, making it tolerant of (infrequent) stride changes. \[ \begin{align*} \text{stride} &= \text{addr} - \text{addr.prev} \\ \text{stride} &= \text{stride} \times k \\ \text{addr.pref} &= \text{addr} + \text{stride} \\ \text{addr.prev} &= \text{addr} \\ \text{pref addr.pref} & \end{align*} \] Identification of Pointer-Chasing Recurrences A surprisingly simple method works well: look in the intermediate code for recurrence circuits containing only loads with constant offsets. Examples: \[ \text{node} = \text{ptr} \rightarrow \text{next}; \] \[ \text{ptr} = \text{node} \rightarrow \text{ptr}; \] \[ \text{current} = \text{current} \rightarrow \text{next}; \] \[ r1 \leftarrow \text{load } r2, \text{ offset}_\text{next} \] \[ r2 \leftarrow \text{load } r1, \text{ offset}_\text{ptr} \] \[ r2 \leftarrow \text{load } r1 \] \[ r1 \leftarrow \text{load } r2, \text{ offset}_\text{next} \] Profitability Analysis Goal: **Balance** the gains and costs of prefetching. Although we use resource estimates analogous to those done for software pipelining, we consider loop bodies with control flow. How to estimate the resources available for prefetching in a basic block B that belongs to many data dependence recurrences? Software Pipelining What limits the speed of a loop? - **Data dependences**: recurrence initiation interval (recMII) - **Processor resources**: resource initiation interval (resMII) - **Memory accesses**: memory initiation interval (memMII) Data Dependences(recMII) The recurrence minimum initiation interval (recMII) is given by: \[ \text{recMII} = \max_{\forall \text{cycle} \theta} \left[ \frac{\text{latency}(\theta)}{\text{iteration distance}(\theta)} \right] \] for \( i = 0 \) to \( N - 1 \) do \[a: \ X[i] = X[i - 1] + R[i]; \] \[b: \ Y[i] = X[i] + Z[i - 1]; \] \[c: \ Z[i] = Y[i] + 1; \] end; The recMII for Loops with Control Flow An instruction of a basic block B, can belong to many recurrences (with distinct control paths). We define the recurrence MII of a load operation L as: \[ \text{recMII}(L) = \max_{c \mid L \in c} \left[ \text{recMII}(c) \right] \] \( L \in c \) means that the operation L is part of the recurrence c. Control Flow Graph A basic block $B$ may belong to multiple control paths. We define the resource constraint of a basic block $B$ as the maximum over all control paths that execute $B$. \[ resMII(B) = \max_p \left[ resMII(p) \right]_{p \mid B \in p} \] Available Memory Bandwidth Processors with non-blocking caches can support up to $k$ outstanding cache misses without stalling. We define the available memory bandwidth of all control paths that execute a basic block $B$ as $$M(B) = \min_{p:B \in p} \left\{ k - m(p) \right\}$$ where $m(p)$ is the number of expected cache misses in each control path $p$. Control Flow Graph Profitability Analysis Adding prefetch code for an induction pointer \( L \) in a basic block \( B \) is profitable if both: 1. the mii due to recurrences that contain \( L \) is greater than the resMII after prefetch insertion, and 2. there is enough memory bandwidth to enable another cache miss without causing stalls. \[ resMII^P(B) \leq recMII^P(L) \land M(B) > 0 \] Computing Available Memory Bandwidth To compute the available memory bandwidth of a control path we need to estimate how many cache misses are expected in that control path. We use a graph coloring technique over a cache miss interference graph to predict which memory references are likely to incur a miss. The Miss Interference Graph Two memory references interfere if: 1. They are both expected to miss the cache 2. They can both be issued in the same iteration of the loop 3. They do not fall into the same cache line Miss Interference Graph assumptions: 1. Loop invariant references are cache hits (global-pointer relative, stack-pointer relative, etc). 2. Memory references on mutually exclusive control paths do not interfere. 3. References relative to the same base address interfere only if their relative offset is larger than the cache line. Prefetching Algorithm DoPrefetch(P,V,E) 1. $C \leftarrow$ pointer-chasing recurrences 2. $R \leftarrow$ Prioritized list of induction pointer loads in $C$ 3. $N \leftarrow$ Prioritized list of other loads (not in $C$) 4. $O \leftarrow R + N$ 5. mark each $L$ in $O$ as a cache miss 6. for each $L$ in $O$, $L \in B$ 7. do if $\text{recMII}^P(B) \leq \text{resMII}^P(B)$ and $S(B)$ 8. then add prefetch for $L$ to $B$ 9. mark $L$ as cache hit 10. endif 11. endfor An Example* *mcf: minimal cost flow optimizer, (Konrad-Zuse Informatics Center, Berlin) 1 while (arcin){ 2 tail = arcin->tail; 3 if (tail->time + arcin->org_cost > latest){ 4 arcin = (arc_t *)tail->mark; 5 continue; } 6 arc_cost = tail->potential + head_potential; 7 if (red_cost < 0) { 8 if (new_arcs < MAX_NEW_ARCS){ 9 insert_new_arc(arcnew, new_arcs, tail, head, arc_cost, red_cost); 10 new_arcs++; } 11 else if((cost_t)arcnew[0].flow > red_cost) 12 replace_weaker_arc(arcnew, tail, head, arc_cost, red_cost); } 13 arcin = (arc_t *)tail->mark; } An Example 1 while (arcin){ 2 tail = arcin->tail; 3 if (tail->time + arcin->org_cost > latest){ 4 arcin = (arc_t *)tail->mark; 5 continue; 6 } 7 arc_cost = tail->potential + head_potential; 8 if (red_cost < 0) { 9 if (new_arcs < MAX_NEW_ARCS){ 10 insert_new_arc(arcnew, new_arcs, tail, 11 head, arc_cost, red_cost); 12 new_arcs++; 13 } 14 } else if(((cost_t)arcnew[0].flow > red_cost) 15 replace_weaker_arc(arcnew, tail, head, 16 arc_cost, red_cost); 17 } 18 arcin = (arc_t *)tail->mark; 19 } 1. t228 = lw 0x0(t226) 2. t229 = lw 0x14(t226) 3. t230 = lw 0x38(t228) 4. t231 = addu t229, t230 5. t232 = slt t220, 0 6. bne B3, t232, 0 7. t226 = lw 0x34(t228) 8. b B8 9. t234 = lw 0x2c(t228) 10. t235 = subu t225, t234 11. t233 = addiu t235, 0x1e 12. bgez B7, t233 13. t236 = slt t209, t175 14. Beq B6, t236, 0 15. t226 = lw 0x34(t228) 15. bne B1, t226, 0 1. \( t_{228} = lw \ 0x0(t_{226}) \) 2. \( t_{229} = lw \ 0x14(t_{226}) \) 3. \( t_{230} = lw \ 0x38(t_{228}) \) 4. \( t_{231} = addu \ t_{229}, \ t_{230} \) 5. \( t_{232} = slt \ t_{220}, \ 0 \) 6. bne B3, t_{232}, 0 7. \( t_{226} = lw \ 0x34(t_{228}) \) 8. b B8 --- 9. \( t_{234} = lw \ 0x2c(t_{228}) \) 10. \( t_{235} = subu \ t_{225}, \ t_{234} \) 11. \( t_{233} = addiu \ t_{235}, \ 0x1e \) 12. bgez B7, t_{233} --- 13. \( t_{236} = slt \ t_{209}, \ t_{175} \) 14. Beq B6, t_{236}, 0 --- insert_new_arc(); --- replace_weaker_arc(); --- 15. \( t_{226} = lw \ 0x34(t_{228}) \) --- 15. bne B1, t_{226}, 0 1. \( t_{228} = \text{lw} \ 0x0(t_{226}) \) 2. \( t_{229} = \text{lw} \ 0x14(t_{226}) \) 3. \( t_{230} = \text{lw} \ 0x38(t_{228}) \) 4. \( t_{231} = \text{addu} \ t_{229}, t_{230} \) 5. \( t_{232} = \text{slt} \ t_{220}, 0 \) 6. \( \text{bne} \ B3, t_{232}, 0 \) 7. \( t_{226} = \text{lw} \ 0x34(t_{228}) \) 8. \( \text{b} \ B8 \) 9. \( t_{234} = \text{lw} \ 0x2c(t_{228}) \) 10. \( t_{235} = \text{subu} \ t_{225}, t_{234} \) 11. \( t_{233} = \text{addiu} \ t_{235}, 0x1e \) 12. \( \text{bgez} \ B7, t_{233} \) 13. \( t_{236} = \text{slt} \ t_{209}, t_{175} \) 14. \( \text{beq} \ B6, t_{236}, 0 \) 15. \( \text{bne} \ B1, t_{226}, 0 \) **Function Calls** - **B5:** \( \text{insert\_new\_arc}(); \) - **B6:** \( \text{replace\_weaker\_arc}(); \) 1. t228 = lw 0x0(t226) 2. t229 = lw 0x14(t226) 3. t230 = lw 0x38(t228) 4. t231 = addu t229, t230 5. t232 = slt t220, 0 6. bne B3, t232, 0 7. t226 = lw 0x34(t228) 8. b B10 15. t226 = lw 0x34(t228) 1. \( t_{228} = \text{lw} \ 0x0(t_{226}) \) 1. \( \text{tmp} = \text{subu} \ t_{228}, \ t_{228s} \) 1. \( \text{tmp} = \text{addu} \ \text{tmp}, \ \text{tmp} \) 1. \( \text{tmp} = \text{addw} \ t_{228}, \ \text{tmp} \) 1. \( \text{pref} \ 0x34(\text{tmp}) \) 1. \( t_{228s} = t_{228} \) 2. \( t_{229} = \text{lw} \ 0x14(t_{226}) \) 3. \( t_{230} = \text{lw} \ 0x38(t_{228}) \) 4. \( t_{231} = \text{addu} \ t_{229}, \ t_{230} \) 5. \( t_{232} = \text{slt} \ t_{220}, \ 0 \) 6. \( \text{bne} \ B3, \ t_{232}, \ 0 \) 7. \( t_{226} = \text{lw} \ 0x34(t_{228}) \) 7. \( \text{tmp} = \text{subu} \ t_{226}, \ t_{226s} \) 7. \( \text{tmp} = \text{addu} \ \text{tmp}, \ \text{tmp} \) 7. \( \text{tmp} = \text{addu} \ t_{226}, \ \text{tmp} \) 7. \( \text{pref} \ 0x0(\text{tmp}) \) 7. \( t_{226s} = t_{226} \) 8. \( \text{b} \ \text{B10} \) 15. \( t_{226} = \text{lw} \ 0x34(t_{228}) \) 15. \( \text{tmp} = \text{subu} \ t_{226}, \ t_{226s} \) 15. \( \text{tmp} = \text{addu} \ \text{tmp}, \ \text{tmp} \) 15. \( \text{tmp} = \text{addu} \ t_{226}, \ \text{tmp} \) 15. \( \text{pref} \ 0x0(\text{tmp}) \) 15. \( t_{226s} = t_{226} \) When Pointer Prefetch Works <table> <thead> <tr> <th>Benchmark</th> <th>Execution Time</th> <th>Performance Improvement</th> </tr> </thead> <tbody> <tr> <td></td> <td>No Prefetch</td> <td>Without Analysis</td> </tr> <tr> <td>mcf</td> <td>3,396 s</td> <td>2,854 s</td> </tr> <tr> <td>ft</td> <td>517 s</td> <td>436 s</td> </tr> <tr> <td>mlp</td> <td>632 s</td> <td>333 s</td> </tr> <tr> <td>vpr</td> <td>1,771 s</td> <td>-</td> </tr> <tr> <td>twolf</td> <td>2,540 s</td> <td>2,657 s</td> </tr> </tbody> </table> ## When Pointer Prefetch Does Not Help <table> <thead> <tr> <th>Benchmark</th> <th>Execution Time</th> <th>Performance Improvement</th> </tr> </thead> <tbody> <tr> <td></td> <td>No Prefetch</td> <td>Without Analysis</td> </tr> <tr> <td>gap</td> <td>1,174 s</td> <td>-</td> </tr> <tr> <td>li</td> <td>285 s</td> <td>293 s</td> </tr> <tr> <td>perlbmk</td> <td>2,062 s</td> <td>-</td> </tr> <tr> <td>eon</td> <td>949 s</td> <td>-</td> </tr> <tr> <td>parser</td> <td>2,180 s</td> <td>333 s</td> </tr> <tr> <td>gcc</td> <td>122 s</td> <td>123 s</td> </tr> </tbody> </table> Summary of Attributes - Software-only implementation - Simple candidate identification - Simple code transformation - No impact on user data structures - Simple profitability analysis, local to loop - Performance degradations are rare, minor Open Questions - How often is the speculated stride correct? - Can instrumentation feedback help? - How well does the speculative prefetch work with other recursive data structures: trees, graphs, etc? - How well does this approach work for read/write recursive data structures? Related Work (Software) - Luk-Mowry *(ASPLOS-96)* - Greedy prefetching; History-Pointer prefetching; Data Linearization Prefetching; - Change the data structure storage; - Lipatsi *et al.* *(Micro-95)* - Prefetching pointers at procedure call sites; - Maintains a table of offsets for prefetching Related Work (Hardware) - Roth-Moshovos-Sohi (ASPLOS, 1998) - Gonzales-Gonzales (ICS, 1997) - Mehrotra (Urbana-Champaign, 1996) - Chen-Baer (Trans. Computer, 1995) - Charney-Reeves (Trans. Comp., 1994) - Jegou-Teman (ICS, 1993) - Fu-Patel (Micro, 1992) Execution Time Measurements Execution time on Onyx - No Prefetch - No Resource Analysis - With Resource Analysis Benchmarks: - 181.mcf - ft - mip - 300.twolf - 126.gcc - 130.li - 197.parser Graph showing time in seconds for different benchmarks with and without resource analysis. Prefetch Improvement The graph shows the execution time (as a percentage of variation) for various benchmarks: 181.mcf, ft, mlp, 300.twolf, 126.gcc, 130.li, and 197.parser. The bars represent the difference in execution time between with resource analysis and without resource analysis. The y-axis represents the execution time, with values ranging from -5 to 40. The x-axis lists the benchmarks. L1 Cache Misses Variation on number of L1 misses Compared with No Prefetch L2 Cache Misses ![Graph 1: L2 misses on Onyx](image) ![Graph 2: Variation on number of L2 misses Compared with No Prefetch](image) TLB Misses ![Graph showing TLB misses on Onyx](image) ![Graph showing variation on number of TLB misses Compared with No Prefetch](image) Benchmarks gcc GNU C compiler li Lisp interpreter mcf Minimal cost flow solver parser Syntactic parser of English twolfe Place and route simulator mlp Multi-layer perceptron simulator ft Minimum spanning tree algorithm Targeting Pro64 to a New Processor - Create a new targ_info - Adjust configuration file for ABI - Create a new WHIRL-to-CG-lower for instruction selection - Adjust CG utilities (e.g., predication, EBO patterns, SWP stuff, etc.)
{"Source-Url": "https://webdocs.cs.ualberta.ca/~amaral/Pro64/Pro64-Case-Studies-1015.pdf", "len_cl100k_base": 6276, "olmocr-version": "0.1.51", "pdf-total-pages": 62, "total-fallback-pages": 0, "total-input-tokens": 84952, "total-output-tokens": 9308, "length": "2e12", "weborganizer": {"__label__adult": 0.0003886222839355469, "__label__art_design": 0.0003888607025146485, "__label__crime_law": 0.00038051605224609375, "__label__education_jobs": 0.00032019615173339844, "__label__entertainment": 5.40614128112793e-05, "__label__fashion_beauty": 0.00017595291137695312, "__label__finance_business": 0.0002472400665283203, "__label__food_dining": 0.00043272972106933594, "__label__games": 0.00061798095703125, "__label__hardware": 0.005001068115234375, "__label__health": 0.000537872314453125, "__label__history": 0.0002770423889160156, "__label__home_hobbies": 0.00013554096221923828, "__label__industrial": 0.0007891654968261719, "__label__literature": 0.0001462697982788086, "__label__politics": 0.0002942085266113281, "__label__religion": 0.0006127357482910156, "__label__science_tech": 0.032745361328125, "__label__social_life": 5.567073822021485e-05, "__label__software": 0.005397796630859375, "__label__software_dev": 0.94970703125, "__label__sports_fitness": 0.00044083595275878906, "__label__transportation": 0.000774383544921875, "__label__travel": 0.0002574920654296875}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 20240, 0.06404]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 20240, 0.78975]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 20240, 0.68932]], "google_gemma-3-12b-it_contains_pii": [[0, 73, false], [73, 375, null], [375, 618, null], [618, 821, null], [821, 1021, null], [1021, 1104, null], [1104, 1438, null], [1438, 1688, null], [1688, 1839, null], [1839, 2029, null], [2029, 2396, null], [2396, 2657, null], [2657, 2825, null], [2825, 2934, null], [2934, 3072, null], [3072, 3372, null], [3372, 3528, null], [3528, 3855, null], [3855, 4039, null], [4039, 4163, null], [4163, 4425, null], [4425, 4502, null], [4502, 4734, null], [4734, 5031, null], [5031, 5351, null], [5351, 5779, null], [5779, 6161, null], [6161, 6525, null], [6525, 6822, null], [6822, 7110, null], [7110, 7506, null], [7506, 8106, null], [8106, 8438, null], [8438, 8681, null], [8681, 9045, null], [9045, 9409, null], [9409, 9644, null], [9644, 10025, null], [10025, 10400, null], [10400, 10710, null], [10710, 11257, null], [11257, 11721, null], [11721, 12382, null], [12382, 13036, null], [13036, 13399, null], [13399, 14018, null], [14018, 14772, null], [14772, 14968, null], [14968, 16111, null], [16111, 16767, null], [16767, 17607, null], [17607, 17850, null], [17850, 18130, null], [18130, 18486, null], [18486, 18740, null], [18740, 19025, null], [19025, 19423, null], [19423, 19499, null], [19499, 19632, null], [19632, 19772, null], [19772, 20012, null], [20012, 20240, null]], "google_gemma-3-12b-it_is_public_document": [[0, 73, true], [73, 375, null], [375, 618, null], [618, 821, null], [821, 1021, null], [1021, 1104, null], [1104, 1438, null], [1438, 1688, null], [1688, 1839, null], [1839, 2029, null], [2029, 2396, null], [2396, 2657, null], [2657, 2825, null], [2825, 2934, null], [2934, 3072, null], [3072, 3372, null], [3372, 3528, null], [3528, 3855, null], [3855, 4039, null], [4039, 4163, null], [4163, 4425, null], [4425, 4502, null], [4502, 4734, null], [4734, 5031, null], [5031, 5351, null], [5351, 5779, null], [5779, 6161, null], [6161, 6525, null], [6525, 6822, null], [6822, 7110, null], [7110, 7506, null], [7506, 8106, null], [8106, 8438, null], [8438, 8681, null], [8681, 9045, null], [9045, 9409, null], [9409, 9644, null], [9644, 10025, null], [10025, 10400, null], [10400, 10710, null], [10710, 11257, null], [11257, 11721, null], [11721, 12382, null], [12382, 13036, null], [13036, 13399, null], [13399, 14018, null], [14018, 14772, null], [14772, 14968, null], [14968, 16111, null], [16111, 16767, null], [16767, 17607, null], [17607, 17850, null], [17850, 18130, null], [18130, 18486, null], [18486, 18740, null], [18740, 19025, null], [19025, 19423, null], [19423, 19499, null], [19499, 19632, null], [19632, 19772, null], [19772, 20012, null], [20012, 20240, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 20240, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 20240, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 20240, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 20240, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 20240, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 20240, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 20240, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 20240, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 20240, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 20240, null]], "pdf_page_numbers": [[0, 73, 1], [73, 375, 2], [375, 618, 3], [618, 821, 4], [821, 1021, 5], [1021, 1104, 6], [1104, 1438, 7], [1438, 1688, 8], [1688, 1839, 9], [1839, 2029, 10], [2029, 2396, 11], [2396, 2657, 12], [2657, 2825, 13], [2825, 2934, 14], [2934, 3072, 15], [3072, 3372, 16], [3372, 3528, 17], [3528, 3855, 18], [3855, 4039, 19], [4039, 4163, 20], [4163, 4425, 21], [4425, 4502, 22], [4502, 4734, 23], [4734, 5031, 24], [5031, 5351, 25], [5351, 5779, 26], [5779, 6161, 27], [6161, 6525, 28], [6525, 6822, 29], [6822, 7110, 30], [7110, 7506, 31], [7506, 8106, 32], [8106, 8438, 33], [8438, 8681, 34], [8681, 9045, 35], [9045, 9409, 36], [9409, 9644, 37], [9644, 10025, 38], [10025, 10400, 39], [10400, 10710, 40], [10710, 11257, 41], [11257, 11721, 42], [11721, 12382, 43], [12382, 13036, 44], [13036, 13399, 45], [13399, 14018, 46], [14018, 14772, 47], [14772, 14968, 48], [14968, 16111, 49], [16111, 16767, 50], [16767, 17607, 51], [17607, 17850, 52], [17850, 18130, 53], [18130, 18486, 54], [18486, 18740, 55], [18740, 19025, 56], [19025, 19423, 57], [19423, 19499, 58], [19499, 19632, 59], [19632, 19772, 60], [19772, 20012, 61], [20012, 20240, 62]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 20240, 0.03346]]}
olmocr_science_pdfs
2024-12-04
2024-12-04
b61fe6fc5dba09ab5c2ca8671c60e519271c1952
Design of a real-time optimized emulation method Timo Kerstan University of Paderborn Fuerstenalle 11 33102 Paderborn Germany timo.kerstan@uni-paderborn.de Markus Oertel OFFIS Institute for Information Technology Escherweg 2 26121 Oldenburg Germany markus.oertel@offis.de Abstract—Virtualization has become a key technology in the design of embedded systems. Within the scope of virtualization, emulation is a central aspect to overcome the limits induced by the heterogeneity of complex distributed embedded systems. Most of the techniques developed for the desktops and servers are not directly applicable to embedded systems due to their strict timing requirements. We will show the problems of existing emulation methods when applying them to embedded real-time systems and will propose a metric to determine the worst-case overhead caused by emulation. Based on this metric we then propose an emulation method minimizing the worst-case overhead. I. INTRODUCTION Virtualization has become a key technology in the desktop and server markets. There exist a huge number of products offering hardware virtualization at the bare metal level or at the host level. These products are available for system administrators to help consolidating whole server farms and they are available for end users to bring different operating systems at one time on their desktop. In the case of server consolidation virtualization helps to better utilize or load balance servers saving costs and energy. Distributed embedded systems used in automotive and aeronautical systems consist of a number of microcontrollers where every microcontroller executes a dedicated task. This is mainly done because of isolation reasons to prevent a fault from spreading over the whole network. Beside this aspect the utilization of a single microcontroller may also be very low. Applying virtualization to distributed embedded systems helps to increase their scalability while keeping the needed isolation, safety and dependability. Unfortunately it is not possible to apply directly the virtualization techniques used in the server and desktop systems because of the inherent timing constraints of such distributed embedded systems. These timing constraints add the requirement of temporal isolation to virtualized embedded systems. For example the consolidation of a distributed embedded system into a virtualized architecture using less processing elements, is restricted due to the heterogeneity of the Instruction Set Architectures of the processing elements. Emulation overcomes this restriction. Research on emulation techniques has resulted in a number of methods optimizing their steady state performance, but they lack the support of real-time aspects like bounded execution times or minimizing the Worst Case Execution Times (WCET). This paper describes a method for emulating embedded programs under hard real-time constraints. The approach guarantees holding all deadlines while estimating the WCET of the emulation in a non conservative way. Further it is possible to adapt the emulated program freely to the available memory on the target platform, while reaching an optimal WCET for the final program size. II. RELATED WORK The basic interpretation technique uses a decode and dispatch loop to fetch and execute the source instructions using emulation methods called within the loop. The performance of interpretation is very poor. Therefore several interpretation techniques like Indirect Threading [1], [2], Direct Threading [3], Subroutine Threading [4], Context Threading [5] and optimization techniques like Inlining [6] and Replication [7] have been developed to improve the performance of interpretation. However the resulting performance is still poor in contrast to the native execution. To overcome the performance problems of interpretation techniques, binary translation tries to map a sequence of source instructions to a sequence of target instructions. These instructions can be directly executed on the target with a better performance than interpretation. The Code Location Problem and the Code Discovery Problem[8] make it very difficult to translate a complete source program to the targets ISA. Dynamic Binary Translators address these problems by translating so-called basic blocks into a block of natively executable code for the target using runtime information. There are two kinds of basic blocks: the static basic blocks and the dynamic basic blocks. Static basic blocks contain an instruction sequence with a single entry point and a single leave point. In essence, static basic blocks begin and end at all branch or jump instructions and all branch or jump targets. Static basic blocks are the biggest atomic instruction sequences and can be translated in advance. In contrast, dynamic basic blocks are determined by the actual flow of a program as it is executed. A dynamic basic block always begins at the instruction executed immediately after a branch or jump, follows the sequential instruction stream, and ends with the next branch or jump. Jump or branch targets within this flow do not terminate the dynamic basic block. This shows that dynamic basic blocks tend to be larger than static basic blocks. Another thing to notice is that dynamic basic blocks can overlap each other and will be compiled just-in-time and kept in a so called block cache as they depend on the execution flow while this is not the case with static basic blocks. The block cache is very problematic for real-time applications, as the contents of the block cache is not deterministic. Because of this the worst case, the dynamic block not being present in the block cache, has to be assumed. This leads to a very large WCET in the case of dynamic binary translation. An interesting approach is to improve the performance of interpretation by selective inlining. Piumarta und Riccardi [6] proposed a method to split the source program into blocks. Every emulation method for a source instruction is available as a precompiled binary code. Within a block every source instruction is replaced by the binary code of its corresponding emulation method. This means a translated block consists of a concatenation of the binary code of its emulation methods. This improves the performance, since the jumps between each instruction implementation in a block can be omitted, but increases the memory needed on the target system as the emulation methods were copied into several different blocks. All these emulation techniques presented here have not been developed to consider real-time aspects like minimization of the WCET and deterministic behaviour. Their main goal is to maximize the steady-state-performance of an emulated program. In the following parts of this paper we will show how these techniques can be used and improved to minimize the WCET and guarantee deterministic behaviour. Since the slow-down of emulated programs has already been discussed [9], we concentrate on developing an emulation with a small WCET. ### III. Design Aspects Emulation of a real-time system consists of two fundamental tasks: First, the result of the emulated program has to be identical to the result of the program being emulated and second, the timing constraints have to remain fulfilled in all cases. The first task has already been solved by a variety of different techniques introduced in section II. A solution of the second task is presented in the following chapters. #### A. Metrics Emulating a program usually takes more cycles on the target system, since there is not always an equivalent replacement for instructions of the source architecture. This is in particular even more problematic if the bus-width of the source and the target system differs, since all condition codes have to be calculated manually. For still holding all deadlines, the target system has to be faster by a program-dependant factor. This factor is called $CGR_{\text{max}}$ (Maximum Cycle Gain Ratio) and is based, as the name indicates, on cycles. The CGR defines a performance ratio between the emulated execution on the host and the native execution on the source system. The aim of the approach presented in this paper is to determine $CGR_{\text{max}}$ and minimize it at the cost of additional memory consumption. #### Definition 1: A program $p$ is a ordered sequence of instructions $i_k \in ISA$ with length $n \geq 1$: $$p_{1:n} = (i_1, i_2, \ldots, i_n) \in ISA^n$$ The instructions occuring in $p$ form the set of used instructions in $p$: $$I_p = \{i | i \in p\} \subseteq ISA$$ 10pt #### Definition 2: $SC(x)/TC(x)$ denotes the number of cycles needed on the source ISA to execute/emulate the source instruction $x \in ISA$: $$SC : ISA \rightarrow N^+$$ $$TC : ISA \rightarrow N^+$$ #### Definition 3: The Cycle Gain Ratio represents the time delay factor introduced by the emulation of an ordered instruction subsequence $p_{m:r}$ with $m \leq r$ from instruction $i_m$ up to instruction $i_r$ of $p_{1:n}$: $$CGR(p_{m:r}) = \frac{\sum_{i \in p_{m:r}} TC(i)}{\sum_{i \in p_{m:r}} SC(i)}$$ All considerations rest upon a worst-case scenario, so the cycles per instruction are assumed to be constant and equal for each instruction, since a possible pipeline of the target system is neglected. Because of this, the timings of a real system will differ from the calculated behavior hence superscalar architectures usually speed up a system quite a bit. But it is not possible to make assumptions about the state of the pipeline at a particular point of the program flow. This is mainly caused by unpredictable thrown interrupts and input dependant branches. To calculate $CGR_{\text{max}}$ based on single instruction emulation $CGR_{\text{max}}$ of a program $p$ is determined by the instruction $i \in I_p$ that expands the most: $$CGR_{\text{max}}(I_p) = \max\{CGR(i) | i \in I_p\}$$ A target system using pure interpretation of single instructions and being $CGR_{\text{max}}$ times faster than the source system would hold all deadlines, since even the most complicated instruction could be executed on the new target in the same time as on the original system. This would be sufficient, but we have already shown that pure interpretation suffers from bad performance and a preciseness of one instruction is not necessary. The biggest independantly ordered instruction sequence which is always contiguously executed is the static basic block. This is the reason why $CGR(s)$ is based on an ordered instruction sequence. The benefit of considering static basic blocks instead of single instructions is quite huge, since within one block the number of cycles from all instructions can be accumulated (see Definition 3). A single instruction having a big $CGR$ value can be compensated by other, smaller instructions, leading to a smaller WCET. Let the set $SBB$ be the set of all static basic blocks of $p$, then $CGR_{\text{max}}$ based on the set $SBB$ of static basic blocks can be calculated as follows: $$CGR_{\text{max}} = \max\{CGR(b)|b \in SBB\} \quad (7)$$ **Definition 4:** The set of critical static basic blocks with $CGR_{\text{max}}$ is called $CSBB$: $$CSBB = \{b|b \in SBB \land CGR(b) = CGR_{\text{max}}\} \quad (8)$$ **B. Design-goal for the implementation** While designing an emulator, there is no information about the composition of instructions inside the blocks nor their execution flow known, since this information is program-dependent. Some emulators speed up the execution time of some instructions at the cost of other instructions because they make the assumption that the usage of instructions is not equally distributed. This assumption is useful in non real-time systems, but it is not useful for real-time systems, because this may raise the upper bound of the WCET of the emulation. When taking a closer look at the emulation of a single instruction there are several performance aspects that have to be taken into account: - The **startup-time** describes the time spent in operations before the emulation starts. These operations include the pre-decoding of the source-binary or different kinds of binary optimizations. The effort spent in this period is irrelevant for the calculation of $CGR_{\text{max}}$ since only the timing behavior at runtime matters. Optimizations that take place at this moment are to be preferred. - The **first-time-effort** is the effort caused by the first execution of an instruction. Especially dynamic binary translators tend to have a huge first-time-effort compared to the other executions of the instruction. Regarding $CGR_{\text{max}}$ this effort is critical and should be kept at a minimum. - The effort spend for a single execution which is not the first one is called **steady-state-performance**. The **overall-performance** of an instruction $i$ is a fraction of the combination of its first-time-effort $FTE_i$ and its steady-state-performance $SSP_i$ for $n \in \mathbb{N}^+$ executions: $$TC(i)_{\text{overall}} \approx \frac{FTE_i + (n-1) \cdot SSP_i}{n} \quad (9)$$ $n$ is assumed to be large in desktop and server systems and hence the overall-performance is often used as a metric to optimize modern virtualization systems because the FTE does not carry much weight. In real-time emulation systems this assumption cannot be made, because in the case of real-time applications the worst case for emulating an instruction $i$ has to be considered: $$TC_{WC}(i) = \max(FTE_i, SSP_i) \quad (10)$$ So a solution for $FTE = SSP$ has to be found while obtaining still a good SSP. This approach differs a bit from the common virtualization techniques, which usually try to optimize the overall performance. **IV. Real-Time Optimized Emulation** Interpretation and static binary translation are the techniques that could be used for real-time emulation. The pros and cons act quite oppositional. Static translated program could reach a better $CGR_{\text{max}}$ but need more space. Interpreted programs use less space and process slower. Both, memory and processing power can be critical in small embedded systems. Because of this our approach combines both techniques to enable the user to make the emulator fulfill the requirements in the best possible way. **A. The general idea** Piumarta and Riccardi [6] already proposed an approach increasing the speed of interpretation by the help of static translated code (see Section II). The target code for the implementation of the instructions of the source ISA was stored in memory. The source program was also divided into blocks. To speed up a block, the target code of the instruction implementations gets concatenated. The benefit of this approach is, that there are no jumps between the instruction implementations inside a block. But this approach has some major disadvantages. Through the block-building process not every instruction can be assigned to a block and so only a part of the instructions can be translated. Further, the operands of the instruction still have to be fetched from the threading table, which normally could be prevented by the use of static translation. Another disadvantage is the lack of the capability to optimize the code block-wide. Block-wide optimization means, that a block is treated as a unit. So the order of target instructions can vary and is not bound to the source instruction frame. It can even be possible to save some store instructions to write temporary data back to the context block since this data can be kept in the registers of the target system. In a real-time environment this approach can be enhanced to avoid all the mentioned disadvantages. Our approach uses static basic blocks to divide the program. These blocks are statically translated with embedded operands and block-wide optimizations. The main problem of the static translation is that the target binary gets very big. Even with quite small instruction implementations a multiplier of ten is not uncommon. The problem of partly and offline translated programs can not be solved for desktop applications, since there is no data available how frequently a block gets executed. Considering real-time execution the overall-performance does not matter and so the frequency of block execution is not needed either. Important is the cycle gain ratio of a block. To reduce $CGR_{\text{max}}$ for a program the critical set of blocks has to be statically translated. Using the $CGR$ it is possible to sort the blocks in the order of importance for a static translation. Having a memory limitation it is possible to choose the most important blocks for translation while fulfilling the memory constraint. For all instructions inside a block the critical set of blocks can be determined by summing up all the cycles necessary for an interpreted execution of an instruction (see Def. 4). The blocks can be translated offline until the memory limit has been reached. To increase platform independence and to reduce the complexity of the translation process the blocks are translated to C-code which later will be compiled for the target system. This empowers our approach to have optimizations across the instruction borders, since the C-code can be translated with all possible compiler optimizations. The advantage of block wide optimizations is huge. Operands can be embedded in the code and do not have to be extracted out of the threading table and a lot of stores to the context block can be saved, since a lot of registers get overwritten inside a single block. ![Diagram] Fig. 1. Stages of the emulator generation process Fig. 1 depicts the basic steps of our approach: - In the first step, the program is disassembled and stored as a predecoded array. In this step optimization is already active. Some instructions have switch bits, which change the operation. These instructions are split into separate ones to avoid a computation of the switch bits at runtime. In many architectures there are special registers that configure the behavior of the CPU or peripheral devices. Usually there is only one instruction to set the value of a register which would result in the necessity to check the target register type every time the instruction would have been called. To avoid this, the setting of configuration registers are also separated in different instructions. - In the second step the program is divided into static basic blocks. Depending on the use of indirect jumps the C-code of the application is necessary - In the third step the critical blocks are identified to minimize the WCET. - As a next step, the C-code for the identified block is generated. - In a last step, the generated code including the necessary real-time emulation core is compiled for the target system and can then be started. V. CONCLUSION & FUTURE WORK This paper presented a real-time emulation method for minimizing the $CGR_{max}$ of arbitrary programs. In the worst case scenario the system performing the target system has to be $CGR_{max}$ times faster than the source system to guarantee that all deadlines will still be met. $CGR_{max}$ can be minimized to a certain degree depending on the memory constraint and the possibility to divide the program in static basic blocks. Our approach can be used in the scope of self-optimizing systems, because we are working on ways to change the set of pre-compiled blocks at runtime. Minimizing $CGR_{max}$ can be used as an optimization goal which is limited by the required memory. Our approach can be seen in the middle of interpretation and static binary translators which combines the advantages of the good portability and the simple implementation of interpreters with the speed of binary translators without the nearly unpredictable effort for compilation at runtime. We are currently working to finalize our case study. We have chosen the ATmega8 micro-controller from AVR as an 8-bit system, that should be emulated on a 32-bit PowerPC 405 from IBM. In this case the effort to compute the condition codes of the 8-bit instructions on the 32-bit system is quite big, because of the different number representation. The first results of our case study are promising good results in minimizing the $CGR_{max}$. REFERENCES
{"Source-Url": "http://www.date-conference.com/proceedings/PAPERS/2010/DATE10/PDFFILES/IP2_13.PDF", "len_cl100k_base": 4130, "olmocr-version": "0.1.50", "pdf-total-pages": 4, "total-fallback-pages": 0, "total-input-tokens": 14285, "total-output-tokens": 5275, "length": "2e12", "weborganizer": {"__label__adult": 0.0005993843078613281, "__label__art_design": 0.0006270408630371094, "__label__crime_law": 0.0005483627319335938, "__label__education_jobs": 0.0004777908325195313, "__label__entertainment": 0.00010335445404052734, "__label__fashion_beauty": 0.00023174285888671875, "__label__finance_business": 0.0002715587615966797, "__label__food_dining": 0.0005598068237304688, "__label__games": 0.0008955001831054688, "__label__hardware": 0.00958251953125, "__label__health": 0.0007905960083007812, "__label__history": 0.0004622936248779297, "__label__home_hobbies": 0.00019097328186035156, "__label__industrial": 0.0010814666748046875, "__label__literature": 0.0002312660217285156, "__label__politics": 0.00042891502380371094, "__label__religion": 0.0008273124694824219, "__label__science_tech": 0.10101318359375, "__label__social_life": 8.237361907958984e-05, "__label__software": 0.006107330322265625, "__label__software_dev": 0.87255859375, "__label__sports_fitness": 0.0005469322204589844, "__label__transportation": 0.0015439987182617188, "__label__travel": 0.00034117698669433594}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 22543, 0.02816]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 22543, 0.70382]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 22543, 0.90167]], "google_gemma-3-12b-it_contains_pii": [[0, 5250, false], [5250, 10874, null], [10874, 16694, null], [16694, 22543, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5250, true], [5250, 10874, null], [10874, 16694, null], [16694, 22543, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 22543, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 22543, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 22543, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 22543, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 22543, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 22543, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 22543, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 22543, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 22543, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 22543, null]], "pdf_page_numbers": [[0, 5250, 1], [5250, 10874, 2], [10874, 16694, 3], [16694, 22543, 4]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 22543, 0.0]]}
olmocr_science_pdfs
2024-12-03
2024-12-03
eef751da95cd2f8b2f070af64f71f7aba8d663c4
On the effectiveness of virtualization-based security Protecting commodity operating systems and applications against malware and targeted attacks has proven to be difficult. In recent years, virtualization has received attention from security researchers who utilize it to harden existing systems and provide strong security guarantees. This has lead to interesting use cases such as cloud computing where possibly sensitive data is processed on remote, third party systems. The migration and processing of data in remote servers, poses new technical and legal questions, such as which security measures should be taken to protect this data or how can it be proven that execution of code wasn’t tampered with. In this paper we focus on technological aspects. We discuss the various possibilities of security within the virtualization layer and we use as a case study Hello Rootkitty, a lightweight invariance-enforcing framework which allows an operating system to recover from kernel-level attacks. In addition to Hello Rootkitty, we also explore the use of special hardware chips as a way of further protecting and guaranteeing the integrity of a virtualized system. I. Introduction Virtualization is the set of technologies that together allow for the existence of multiple running virtual machines on-top of a single physical machine. While initially all of the needed mechanisms for virtualization were created in software, the sustained popularity of virtualization, lead to their implementation in hardware, providing the desired speed that was lacking in their software counterparts. Today virtualization is gaining more and more interest in IT as well as the business world. The ability of virtualization to easily consolidate and migrate virtual machines between physical machines, allows corporations to outsource their IT infrastructure while reducing the cost of maintenance, power consumption and required infrastructure. This practice is called cloud computing. While virtualization is now mostly a technology for server farms, it is expected that it will soon affect both the mobile device and desktops market. Companies are already offering products such as VMWare’s Mobile Virtualization platform (Barr et al., 2010) and Citrix’s XenDesktop which utilize virtualization to increase productivity, decrease costs and allow easier maintenance of mobile and desktop devices in corporate environments. From a security point of view, researchers have already identified a number of attractive properties of virtualization that can be used to provide stronger security guarantees in server, desktop as well as mobile environments. The property that has received the most attention is the guaranteed isolation between virtual *IBBT-DistriNet, Katholieke Universiteit Leuven, 3001 Leuven, Belgium machines on top of the same physical machine and the isolation of the code managing the virtual machines, called the hypervisor, from the virtualized operating systems. This makes the hypervisor and separate virtual machines ideal locations for security measures. A strong isolation between the layer where a security mechanism resides and the layer which it protects allows the security mechanism to continue to operate correctly even in the presence of an attack against the protected layer. A number of virtualization-utilizing security mechanisms have been proposed, ranging all the way from rootkit detectors to anti-virus products (Chiueh et al., 2009; Gadaleta et al., 2011, 2009; Qub, n.d.). Unfortunately virtualization-utilizing security measures are usually affected by consistent overhead since they typically require interactions between the hypervisor and the virtualized operating system that would not be present in traditional environments. In this paper we discuss two very active research tracks. First, one track focuses on the application of virtualization techniques to increase the security of the overall system against malicious software. As a use case we describe Hello Rootkitty, an in-hypervisor invariance-enforcing framework used to detect kernel-level rootkits. While Hello Rootkitty significantly elevates security of the overall system without requiring any hardware or software modification, it is not able to guarantee isolation of sensitive information against a determined attacker. Second, we discuss recent research results of another research track to provide formally provable security for small, specially tailored software modules. These strong security guarantees come at a significant cost of partitioning applications in security sensitive and insensitive parts. These results build on the technology of the Trusted Platform Module (TPM), a low-budget chip that is currently shipping with newer computers that provides a limited number of security features in hardware. The rest of the paper is structured as follows. Section II. discusses how virtualization can be used to rethink security from the ground-up and use it to develop strong defenses for modern computing. Section A. explores Hello Rootkitty and shows how a hypervisor can be used as an invariance enforcing framework in order to identify malicious and unexpected modifications in a kernel’s data structures. Section B. presents the technology of TPMs and discusses how this hardware chip can be employed to offer provable security, followed by our conclusions in Section III.. II. Rethinking security In order to take advantage of cloud computing in a corporate environment, a strong isolation between workloads of different parties is required. Modern operating systems, such as Microsoft Windows Server 2008, are not able to provide sufficient isolation between different applications, or even between applications and the operating system itself. According to the National Institute of Standards and Technology (NIST), that keeps track of all reported vulnerabilities of commercial available software packets, there were 128 new vulnerabilities found in Windows Server 2008 in 2010 alone (National Vulnerability Database (NVD) CVE Statistics, 2011). For 2011, this figure was already surpassed at the time of writing. The size of the kernel, ranging into millions lines of code, make it infeasible to make it reliably secure. Subtle bugs (One, 1996) can be exploited by an attacker to gain kernel-level access. As this is the most privileged level, sensitive information stored by another party’s applications can now be easily accessed. Virtualization techniques, allow us to create another, even more privileged, layer. Using this additional layer, research has focused on two distinct approaches. First, the layer can be used to offer stronger protection of the operating system running on top of it without any need to modify any source code or binary. Second, security measures can be implemented in this layer to protect the execution and isolation of code even in the presence of malware. While the latter approach is able to offer stronger security guarantees, it requires a significant modification of source code. A. Hello Rootkitty: an invariance-enforcing framework Rootkits are pieces of malicious software deployed on a compromised operating system with the chief purpose of concealing the presence of other malicious applications (such as a keylogger, or a backdoor) from the users and administrators of that system. The two most common rootkit classes are user-mode and kernel-mode and essentially signify the privilege level where the rootkit resides. User-mode rootkits have a relatively limited impact on the system because they compromise a single application at a time and can be easily detected and removed by security mechanisms residing either in the userspace or the kernel-space of the operating system. Kernel-mode rootkits however, are much more insidious, with a higher impact on the system and harder to detect and remove. A countermeasure deployed within the same layer of the system that it protects might be circumvented and is susceptible to attacks. No isolation can be guaranteed if the countermeasure that protects and the kernel that is to be protected, are both part of the attack surface. Hello Rootkitty takes advantage of isolation provided by virtualization in order to protect a target kernel and mitigate the problem of rootkits. We assume that a rootkit can be introduced in a system through a Loadable Kernel Module (LKM) \(^1\), by overwriting mem- \(^1\)LKM\~s are regularly used to install new hardware or extend the kernel with new features. Unfortunately, an inexperienced user can easily install a malicious LKM which masks itself as a benign ory directly via kernel-exposed interfaces, or by exploiting a vulnerability in the kernel that allows execution of arbitrary code. A common characteristic of most rootkits is that they overwrite locations in memory in order to change the control-flow inside the kernel. The majority of these locations have values that do not change during normal execution. Thus, any sign of variance can be used to detect the presence of rootkits. We name these target memory areas as invariant “critical kernel objects” because compromising such locations is essential to change the control-flow of the kernel and execute injected code. The literature provides methods to detect invariant critical kernel objects as described in Baliga et al. (2010); Dolan-Gavitt et al. (2009); Carbone et al. (2009); Wang et al. (2009). These methods differ depending on the type of kernel object. We identify three types of objects: 1. Static kernel objects at addresses hard-coded and not dependent on kernel compilation 2. Static kernel objects whose addresses depend on kernel compilation 3. Dynamic kernel objects allocated on the kernel heap via kernel-specific memory allocation functions Once the locations of invariant kernel objects have been collected, Hello Rootkitty can check their integrity regardless of their type. The minimal information required to enable protection without dealing with false positives is the address of the object within guest memory and its size in bytes. Part of Hello Rootkitty is a trusted module which operates in the guest operating system at boot time and provides such information to the hypervisor. We consider boot time our root of trust. This is a realistic assumption especially in the case of production servers, such as mail and web servers, in which the environment does not change after their installation. After the first boot, the system is considered to operate in an untrusted environment and integrity checking will be enforced by the hypervisor. A schema of Hello Rootkitty is provided in Figure 1. Given the list of invariant kernel objects, the trusted module sends this data to the hypervisor via a hypercall$^2$. The hypervisor will checksum the contents at the provided addresses, store the computed hashes to a private memory area, not accessible by the guest, and will force the trusted module to unload. After this point, an attacker can no longer tamper with the countermeasure: the trusted module is not part of the attack surface and isolation between the guest and the hypervisor is guaranteed by virtualization-enabled hardware. application. $^2$Virtual machines communicate to the underlying hypervisor via hypercalls, the equivalent of system calls used by regular processes to communicate with the underlying kernel. Integrity checking is needed to detect if any of the protected objects has been compromised. In order to detect such changes, the hypervisor needs to access the contents within the guest, compute their hash and finally compare it against the hash stored in its private memory area. *Hello Rootkitty* executes checking by taking into account the regular interaction of the hypervisor and the guest running on top. In a virtualized environment the guest runs on a logical processor in a privilege level lower than the virtualized machine, called VMX non-root mode. In this mode certain instructions or events triggered by the guest kernel will cause a VMExit and control is given to the hypervisor. The hypervisor will handle the exception and return to the guest upon termination. We found that writing to control registers\(^3\) is the most convenient event to check the integrity of kernel objects. This event is strategic because with virtual addressing enabled, Control Register 3 (CR3) becomes the page directory base register. On Intel architecture switching between two running processes will change CR3. This gives direct information about the current guest system load and allows to implement a countermeasure that scales accordingly. When the hypervisor detects that the signature of a protected object does not match the one computed the first time, the system will report an ongoing attack. *Hello Rootkitty* is also able to repair the compromised object, if a copy of it has --- \(^3\)MOV CR\(^*\) for Intel x86 Architecture been provided by the trusted module. Executing integrity checking outside of the target operating system can have consistent cost that affects performance overhead and limit the deployment in production systems. Moreover, the number of critical kernel objects to be protected is usually high and checking the integrity of the entire list could make the system unusable. Thus, integrity checking of a large list of objects is spread over a certain number of events trapped by the hypervisor. This problem relaxation considerably improves the performance overhead, although it comes at a cost in terms of security and detection time. However, the detection ability of this countermeasure remains strong also in a realistic scenario. While performance benchmarks show negligible overhead and the memory footprint is proportional to the number of protected objects, *hello Rootkitty* has some limitations. Since it depends on invariance inference engines to provide an accurate list of invariant critical kernel objects, *hello Rootkitty* will be unable to detect attacks that occur in the non-reported ones. Moreover, this framework will not enable protection of objects whose values can legitimately change during regular usage. However, protecting a consistent amount of invariant kernel objects will dramatically reduce the attack surface and make the overall system more secure against rootkits. **B. Offering provable secure isolation** While *Hello Rootkitty* significantly elevates the security of the overall system, it is not able to guarantee complete isolation of applications. Malware could still successfully exploit subtle bugs in the kernel by trying to restore invariants before they are checked or avoiding breaking invariants altogether. For at least a certain period of time, the malware may be able to access sensitive information of applications running on behalf of other parties. An alternative research track attempts to protect sensitive information even in the presence of kernel-level malware. Security measures have been developed (Azab et al., 2011; Garfinkel et al., 2003; McCune et al., 2008, 2010; Singaravelu et al., 2006; Strackx et al., 2010) to offer such strong security guarantees by splitting applications in a security sensitive and a security insensitive part. The former part is executed in complete isolation from the rest of the system. This minimizes the size of the trusted computing base (TCB), the sum of all software that is relied upon to isolate sensitive information and calculate the correct result, up-to a point that it becomes feasible to formally verify (Jacobs and Piessens, 2008) the correctness of code. This proves with mathematical certainty that sensitive information will never leak to another party. While these security measures are able to provide very strong security guarantees, they are no longer binary-compatible with legacy applications. A significant effort is required to partition these applications in a security sensitive and insensitive part. Moreover, it does not provide any availability guarantees. While malware is unable to access or modify sensitive information, it still can, for example, cause the system to freeze, preventing all parties to execute any application. 1. Root of trust Accepting the presence of kernel-level malware causes significant problems to establish a root of trust. Malware may already have infected the system before the security measure is applied. Hence, the malware could influence the security measure’s behavior or disable it altogether. For example, the kernel im- age stored on the hard drive, could have been modified to include the malicious code. To mitigate this problem, a low-cost security chip, called the Trusted Platform Module (TPM)(Trusted Computing Group, 2004) has been developed and is already shipped with most modern computers. Equipped with a slow but cheap processor and its own memory, it can be used to execute a fixed set of security-related tasks. To protect the chip itself from software attacks, it is shipped with all required software that under no circumstance can be modified. The TPM chip is designed for a few specific tasks. First, it is able to record all software that is loaded on the system. Starting at power up, a measurement of the software is calculated and stored on the chip. Every time a new pro- cess is loaded, this measurement is extended with a measurement of the loaded software including the used configuration files. This is called a Static Root of Trust Measurement (SRTM). Similarly, a new measurement can be started after the system has already booted, called a Dynamic Root of Trust Measurement (DRTM). Second, the TPM chip is able to store a very limited amount of data, called sealed storage. On storage, the data is supplied together with a mea- surement. Only when software with this specific measurement is loaded, can the data be retrieved again. Finally, the chip is able to attest to a third party that a specific version of software has executed and outputted the specified re- results. Using cryptographic functions, it can prevent malware from making false claims such as specifying a different output. Using a combination of the features directly provided by the TPM chip, strong security guarantees can be provided. Flicker(McCune et al., 2008), takes this approach. Applications are divided into security sensitive modules. Upon invocation, a new dynamic root of trust measurement is started, measuring the loaded module. This will also place the machine in an isolated state. During that time, only the module itself has control over the machine. Malware, possi- bly already present on the system, will not be executed. Hence, it is unable to access any sensitive information used by the module. After the module finished its execution, it will clear all sensitive information from memory and resume normal operation of the system. When information needs to be stored for other invocations of the same or other modules, it uses the sealed storage feature of the TPM chip. While malware is not able to modify the binary image of the module, the module must still be trusted. Subtle bugs in the module itself, may be exploited by an attacker by providing unexpected parameters. As a result, sensitive information may not be completely overwritten after the module finished its execution or an incorrect result may be provided. Hence, there is still a need to formally verify that modules behave correctly (Jacobs and Piessens, 2008). Given the very limited code size, contrary to entire monolithic kernels such as Windows and Linux, this approach is feasible. While offering strong security guarantees, the Flicker security measure still has significant drawbacks. First, isolating security-sensitive parts of an application in modules can be difficult. All accesses to sensitive information must be encapsulated in the module in such a way that the result does not reveal any information unknown to an attacker. This could be achieved by, for example, encrypting the provided result. Another difficulty is that security-sensitive functionality provided by the operating system can no longer be used by the module. Second, to reduce the cost of the TPM chip, it is equipped with a low-budget processor that is much slower than the main processor of the system. As a result, executing a module incurs a significant overhead. Moreover, to isolate the module, other code is prevented from being executed and the user can experience a momentarily freeze of the system. 2. Increasing flexibility Recent security measures (McCune et al., 2010; Sahita R, 2009) are able to significantly reduce Flicker’s drawbacks while offering the same strong security guarantees. Using virtualization techniques, an additional protection layer can be added. This hypervisor layer is even more privileged than kernel layer and can be used to protect against kernel-level malware. As usual, formal verification is required to avoid malware infecting this most privileged level. TrustVisor is an example of a security architecture that uses virtualization techniques to offer strong isolation of code and data of sensitive parts of an application. When the system is booted, a hypervisor is installed. This code executing at the highest privilege level, has two purposes. First, it is responsible to maintain binary compatibility with legacy code. Given the number and diversity of operating systems and legacy applications, any security measure that requires even minor changes to legacy software are infeasible in practice. Only applications that require use of the newly offered security guarantees should require minimal modification. Second, the hypervisor must protect memory regions used by itself or protected modules. To be able to guarantee isolation of modules, TrustVisor must prevent read and write access from malware to these memory regions from the legacy operating system or applications. Similarly, protected modules that are possibly specially crafted by an attacker must not be able access other protected modules or the implementation of the security measure itself. Using these properties, TrustVisor implements and protects software-based TPM’s, called μTPMs, to significantly increase performance. When the system is booted, the hardware TPM chip measures all loaded software. At the first execution of the security measure, a long term secret is created for the μTPMs and sealed by the TPM. For subsequent boots, only when the security measure is loaded correctly, access to the long-term secrets is granted. The μTPMs use this long-term secret to safely provide secure storage and attestation functionality without accessing the slow hardware TPM. When a security-sensitive part of an application request TPM functionality, a μTPM is accessed instead. This reduces the overhead of accessing the hardware TPM chip to the cost of crossing the kernel-hypervisor border. Since μTPMs are executed on the main processor which is significantly more performant than the low-cost hardware TPM, performance evaluation of TrustVisor shows a significant speedup compared to Flicker. III. Conclusion Recent years corporations have been looking at cloud computing as a convenient model to outsource their IT infrastructure. The key technology to enable this is virtualization. It allows the execution of several virtualized machines on the same physical hardware decreasing the cost of maintenance, power consumption and required infrastructure. Virtualization, when supported by hardware, also comes with important features that can be used to implement strong security measures such as isolation and a low performance overhead. In this paper we described two distinct active security research tracks. First, as a use case, we presented Hello Rootkitty, a lightweight security measure that mitigates the problem of kernel level rootkits. Upon detection of malware Hello Rootkitty alerts the administrator of the virtual machine and, in some cases, proceeds to repair the compromised kernel. This security measure has been implemented within a hypervisor. Using virtualization techniques, it doesn’t require any modification of the target kernel nor of any legacy user application. Moreover performance overhead is low enough to be applicable to a large spectrum of systems. Although it significantly elevates security, it can’t guarantee full isolation of applications and can leave sensitive information unprotected. Secondly, we described recent results of another active research track that focuses on provable protection of sensitive information. The core idea of security measures in this research field, is to partition target applications into a security sensitive and an insensitive part. This is achieved by modifying the target application according to a detailed application specific functional analysis. For most use cases a significant effort is required. Moreover to achieve complete isolation from malware, a root of trust needs to be established by supported hardware. Most countermeasures originating from these two research tracks are complementary. Strong isolation of sensitive information and availability guarantees can be provided, even when multiple, possibly malicious, parties are executing on the same platform, as is the case of cloud computing. Acknowledgements: This research is partially funded by the Interuniversity Attraction Poles Programme Belgian State, Belgian Science Policy, IBBT, the Research Fund KU Leuven, the Flemish agency for Innovation by Science and Technology (IWT) and EU FP7 project NESSoS. References: ALEPH ONE (1996), ‘Smashing the stack for fun and profit’, Phrack magazine 7(49). URL: http://www.phrack.com/issues.html?issue=49&id=14 URL: http://www4.ncsu.edu/~amazab/SICE-CCS11.pdf URL: http://doi.acm.org/10.1145/1899928.1899945 DOLAN-GAVITT, BRENDA AND SRIVASTAVA, ABHINAV AND TRAYNOR, PATRICK AND GIFFIN, JONATHAN (2009), Robust signatures for kernel data structures, in ‘Proceedings of CCS ’09’. MARTIM CARBONE AND WENKE LEE AND WEIDONG CUI AND MARCUS PEINADO AND LONG LU AND XUXIAN JIANG (2009), Mapping kernel objects to enable systematic integrity checking, in ‘In ACM Conf. on Computer and Communications Security’. WANG, ZHI AND JIANG, XUXIAN AND CUI, WEIDONG AND NING, PENG (2009), Countering kernel rootkits with lightweight hook protection, in ‘Proceedings of CCS ’09’.
{"Source-Url": "https://core.ac.uk/download/pdf/34526727.pdf", "len_cl100k_base": 5129, "olmocr-version": "0.1.50", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 23585, "total-output-tokens": 7009, "length": "2e12", "weborganizer": {"__label__adult": 0.0004451274871826172, "__label__art_design": 0.0004436969757080078, "__label__crime_law": 0.0012159347534179688, "__label__education_jobs": 0.0005507469177246094, "__label__entertainment": 0.00013184547424316406, "__label__fashion_beauty": 0.00019502639770507812, "__label__finance_business": 0.0005130767822265625, "__label__food_dining": 0.0003485679626464844, "__label__games": 0.0008511543273925781, "__label__hardware": 0.01039886474609375, "__label__health": 0.0008153915405273438, "__label__history": 0.0002994537353515625, "__label__home_hobbies": 0.0001684427261352539, "__label__industrial": 0.0008368492126464844, "__label__literature": 0.00026488304138183594, "__label__politics": 0.0003762245178222656, "__label__religion": 0.0004761219024658203, "__label__science_tech": 0.45361328125, "__label__social_life": 0.00010579824447631836, "__label__software": 0.04034423828125, "__label__software_dev": 0.486572265625, "__label__sports_fitness": 0.0002491474151611328, "__label__transportation": 0.0005826950073242188, "__label__travel": 0.00018143653869628904}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 30207, 0.01729]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 30207, 0.4766]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 30207, 0.89773]], "google_gemma-3-12b-it_contains_pii": [[0, 2812, false], [2812, 5655, null], [5655, 8632, null], [8632, 11404, null], [11404, 12945, null], [12945, 15963, null], [15963, 18995, null], [18995, 21882, null], [21882, 24855, null], [24855, 26812, null], [26812, 28966, null], [28966, 30207, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2812, true], [2812, 5655, null], [5655, 8632, null], [8632, 11404, null], [11404, 12945, null], [12945, 15963, null], [15963, 18995, null], [18995, 21882, null], [21882, 24855, null], [24855, 26812, null], [26812, 28966, null], [28966, 30207, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 30207, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 30207, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 30207, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 30207, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 30207, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 30207, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 30207, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 30207, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 30207, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 30207, null]], "pdf_page_numbers": [[0, 2812, 1], [2812, 5655, 2], [5655, 8632, 3], [8632, 11404, 4], [11404, 12945, 5], [12945, 15963, 6], [15963, 18995, 7], [18995, 21882, 8], [21882, 24855, 9], [24855, 26812, 10], [26812, 28966, 11], [28966, 30207, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 30207, 0.0]]}
olmocr_science_pdfs
2024-11-30
2024-11-30
b03b65d394945b3bcfba1d9f327646ec95cfaaae
CS371m - Mobile Computing Persistence Storing Data • Multiple options for storing data associated with apps • Shared Preferences • Internal Storage – device memory • External Storage • SQLite Database • Network Connection Saving State • We have already seen saving app state into a Bundle on orientation changes or when an app is killed to reclaim resources but may be recreated later ```java @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); Log.d(TAG, "in onSaveInstanceState"); outState.putCharArray("board", mGame.getBoardState()); outState.putBoolean("mGameOver", mGameOver); outState.putCharSequence("info", mInfoTextView.getText()); outState.putChar("mTurn", mTurn); outState.putChar("mGoesFirst", mGoesFirst); } ``` SHARED PREFERENCES Shared Preferences • Private primitive data stored in key-value pairs • SharedPreferences Class • Store and retrieve key-value pairs of data – keys are Strings – values are Strings, Sets of Strings, boolean, float, int, or long – So, somewhat limited options • Not strictly for app preferences SharedPreferences - Several levels of preferences: - `getPreferences(int mode)` for the Activity's Preferences - name based on Activity - `getSharedPreferences(String name, int mode)` for an Application's shared preferences - multiple activities - `PreferenceManager.getDefaultSharedPreferences()` for system wide preferences Using SharedPreferences • Obtain a SharedPreferences object for application using these methods: – getSharedPreferences(String name, int mode) – getPreferences(int mode) ```java // restore the scores and difficulty SharedPreferences mPrefs = getSharedPreferences("ttt_prefs", MODE_PRIVATE); mHumanWins = mPrefs.getInt("mHumanWins", 0); mComputerWins = mPrefs.getInt("mComputerWins", 0); mTies = mPrefs.getInt("mTies", 0); mGame.setDifficultyLevel(TicTacToeGame.DifficultyLevel.values()[mPrefs.getInt("mDifficulty", 0)]); ``` Writing to SharedPreferences • After obtaining SharedPreferences object: – call edit() method on object to get a SharedPreferences.Editor object – place data by calling put methods on the SharedPreferences.Editor object – also possible to clear all data or remove a particular key Limited Data Types for SharedPreferences <table> <thead> <tr> <th>Method</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td>putBoolean(String key, boolean value)</td> <td>Set a boolean value in the preferences editor, to be written</td> </tr> <tr> <td>putFloat(String key, float value)</td> <td>Set a float value in the preferences editor, to be written</td> </tr> <tr> <td>putInt(String key, int value)</td> <td>Set an int value in the preferences editor, to be written</td> </tr> <tr> <td>putLong(String key, long value)</td> <td>Set a long value in the preferences editor, to be written</td> </tr> <tr> <td>putString(String key, String value)</td> <td>Set a String value in the preferences editor, to be written</td> </tr> <tr> <td>putStringSet(String key, Set&lt;String&gt; values)</td> <td>Set a set of String values in the preferences editor, to be written</td> </tr> </tbody> </table> Writing to SharedPreferences • When done writing data via the editor call either apply() or commit() • apply() is the simpler method – used when only one process expected to write to the preferences object • commit() returns a boolean if write was successful – for when multiple process may be writing to preferences – blocking operation, so use sparingly or in thread off of the UI thread to avoid ANR Reading From Shared Preferences • After obtaining SharedPreferences object use various get methods to retrieve data • Provide key (string) and default value if key is not present • get Boolean, Float, Int, Long, String, StringSet • getAll() returns Map<String, ?> with all of the key/value pairs in the preferences Shared Preferences File • Stored as XML ```xml <?xml version='1.0' encoding='utf-8' standalone='yes' ?> <map> <string name="victory_message">Excellent</string> <int name="board_color" value="-65528" /> <int name="mTies" value="6" /> <string name="difficulty_level">Harder</string> <int name="mComputerWins" value="1" /> <int name="mDifficulty" value="1" /> <int name="mHumanWins" value="9" /> </map> ``` Preference Activity • An Activity framework to allow user to select and set preferences for your app • tutorial 6 has an example – difficulty, sound, color, victory message • Main Activity can start a preference activity to allow user to set preferences • Current standard is to use a PreferenceFragment instead INTERNAL STORAGE Internal Storage • Private data stored on device memory – not part of apk • More like traditional file i/o – in fact not that different from Java I/O • by default files are private to your application – other apps cannot access directly – recall content providers to share data with other apps • files removed when app is uninstalled Internal Storage • To create and write a private file to the device internal storage: • call openFileOutput(String name, int mode) – method inherited from Context – file created if does not already exist – returns FileOutputStream object • regular Java class • Modes include: MODE_APPEND, MODE_PRIVATE deprecated: MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE Writing to Files • FileOutputStream writes raw bytes – arrays of bytes or single bytes • Much easier to wrap the FileOutputStream in PrintStream object ```java public void writeFile(View v) { try { FileOutputStream fos = openFileOutput("sampleData", MODE_PRIVATE); PrintStream writer = new PrintStream(fos); Random r = new Random(); for (int i = 0; i < 1000; i++) { writer.println(r.nextInt()); } writer.close(); } catch (FileNotFoundException e) { Log.d(TAG, "Exception trying to open file: " + e); } } ``` Reading from Files • files saved to device – data directory for app • call `openFileInput(String name)` method to obtain a `FileInputStream` • `FileInputStream` reads bytes – for convenience may connect to `Scanner` object or wrap in a `DataInputStream` object Static Files • If you need or have a file with a lot of data at compile time: – create and save file in project res/raw/ directory – open file using the openRawResource(int id) method and pass the R.raw.id of file – returns an InputStream to read from file – cannot write to the file, part of the apk Cache Files • If need to cache data for application instead of storing persistently: – call `getCacheDir()` method to obtain a File object that is a directory where you can create and save temporary cache files – files may be deleted by Android later if space needed but you should clean them up on your own – recommended to keep under 1 MB Internal Files - Other Useful Methods • All of these are inherited from Context • File getFileDir() – get absolute path to filesystem directory where app files are saved • File getDir(String name, int mode) – get and create if necessary a directory for files • boolean deleteFile(String name) – get rid of files, especially cache files • String[] fileList() – get an array of Strings with files associated with Context (application) EXTERNAL FILES External Storage • Public data stored on shared external storage • may be removable SD (Secure Digital) card or internal, non-removable storage • files saved to external storage are world-readable • files may be unavailable when device mounts external storage to another system • files may be modified by user when they enable USB mass storage for device • request WRITE_EXTERNAL_STORAGE permission in manifest Checking Media Availability • Call Environment.getExternalStorageState() method to determine if media available – may be mounted to computer, missing, read-only or in some other state that prevents accessing Checking Media State ```java boolean mExternalStorageAvailable = false; boolean mExternalStorageWriteable = false; String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { // We can read and write the media mExternalStorageAvailable = mExternalStorageWriteable = true; } else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) { // We can only read the media mExternalStorageAvailable = true; mExternalStorageWriteable = false; } else { // Something else is wrong. It may be one of many other states, // to know is we can neither read nor write mExternalStorageAvailable = mExternalStorageWriteable = false; } ``` - other states such as media being shared, missing, and others Accessing Files on External Storage • call getExternalFilesDir(String type) to obtain a directory (File object) to get directory to save files • type is String constant from Environment class – DIRECTORY_ALARM, DIRECTORY_DCIM (Digital Camera Images), DIRECTORY_DOWNLOADS, DIRECTORY_MOVIES, DIRECTORY_MUSIC, DIRECTORY_NOTIFICATIONS, DIRECTORY_PICTURES, DIRECTORY_PODCASTS, DIRECTORY_RINGTONES External File Directory • If not a media file then send `null` as parameter to `getExternalFilesDir()` method • The `DIRECTORY_<TYPE>` constants allow Android's Media Scanner to categorize files in the system • External files associated with application are deleted when application uninstalled External Data Shared Files • If you want to save files to be shared with other apps: • save the files (audio, images, video, etc.) to one of the public directories on the external storage device • Environment.getExternalStoragePublicDirectory(String type) method returns a File object which is a directory • same types as getExternalFilesDir method Sharing Data • Example: – In the random art app – add a button to save images – if we want images to show up with other "images" save to the DIRECTORY_PICTURES directory – now, other apps can view / use these images via the media scanner – NOT deleted when app deleted private void showDirs() { for (String type : types) { File dir = Environment.getExternalStoragePublicDirectory(type); Log.d(TAG, "type: " + type + ", dir: " + dir); File[] files = dir.listFiles(); if (files != null) for (File f : dir.listFiles()) Log.d(TAG, f + ""); } } <table> <thead> <tr> <th>PTest</th> <th>type: Alarms, dir: /mnt/sdcard/Alarms</th> </tr> </thead> <tbody> <tr> <td>PTest</td> <td>type: DCIM, dir: /mnt/sdcard/DCIM</td> </tr> <tr> <td>PTest</td> <td>/mnt/sdcard/DCIM/.thumbnails</td> </tr> <tr> <td>PTest</td> <td>/mnt/sdcard/DCIM/100ANDRO</td> </tr> <tr> <td>PTest</td> <td>type: Download, dir: /mnt/sdcard/Download</td> </tr> <tr> <td>PTest</td> <td>type: Movies, dir: /mnt/sdcard/Movies</td> </tr> <tr> <td>PTest</td> <td>type: Music, dir: /mnt/sdcard/Music</td> </tr> <tr> <td>PTest</td> <td>/mnt/sdcard/Music/Susan Boyle - Amazing grace.mp3</td> </tr> <tr> <td>PTest</td> <td>/mnt/sdcard/Music/Rem - Losing My Religion.mp3</td> </tr> <tr> <td>PTest</td> <td>type: Notifications, dir: /mnt/sdcard/Notifications</td> </tr> <tr> <td>PTest</td> <td>type: Pictures, dir: /mnt/sdcard/Pictures</td> </tr> <tr> <td>PTest</td> <td>type: Podcasts, dir: /mnt/sdcard/Podcasts</td> </tr> <tr> <td>PTest</td> <td>type: Ringtones, dir: /mnt/sdcard/Ringtones</td> </tr> </tbody> </table> OBJECT SERIALIZATION Clicker • What is Object Serialization? A. Giving a number to object for sorting B. Converting object to a byte stream C. Searching for objects D. Converting Object to a file E. Reading Objects from files Object Serialization • Taking a runtime data structure or object and converting it to a form that can be stored and / or transmitted – converted to a byte stream • store the object in between program runs • transmit the object over a network • store the data, **not the methods / ops** – **not the class definition** Object Serialization runtime Object ArrayList<Integer> serialization Secondary Storage / Network deserialization runtime Object ArrayList<Integer> Serialization - Why? • Could just do it by hand – write out fields and structure to file – read it back in • Serialization provides an abstraction in place of the "by hand" approach • Much less code to write • Example, Java has a specification for serializing objects – little effort on your part Serialization in Java • java.io.Serializable interface • Here are the methods in the Serializable interface: • Really, that's it • A TAG interface • A way for a class to mark that is Serializable Serialization in Java java.util **Class ArrayList<E>** java.lang.Object java.util.AbstractCollection<E> java.util.AbstractList<E> java.util.ArrayList<E> **All Implemented Interfaces:** - Serializable - Cloneable - Iterable<E> - Collection<E> - List<E> - RandomAccess **Direct Known Subclasses:** - AttributeList - RoleList - RoleUnresolvedList Serialization in Java • Data is serialized, not the class definition • Program that deserializes must have the class definition • Use an ObjectOutputStream object to write out Serializable objects – serialize, deflate, flatten, dehydrate, marshal • Later, use an ObjectInputStream to read in Serializable objects – deserialize, inflate, unflatten, hydrate, unmarshal ObjectOutputStream Example • from CS307 / CS314 • Evil Hangman test cases • play the game and test student results • for each guess we want the patterns and the number of words in each pattern — Map<String, Integer> ObjectOutputStream Example Create tests ```java private static final String DICTIONARY_FILE = "dictionary.txt"; private static final int NUM_TESTS = 13; private static final String OUTPUT_FILE = "evilGraderTests.eht" public static void main(String[] args) { try { ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream(new File(OUTPUT_FILE))); // make guesses and write results for (int i = 0; i < guesses.length(); i++) { char guess = guesses.charAt(i); Map<String, Integer> result = hm.makeGuess(guess); os.writeObject(result); os.writeInt(hm.numWordsCurrent()); os.writeObject(hm.getPattern()); } } } ``` - LATER FOR EACH GUESS - data methods (writeInt, ...) for primitives ObjectOutputStream writeObject public final void writeObject(Object obj) throws IOException Parameters: obj - the object to be written Throws: InvalidClassException - Something is wrong with a class used by serialization. NotSerializableException - Some object to be serialized does not implement the java.io.Serializable interface. IOException - Any exception thrown by the underlying OutputStream. ObjectOutputStream Data Methods <table> <thead> <tr> <th>Method Type</th> <th>Method Name</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td>void</td> <td><code>writeDouble(double val)</code></td> <td>Writes a 64 bit double.</td> </tr> <tr> <td>void</td> <td><code>writeFields()</code></td> <td>Write the buffered fields to the stream.</td> </tr> <tr> <td>void</td> <td><code>writeFloat(float val)</code></td> <td>Writes a 32 bit float.</td> </tr> <tr> <td>void</td> <td><code>writeInt(int val)</code></td> <td>Writes a 32 bit int.</td> </tr> <tr> <td>void</td> <td><code>writeLong(long val)</code></td> <td>Writes a 64 bit long.</td> </tr> </tbody> </table> - ... and others ObjectInputStream • When ready to run tests ```java ObjectInputStream reader = new ObjectInputStream(new FileInputStream(new File("TEST_FILE_NAME"))); int numMines = reader.readInt(); ``` • Make the guesses ```java for(int i = 0; i < actualGuesses.length(); i++) { char ch = actualGuesses.charAt(i); System.out.println("\nRound Number: " + roundNumber); // read in expected results Map<String, Integer> expectedMap = (Map<String, Integer>) reader.readObject(); ``` Externalizable • A sub-interface of Serializable • Gives more control over the format of the serialization to the class itself • Two methods: <table> <thead> <tr> <th>Modifier and Type</th> <th>Method and Description</th> </tr> </thead> <tbody> <tr> <td>void</td> <td>readExternal(ObjectInput in)</td> </tr> <tr> <td></td> <td>The object implements the readExternal method to restore its contents by calling the</td> </tr> <tr> <td></td> <td>methods of DataInput for primitive types and readObject for objects, strings and arrays.</td> </tr> <tr> <td>void</td> <td>writeExternal(ObjectOutput out)</td> </tr> <tr> <td></td> <td>The object implements the writeExternal method to save its contents by calling the</td> </tr> <tr> <td></td> <td>methods of DataOutput for its primitive values or calling the writeObject method of</td> </tr> <tr> <td></td> <td>ObjectOutput for objects, strings, and arrays.</td> </tr> </tbody> </table> Externalizable • ObjectOutputStream will test if object is Serializable — if not, throws an exception • Then tests if Externalizable — if so calls the writeExternal method on the object — if not, uses default specification for serialization PARCEL AND PARCELABLE Bundles Again • What can you add to Bundles? • Recall Bundles sent to onCreate when restoring an Activity • Bundles attached to Intents • put – Bundle, byte, char, CharSequence (includes String), float, Parcelable, Serializable, short, Size (width and height) – arrays and ArrayLists of some of those types Parcelable? • **Parcel:** - Android class for sending data via IPC - Inter Process Communication - Send an object (data) from one process to another • Generally faster (at run time) than **Serializable** - long term storage vs. short term storage Parcelable - interface - have class implement interface - implement writeToParcel method - not just a Tag interface - writes current state of object to Parcel - void writeToParcel (Parcel dest, int flags) - add a static field named CREATOR to class - object that implements Parcelable.Creator interface public class MyParcelable implements Parcelable { private int mData; public int describeContents() { return 0; } public void writeToParcel(Parcel out, int flags) { out.writeInt(mData); } public static final Parcelable.Creator<MyParcelable> CREATOR = new Parcelable.Creator<MyParcelable>() { public MyParcelable createFromParcel(Parcel in) { return new MyParcelable(in); } public MyParcelable[] newArray(int size) { return new MyParcelable[size]; } }; private MyParcelable(Parcel in) { mData = in.readInt(); } } OTHER STORAGE OPTIONS SQLite Database • Structured data stored in a private database • More on this next lecture Network Connection • Store data on web with your own network server • Use wireless or carrier network to store and retrieve data on web based server • classes from java.net and android.net
{"Source-Url": "http://www.cs.utexas.edu/~scottm/cs371m/Handouts/Slides/12_Persistence.pdf", "len_cl100k_base": 4552, "olmocr-version": "0.1.53", "pdf-total-pages": 55, "total-fallback-pages": 0, "total-input-tokens": 68566, "total-output-tokens": 6226, "length": "2e12", "weborganizer": {"__label__adult": 0.0003924369812011719, "__label__art_design": 0.00018036365509033203, "__label__crime_law": 0.0002211332321166992, "__label__education_jobs": 0.0011911392211914062, "__label__entertainment": 5.143880844116211e-05, "__label__fashion_beauty": 0.0001348257064819336, "__label__finance_business": 7.855892181396484e-05, "__label__food_dining": 0.00029754638671875, "__label__games": 0.0006670951843261719, "__label__hardware": 0.001861572265625, "__label__health": 0.00026154518127441406, "__label__history": 0.00015544891357421875, "__label__home_hobbies": 9.256601333618164e-05, "__label__industrial": 0.00028133392333984375, "__label__literature": 0.00015234947204589844, "__label__politics": 0.00014281272888183594, "__label__religion": 0.000392913818359375, "__label__science_tech": 0.003025054931640625, "__label__social_life": 0.00010156631469726562, "__label__software": 0.005023956298828125, "__label__software_dev": 0.984375, "__label__sports_fitness": 0.000301361083984375, "__label__transportation": 0.00049591064453125, "__label__travel": 0.00018608570098876953}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 18900, 0.00294]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 18900, 0.4933]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 18900, 0.67805]], "google_gemma-3-12b-it_contains_pii": [[0, 39, false], [39, 234, null], [234, 819, null], [819, 838, null], [838, 1139, null], [1139, 1478, null], [1478, 2009, null], [2009, 2297, null], [2297, 3004, null], [3004, 3414, null], [3414, 3730, null], [3730, 4150, null], [4150, 4463, null], [4463, 4480, null], [4480, 4823, null], [4823, 5192, null], [5192, 5784, null], [5784, 6050, null], [6050, 6360, null], [6360, 6708, null], [6708, 7150, null], [7150, 7165, null], [7165, 7577, null], [7577, 7790, null], [7790, 8550, null], [8550, 8946, null], [8946, 9244, null], [9244, 9600, null], [9600, 9880, null], [9880, 10219, null], [10219, 10963, null], [10963, 10984, null], [10984, 11190, null], [11190, 11512, null], [11512, 11664, null], [11664, 11968, null], [11968, 12166, null], [12166, 12529, null], [12529, 12901, null], [12901, 13120, null], [13120, 13927, null], [13927, 14359, null], [14359, 15132, null], [15132, 15132, null], [15132, 15630, null], [15630, 16773, null], [16773, 17022, null], [17022, 17044, null], [17044, 17356, null], [17356, 17613, null], [17613, 17929, null], [17929, 18597, null], [18597, 18619, null], [18619, 18711, null], [18711, 18900, null]], "google_gemma-3-12b-it_is_public_document": [[0, 39, true], [39, 234, null], [234, 819, null], [819, 838, null], [838, 1139, null], [1139, 1478, null], [1478, 2009, null], [2009, 2297, null], [2297, 3004, null], [3004, 3414, null], [3414, 3730, null], [3730, 4150, null], [4150, 4463, null], [4463, 4480, null], [4480, 4823, null], [4823, 5192, null], [5192, 5784, null], [5784, 6050, null], [6050, 6360, null], [6360, 6708, null], [6708, 7150, null], [7150, 7165, null], [7165, 7577, null], [7577, 7790, null], [7790, 8550, null], [8550, 8946, null], [8946, 9244, null], [9244, 9600, null], [9600, 9880, null], [9880, 10219, null], [10219, 10963, null], [10963, 10984, null], [10984, 11190, null], [11190, 11512, null], [11512, 11664, null], [11664, 11968, null], [11968, 12166, null], [12166, 12529, null], [12529, 12901, null], [12901, 13120, null], [13120, 13927, null], [13927, 14359, null], [14359, 15132, null], [15132, 15132, null], [15132, 15630, null], [15630, 16773, null], [16773, 17022, null], [17022, 17044, null], [17044, 17356, null], [17356, 17613, null], [17613, 17929, null], [17929, 18597, null], [18597, 18619, null], [18619, 18711, null], [18711, 18900, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 18900, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 18900, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 18900, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 18900, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 18900, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 18900, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 18900, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 18900, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 18900, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 18900, null]], "pdf_page_numbers": [[0, 39, 1], [39, 234, 2], [234, 819, 3], [819, 838, 4], [838, 1139, 5], [1139, 1478, 6], [1478, 2009, 7], [2009, 2297, 8], [2297, 3004, 9], [3004, 3414, 10], [3414, 3730, 11], [3730, 4150, 12], [4150, 4463, 13], [4463, 4480, 14], [4480, 4823, 15], [4823, 5192, 16], [5192, 5784, 17], [5784, 6050, 18], [6050, 6360, 19], [6360, 6708, 20], [6708, 7150, 21], [7150, 7165, 22], [7165, 7577, 23], [7577, 7790, 24], [7790, 8550, 25], [8550, 8946, 26], [8946, 9244, 27], [9244, 9600, 28], [9600, 9880, 29], [9880, 10219, 30], [10219, 10963, 31], [10963, 10984, 32], [10984, 11190, 33], [11190, 11512, 34], [11512, 11664, 35], [11664, 11968, 36], [11968, 12166, 37], [12166, 12529, 38], [12529, 12901, 39], [12901, 13120, 40], [13120, 13927, 41], [13927, 14359, 42], [14359, 15132, 43], [15132, 15132, 44], [15132, 15630, 45], [15630, 16773, 46], [16773, 17022, 47], [17022, 17044, 48], [17044, 17356, 49], [17356, 17613, 50], [17613, 17929, 51], [17929, 18597, 52], [18597, 18619, 53], [18619, 18711, 54], [18711, 18900, 55]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 18900, 0.08776]]}
olmocr_science_pdfs
2024-12-07
2024-12-07
d2868ca0ea29caf1111c066f8d3ed47bf9dd5a33
[REMOVED]
{"Source-Url": "http://geneura.ugr.es/~pgarcia/papers/2010/OSGI-NICSO/osgi-NICSO-10.pdf", "len_cl100k_base": 4453, "olmocr-version": "0.1.51", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 25607, "total-output-tokens": 6270, "length": "2e12", "weborganizer": {"__label__adult": 0.00030803680419921875, "__label__art_design": 0.00029778480529785156, "__label__crime_law": 0.0003826618194580078, "__label__education_jobs": 0.0005855560302734375, "__label__entertainment": 7.224082946777344e-05, "__label__fashion_beauty": 0.00015342235565185547, "__label__finance_business": 0.00029778480529785156, "__label__food_dining": 0.0003132820129394531, "__label__games": 0.0005421638488769531, "__label__hardware": 0.00101470947265625, "__label__health": 0.0005121231079101562, "__label__history": 0.00027632713317871094, "__label__home_hobbies": 8.916854858398438e-05, "__label__industrial": 0.0005784034729003906, "__label__literature": 0.00020694732666015625, "__label__politics": 0.0003094673156738281, "__label__religion": 0.00047850608825683594, "__label__science_tech": 0.065673828125, "__label__social_life": 0.00010007619857788086, "__label__software": 0.01313018798828125, "__label__software_dev": 0.91357421875, "__label__sports_fitness": 0.0003628730773925781, "__label__transportation": 0.0006875991821289062, "__label__travel": 0.000232696533203125}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 25847, 0.04619]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 25847, 0.30906]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 25847, 0.88881]], "google_gemma-3-12b-it_contains_pii": [[0, 2052, false], [2052, 4184, null], [4184, 7191, null], [7191, 9837, null], [9837, 11635, null], [11635, 13632, null], [13632, 15280, null], [15280, 17506, null], [17506, 18736, null], [18736, 21018, null], [21018, 23604, null], [23604, 25847, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2052, true], [2052, 4184, null], [4184, 7191, null], [7191, 9837, null], [9837, 11635, null], [11635, 13632, null], [13632, 15280, null], [15280, 17506, null], [17506, 18736, null], [18736, 21018, null], [21018, 23604, null], [23604, 25847, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 25847, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 25847, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 25847, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 25847, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 25847, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 25847, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 25847, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 25847, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 25847, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 25847, null]], "pdf_page_numbers": [[0, 2052, 1], [2052, 4184, 2], [4184, 7191, 3], [7191, 9837, 4], [9837, 11635, 5], [11635, 13632, 6], [13632, 15280, 7], [15280, 17506, 8], [17506, 18736, 9], [18736, 21018, 10], [21018, 23604, 11], [23604, 25847, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 25847, 0.05769]]}
olmocr_science_pdfs
2024-12-04
2024-12-04
2f32ada63d70b0e106ccadb41717005805cb7203
LLVM parallel intermediate representation: design and evaluation using OpenSHMEM communications Conference Paper · January 2015 DOI: 10.1145/2833157.2833158 5 authors, including: - **Dounia Khaldi** Stony Brook University 17 PUBLICATIONS 19 CITATIONS [SEE PROFILE] - **Pierre Jouvelot** MINES ParisTech 85 PUBLICATIONS 1,546 CITATIONS [SEE PROFILE] - **François Irigoin** MINES ParisTech 137 PUBLICATIONS 1,688 CITATIONS [SEE PROFILE] - **Corinne Ancourt** MINES ParisTech 42 PUBLICATIONS 652 CITATIONS [SEE PROFILE] All content following this page was uploaded by Dounia Khaldi on 02 July 2016. The user has requested enhancement of the downloaded file. All in-text references underlined in blue are added to the original document and are linked to publications on ResearchGate, letting you access and read them immediately. ABSTRACT We extend the LLVM intermediate representation (IR) to make it a parallel IR (LLVM PIR), which is a necessary step for introducing simple and generic parallel code optimization into LLVM. LLVM is a modular compiler that can be efficiently and easily used for static analysis, static and dynamic compilation, optimization, and code generation. Being increasingly used to address high-performance computing abstractions and hardware, LLVM will benefit from the ability to handle parallel constructs at the IR level. We use SPIRE, an incremental methodology for designing the intermediate representations of compilers that target parallel programming languages, to design LLVM PIR. Languages and libraries based on the Partitioned Global Address Space (PGAS) programming model have emerged in recent years with a focus on addressing the programming challenges for scalable parallel systems. Among these, OpenSHMEM is a library that is the culmination of a standardization effort among many implementers and users of SHMEM; it provides a means to develop light-weight, portable, scalable applications based on the PGAS programming model. As a use case for validating our LLVM PIR proposal, we show how OpenSHMEM one-sided communications can be optimized via our implementation of PIR into the LLVM compiler; we illustrate two important optimizations for such operations using loop tiling and communication vectorization. Categories and Subject Descriptors D.3.4 [Processors]: Compilers 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. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from Permissions@acm.org. DOI: http://dx.doi.org/10.1145/2833157.2833158 with. Our design is the result of many trade-offs between generality and precision, abstraction and low-level concerns. On the one hand, and in particular when looking at the low-level features of the LLVM IR, one needs to be able to represent as many of the existing (and, hopefully, future) parallel constructs while minimizing the number of new concepts introduced in the parallel IR. Yet, keeping only a limited number of hardware-level notions in the IR, while good enough to deal with all parallel constructs, could entail convoluted rewritings of some high-level parallel flows. To validate the benefits of our LLVM PIR proposal on actual parallel code, we describe the application, via our PIR-equipped LLVM compiler implementation, of two optimizations on OpenSHMEM microbenchmarks and exhibit their improved run-time performance. OpenSHMEM [4] is a library interface specification that is the culmination of a unification effort among many vendors and users in the SHMEM programming community. It is designed with a chief aim of performance, exploiting support for Remote Direct Memory Access (RMA) available in modern network interconnects and thereby allowing for highly efficient data transfers. On such operations, we show the positive impact of loop tiling and communication vectorization, two optimization techniques deployed within LLVM and easily specified on PIR-encoded structures. The main contributions of this paper are: - the design of LLVM PIR, a parallel intermediate representation to be used in the LLVM compilation framework, via the application of SPIRE, a simple, parallel intermediate representation extension methodology; - the conversion of OpenSHMEM one-sided communication calls into LLVM volatile load/store operations – we use metadata to express remote processes and volatile annotations to avoid unsafe optimizations; - an implementation of LLVM PIR into the LLVM compiler, to validate SPIRE for the parsing of the parallel library OpenSHMEM and enabling important optimizations for one-sided communications using loop tiling and communication vectorization. After this introduction, we describe the LLVM compilation framework and its sequential IR, in Section 2, and provide a quick overview of OpenSHMEM. Our parallel extension proposal, LLVM PIR, is introduced in Section 3. Section 4 illustrates and discusses performance results of the application of LLVM PIR on OpenSHMEM one-sided communications. We survey existing parallel IRs in Section 5. We discuss future work and conclude in Section 6. 2. BACKGROUND In this section, we present the LLVM compiler, its intermediate representation and OpenSHMEM. 2.1 LLVM (Sequential) IR In this work, we provide a parallel version of the IR of widely-used LLVM [14] (Low-Level Virtual Machine). LLVM is an open-source compilation framework that uses an intermediate representation in Static Single Assignment (SSA) [5] form. LLVM includes multiple tools, especially Polly [7] for optimizing memory accesses. Polly [7] is a high-level loop and data-locality optimizer for LLVM. It uses the polyhedral model to analyze and optimize the memory access patterns of a program. Polly also performs classical loop transformations, especially tiling and loop fusion, to improve data locality. One motivation for using LLVM is that it has been widely used in both academia and industry. Another interesting feature of LLVM IR is that it sports a graph approach; each function is structured in LLVM as a control-flow graph (CFG). Figure 1 provides the definition of a significant subset of the sequential LLVM IR described in [15]. It is specified using Newgen [11], a Domain Specific Language for the definition of set equations from which a dedicated API is automatically generated to manipulate (creation, access, IO operations...) data structures implementing these set elements. The main components of LLVM IR are summarized in Figure 1. - A function is a list of basic blocks, which are portions of code with one entry and one exit points; the “*” symbol symbol introduces lists. - A basic block has an entry label, a list of φ nodes and a list of instructions, and ends with a terminator instruction. Instructions are included within basic blocks, which are members of a cartesian product set (noted x). Load and store instructions are members of the disjoint union set instruction (noted +). - φ nodes, which are the key elements of SSA, are used to merge the values coming from multiple basic blocks. A φ node is an assignment (represented here as a call expression) that takes as arguments an identifier and a list of pairs (value, label); it assigns to the identifier the value corresponding to the label of the block preceding the current one at run time. - Every basic block ends with a terminator, which is a control flow-altering instruction that specifies which block to execute after completion of the current one. An example of the LLVM encoding of a simple “for” loop in three basic blocks is provided in Figure 2. In the assignment to %sum.0, which uses a φ node, sum is 42 if it is the first time we enter the bb1 block (from entry) or the updated sum otherwise (from the branch bb). 2.2 OpenSHMEM OpenSHMEM offers many features for supporting Partitioned Global Address Space (PGAS)-based applications, such as (1) management of remotely-accessible variables, (2) one-sided data communication, (3) barrier and point-to-point synchronizations, (4) atomic memory operations, and (5) collective operations such as reductions. OpenSHMEM programs follow an SPMD-like style of programming where all Processing Elements (PEs) are launched at the beginning of the program. The general objective of the OpenSHMEM library is to provide explicit control over data transfers with low-latency communications. Note that, in our experiments (see Section 4), we focus on optimizing one-sided communications of OpenSHMEM, namely `shmem_put` and `shmem_get`. 3. DESIGNING LLVM PARALLEL IR In this section, we present the steps taken to extend the LLVM sequential IR to LLVM Parallel IR via the SPIRE transformation methodology. 3.1 SPIRE SPIRE [12] (for Sequential to Parallel IR Extension Methodology) is a design framework dedicated to the introduction, in a systematic manner, of parallel concepts within sequential IRs. In [13], we defined the small-step, operational semantics of the SPIRE transformation process, to formally specify how its key parallel concepts are added to existing systems. Compiler writers following SPIRE guidelines can easily include parallel traits to their IR, enabling the generation of parallel code from sequential programs or the handling of explicitly parallel programming languages. The use of SPIRE does not intend to lead to minimal parallel IR extensions but to parallel IRs as seamlessly as possible integrable within actual IRs, while handling as many parallel programming constructs as possible. Its design point provides proper trade-offs between generality, expressibility and conciseness of representation. The main parallel constructs targeted by SPIRE are (1) launching task groups of statements, which in our case corresponds to members of the `function` and `block` sets. Following SPIRE guidelines, an execution attribute is added to these sequential set definitions: ``` function’ = function x execution; block’ = block x execution; ``` The primed sets `function’` and `block’` (implementing control parallelism) represent SPIREd-up sets for the LLVM parallel IR. Of course, the ‘prime’ notation is used here for pedagogical purpose only; in practice, an execution field is added in the existing IR representation. The definition of `execution` is straightforward: ``` execution = sequential:unit + parallel:scheduling + reduced:unit; ``` where `unit` denotes a set with one single element; this encodes a simple enumeration of cases for execution. A `parallel` (resp. `reduced`) execution attribute asks for all statements in a block to be all launched in parallel, in an implicit flat fork/join (resp. left-to-right, tree-like) fashion. LLVM PIR is an extendable framework; this can be shown with the generalization of the definition for the parallel case, where scheduling properties such as dynamic or speculative are introduced. 3.3 Synchronization Synchronization behavior is a characteristic feature of the run-time properties of one statement with respect to other statements. SPIRE suggests to extend sequential intermediate representations by adding a synchronization attribute to the specification of statements. Applying these guidelines to LLVM IR yields: ``` block’’ = block’ x synchronization; instruction’ = instruction x synchronization; ``` Coordination by synchronization in parallel programs is often managed via coding patterns such as barriers, used for instance when a code fragment contains many phases of parallel execution where each phase should wait for the precedent ones to proceed. We define the synchronization set via high-level coordination characteristics useful for optimization purposes: ``` synchronization = none:unit + spawn:identifier + barrier:unit + atomic:identifier; ``` Assume `S` is the instruction with a synchronization attribute. - `none` specifies the default behavior, i.e., independent with respect to other statements, for `S`. ``` ... entry: ... sum = 42; for( i=0; i<10; i++) sum = sum + 2; ``` Figure 2: A loop in C and its LLVM intermediate representation. • spawn induces the creation of an asynchronous task \( S \), while the value of the corresponding identifier is the user-chosen number of the thread that executes \( S \). By convention, we say that spawn creates processes in the case of the message-passing and PGAS memory models, and threads, in case of the shared memory model. Since spawn impacts the flow of control of \( S \) with respect to its surrounding instructions, we see spawn as a synchronization characteristic of \( S \). • barrier specifies that all the children threads spawned by the execution of \( S \) are suspended before exiting until they are all finished. • atomic predicates the execution of \( S \) to the acquisition of a lock to ensure exclusive access; at any given time, \( S \) can be executed by only one thread. Locks are logical memory addresses, represented here by a member of the LLVM IR identifier set. 3.4 Data Distribution The ability of handling the various memory models used by parallel languages is an important issue when designing a generic intermediate representation. One currently considers there are three main parallel memory models: shared, message passing and, more recently, PGAS. This last model, which appears in languages such as CAF [18], Chapel [3], OpenSHMEM [4] and X10 [2], introduces various new notions such as image, place or locale to label portions of a logically-shared memory that processes may access, in addition to complex APIs for distributing data over these portions. 3.4.1 Memory Model SPIRE is able to handle all three memory models using specific memory information, namely private, shared and PGAS. Each process has its own private memory; the address of a shared variable refers, within each thread, to the same physical memory location; PGAS memory is distributed evenly among different processes. In this last case, e.g., in OpenSHMEM and CAF, all processes have their own view of PGAS memory. To handle memory information, SPIRE extends the definition of the storage feature of identifiers by specifying where a given identifier is stored, i.e., within private, shared or PGAS memory. For LLVM IR, this leads to adding a location domain to the identifier domain: \[ \text{identifier'} = \text{identifier} \times \text{location}; \] \[ \text{location} = \text{private:unit} + \text{shared:unit} + \text{pgas:unit}; \] We show below two examples related to memory in \( \text{PGAS} \) location. First, in CAF, coarrays, which are data entities that can be directly referenced or defined by any image and may be a scalar or an array, are PGAS arrays. A coarray has codimensions, which specify the image to which it belongs. In the following example, the \( \text{dest} \) coarray of 20 elements will be visible and accessible remotely by all images. \[ \text{integer(len=20) :: dest[*]} \] Our second example shows an OpenSHMEM statement allocating \( \text{dest} \), which is also remotely accessible by all PEs. dest = (int*)shmalloc(sizeof(int)*20); 3.4.2 One-Sided Memory Access In one-sided communications, only the source or destination process participates in asynchronous memory accesses, decoupling thus data transfer and synchronization. To account for the explicit distribution required by the PGAS memory model used in parallel languages such as CAF or libraries such as OpenSHMEM, SPIRE extends the traditional semantics of memory accesses and assignments. Since the information needed for specifying remote accesses is already present in the location domain of identifiers, there is no need to gather again this information. Put operations copy data from a local source memory area to a memory area of the remote target (get and put are dual operations). The following function call in OpenSHMEM: \[ \text{shmem_int_put(dest, src, 20, pe)}; \] can be represented in LLVM PIR, using here a C-like language notation, by: \[ \begin{align*} \text{for}(i=0; \ i<20; \ i++) \\ \text{dest}[pe][i] &= \text{src}[i]; \end{align*} \] where location of dest is \( \text{PGAS} \). The identifier domain is extended to handle expressions in the left hand side of assignments. Note that, in our case, at the code generation phase (after optimizations), this loop of assignments is transformed back to the OpenSHMEM library call \( \text{shmem_int_put(dest, src, 20, pe)} \). 3.5 Intrinsics In SPIRE, the goal is to design minimalist but general enough parallel IRs to handle as many parallel programming constructs as possible. For some constructs such as two-sided communications and point-to-point synchronization, SPIRE suggests to introduce intrinsic functions to handle them as in the following. 3.5.1 Two-Sided Memory Access In order to take into account the explicit distribution required by the message passing memory model used in parallel languages such as MPI, SPIRE introduces the send and recv blocking functions for implementing communication between processes: \[ \begin{align*} \text{void send(int dest, identifier buf) transfers} \\ & \quad \text{the value of identifier buf to the process numbered dest}; \end{align*} \] \[ \begin{align*} \text{void recv(int source, identifier buf), in a} \\ & \quad \text{dual fashion, receives in buf the value sent by the process numbered source}. \end{align*} \] Non-blocking communications can be implemented within the SPIRE methodology by using the above primitives within spawned statements. Also, broadcast collective communications, such as defined in MPI, can be seen as wrappers around send and recv operations. When the master process and receiver processes want to perform a broadcast function, then, if this process is the master, its broadcast operation is equivalent to a loop over receivers, with a call to send as body; otherwise (receiver), the broadcast is a recv function. Note that, in our case, after the optimization phases of the LLVM compiler, at the backend stage, runtime library calls are generated to take advantage of the support for optimized lower-level communication functions provided via OpenSHMEM. 3.5.2 Event API: Point-to-Point Synchronization In parallel code, one usually distinguishes between two types of synchronization: (1) collective synchronization between threads using barriers, handled in LLVM PIR via the synchronization patterns above, and (2) point-to-point synchronization between participating threads. Handling point-to-point synchronization using decorations on abstract syntax trees or control-flow graphs is too constraining when one has to deal with a varying set of threads that may belong to different parallel parent nodes. Thus, SPIRE suggests to deal with this last class of coordination by introducing new values, of type event. Thus, to handle point-to-point synchronization, the underlying type system of LLVM IR is extended with a new basic type, namely event: \[ type' = type + event:\text{unit}; \] Values of type event are counters, in a manner reminiscent of semaphores [6]. The programming interface for events is defined by the following functions: - \text{event newEvent(int i)} creates an event, initialized with the integer \(i\) that specifies how many threads can execute \text{wait} on this event without being blocked; - \text{void signal(event e)} increments by one the event value of \(e\); - \text{void wait(event e)} blocks the thread that calls it until the value of \(e\) is strictly greater than 0. When the thread is released, this value is decremented by one. Note that the \text{void} return type can be replaced by \text{int} in practice, to enable the handling of error values, and that a \text{free} function may be needed in some languages. Representing high-level point-to-point synchronization features such as phasers and futures using low-level functions on events constitutes a trade-off between generality and conciseness. One can represent any type of synchronization via the low-level interface using events: of course, this way, one may lose some of the expressiveness and precision of these high-level constructs such as the deadlock-freedom safety property of phasers [19]. Indeed, Habanero-Java parallel code avoids deadlock by imposing that the scope of each phaser is the immediately enclosing \text{finish} statement. However, the scope of the events is less restrictive; the user can put them wherever he wants, and this may lead to deadlocks. 4. EXPERIMENTAL EVALUATION After summarizing LLVM PIR, we describe our implementation inside the LLVM compiler and the tests and optimizations enabled by our parallel IR proposal. Our goal is two-fold: (1) to show that our LLVM PIR proposal can be effectively used to encode parallel constructs, here using the PGAS memory model, and (2) to illustrate how the SPIRE approach is useful to leverage existing optimization passes present in the LLVM sequential compiler to parallel constructs. 4.1 LLVM PIR Applying SPIRE to LLVM IR, as detailed in the previous section, yields the SPIREd parallel extension of the LLVM sequential IR; LLVM PIR is summarized in Figure 3. - An execution attribute is added to function and block: a parallel basic block sees all its instructions launched in parallel (in a fork/join manner), while all the blocks of a parallel function are seen as parallel tasks to be executed concurrently. - A synchronization attribute is added to instruction: hence, an instruction can be annotated with \text{spawn}, \text{barrier} or \text{atomic} synchronization attributes. When one wants to deal with a sequence of instructions, this sequence is first enclosed in a block to which synchronization is added. Besides, as LLVM provides a set of intrinsic functions [14], SPIRE functions \text{newEvent}, \text{signal} and \text{wait} for handling point-to-point synchronization are added to this set. - \text{send} and \text{recv} functions for handling data distribution are also seen as intrinsics. Moreover, \text{pgas} variables are introduced in LLVM PIR by enriching the \text{identifier} domain with location information. One-sided communications are represented by adding \text{expression} to \text{load (RMA get)} and \text{store (RMA put)} instructions. \[ \begin{align*} \text{function'} &= \text{function x execution}; \\ \text{block'} &= \text{block x execution x synchronization}; \\ \text{instruction'} &= \text{instruction x synchronization}; \\ \text{load'} &= \text{load x expression}; \\ \text{store'} &= \text{store x expression}; \\ \text{identifier'} &= \text{identifier x location}; \\ \text{type'} &= \text{type + event:\text{unit}}; \end{align*} \] Figure 3: SPIRE (LLVM IR), i.e., LLVM PIR 4.2 LLVM PIR Implementation Since LLVM IR encodes code information using only low-level operations, our goal was to reuse existing low-level operations to implement the concepts presented in Figure 3. As a use case for testing our LLVM PIR proposal, we looked in detail at the issue of OpenSHMEM one-sided communication optimization, via the middle-end optimization layer of LLVM. SPIRE suggests to represent the one-sided communication primitives of OpenSHMEM in LLVM IR by (remote) memory load/store operations. The goal of our implementation was to make minimal changes to LLVM IR. Thus, we used existing functionalities in LLVM IR to represent the RMAs of OpenSHMEM, namely load/store operations, metadata and volatile memory accesses. We implemented the \text{location} domain information as annotations on the IR nodes, using LLVM metadata, which is a simple string added to LLVM IR nodes. LLVM provides the possibility to mark memory accesses as volatile. In this case, the LLVM optimizer must not change the number of volatile operations or change their order of execution relative to other volatile operations. In our implementation, we made use of this concept and we marked remote memory accesses (both read and write) as volatile to avoid unsafe optimizations, especially dead code elimination. However, safe optimizations such as loop unrolling can be applied by the LLVM optimizer. This whole transformation process allows the middle-end optimization phases of LLVM and Polly to identify and optimize communications in OpenSHMEM, seen as "simple" load/store operations and not opaque function calls. We only had to extend the LLVM backend to generate the one-sided put/get calls `shmem_put` and `shmem_get` to be executed by the OpenSHMEM runtime. Note that at run time, two successive OpenSHMEM put/get operations may deliver data out of order unless a call to `shmem_fence` is introduced between the two calls. 4.3 One-Sided Communication Optimizations We use as microbenchmark [1] a single OpenSHMEM statement, namely `shmem_int_put`, between a pair of processes, while varying the size of the transmitted array. Recall that such an instruction is encoded in LLVM PIR as a loop of remote write instructions. Figure 4 shows the LLVM PIR encoding of such a statement. We ran it on the Stampede supercomputing system at Texas Advanced Computing Center (TACC), under the OpenSHMEM implementation in MVAPICH2-X [10] version 2.0b. We compiled with LLVM-3.5.0, sported the same version of Polly. As a specific case study of the benefits induced by our use of LLVM PIR, we show the impact of two optimizations: loop tiling and communication vectorization. Loop tiling permits to overlap computation and communication, while communication vectorization reduces the number of communications. 4.3.1 Loop Tiling Loop tiling is a classical sequential optimization already available in Polly. We applied loop tiling on a SPIRE-encoded OpenSHMEM program; the idea is to break down communications into successive chunk transfers using loop tiling in order to achieve high throughput. Loop tiling was performed via the unmodified LLVM middle-end optimizer module (opt), operating on the loop of (remote) memory load/store operations. We relied upon Polly, in conjunction with opt, for carrying out the polyhedral analyses and optimizations required for loop tiling. Figure 5 shows that opt extended with Polly was able to improve communication operations via tiling. This is particularly visible for large messages (≥ 2048), since we chose a tile size of 2048 (-polly-tile-sizes=2048). The MVAPICH2-X implementation already provides optimizations for small and medium message sizes. Indeed, for such messages, an intermediate buffer is used to first copy the source data of the OpenSHMEM RMA call, thus making such calls non-blocking locally. 4.3.2 Communication Vectorization We performed automatic vectorization [9] of one-sided communications, which transforms a set of load/store operations automatically into bulk put/get communications in order to minimize the number of actual communications. As a simple example, the code for N one-element transfers (so-called `fine` transfer): ```c for(i=0; i<N; i++) shmem_int_put(dest[i], src[i], 1, pe); ``` can be transformed in LLVM PIR to a bulk transfer: ```c dest[pe][0:N]=src[0:N]; ``` This assignment will be transformed again after middle-end optimizations to the run-time library call: ```c shmem_int_put(dest, src, N, pe); ``` We used LoopIdiomRecognize, which is an existing LLVM optimization that transforms simple loops of load/store operations into a non-loop format such as `memcpy`. In this work, we adapted this existing LoopIdiomRecognize LLVM pass to work on (remote) load/store operations that have the same RMA metadata (remote PE). Of course, put/get operations are generated here in lieu of `memcpy` intrinsics. Figure 6 shows the impact of communication vectorization, which reduces both message startup time and latency, thanks to our modified LoopIdiomRecognize transformation. Had we not used our SPIRE encoding, LLVM (and any other compiler) would not have been able to apply these two optimizations, since it would have considered blindly the put operation as a function call with no particular semantic. 5. RELATED WORK In this section, we review different intermediate representations in existing parallel compilers and how they handle parallel programs. Also, we review specific works done in LLVM to support PGAS languages. Syntactic approaches to parallelism expression use abstract syntax tree nodes, while adding specific parallel built-in functions. For instance, the IR of the implementation of OpenMP in GCC (GOMP) [17] extends its three-address representation, GIMPLE [16]. The OpenMP parallel directives are replaced by specific built-ins in low- and high-level GIMPLE, and additional nodes in high-level GIMPLE, such as the `__sync_fetch_and_add` built-in function for an atomic memory access addition. Similarly, Sarkar and Zhao introduce the high-level parallel IR HPIR [21] that decomposes Habanero-Java programs into region syntax trees, while maintaining additional data structures on the side: region control-flow graphs and region dictionaries. New syntax tree nodes are introduced: `AsyncRegionEntry` and `AsyncRegionExit` delimit tasks, while `FinishRegionEntry` and `FinishRegionExit` can be used in parallel sections. In this paper, the LLVM IR designed along SPIRE guidelines borrows some of the ideas used in GOMP or HPIR, but frames them in more structured settings while trying to be more language-neutral. In particular, we try to minimize the number of additional built-in functions, which have the drawback of hiding the abstract high-level structure of parallelism and affecting compiler optimization passes. The LLVM compiler supports OpenMP, but lowers all its pragmas at the front-end phase (in Clang) to runtime calls. In this work, we added specific support for the one-sided operations of OpenSHMEM in LLVM, via load/store constructs of LLVM IR. This makes it possible to apply seamlessly LLVM transformations such as loop tiling and communication vectorization to OpenSHMEM programs. Finally, our work is among the current efforts to uniformly optimize PGAS programs using the LLVM infrastructure. There have been other works to optimize PGAS languages using the LLVM compiler, namely the Chapel and UPC compilers. A set of communica- LoadStoreLoop: ; preds = %LoadStoreLoop, %entry %lafee = phi i64 [ 0, %entry ], [ %nextvar, %LoadStoreLoop ] %addressSrc = getelementptr i32* getelementptr inbounds ([11 x i32]* @src, i32 0, i32 0), i64 %lafee %addressDst = getelementptr i32* getelementptr inbounds ([11 x i32]* @dest, i32 0, i32 0), i64 %lafee %RMA = load i32* %addressSrc store volatile i32 %RMA, i32* %addressDst, !PE !{i32 %7} %nextvar = add i64 %lafee, 1 %cmptmp = icmp ult i64 %nextvar, %conv br i1 %cmptmp, label %LoadStoreLoop, label %shmem_RDMA_bb Figure 4: LLVM PIR encoding of the OpenSHMEM statement `shmem_int_put(dest, src, N, pe)` Figure 5: Performance comparison for loop tiling in OpenSHMEM on Stampede using 2 nodes Figure 6: Performance comparison for communication vectorization in OpenSHMEM on Stampede using 2 nodes Communication optimizations in Chapel has been implemented in LLVM [8]. Communications in Chapel are implicit; they are simple assignments in the code. The Chapel compiler generates LLVM IR. The compiler runtime have then to figure out if the access is local or remote. In this referenced paper, if an access is remote, the address space feature of LLVM is used with the value 100 to denote it. After that, loop invariant code motion optimization is applied to convert remote accesses to local accesses within a loop. Also, an implementation of UPC is available in LLVM [20]. In this work also, the address space feature of LLVM IR is used to represent shared variables. LLVM load and store IR instructions are used to express UPC shared memory accesses. However, in both works, the issue of how the LLVM optimizations are impacted because of the load/store expansion with UPC and Chapel shared memory accesses is not explored. 6. CONCLUSION The LLVM PIR proposed in this paper can leverage parallel optimization of parallel languages and libraries by focusing on structured parallel constructs, which are easier to optimize, while minimizing the number of built-ins and expressing as much parallelism as possible. This extension to LLVM IR includes (1) a parallel execution attribute for each group of statements, (2) a high-level synchronization attribute on each statement and an API for low-level synchronization events, and (3) data location on processes together with two built-ins for implementing communications in message-passing memory systems. We have implemented a part of this parallel extension into the LLVM compiler and tested two possible resulting OpenSHMEM one-sided communication optimizations. Besides the loop tiling and communication vectorization passes addressed in this paper, future work will look at applying and adapting other transformations performed by LLVM to OpenSHMEM benchmarks and applications. 7. REFERENCES [8] A. Hayashi, R. Surendran, J. Zhao, M. Ferguson, and V. Sarkar. LLVM Optimizations for PGAS Programs - Case
{"Source-Url": "https://cpb-us-e1.wpmucdn.com/you.stonybrook.edu/dist/6/1671/files/2017/03/khaldi2015llvm-1sxzzai.pdf", "len_cl100k_base": 7190, "olmocr-version": "0.1.53", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 28893, "total-output-tokens": 9037, "length": "2e12", "weborganizer": {"__label__adult": 0.0003464221954345703, "__label__art_design": 0.00027298927307128906, "__label__crime_law": 0.00030040740966796875, "__label__education_jobs": 0.00040984153747558594, "__label__entertainment": 6.657838821411133e-05, "__label__fashion_beauty": 0.0001424551010131836, "__label__finance_business": 0.00024771690368652344, "__label__food_dining": 0.00034737586975097656, "__label__games": 0.0005478858947753906, "__label__hardware": 0.001537322998046875, "__label__health": 0.0004727840423583984, "__label__history": 0.0002720355987548828, "__label__home_hobbies": 8.910894393920898e-05, "__label__industrial": 0.00054931640625, "__label__literature": 0.00019109249114990232, "__label__politics": 0.0003349781036376953, "__label__religion": 0.0005602836608886719, "__label__science_tech": 0.035858154296875, "__label__social_life": 7.31348991394043e-05, "__label__software": 0.005741119384765625, "__label__software_dev": 0.9501953125, "__label__sports_fitness": 0.0003664493560791016, "__label__transportation": 0.0007042884826660156, "__label__travel": 0.0002467632293701172}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 37022, 0.03137]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 37022, 0.30938]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 37022, 0.86481]], "google_gemma-3-12b-it_contains_pii": [[0, 861, false], [861, 2979, null], [2979, 8444, null], [8444, 12502, null], [12502, 18294, null], [18294, 24512, null], [24512, 30590, null], [30590, 34588, null], [34588, 37022, null]], "google_gemma-3-12b-it_is_public_document": [[0, 861, true], [861, 2979, null], [2979, 8444, null], [8444, 12502, null], [12502, 18294, null], [18294, 24512, null], [24512, 30590, null], [30590, 34588, null], [34588, 37022, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 37022, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 37022, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 37022, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 37022, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 37022, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 37022, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 37022, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 37022, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 37022, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 37022, null]], "pdf_page_numbers": [[0, 861, 1], [861, 2979, 2], [2979, 8444, 3], [8444, 12502, 4], [12502, 18294, 5], [18294, 24512, 6], [24512, 30590, 7], [30590, 34588, 8], [34588, 37022, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 37022, 0.0]]}
olmocr_science_pdfs
2024-12-10
2024-12-10
508a2191cf9a65f97c1f13e0a889c4f6634f54ab
A Long-Term Study of Software Product and Process Metrics in an Embedded Systems Design Course Dr. J.W. Bruce, Tennessee Technological University J.W. Bruce is with the Department of Electrical & Computer Engineering at Tennessee Technological University in Cookeville, Tennessee USA Dr. Ryan A. Taylor, University of Alabama Dr. Taylor received his Ph.D. in Electrical and Computer Engineering from Mississippi State University in 2018. He is currently an assistant professor at the University of Alabama in Tuscaloosa, Alabama. His research interests revolve around remote sensing and engineering education. A Long-Term Study of Software Product and Process Metrics in an Embedded Systems Design Course In response to input from advisory employers, market demands, and academic studies [1], many computer engineering programs have increased focus on embedded computer systems. Embedded systems form a rich application through which computer engineering education can be made relevant. Embedded computer systems are a timely subject that is immediately useful to students in their senior capstone design projects. Furthermore, a large number of our computer engineering graduates currently use or design embedded computer systems in their jobs. A team-based progressive embedded systems design course was developed that, in addition to providing the technical embedded systems knowledge, develops team and communication skills in situations emulative of industry [2]. The course was a success by many accounts; however, student teams abandoned sound design practices in attempt to meet the demanding 15-week “time-to-market” constraint. Team members produced defect-riddled designs and the design schedules slipped due to an unproductive test-redesign-test development cycle. Afterwards, the course was retooled [3] to use a lightweight design process based loosely on proven software engineering standards [8], [9], [10] which detect defects during design. This development process has been used with success in the subsequent offerings of the design course based on a more complex project [6]. The resulting student designs are typically on time and of high quality. Furthermore, students report satisfaction with the experience, because of both the visible results at course end, and the perceived relevance of the processes that they used. All of these course offerings have made a visible impact on the computer engineering program at the authors’ institution. Computer engineering student projects in the capstone design course have greater complexity and are of higher quality compared to previous years. It was decided that these useful embedded system design skills be introduced to students earlier in the program, so a simplified embedded systems approach was adopted in the basic microprocessors course [5]. With fundamental embedded systems content being taught at the junior level, the senior-level embedded systems course was freed to concentrate more on system concepts and integration issues that are more common in engineering practice and industry: team-based design [2], industry-based software engineering standards [3], and the higher-order design constraints [6] that students were lacking in their capstone designs. This paper briefly describes the structure of the authors’ approach to the embedded systems course, the course’s evolution over twelve years of the study, and the process and product measures collected by students in the course. Analysis and discussion of the data is provided. The Course – Motivation and Evolution Over the years, the authors have reported on the evolution of the embedded systems design course. The authors’ college of engineering has required students to purchase laptops since 1999 and many courses make substantial use of these valuable student-provided resources. The mission of the course described in this paper is to be a culminating design experience focused on embedded systems. This course offers a directed, and reasonably tightly controlled, design experience to prepare the students for the much more unstructured design experience in their capstone senior design projects. A secondary mission of the course described here is to introduce the students to practices commonly found in the commercial embedded systems design environment. Since embedded system designs are so naturally adapted to the object-oriented design paradigm, the course has always tended toward a high-level, reusable and modular approach. *The early Java years: before 2007* The earliest offerings [4] of the course used a specialized (read: expensive) development board with a high-performance 8051-compatible microcontroller running a custom Java virtual machine. Embedded code development was done in Java with a communications interface to an intermediate PC running Java code. The Java-enabled 8051 development board read a variety of weather sensors with results being sent to the student’s laptop. Ultimately, weather sensor data was stored in a MySQL database on a centralized campus server with Java servlets allowing Apache Tomcat providing the data to the world via dynamic web pages. *The 8-bit years: 2007-2009* The first two offerings (2007-2008) of the course discussed in this paper largely followed the design specification of the previous years: a microcontroller reading a weather sensor suite with communications to a laptop PC for additional processing and ultimately the storing of the data in a MySQL database for dynamic web page creation. The key difference in the 2007 approach was that the course was altered to deal with the high costs and fragility of the development board. The 2007 offering adopted a student-developed design for microcontroller interfaces to the hardware and sensors. Students developed the system on a breadboard and eventually created their own professionally-manufactured printed circuit boards. Parts were obtained from parts kit purchased by students in the prerequisite microprocessors course [5]. The low-cost 8-bit microcontroller ran C code and provided the RS-232 communications link to the PC running Java as in the earlier iterations. The client-server architecture from the pre-2007 versions remained in place. Although the first-half of the semester was dramatically different than the pre-2007 iterations, design output in the the second-half of the course was almost completely unchanged. Once the data was successfully transmitted to the PC, the existing Java code and client-server architecture worked identically. The 2009 offering adopted the model of the 8-bit microcontroller using USB communications instead of RS-232. Since USB requires a software stack and housekeeping on both endpoints, a cooperative multitasking operating system named “Embedded Systems Operating System” (ESOS) was written by the first author for use on the 8-bit microcontroller to facilitate faster firmware development cycles and give students a ready-built USB service. The provided ESOS and USB infrastructure allowed students to concentrate on the specific design requirements like previous semesters. While the general form of the client-server structure remained in place, students were given the option to develop the client-server portion with a much simpler, albeit less robust and secure, Python implementation instead of Java servlets. It was becoming clear that Python was a powerful language with which computer engineering students should gain more experience. Stepping up to 16-bits: 2010-2011 The 2010 offering of the course was identical to the previous except the microcontroller was changed to a 16-bit model and the Python back-end was mandatory. ESOS was ported to the 16-bit microcontroller and the OS structure and API were harmonized. The resulting operating system was more logical and consistent, and could be easily ported to a number of architectures if desired. Students continued to initially develop on their own breadboard approaches to interface with weather sensors and ultimately design their own PCB for use in the last few design tasks. Transitioning from an 8-bit to a 16-bit MCU for hardware interfacing is potentially a very dramatic change. Surprisingly little changed from the student's perspective because ESOS had been ported to the new processor. The ESOS API hid much of the change of the data size beneath and only minor documentation changes were required of the instructor/author. The 2010 version of the design introduced a simple task where the Controller Area Network (CAN) bus was used to communicate between student designs locally. Student designs would share limited sensor information over CAN. In 2011, students were required to extend ESOS to include a simplistic service for managing a Hitachi 44780 compatible LCD character module. Standardized Hardware and ESOS extensions: 2012-2015 Prior to 2012, students developed their own microcontroller designs on breadboards and eventually a student team-designed PCB. This approach provides valuable experience to the students, but led to a great deal of variation and incompatibility between student team approaches. As class roster changes during the semester are inevitable due to student course withdrawals, team compositions were adjusted to maintain balance between team roster sizes. When a student was assigned to a different team mid-semester, the new team’s approach could be dramatically different than the one used in the student’s previous team. These experiences tended to frustrate students. Furthermore, the addition of CAN bus communications two years earlier was also much complicated by the variations between student designs. To alleviate these problems, students in the 2012 course were given an entire development board design kit consisting of PCBs and parts. As the design experience progressed, students would increasingly populate and test portions of the PCB. By semester’s end, the board would be fully populated, tested, and executing student code. Furthermore, the 2012 course removed the design tasks that required interfacing with the weather sensor suite. Class enrollments had grown, and the weather sensor suite located on the building roof was now more than 10 years old. With the removal of the weather sensor requirements and with common hardware used across the entire class, CAN bus design tasks were increased and the LCD character module OS service design was made more elaborate. The 2013 course design tasks were identical to 2012. However, the design experience shifted to fully exploring the provided hardware and ensuring solid OS support for its capabilities. In addition to creating the LCD character module service as in the previous three years, students also had to extend the OS services to manage a variety of sensors and processing, and to provide a robust human-machine interface service to manage the variety of input devices on the PCB. The CAN bus development remained much the same as before. By 2013, the course structure and design specification had been informed by more than a decade of teaching a team-based, experiential, progressive design course on embedded systems. The approach was deemed solid, and remained largely unchanged. During the 2013-2015 period, the design specifications were altered only slightly, and some tasks were replaced by other tasks of similar complexity. **Gap Learning: 2016-2017** The two offerings in 2016 and 2017 were identical to each other and used a design specification that was very similar to 2013-2015 classes. The only real change was that the authors employed a design education approach called gap-learning [7]. Instead of asking students to use the OS API to implement the desired application functionality in any way they choose, gap learning has the instructor and lab assistant develop a common framework for how the system can best be implemented. Once this framework is determined, it is partially implemented, leaving key portions of the design missing. Students are then assigned the task of filling in the design’s missing gaps. This approach requires the student to approach the design first with an inquisitorial attitude, searching to understand the design framework that has been set up for them. Once this understanding is complete (or sufficient), the student and his or her teammates are able to embark upon the completion of the design requirements. In a coarse view, gap learning is a “fill-in-the-blanks” design, except the blanks may be single lines of code, a block of code, a subroutine, or an entire API with only function calls defined. **Continued gap learning, 32-bit processor, and a different institution: 2019** In 2018, the embedded systems course was not offered as the lead author had moved to a new institution. In 2019, the course was offered for the first time at the new institution using approach described in this paper. During the 2007-2017 period, the prerequisite “microprocessors” course used a smaller processor from the same family line of the microcontroller used in the embedded systems course. The prerequisite “microprocessors” course at the author’s new institution employed a different processor, and this processor was deemed dated and unsuitable for use in the embedded systems course described here. Furthermore, the prerequisite microprocessors course at the new institution has a strong emphasis on low-level assembly language programming with limited coverage of hardware interfacing topics. Timers and interrupts were the only microcontroller hardware devices covered in any detail. Students in the 2019 course had little to no knowledge of synchronous and asynchronous serial communications protocols, data converters, and other common microcontroller peripherals. The 2019 course would need to introduce the fundamental concepts and basic microcontroller peripheral operations before systems-level topics could be addressed. The 2019 version of the design experience compared similarly to the 2016 and 2017 offerings using the gap-learning techniques. The 2019 course adopted a very capable 32-bit microcontroller with a floating-point unit, a DMA engine, and multiple instances of nearly every hardware peripheral imaginable. Over the course of the semester, the authors ported, first, the core of the ESOS code, then, various services to a 32-bit ESOS implementation. Student design assignments were to “fill in the gaps” of a mostly complete and ported OS code and services, then develop a demonstration application using their results. Assessment The foremost assessment of the course's effectiveness is that all teams must successfully complete the project requirements and submit working designs. Although the lab's design specifications are ambitious, there has never been a team fail to finish the lab design. By informing students early and often that failure is not an option, the teams always seem to find a way to make their designs work. Software development metrics can increase productivity, identify development process shortcomings, increase software quality, and aid in development planning [11], [19]. Student confidence can be increased by comparing their metrics to those published in the literature. Furthermore, the instructor gains insight from collecting metrics on the students’ software process. The instructor can observe the improvement in individual and class abilities, as well as acquire indicators of the relative complexity of homework and design assignments. Many software measures in IEEE Std. 982.1 are obtained very naturally during the development process described in the previous section [3]. Throughout the design activities and the inspection process, students are asked to record: - Defects -- identified by author, design task, defect type, and severity - Person-hours -- recorded by team member, task, and activity (design, review, deployment, or testing) - Output -- lines of code (LoC) identified by author, design task, and software routine Each team member maintains his or her own records and is required to compute several additional measures. For example, coding efficiency is computed as LoC per workday where a workday is defined as eight person-hours of effort, development costs per LoC are computed assuming a hourly rate of $75/hour, and a code quality measure is computed as number of identified defects per thousand LoC. Data collection is facilitated by forms for recording time spent in each activity, recording details of defects found, and summarizing inspection findings. A spreadsheet is provided to compute all measures by individual, team, and design task. Example data collection forms and spreadsheets can be obtained by contacting the author. The data disclosed in this paper is self-reported by the students, with each student and team having a different standard by which they choose to measure themselves. Large variations in the data may be attributed to variation in discipline and expectations on the part of the students. Figure 1 shows the student-reported hours spent on course tasks. In total, the 164 student participants over the period 2007-2019 invested 12,394 person-hours of effort. In classroom discussions, we assigned a loaded compensation rate of US$75 per hour. Therefore, the authors’ mythical design team incurred non-recurring engineering (NRE) costs of nearly US$930,000. Each year, the lab design specification was changed in subtle ways. Some years, entire tasks were completely changed. These changes in the lab design specification were made to provide variety, address new topics introduced into the course, prevent academic dishonesty, and deal with changes to target hardware components. Furthermore, end-of-semester metrics were analyzed and adjustments made for the following offering of the course – with changes often made to reduce the student workload. By the last offerings in 2016-2019, the lab specification was dramatically different than the first specification in 2007. Over the twelve years of data presented in this paper, the 165 students reported an average of 77 hours spent on lab design tasks with a standard deviation of 45. Only twice during 2007-2019 did the average student report spending less than 60 hours on design activities. This level of effort is one of the authors’ goals as it represents approximately 4 hours per week over the 15-week semester. The overall trend from 2011 to 2014 shows a trend of reducing student effort. In 2016, a gap learning [7] approach was introduced in an attempt to reduce student workload further while still allowing completion of more complex designs. Gap learning is similar in concept to “guided notes” [15][16]. While guided notes – incomplete lecture notes – are typically provided for use in a lecture, our gap learning technique provided an incomplete design for a design activity. A design framework or a full reference design is created for each design milestone. Students are given a partially implemented version, where small but key parts of the design are omitted. The omitted portions of the provided design is such that diligent study of the provided information makes obvious what is missing. With so much of the design already specified in detail, there is little latitude for the students to do anything else but supply the missing information, code, etc. It is a “fill-in-the-blank” design. This approach requires the student to approach the design first with an inquisitorial attitude, searching to understand the framework that has been set up for them. Once this understanding is complete (or sufficient), the student is able to embark upon the completion of the design requirements. It was hoped that this technique would affect multiple benefits. First, the techniques would allow the students to see the framework of a successful design before beginning their own implementation. This helps to visualize a successful design as a team before they are thrown into the throes of their senior capstone design project. Second, the techniques would remove some of the tedious work that should be covered in prerequisite courses. On a quick timeline such as a 15-week semester, precious time cannot be spent rehashing material that the students should be comfortable with already. This also reduces the overall workload from a course that is naturally “work-heavy.” Third, these gap learning techniques would allow for students to be able to immediately see the heart of the concept that is being addressed with each lab milestone. Added possible tertiary benefits included a lower stress level for students and potentially smoother team interaction. While data collected [7] implied that the first two objectives were largely met, the gap learning approach does not seem to save time. While students do not have to form system architectures or write and debug many lines of code, the student must read, study, understand, and internalize the entirety of the design and associated device data. An improvement in student workload was noted in 2017. It is believed that the improvement in 2017 was largely due to the instructor being more skilled with the approach. Based on the 2016-2017 experience, the 2019 revision of the course was created where the “gaps” were smaller and very well-defined. Functionality of each of the lab tasks was still quite complex with a very large percentage of the code provided to students in the design assignment. Student-generated code was limited and very localized. The authors are continuing research into gap learning efficacy and ways to streamline the process for students. Figure 2 shows the average number of lines of code (LoC) written by a student in each offering of the course. It is widely held that LoC is a poor product measure. Use of high-level languages such as Java or Python compared to low-level languages like C make comparisons of LoC in production difficult. Furthermore, it is true that a few well-written LoC are more useful, better, and often more time-consuming to write than a large numbers of lines of poorly written code. In the data presented here, most of the students’ output was straight ANSI C language running on a small microcontroller, so comparisons between students and semesters is not entirely unreasonable. Once again, data shown here was self-reported by students. Students were instructed to only report LoC developed in the submitted design milestone, and not to count previously written LoC and LoC provided in libraries, gap learning frameworks, etc. The authors believe that student reported measures for this metric are suspect, as student teams submitted designs to identical specifications with LoC product measures that vary significantly. In total, the 164 student participants over the period 2007-2019 reported creating 185,808 LoC. Again using our loaded compensation rate of US$75 per hour, the twelve year design effort averages to a software production cost of US$5.00 per LoC. One software manager’s blog [20] reported US$3.98 per LoC for a traditional programming design team that he personally served as the design architect and manager. Several other studies [19] report software development costs ranging from $5-100 per LoC. Changes in the course’s design requirements are reflected in Figure 2. For example, the design requirements changed only slightly from 2009 to 2010. In 2011, the design specification remove much of the client-server requirements where MySQL transactions and server-side Java servlet (high-level language interaction with dynamic web server frameworks) were replaced by more hardware-focused microcontroller code (C language control of registers and student-written data structures) to control external devices. The 2013 offering removed the laborious task introduced in 2012, replacing it with a requirement that students develop a new service for the OS. That change was well-received, so low-level microcontroller code development was removed and replaced by a task for students to develop a second service for the OS. Unfortunately, that service was a bit more complex than the 2013 addition. In 2015, CAN bus functionality was added to the 2014 specification. The CAN bus is a robust but complex network protocol, and student-reported development peaked. Apart from the heavy workload, students reported satisfaction with the experience as they found the CAN bus interesting and saw the utility of having experience with it for future courses and their careers. The 2016 design was fundamentally identical to the 2015 variation but with the introduction of gap learning. A clear reduction in LoC reported is seen. The 2017 offering was nearly identical to the 2016 version and reported LoC was almost unchanged. The effort in 2019 to reduce student workload by providing more of a complete design framework and limiting student requirements is clearly seen in Figure 2. Also, the authors are likely more adept with gap learning as the 2019 was the third course iteration using the method. The average number of software defects reported by students over the semester experience is given in Figure 3. Students were instructed to classify defects as major or minor. A major defect is one that will result in a problem that the customer will see or will cause system functionality to be compromised. Minor defects are those that include spelling errors, non-compliance with design conventions, and poor workmanship that does not lead to a major defect. Major defects are fairly obvious as being major – something is broken – and so they are more consistently reported year on year. Minor defects are a bit more subjective, so the data reported varies widely. In fact, every semester there was some number of students who reported no minor defects at all. Clearly, that is not reality. Figures 1-3 detail student-reported metrics. Changes in the assigned lab tasks make comparison difficult. However, using the student-reported time invested in the design experience, student coding productivity and product defect density can be calculated. Industrial averages for these number exist in the literature and allow for a comparison of our novice embedded systems designers with seasoned professionals [17]. Just such a comparison was performed during the last class of the semester. Validation of their own efforts against real-world engineers was definitely well-received. Students report satisfaction with the experience and increased confidence knowing that their abilities and output are near industry norms. Figure 4 presents the average student’s coding productivity in LoC per day. The average coding productivity for the 165 student participants from 2007-2019 was 125 LoC per standard eight-hour workday. So how many LoC do “real” programmers average per day? Brooks reported in his famous book that OS/360 programmers averaged 10 LoC per day [17]. Jones found coding productivity 16 to 38 LoC per day across a range of projects [18]. McConnell measured productivity of 20-125 LoC per day for small projects (<10 kLoC) dropping down to 1.5-25 LoC per day for large projects (10 MLoC) [19]. Anecdotal reports by a few software developers are 50-100 LoC per day determined by dividing their lifetime coding output by estimates of time spent working over their decades-long career. With these benchmark numbers in mind, the student-reported coding productivity in Figure 4 is at least reasonable but likely somewhat optimistic. Team projects averaged just over 4.5 kLoC over the 2007-2019 period. Projects of this size would be considered small by McConnell [19], and the student productivity of 125 LoC per day would be at the upper range of his findings for small projects. Data reported in years 2008-2010, 2012-2013, and 2016-2017 may be fairly accurate with the other years considered outliers. Clearer guidelines to the students on what constitutes a countable LoC would likely have improved the data in Figure 4. Students reported their programming output and productivity at the conclusion of each design task (the semester-long design experience was divided into seven to ten design tasks). Not presented here, but worth noting is the students' maturation as software developers was often apparent in the data. Students tended to become more productive coders as the semester progresses. In general, students produced more LoC/day later in the semester than earlier. Also, some of the design tasks that were heavy on systems integration were characterized by lower coding productivity than tasks involving development of stand alone processing. This is logical as system integration design deals largely with module interfaces and is time-consuming to write, but often has relatively few LoC. What is the relative quality of the student-generated software product? Figure 5 shows the defect density in defects per 1000 LoC over the twelve years of the course offerings. As mentioned earlier, the reported minor defect quantity varies widely, and is likely not very accurate. Assuming that major defect reporting is more accurate, the major defect density is more tightly bound. Variations seen in Figure 5 are attributed to varied reporting by students and design specification differences from year to year. Over the entire twelve year study, the average major defect rate was 7.6 defects per kLoC, the minor defect rate was 17.9 defects per kLoC, and the total defect rate was 25.4 defects per kLoC. Industry averages for defect density are 15-50 error per 1000 LoC delivered [19]. The student data reported here falls within that range. Jones reports that defect density increases as a function of project size [18]. The small project described here were always less than 10 kLoC (as reported by the students) and Jones’ results would indicate a defect densities of <40 defects per kLoC. The student reports fall squarely in the middle of Jones’ range for industry products. ![SW Defects Produced per kLoC](image) **Figure 5**: Software defect density as reported by severity Discussion and Conclusions At several points during the semester, design teams are required to forward their measures data to the instructor. Individual and team data is disseminated to the class. This disclosure allows the instructor to (i) give frequent feedback to ensure quality data collection, (ii) identify teams with a poor team dynamic, (iii) promote a friendly competition between teams to operate with maximum efficiency, and (iv) motivate engaging classroom discussion on ethical, economic, and design method issues. As might be expected, some students resisted the design processes described here as “a complete waste of time”. Students argued that designers are “born, not created”. Many examples from the literature to support quantitatively the effectiveness of development processes were given in counter argument. Students are asked to follow the prescribed procedure for a few weeks. A promise to discuss, evaluate, and incorporate any suggested improvements usually sways stalwart resisters (this is an excellent way to give students ownership and responsibility of their own learning). After the first design milestone during one semester, an elated team gave a class-time testimonial about how the design process and inspections identified all of their design defects in the preparation and design review meeting. The team declared the process valuable since their design worked the first time upon consolidation of their individual efforts. For the remainder of the semester, this team insisted on following the design procedures exactly. This team consistently finished assignments first and with high quality. Clearly, this team had internalized the development process and made it a part of their “professional persona”. Throughout the semester, several other design teams reported similar experiences. This paper details student-reported process and product metrics from an embedded systems design experience over a twelve year period. The course was offered in an electrical and computer engineering department and was taken by mostly computer engineering majors along with some electrical engineering majors. Occasionally, software engineering majors or computer science majors would enroll. The course utilized different processors and was offered at two different institutions. While the exact design tasks varied from year to year, the design experience involved a team-based (3 or 4 students), progressive design to specification using design inspections. Design tasks assigned include writing low-level C language routines to interface with sensors and control microcontroller peripherals, data analysis and processing software, creation or modification of operating system code, and writing Java or Python code on student laptops to process, display, or store data on client-server systems. Although the projects are ambitious, all teams were successful in completing the design requirements. Student coding productivity measures are comparable to data reported in the literature from industrial settings. Software defect production appears to be very much in the center of the range of reported industrial norms. Finally, qualitative feedback from students was mostly positive apart from concerns about heavy time investment. The authors created a design education method called gap-learning in attempt to reduce the required student effort while maintaining the design complexity. Post-semester discussions with most teams who experienced this method of learning were positive, with students reporting a more clear idea of what was expected from them and a better overall team experience. Most students report that the experience of this embedded systems course was “realistic” and “help them to know what to expect upon employment”. Many students participating the course described here accepted jobs in industry as embedded systems designers. Alumni participants report that the experience was an excellent preparation for their professional responsibilities. References
{"Source-Url": "https://peer.asee.org/31967.pdf", "len_cl100k_base": 6502, "olmocr-version": "0.1.53", "pdf-total-pages": 14, "total-fallback-pages": 0, "total-input-tokens": 29832, "total-output-tokens": 7986, "length": "2e12", "weborganizer": {"__label__adult": 0.0012378692626953125, "__label__art_design": 0.0031890869140625, "__label__crime_law": 0.0009527206420898438, "__label__education_jobs": 0.1641845703125, "__label__entertainment": 0.00031375885009765625, "__label__fashion_beauty": 0.000918865203857422, "__label__finance_business": 0.0015611648559570312, "__label__food_dining": 0.0012331008911132812, "__label__games": 0.0027523040771484375, "__label__hardware": 0.02728271484375, "__label__health": 0.0022258758544921875, "__label__history": 0.0015745162963867188, "__label__home_hobbies": 0.000980377197265625, "__label__industrial": 0.0038051605224609375, "__label__literature": 0.0009927749633789062, "__label__politics": 0.0010776519775390625, "__label__religion": 0.0016918182373046875, "__label__science_tech": 0.236083984375, "__label__social_life": 0.0004646778106689453, "__label__software": 0.0070648193359375, "__label__software_dev": 0.5341796875, "__label__sports_fitness": 0.0015058517456054688, "__label__transportation": 0.0042266845703125, "__label__travel": 0.0005788803100585938}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 36105, 0.03531]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 36105, 0.58305]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 36105, 0.96079]], "google_gemma-3-12b-it_contains_pii": [[0, 614, false], [614, 3754, null], [3754, 7282, null], [7282, 10820, null], [10820, 14425, null], [14425, 17364, null], [17364, 19436, null], [19436, 23208, null], [23208, 25001, null], [25001, 26722, null], [26722, 28717, null], [28717, 30005, null], [30005, 33784, null], [33784, 36105, null]], "google_gemma-3-12b-it_is_public_document": [[0, 614, true], [614, 3754, null], [3754, 7282, null], [7282, 10820, null], [10820, 14425, null], [14425, 17364, null], [17364, 19436, null], [19436, 23208, null], [23208, 25001, null], [25001, 26722, null], [26722, 28717, null], [28717, 30005, null], [30005, 33784, null], [33784, 36105, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 36105, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 36105, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 36105, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 36105, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 36105, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 36105, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 36105, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 36105, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 36105, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 36105, null]], "pdf_page_numbers": [[0, 614, 1], [614, 3754, 2], [3754, 7282, 3], [7282, 10820, 4], [10820, 14425, 5], [14425, 17364, 6], [17364, 19436, 7], [19436, 23208, 8], [23208, 25001, 9], [25001, 26722, 10], [26722, 28717, 11], [28717, 30005, 12], [30005, 33784, 13], [33784, 36105, 14]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 36105, 0.0]]}
olmocr_science_pdfs
2024-12-07
2024-12-07
3842ea4689c624445b3981abf7f9eb9912790549
LOD2 Deliverable D3.3.2: Release of Knowledge Base Enrichment User Interface Lorenz Bühmann, Jens Lehmann Abstract: This prototype deliverable consists of a software release of a JavaScript widget for a knowledge base enrichment user interface and an accompanying deliverable report. The software is open source and can be downloaded at https://github.com/AKSW/EnrichmentUIWidget. A description of the usage of the widget in the ORE project is provided. The deliverable describes the purpose and usage of the widget in detail Collaborative Project LOD2 - Creating Knowledge out of Interlinked Data Project Number: 257943 Start Date of Project: 01/09/2010 Duration: 48 months Deliverable 3.3.2 Release of Knowledge Base Enrichment User Interface <table> <thead> <tr> <th>Dissemination Level</th> <th>Public</th> </tr> </thead> <tbody> <tr> <td>Due Date of Deliverable</td> <td>Month 24, 31/08/2012</td> </tr> <tr> <td>Actual Submission Date</td> <td>31/08/2012</td> </tr> <tr> <td>Work Package</td> <td>WP3, Knowledge Base Creation, Enrichment and Repair</td> </tr> <tr> <td>Task</td> <td>T 3.3</td> </tr> <tr> <td>Type</td> <td>Prototype</td> </tr> <tr> <td>Approval Status</td> <td>Approved</td> </tr> <tr> <td>Version</td> <td>1.0</td> </tr> <tr> <td>Number of Pages</td> <td>14</td> </tr> <tr> <td>Filename</td> <td>deliverable-3.3.2.pdf</td> </tr> </tbody> </table> Abstract: This is a deliverable accompanying a software release on a user interface widget for knowledge base enrichment algorithms. The information in this document reflects only the author's views and the European Community is not liable for any use that may be made of the information contained therein. The information in this document is provided “as is” without guarantee or warranty of any kind, express or implied, including but not limited to the fitness of the information for a particular purpose. The user thereof uses the information at his/her sole risk and liability. Project funded by the European Commission within the Seventh Framework Programme (2007 - 2013) History <table> <thead> <tr> <th>Version</th> <th>Date</th> <th>Reason</th> <th>Revised by</th> </tr> </thead> <tbody> <tr> <td>0.0</td> <td>10/07/2012</td> <td>Initial Version</td> <td>Lorenz Bühmann</td> </tr> <tr> <td>0.5</td> <td>30/07/2012</td> <td>General Description of Enrichment</td> <td>Lorenz Bühmann</td> </tr> <tr> <td>0.9</td> <td>15/08/2012</td> <td>Peer review</td> <td>Norman Heino</td> </tr> <tr> <td>1.0</td> <td>30/08/2012</td> <td>Address peer review comments</td> <td>Jens Lehmann</td> </tr> </tbody> </table> Author List <table> <thead> <tr> <th>Organization</th> <th>Name</th> <th>Contact Information</th> </tr> </thead> <tbody> <tr> <td>ULEI</td> <td>Jens Lehmann</td> <td><a href="mailto:lehmann@informatik.uni-leipzig.de">lehmann@informatik.uni-leipzig.de</a></td> </tr> <tr> <td>ULEI</td> <td>Lorenz Bühmann</td> <td><a href="mailto:buehmann@informatik.uni-leipzig.de">buehmann@informatik.uni-leipzig.de</a></td> </tr> </tbody> </table> Executive Summary This prototype deliverable consists of a software release of a JavaScript widget for a knowledge base enrichment user interface and an accompanying deliverable report. The software is open source and can be downloaded at https://github.com/AKSW/EnrichmentUIWidget. A description of the usage of the widget in the ORE project is provided. The deliverable describes the purpose and usage of the widget in detail. # Table of Contents 1 Introduction and Motivation .................................................. 5 2 A General Method for Enrichment with OWL Axioms ................. 6 3 General Description .......................................................... 8 3.1 Availability ................................................................ 8 3.2 Implementation ......................................................... 8 3.3 Layout ........................................................................ 8 3.4 Configuration Parameters ............................................. 8 3.5 Scenario ...................................................................... 9 4 Manual .............................................................................. 11 4.1 Obtaining the Widget ................................................... 11 4.2 Integrating the Widget .................................................. 11 4.3 Reporting Bugs .......................................................... 12 5 Pointers ............................................................................ 13 References ............................................................................ 13 List of Figures 1 3-Phase Enrichment Workflow ........................................... 6 2 Integration of the Enrichment Widget into the ORE tool. ............... 9 1 Introduction and Motivation The Semantic Web has recently seen a rise in the availability and usage of knowledge bases, as can be observed within the DataHub¹ and other repositories. Despite this growth, there is still a lack of knowledge bases that consist of sophisticated schema information and instance data adhering to this schema. Several knowledge bases, e.g. in the life sciences, only consist of schema information, while others are, to a large extent, a collection of facts without a clear structure, e.g. information extracted from databases. The combination of sophisticated schema and instance data would allow powerful reasoning, consistency checking, and improved querying. Schema enrichment, as described in this article, allows to create schemata base based on existing data.² Example 1.1 As an example, consider a knowledge base containing a property birthPlace and subjects in triples of this property, e.g. Brad Pitt, Angela Merkel, Albert Einstein etc. Enrichment algorithms could, then, suggest that the property birthPlace may be functional and has the domain Person as it is encoded via the following axioms in Manchester OWL syntax³: ObjectProperty: birthPlace Characteristics: Functional Domain: Person Range: Place SubPropertyOf: hasBeenAt Adding such axiom to a knowledge base can have several benefits: 1.) The axioms serve as documentation for the purpose and correct usage of schema elements. 2.) They improve the application of schema debugging techniques. For instance, after adding the above axioms the knowledge base would become inconsistent if a person has two different birth places due to the functionality axiom. Specifically for the DBpedia² knowledge base, we observed an error in which a person was asserted to be born in Lacrosse, the game, instead of Lacross, the city in the United States. Such errors can be automatically detected when schema information such as the range restriction is present (assuming disjointness of the classes Place and Game). 3.) Additional implicit information can be inferred, e.g. in the above example the birth place of a person can be inferred to be one of the places a person has stayed at. The main benefit of this research is a reduction of the effort of creating and maintaining such schema information. These enrichment methods were developed in Deliverable 3.3.1 and implemented in the DL-Learner⁴⁵⁶⁸ framework, a general description is given in the next section. --- ¹http://thedatahub.org/ ²The approach of not creating schema upfront is sometimes referred to as “grass roots” approach or “after the fact” schema creation. ³For details on Manchester OWL syntax (e.g. used in Protégé, OntoWiki) see http://www.w3.org/TR/owl2-manchester-syntax/. ⁴http://dl-learner.org There is a large variety of axiom types in OWL, which we support in our enrichment tool. The light-weight learning methods for obtaining enrichment suggestions usually take an entity (a class or property in our case) as input, generate a set of OWL axioms as output and proceed in three phases (see Figure 1): 1. In the first phase, SPARQL queries are used to obtain general information about the knowledge base, in particular we retrieve axioms, which allow to construct the class hierarchy. It can be configured whether to use an OWL reasoner for inferencing over the schema or just taking explicit knowledge into account.\(^5\) Naturally, the schema only needs to be obtained once and can then be re-used by all algorithms and all entities. 2. The second phase consists of obtaining data via SPARQL, which is relevant for learning the considered axiom. 3. In the third phase, the score of axiom candidates is computed and the results returned. Many of our employed heuristics to suggest axioms are based on counting. For instance, when determining whether a class \(A\) is appropriate as domain of a property \(p\), we count the number of triples using \(p\) in predicate position and the number of subjects in those triples which are instances of \(A\). The latter value is divided by the first value to obtain a score. We illustrate this using a simple example. Let the following triples be given (Turtle syntax): \[ \text{prefix dbpedia: <http://dbpedia.org/resource/>}. \text{prefix dbo: <http://dbpedia.org/ontology/>}. \] \(^5\)Note that the OWL reasoner only loads the schema of the knowledge base and, therefore, this option usually works even in cases with several hundred thousand classes in our experiments, which used the HermiT reasoner. In the above example, we would obtain a score of 66.7% (2 out of 3) for the class `dbo:Country` and 100% (3 out of 3) for the class `dbo:PopulatedPlace`\(^6\) as candidates for the range of the property `dbo:currency`. A disadvantage of using this straightforward method of obtaining a score is that it does not take the support for an axiom in the knowledge base into account. Specifically, there would be no difference between having 100 out of 100 correct observations or 3 out of 3 correct observations. For this reason, we do not just consider the count, but the average of the 95% confidence interval of the count. This confidence interval can be computed efficiently by using the improved Wald method defined in [1]. Assume we have \( m \) observations out of which \( s \) were successful, then the approximation of the 95% confidence interval is as follows: \[ \text{max}(0, p' - 1.96 \cdot \sqrt{\frac{p' \cdot (1-p')}{m+4}}) \quad \text{to} \quad \text{min}(1, p' + 1.96 \cdot \sqrt{\frac{p' \cdot (1-p')}{m+4}}) \] with \( p' = \frac{s+2}{m+4} \) This formula is easy to compute and has been shown to be accurate in [1]. In the above case, this would change the score to 57.3% (previously 66.7%) for `dbo:Country` and 69.1% (previously 100%) for `dbo:PopulatedPlace`. This indicates that there is not much support for either of those choices in the knowledge base. 100 out of 100 correct observations would score much higher (97.8%). The actual scores for the DBpedia Live[9] as of May 2012 are 99.1% for the class `dbo:PopulatedPlace` and 97.6% for `dbo:Country`. Note that in this implementation, more general classes in the hierarchy would always score higher. It might be desirable to correct this by slightly penalising very general classes. The drawback of such a penalty could be that the scores would be more difficult to understand for users. The described method was published in [4] and can be seen as an lightweight complement to the closely related work in the area of statistical schema induction via association rule mining [10], where the whole knowledge base has to be loaded in advance. Association rules are a form of implication patterns and used to discover regularities in a data set. For instance, in [10] an association rule \( A \implies B \) with sufficiently high confidence and support between two classes \( A \) and \( B \) indicates that introducing a subclass relationship \( A \sqsubseteq B \) may be appropriate. \(^6\)If the reasoning option is turned off, the score would be 33.3%. 3 General Description In this software release, a user-friendly interface for knowledge engineers, who intent to use the enrichment algorithms described in Deliverable D3.3.1 is provided. It consists of a web user interface, which can be configured for working on a specific knowledge base and a widget, which can be integrated into other tools. In particular, the ORE tool[7] developed in Task 3.4 integrates this widget, but other software like the WebProtege[8] and OntoWiki[3] ontology editors will also be able to use it. 3.1 Availability The widget is published as open source project and can be downloaded at https://github.com/AKSW/EnrichmentUIWidget. 3.2 Implementation The Knowledge Base Enrichment User Interface is implemented as jQuery\(^{10}\) widget and also makes use of the JavaScript library jQuery EasyUI\(^{11}\) for some graphical components. The underlying learning algorithms are part of the DL-Learner Framework and called via AJAX requests to a Java Servlet which must be deployed on an accessible server. In order to use the widget in other web projects the following parameters have to be specified: **SPARQL endpoint URL** The URL of the SPARQL endpoint and optionally the default graph URL on which the enrichment algorithms will be executed. **Service URL** Declares the URL of the Java Servlet which is called to execute the corresponding learning algorithms. 3.3 Layout To keep the layout as simple as possible the widget currently consists only of 2 main parts, as it is shown in Figure 2: On the left side there is a configuration panel, where several learning parameters can be defined. The panel on the right side shows the result of the learning process. For each learned axiom type, the axioms and their corresponding accuracy value are displayed in separate tables. 3.4 Configuration Parameters The enrichment user interfaces allows to configure the following parameters which affect the axiom learning process: \(^{7}\)http://ore-tool.net/Projects/ORE \(^{8}\)http://protegewiki.stanford.edu/wiki/WebProtege \(^{9}\)http://ontowiki.net/Projects/OntoWiki \(^{10}\)http://jquery.com/ \(^{11}\)http://www.jeasyui.com/ Resource URI is used to specify the resource (property or class) which should be enriched. Resource Type allows to determine of which type of entity the resource is. This implicitly works as a filter on the allowed and executed learning algorithms. Inference allows to turn inference on or off. If it is turned on, in a preprocessing step the class hierarchy is computed. Powerful reasoning capabilities may improve the quality of suggestions, in particular for those axioms, which rely on knowing the class hierarchy of the knowledge base, e.g. domain and range axioms. Max. execution time specifies the maximum execution time in seconds for each algorithm run. Max. returned axioms specifies the maximum number of returned axioms per axiom type. Threshold allows to specify a threshold for enrichment suggestions, i.e. suggestions with a lower score will be omitted. Axiom Types is used to choose for which type of axioms the learning algorithm will be executed. 3.5 Scenario Suppose, we are working on the knowledge base DBpedia and we want to add more schema information for the property http://dbpedia.org/ontology/league. At first, we enter the URI in the Resource URI field. We don’t know whether it is an object property or a datatype property, so we let the tool determine the Resource Type automatically. We do not want to use inferred knowledge, i.e. we don’t check the Inference. box. By setting the Max. execution time spinner to 10, the Max. returned axioms spinner to 5 and the Threshold slider to 75, we ensure that all algorithms terminate after 10 seconds and return at most 5 axioms with an accuracy value above 75%. We are interested in super properties and in domain and range of the property. Additionally, we also want to know some characteristics of the property, i.e. whether it is functional, inverse functional, symmetric and transitive. Therefore we select the corresponding Axiom Types. After that, we are done with the configuration and can Start the computation. For each axiom type a request is sent to the Java Servlet in parallel and the returned axioms are shown as tables in the panel on the right side. # 4 Manual ## 4.1 Obtaining the Widget The widget is published as open source project and can be downloaded on GitHub at [https://github.com/AKSW/EnrichmentUIWidget](https://github.com/AKSW/EnrichmentUIWidget). A general documentation can be found at [http://dl-learner.org/wiki/EnrichmentUIWidget](http://dl-learner.org/wiki/EnrichmentUIWidget). ## 4.2 Integrating the Widget Get the sources from GitHub ``` git clone git://github.com/AKSW/EnrichmentUIWidget.git ``` or download the package from [https://github.com/AKSW/EnrichmentUIWidget/tarball/master](https://github.com/AKSW/EnrichmentUIWidget/tarball/master). Put the war file `enrichment.war` on a Java Servlet container, e.g. for Tomcat 6 it would be ``` cd EnrichmentUIWidget cp enrichment.war /PATH/TO/TOMCAT6/webapps/ ``` The resulting service URL will then be [http://SERVLET_CONTAINER_URL/enrichment/Enrichment](http://SERVLET_CONTAINER_URL/enrichment/Enrichment) Link to the necessary JavaScript and CSS files into your project ``` <html> <head>... ...<script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/jquery-ui.min.js"></script> <script type="text/javascript" src="js/jquery.easyui.min.js"></script> <script type="text/javascript" src="jquery.ui.enrichment.js"></script> <link rel="stylesheet" type="text/css" href="css/ ui-darkness/jquery-ui-1.8.22.custom.css"> <link rel="stylesheet" type="text/css" href="css/default/easyui.css"> <link rel="stylesheet" type="text/css" href="css/icon.css"> <link rel="stylesheet" type="text/css" href="css/enrichment.css"> </head> ...</html> ``` Create a container element with an **ID**, call the jQuery plugin on it using `$("ID").enrichment()` and set the parameters for the SPARQL endpoint URL and the Java Servlet URL, e.g. ``` <div id="enrichment-container"></div> <script type="text/javascript"> $("#enrichment-container").enrichment({ 'service_url': 'http://localhost:8080/enrichment/Enrichment', 'endpoint': { ``` 4.3 Reporting Bugs As it is deployed on GitHub, bugs and issues will be managed on https://github.com/AKSW/EnrichmentUIWidget/issues. 5 Pointers Enrichment Widget: https://github.com/AKSW/EnrichmentUIWidget jQuery: http://jquery.com/ jQuery EasyUI: http://www.jeasyui.com/ DL-Learner: http://dl-learner.org/ ORE: http://ore-tool.net/Projects/ORE References
{"Source-Url": "http://jens-lehmann.org/files/2012/lod2_deliverable_3.3.2.pdf", "len_cl100k_base": 4423, "olmocr-version": "0.1.42", "pdf-total-pages": 16, "total-fallback-pages": 0, "total-input-tokens": 32493, "total-output-tokens": 5592, "length": "2e12", "weborganizer": {"__label__adult": 0.00024819374084472656, "__label__art_design": 0.0004875659942626953, "__label__crime_law": 0.0003190040588378906, "__label__education_jobs": 0.0027561187744140625, "__label__entertainment": 7.641315460205078e-05, "__label__fashion_beauty": 0.00015354156494140625, "__label__finance_business": 0.0002841949462890625, "__label__food_dining": 0.00027489662170410156, "__label__games": 0.00038361549377441406, "__label__hardware": 0.0004625320434570313, "__label__health": 0.0003490447998046875, "__label__history": 0.00026988983154296875, "__label__home_hobbies": 0.00011539459228515624, "__label__industrial": 0.0003330707550048828, "__label__literature": 0.00035119056701660156, "__label__politics": 0.00021731853485107425, "__label__religion": 0.0003781318664550781, "__label__science_tech": 0.027557373046875, "__label__social_life": 0.00015306472778320312, "__label__software": 0.0279998779296875, "__label__software_dev": 0.93603515625, "__label__sports_fitness": 0.00018262863159179688, "__label__transportation": 0.0002887248992919922, "__label__travel": 0.0001908540725708008}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 20310, 0.02999]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 20310, 0.40156]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 20310, 0.8119]], "google_gemma-3-12b-it_contains_pii": [[0, 528, false], [528, 1809, null], [1809, 2600, null], [2600, 3030, null], [3030, 4243, null], [4243, 4412, null], [4412, 7181, null], [7181, 8941, null], [8941, 11480, null], [11480, 13647, null], [13647, 15047, null], [15047, 15795, null], [15795, 17839, null], [17839, 17974, null], [17974, 18187, null], [18187, 20310, null]], "google_gemma-3-12b-it_is_public_document": [[0, 528, true], [528, 1809, null], [1809, 2600, null], [2600, 3030, null], [3030, 4243, null], [4243, 4412, null], [4412, 7181, null], [7181, 8941, null], [8941, 11480, null], [11480, 13647, null], [13647, 15047, null], [15047, 15795, null], [15795, 17839, null], [17839, 17974, null], [17974, 18187, null], [18187, 20310, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 20310, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 20310, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 20310, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 20310, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 20310, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 20310, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 20310, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 20310, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 20310, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 20310, null]], "pdf_page_numbers": [[0, 528, 1], [528, 1809, 2], [1809, 2600, 3], [2600, 3030, 4], [3030, 4243, 5], [4243, 4412, 6], [4412, 7181, 7], [7181, 8941, 8], [8941, 11480, 9], [11480, 13647, 10], [13647, 15047, 11], [15047, 15795, 12], [15795, 17839, 13], [17839, 17974, 14], [17974, 18187, 15], [18187, 20310, 16]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 20310, 0.11932]]}
olmocr_science_pdfs
2024-11-22
2024-11-22
041c34995afe1d02ad7f880163950fe6839cff2d
MR-Part: Minimizing Data Transfers Between Mappers and Reducers in MapReduce Miguel Liroz-Gistau, Reza Akbarinia, Divyakant Agrawal, Esther Pacitti, Patrick Valduriez To cite this version: HAL Id: lirmm-00879531 https://hal-lirmm.ccsd.cnrs.fr/lirmm-00879531 Submitted on 18 Nov 2013 HAL is a multi-disciplinary open access archive for the deposit and dissemination of scientific research documents, whether they are published or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers. L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés. Résumé La réduction du transfert des données dans la phase “Shuffle” de MapReduce est très importante, car elle augmente la localité des données, et diminue le coût total des exécutions des jobs MapReduce. Dans la littérature, plusieurs optimisations ont été proposées pour réduire le transfert de données entre les mappers et les reducers. Néanmoins, toutes ces approches sont limitées par la façon dont les clé-valeurs intermédiaires sont réparties sur les mappers. Dans cet article, nous proposons une technique qui repartitionne les tuples dans le fichier d’entrée, avec l’objectif d’optimiser la distribution des clés-valeurs sur les mappers. Notre approche détecte les relations entre les tuples d’entrée et les clé-valeurs intermédiaires en surveillant l’exécution d’un ensemble de tâches MapReduce qui est représentatif du workload. Puis, à partir des relations détectées, il affecte les tuples d’entrée aux mappers, et augmente la localité des données lors des futures exécutions. Nous avons implémenté notre approche dans Hadoop, et l’avons évaluée par expérimentation dans Grid5000. Les résultats montrent une grande réduction dans le transfert de données pendant la phase “Shuffle” par rapport à Hadoop. Mots-clés : MapReduce, partitionnement basé sur workload ; localité des données 1 Introduction MapReduce [4] has established itself as one of the most popular alternatives for big data processing due to its programming model simplicity and automatic management of parallel execution in clusters of machines. Initially proposed by Google to be used for indexing the web, it has been applied to a wide range of problems having to process big quantities of data, favored by the popularity of Hadoop [2], an open-source implementation. MapReduce divides the computation in two main phases, namely map and reduce, which in turn are carried out by several tasks that process the data in parallel. Between them, there is a phase, called shuffle, where the data produced by the map phase is ordered, partitioned and transferred to the appropriate machines executing the reduce phase. MapReduce applies the principle of “moving computation towards data” and thus tries to schedule map tasks in MapReduce executions close to the input data they process, in order to maximize data locality. Data locality is desirable because it reduces the amount of data transferred through the network, and this reduces energy consumption as well as network traffic in data centers. Recently, several optimizations have been proposed to reduce data transfer between mappers and reducers. For example, [7] and [12] try to reduce the amount of data transferred in the shuffle phase by scheduling reduce tasks close to the map tasks that produce their input. Ibrahim et al. [9] go even further and dynamically partition intermediate keys in order to balance load among reduce tasks and decrease network transfers. Nevertheless, all these approaches are limited by how intermediate key-value pairs are distributed over map outputs. If the data associated to a given intermediate key is present in all map outputs, even if we assign it to a reducer executing in the same machine, the rest of the pairs still have to be transferred. In this paper, we propose a technique, called MR-Part, that aims at minimizing the transferred data between mappers and reducers in the shuffle phase of MapReduce. MR-Part captures the relationships between input tuples and intermediate keys by monitoring the execution of a set of MapReduce jobs which are representative of the workload. Then, based on the captured relationships, it partitions the input files, and assigns input tuples to the appropriate fragments in such a way that subsequent MapReduce jobs following the modeled workload will take full advantage of data locality in the reduce phase. In order to characterize the workload, we inject a monitoring component in the MapReduce framework that produces the required metadata. Then, another component, which is executed offline, combines the information captured for all the MapReduce jobs of the workload and partitions the input data accordingly. We have modeled the workload by means of an hypergraph, to which we apply a min-cut k-way graph partitioning algorithm to assign the tuples to the input fragments. We implemented MR-Part in Hadoop, and evaluated it through experimentation on top of Grid5000 using standard benchmarks. The results show significant reduction in data transfer during the shuffle phase compared to Native Hadoop. They also exhibit a significant reduction in execution time when network bandwidth is limited. The rest of the paper is organized as follows: In Section 2, we briefly describe MapReduce, and then define formally the problem we address. In Section 3, we propose MR-Part. In Section 4, we report the results of our experimental tests evaluating its efficiency. Section 5 presents the related work and Section 6 concludes. 2 Problem Definition 2.1 MapReduce Background MapReduce is a programming model based on two primitives: \[ \begin{align*} \text{map} & : (K_1, V_1) \rightarrow \text{list}(K_2, V_2) \\ \text{reduce} & : (K_2, \text{list}(V_1)) \rightarrow \text{list}(K_3, V_3) \end{align*} \] The map function processes key/value pairs and produces a set of intermediate/value pairs. Intermediate key/value pairs are merged and sorted based on the intermediate key \(k_2\) and provided as input to the reduce function. MapReduce jobs are executed over a distributed system composed of a master and a set of workers. The input is divided into several splits and assigned to map tasks. The master schedules map tasks in the workers by taking into account data locality (nodes holding the assigned input are preferred). The output of the map tasks is divided into as many partitions as reducers are scheduled in the system. Entries with the same intermediate key \(k_2\) should be assigned to the same partition to guarantee the correctness of the execution. All the intermediate key/value pairs of a given partition are sorted and sent to the worker where the corresponding reduce task is going to be executed. This phase is called shuffle. Default scheduling of reduce task does not take into consideration any data locality constraint. As a consequence, depending on how intermediate keys appear in the input splits and how the partitioning is done, the amount of data that has to be transferred through the network in the shuffle phase may be significant. 2.2 Problem Statement We are given a set of MapReduce jobs which are representative of the system workload, and a set of input files. We assume that future MapReduce jobs follow similar patterns as those of the representative workload, at least in the generation of intermediate keys. The goal of our system is to automatically partition the input files so that the amount of data that is transferred through the network in the shuffle phase is minimized in future executions. We make no assumptions about the scheduling of map and reduce tasks, and only consider intelligent partitioning of intermediate keys to reducers, e.g., as it is done in [9]. Let us formally state the problem which we address. Let the input data for a MapReduce job, $\text{job}_\alpha$, be composed of a set of data items $D = \{d_1, \ldots, d_n\}$ and divided into a set of chunks $C = \{C_1, \ldots, C_p\}$. Function $\text{loc}: D \rightarrow C$ assigns data items to chunks. Let $\text{job}_\alpha$ be composed of $M_\alpha = \{m_1, \ldots, m_p\}$ map tasks and $R_\alpha = \{r_1, \ldots, r_q\}$ reduce tasks. We assume that each map task $m_i$ processes chunk $c_i$. Let $N_\alpha = \{n_1, \ldots, n_s\}$ be the set of machines used in the job execution; $\text{node}(t)$ represents the machine where task $t$ is executed. Let $I_\alpha = \{i_1, \ldots, i_n\}$ be the set of intermediate key-value pairs produced by the map phase, such that $\text{map}(d_j) = \{i_{j1}, \ldots, i_{jt}\}$. $k(i_j)$ represents the key of intermediate pair $i_j$ and $\text{size}(i_j)$ represents its total size in bytes. We define $\text{output}(m_i) \subseteq I_\alpha$ as the set of intermediate pairs produced by map task $m_i$, $\text{output}(m_i) = \bigcup_{d_j \in C_i} \text{map}(d_j)$. We also define $\text{input}(r_i) \subseteq I_\alpha$ as the set of intermediate pairs assigned to reduce task $r_i$. Function $\text{part}: k(I_\alpha) \rightarrow R$ assigns intermediate keys to reduce tasks. Let $i_j$ be an intermediate key-value pair, such that $i_j \in \text{output}(m)$ and $i_j \in \text{input}(r)$. Let $P_{ij} \in \{0, 1\}$ be a variable that is equal to 0 if intermediate pair $i_j$ is produced in the same machine where it is processed by the reduce task, and 1 otherwise, i.e., $P(i_j) = 0$ iff $\text{node}(m) = \text{node}(r)$. Let $W = \{\text{job}_1, \ldots, \text{job}_w\}$ be the set of jobs in the workload. Our goal is to find $\text{loc}$ and $\text{part}$ functions in a way in which $\sum_{\text{job}_\alpha \in W} \sum_{i_j \in I_\alpha} \text{size}(i_j) P(i_j)$ is minimized. \section{MR-Part} In this section, we propose MR-Part, a technique that by automatic partitioning of MapReduce input files allows Hadoop to take full advantage of locality-aware scheduling for reduce tasks, and to reduce significantly the amount of data transferred between map and reduce nodes during the shuffle phase. MR-Part proceeds in three main phases, as shown in Figure 1: 1) Workload characterization, in which information about the workload is obtained from the execution of MapReduce jobs, and then combined to create a model of the workload represented as a hypergraph; 2) Repartitioning, in which a graph partitioning algorithm is applied over the hypergraph produced in the first phase, and based on the results the input files are repartitioned; 3) Scheduling, that takes advantage of the input partitioning in further executions of MapReduce jobs, and by an intelligent assignment of reduce tasks to the workers reduces the amount of data transferred in the shuffle phase. Phases 1 and 2 are executed offline over the model of the workload, so their cost is amortized over future job executions. ### 3.1 Workload Characterization In order to minimize the amount of data transferred through the network between map and reduce tasks, MR-Part tries to perform the following actions: 1) grouping all input tuples producing a given intermediate key in the same chunk and 2) assigning the key to a reduce task executing in the same node. The first action needs to find the relationship between input tuples and intermediate keys. With that information, tuples producing the same intermediate key are co-located in the same chunk. #### 3.1.1 Monitoring We inject a monitoring component in the MapReduce framework that monitors the execution of map tasks and captures the relationship between input tuples and intermediate keys. This component is completely transparent to the user program. The development of the monitoring component was not straightforward because the map tasks receive entries of the form $(K, V)$, but with this information alone we are not able to uniquely identify the corresponding input tuples. However, if we always use the same RecordReader\(^1\) to read the file, we can --- 1. The **RecordReader** is the component of MapReduce that parses the input and produce input key-value pairs. Normally each file format is parsed by a single RecordReader; therefore, using the same RecordReader for the same file is a common practice. uniquely identify an input tuple by a combination of its input file name, its chunk starting offset and the position of RecordReader when producing the input pairs for the map task. For each map task, the monitoring component produces a metadata file as follows. When a new input chunk is loaded, the monitoring component creates a new metadata file and writes the chunk information (file name and starting offset). Then, it initiates a record counter ($rc$). Whenever an input pair is read, the counter is incremented by one. Moreover, if an intermediate key $k$ is produced, it generates a pair $(k, rc)$. When the processing of the input chunk is finished, the monitoring component groups all key-counter pairs by their key, and for each key it stores an entry of the form $\langle k, \{rc_1, ..., rc_n\} \rangle$ in the metadata file. ### 3.1.2 Combination While executing a monitored job, all metadata is stored locally. Whenever a repartitioning is launched by the user, the information from different metadata files have to be combined in order to generate a hypergraph for each input file. The hypergraph is used for partitioning the tuples of an input file, and is generated by using the metadata files created in the monitoring phase. A hypergraph $H = (H_V, H_E)$ is a generalization of a graph in which each hyper edge $e \in H_E$ can connect more than two vertices. In fact, a hyper edge is a subset of vertices, $e \subseteq H_V$. In our model, vertices represent input tuples and hyper edges characterize tuples producing the same intermediate key in a job. The pseudo-code for generating the hypergraph is shown in Algorithm 1. Initially the hypergraph is empty, and new vertices and edges are added to it as the metadata files are read. The metadata of each job is processed separately. For each job, our algorithm creates a data structure $T$, which stores for each generated intermediate key, the set of input tuples that produce the key. For every entry in the file, the algorithm generates the corresponding tuple ids and adds them to the entry in $T$ corresponding to the generated key. For easy id generation, we store in each metadata file, the number of input tuples processed for the associated chunk, $n_i$. We use the function $generateTupleID(c_i, rc) = \sum_{j=1}^{i-1} n_i + rc$ to translate record numbers into ids. After processing all metadata of a job, for each read tuple, our algorithm adds a vertex in the hypergraph (if it is not there). Then, for each intermediate key, it adds a hyper edge containing the set of tuples that have produced the key. ### 3.2 Repartitioning Once we have modeled the workload of each input file through a hypergraph, we apply a min-cut $k$-way graph partitioning algorithm. The algorithm takes as Algorithm 1: Metadata combination Data: $F$: Input file; $W$: Set of jobs composing the workload Result: $H = (H_V, H_E)$: Hypergraph modeling the workload begin $H_E \leftarrow \emptyset$; $H_V \leftarrow \emptyset$ foreach $job \in |W|$ do $T \leftarrow \emptyset$; $K \leftarrow \emptyset$ foreach $m_i \in M_{job}$ do $md_i \leftarrow \text{getMetadata}(m_i)$ if $F = \text{getFile}(md_i)$ then foreach $\langle k, \{rc_1, ..., rc_n\} \rangle \in md_i$ do $\{t_1.id, ..., t_n.id\} \leftarrow \text{generateTupleID}(c_i, \{rc_1, ..., rc_n\})$ $T[k] \leftarrow T[k] \cup \{t_1.id, ..., t_n.id\}$ $K \leftarrow K \cup \{k\}$ endforeach endforeach foreach intermediate key $k \in K$ do $H_V \leftarrow H_V \cup T[k]$ $H_E \leftarrow H_E \cup \{T[k]\}$ endforeach end input a value $k$ and a hypergraph, and produces $k$ disjoint subsets of vertices minimizing the sum of the weights of the edges between vertices of different subsets. Weights can be associated to vertices, for instance to represent different sizes. We set $k$ as the number of chunks in the input file. By using the min-cut algorithm, the tuples that are used for generating the same intermediate key are usually assigned to the same partition. The output of the algorithm indicates the set of tuples that have to be assigned to each of the input file chunks. Then, the input file should be repartitioned using the produced assignments. However, the file repartitioning cannot be done in a straightforward manner, particularly because the chunks are created by HDFS automatically as new data is appended to a file. We create a set of temporary files, one for each partition. Then, we read the original file, and for each read tuple, the graph algorithm output indicates to which of the temporary files the tuple should be copied. Then, two strategies are possible: 1) create a set of files in one directory, one per partition, as it is done in the reduce phase of MapReduce executions and 2) write the generated files sequentially in the same file. In both cases, at the end of the process, we remove the old file and rename the new file/directory to its name. The first strategy is straightforward and instead of writing data in temporary files, it can be written directly in HDFS. The second one has the advantage of not having to deal with more files but has to deal with the following issues: – *Unfitted partitions*: The size of partitions created by the partitioning algorithm may be different than the predefined chunk size, even if we set strict imbalance constraints in the algorithm. To approximate the chunk limits to the end of the temporary files when written one after the other, we can modify the order in which temporary files are written. We used a greedy approach in which we select at each time the temporary file whose size, added to the total size written, approximates the most to the next chunk limit. – *Inappropriate last chunk*: The last chunk of a file is a special case, as its size is less than the predefined chunk size. However, the graph partitioning algorithm tries to make all partitions balanced and does not support such a constraint. In order to force one of the partitions to be of the size of the last chunk, we insert a virtual tuple, \( t_{\text{virtual}} \), with the weight equivalent to the empty space in the last chunk. After discarding this tuple, one of the partitions would have a size proportional to the size of the last chunk. The repartitioning algorithm’s pseudo-code is shown in Algorithm 2. In the algorithm we represent \( RR \) as the RecordReader used to parse the input data. We need to specify the associated RecordWriter, here represented as \( RW \), that performs the inverse function as \( RR \). The reordering of temporary files is represented by the function \( reorder() \). The complexity of the algorithm is dominated by the min-cut algorithm execution. Min-cut graph partitioning is NP-Complete, however, several polynomial approximation algorithms have been developed for it. In this paper we use PaToH\(^2\) to partition the hypergraph. In the rest of the algorithm, an inner loop is executed \( n \) times, where \( n \) is the number of tuples. \( \text{generateTupleID()} \) can be executed in \( O(1) \) if we keep a table with \( n_i \), the number of input tuples, for all input chunks. \( \text{getPartition()} \) can also be executed in \( O(1) \) if we keep an array storing for each tuple the assigned partition. Thus, the rest of the algorithm is done in \( O(n) \). ### 3.3 Reduce Tasks Locality-Aware Scheduling In order to take advantage of the repartitioning, we need to maximize data locality when scheduling reduce tasks. We have adapted the algorithm proposed in [9], in which each (key,node) pair is given a fairness-locality score representing the ratio between the imbalance in reducers input and data locality when key is assigned to a reducer. Each key is processed independently in a greedy algorithm. For each key, candidate nodes are sorted by their key frequency in descending order (nodes with higher key frequencies have better data locality). But instead of selecting the node with the maximum frequency, further nodes are considered \(^2\) [http://bmi.osu.edu/~umit/software.html](http://bmi.osu.edu/~umit/software.html) Algorithm 2: Repartitioning \textbf{Data:} $F$: Input file; $H = (H_V, H_E)$: Hypergraph modeling the workload; $k$: Number of partitions \textbf{Result:} $F'$: The repartitioned file \begin{algorithm} \begin{algorithmic} \State $H_V \leftarrow H_V \cup t_{\text{virtual}}$ \State $\{P_1, ..., P_k\} \leftarrow \text{mincut}(H, k)$ \For{$i \in (1, ..., k)$} \State create $temp_f_i$ \EndFor \ForAll{$c_i \in F$} \State initialize($RR, c_i$) \State $rc \leftarrow 0$ \While{$t$.data $\leftarrow RR.next()$} \State $t$.id $\leftarrow$ generateTupleID($c_i$, $rc$) \State $p \leftarrow \text{getPartition}(t$.id, $\{P_1, ..., P_k\})$ \State $RW$.write($temp_f_p$, $t$.data) \State $rc \leftarrow rc + 1$ \EndWhile \EndFor \State $(j_1, ..., j_k) \leftarrow \text{reorder}(temp_f_1, ..., temp_f_k)$ \For{$j \in (j_1, ..., j_k)$} \State write $temp_f_i$ in $F'$ \EndFor \end{algorithmic} \end{algorithm} if they have a better fairness-locality score. The aim of this strategy is to balance reduce inputs as much as possible. On the whole, we made the following modifications in the MapReduce framework: – The partitioning function is changed to assign a unique partition for each intermediate key. – Map tasks, when finished, send to the master a list with the generated intermediate keys and their frequencies. This information is included in the Heartbeat message that is sent at task completion. – The master assigns intermediate keys to the reduce tasks relying on this information in order to maximize data locality and to achieve load balancing. 3.4 Improving Scalability Two strategies can be taken into account to improve the scalability of the presented algorithms: 1) the number of intermediate keys; 2) the size of the generated graph. In order to deal with a high number of intermediate keys we have created the concept of virtual reducers, \( VR \). Instead of using intermediate keys both in the metadata and the modified partitioning function we use \( k \mod VR \). Actually, this is similar to the way in which keys are assigned to reduce tasks in the original MapReduce, but in this case we set \( VR \) to a much greater number than the actual number of reducers. This decreases the amount of metadata that should be transferred to the master and the time to process the key frequencies and also the amount of edges that are generated in the hypergraph. To reduce the number of vertices that should be processed in the graph partitioning algorithm, we perform a preparing step in which we coalesce tuples that always appear together in the edges, as they should be co-located together. The weights of the coalesced tuples would be the sum of the weights of the tuples that have been merged. This step can be performed as part of the combination algorithm that was described in Section 3.1.2. 4 Experimental Evaluation In this section, we report the results of our experiments done for evaluating the performance of MR-Part. We first describe the experimental setup, and then present the results. 4.1 Set-Up We have implemented MR-Part in Hadoop-1.0.4 and evaluated it on Grid5000 [1], a large scale infrastructure composed of different sites with several clusters of computers. In our experiments we have employed PowerEdge 1950 servers with 8 cores and 16 GB of memory. We installed Debian GNU/Linux 6.0 (squeeze) 64-bit in all nodes, and used the default parameters for Hadoop configuration. We tested the proposed algorithm with queries from TPC-H, a decision support benchmark. Queries have been written in Pig [11], a dataflow system on top of Hadoop that translates queries into MapReduce jobs. Scale factor (which accounts for the total size of the dataset in GBs) and employed queries are specified on each specific test. After data population and data repartitioning the cluster is rebalanced in order to minimize the effects of remote transfers in the map phase. As input data, we used lineitem, which is the biggest table in TPC-H dataset. In our tests, we used queries for which the shuffle phase has a significant impact in the total execution time. Particularly, we used the following queries: Q5 and Q9 that are examples of hash joins on different columns, Q7 that executes a replicated join and Q17 that executes a co-group. Note that, for any query data locality will be at least that of native Hadoop. We compared the performance of MR-Part with that of native Hadoop (NAT) and reduce locality-aware scheduling (RLS) [9], which corresponds to changes explained in Section 3.3 but over the non-repartitioned dataset. We measured the percentage of transferred data in the shuffle phase for different queries and cluster sizes. We also measured the response time and shuffle time of MapReduce jobs under varying network bandwidth configurations. 4.2 Results 4.2.1 Transferred Data for Different Query Types We repartitioned the dataset by using the metadata information collected from monitoring query executions. Then, we measured the amount of transferred data in the shuffled phase for our queries in the repartitioned dataset. Figure 2(a) depicts the percentage of data transferred for each of the queries on a 5 nodes cluster and scale factor of 5. As we can see, transferred data is around 80% in non-repartitioned data sets (actually the data locality is always around 1 divided by the number of nodes for the original datasets), while MR-Part obtains values for transferred data below 10% for all the queries. Notice that, even with reduce locality- 3. We have used the implementation provided in [link](http://www.cs.duke.edu/starfish/mr-apps.html) Figure 2: Percentage of transferred data for a) different type of queries b) varying cluster and data size aware scheduling, no gain is obtained in data locality as keys are distributed in all input chunks. 4.2.2 Transferred Data for Different Cluster Sizes In the next scenario, we have chosen query Q5, and measured the transferred data in the shuffle phase by varying the cluster size and input data size. Input data size has been scaled depending on the cluster size, so that each node is assigned 2GB of data. Fig 2(b) shows the percentage of transferred data for the three approaches, while increasing the number of cluster nodes. As shown, with increasing the number of nodes, our approach maintains a steady data locality, but it decreases for the other approaches. Since there is no skew in key frequencies, both native Hadoop and RLS obtain data localities near 1 divided by the number of nodes. Our experiments with different data sizes for the same cluster size show no modification in the percentage of transferred data for MR-Part (the results are not shown in the paper due to space restrictions). 4.2.3 Response Time As shown in previous subsection, MR-Part can significantly reduce the amount of transferred data in the shuffle phase. However, its impact on response time strongly depends on the network bandwidth. In this section, we measure the effect of MR-Part on MapReduce response time by varying network bandwidth. We control point-to-point bandwidth by using Linux `tc` command line utility. We execute query Q5 on a cluster of 20 nodes with scale factor of 40 (40GB of dataset total size). The results are shown in Figure 3. As we can see in Figure 3 (a), the slower is the network, the biggest is the impact of data locality on execution time. To show where the improvement is produced, in Figure 3 (b) we report the time spent in data shuffling. Measuring shuffle time is not straightforward since in native Hadoop it starts once 5% of map tasks have finished and proceeds in parallel while they are completed. Because of that, we represent two lines: NAT-ms that represents the time spent since the first shuffle byte is sent until this phase is completed, and NAT-os that represents the period of time where the system is only dedicated to shuffling (after last map finishes). For MR-Part only the second line has to be represented as the system has to wait for all map tasks to complete in order to schedule reduce tasks. We can observe that, while shuffle time is almost constant for MR-Part, regardless of the network conditions, it increases significantly as the network bandwidth decreases for the other alternatives. As a consequence, the response time for MR-Part is less sensitive to the network bandwidth than that of native Hadoop. For instance, for 10mbps, MR-Part executes in around 30% less time than native Hadoop. 5 Related Work Reducing data transfer in the shuffle phase is important because it may impose a significant overhead in job execution. In [14] a simulation is carried out in order to study the performance of MapReduce in different scenarios. The results show that data shuffling may take an important part of the job execution, particularly when network links are shared among different nodes belonging to a rack or a network topology. In [13], a pre-shuffling scheme is proposed to reduce data transfers in the shuffle phase. It looks over the input splits before the map phase begins and predicts the reducer the key-value pairs are partitioned into. Then, the data is assigned to a map task near the expected future reducer. Similarly, in [7], reduce tasks are assigned to the nodes that reduce the network transfers among nodes and racks. However, in this case, the decision is taken at reduce scheduling time. In [12] a set of data and VM placement techniques are proposed to improve data locality in shared cloud environments. They classify MapReduce jobs into three classes and use different placement techniques to reduce network transfers. All the mentioned jobs are limited by how the MapReduce partitioning function assigns intermediate keys to reduce tasks. In [9] this problem is addressed by assigning intermediate keys to reducers at scheduling time. However, data locality is limited by how intermediate keys are spread over all the map outputs. MR-part employs this technique as part of the reduce scheduling, but improves its efficiency by partitioning intelligently input data. In the literature, there have been many other improvements to the MapReduce framework. Some of them are related to MR-part. Eltabakh et al. [6] present CoHadoop, which aims to improve the performance of joins by partitioning input datasets over the join column and co-locating the corresponding chunks in the same nodes. Then, a map-side join strategy is used, avoiding to transfer data in the shuffle phase. This approach is only applicable to a very specific type of queries, as opposed to ours which aims at a greater type of jobs. An alternative to repartitioning when executing a set of queries over the same dataset is to store intermediate results as a form of caching, as is proposed in [5]. However, this may pose a high overhead in storage requirements. Our approach, on the other hand, improves queries performance while requiring the same storage size as the original dataset. Graph and hypergraph partitioning have been used to guide data partitioning in databases and in general in parallel computing [8]. They allow to capture data relationships when no other information, e.g., the schema, is given. The work in [3, 10] uses this approach to generate a database partitioning. The approach in Curino et al. [3] is similar to our approach in the sense that it tries to co-locate frequently accessed data items, although it is used to avoid distributed transactions in an OLTP system. 6 Conclusions and Future Work In this paper we proposed MR-Part, a new technique for reducing the transferred data in the MapReduce shuffle phase. MR-Part monitors a set of MapReduce jobs constituting a workload sample and creates a workload model by means of a hypergraph. Then, using the workload model, MR-Part repartitions the input files with the objective of maximizing the data locality in the reduce phase. We have built the prototype of MR-Part in Hadoop, and tested it in Grid5000 experimental platform. Results show a significant reduction in transferred data in the shuffle phase and important improvements in response time when network bandwidth is limited. As a possible future work we envision to perform the repartitioning in parallel. The approach used in this paper has worked flawlessly for the employed datasets, but a parallel version would be able to scale to very big inputs. This version would need to use parallel graph partitioning libraries, such as Zoltan. Acknowledgments Experiments presented in this paper were carried out using the Grid’5000 experimental testbed, being developed under the INRIA ALADDIN development action with support from CNRS, RENATER and several universities as well as other funding bodies (see https://www.grid5000.fr). References gravity reduce task scheduling to lower mapreduce network traffic. In *IEEE [8] Bruce Hendrickson and Tamara G. Kolda. Graph partitioning models for [9] Shadi Ibrahim, Hai Jin, Lu Lu, Song Wu, Bingsheng He, and Li Qi. LEEN: Locality/fairness-aware key partitioning for mapreduce in the cloud. In *Cloud Computing, Second International Conference, CloudCom 2010, [11] Christopher Olston, Benjamin Reed, Utkarsh Srivastava, Ravi Kumar, and Andrew Tomkins. Pig latin: a not-so-foreign language for data processing. locality-aware resource allocation for mapreduce in a cloud. In *Conference on High Performance Computing Networking, Storage and Analysis, [13] Sangwon Seo, Ingook Jang, Kyungchang Woo, Inkyo Kim, Jin-Soo Kim, and Seungryoul Maeng. HPMR: Prefetching and pre-shuffling in shared
{"Source-Url": "https://hal-lirmm.ccsd.cnrs.fr/lirmm-00879531/file/bda_2013-paper.pdf", "len_cl100k_base": 7784, "olmocr-version": "0.1.50", "pdf-total-pages": 17, "total-fallback-pages": 0, "total-input-tokens": 41299, "total-output-tokens": 9298, "length": "2e12", "weborganizer": {"__label__adult": 0.0003046989440917969, "__label__art_design": 0.0004224777221679687, "__label__crime_law": 0.0004138946533203125, "__label__education_jobs": 0.0013418197631835938, "__label__entertainment": 0.0001537799835205078, "__label__fashion_beauty": 0.0001811981201171875, "__label__finance_business": 0.0004863739013671875, "__label__food_dining": 0.0004315376281738281, "__label__games": 0.0006918907165527344, "__label__hardware": 0.0018663406372070312, "__label__health": 0.0008797645568847656, "__label__history": 0.0004253387451171875, "__label__home_hobbies": 0.00014388561248779297, "__label__industrial": 0.0007023811340332031, "__label__literature": 0.0003476142883300781, "__label__politics": 0.00032806396484375, "__label__religion": 0.0004954338073730469, "__label__science_tech": 0.44677734375, "__label__social_life": 0.00018227100372314453, "__label__software": 0.043731689453125, "__label__software_dev": 0.49853515625, "__label__sports_fitness": 0.0002644062042236328, "__label__transportation": 0.0005793571472167969, "__label__travel": 0.0002386569976806641}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 35922, 0.03082]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 35922, 0.53954]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 35922, 0.86408]], "google_gemma-3-12b-it_contains_pii": [[0, 1071, false], [1071, 2369, null], [2369, 5373, null], [5373, 7751, null], [7751, 10893, null], [10893, 12628, null], [12628, 15401, null], [15401, 17788, null], [17788, 20723, null], [20723, 21626, null], [21626, 23744, null], [23744, 26329, null], [26329, 27854, null], [27854, 29455, null], [29455, 32193, null], [32193, 34265, null], [34265, 35922, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1071, true], [1071, 2369, null], [2369, 5373, null], [5373, 7751, null], [7751, 10893, null], [10893, 12628, null], [12628, 15401, null], [15401, 17788, null], [17788, 20723, null], [20723, 21626, null], [21626, 23744, null], [23744, 26329, null], [26329, 27854, null], [27854, 29455, null], [29455, 32193, null], [32193, 34265, null], [34265, 35922, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 35922, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 35922, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 35922, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 35922, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 35922, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 35922, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 35922, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 35922, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 35922, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 35922, null]], "pdf_page_numbers": [[0, 1071, 1], [1071, 2369, 2], [2369, 5373, 3], [5373, 7751, 4], [7751, 10893, 5], [10893, 12628, 6], [12628, 15401, 7], [15401, 17788, 8], [17788, 20723, 9], [20723, 21626, 10], [21626, 23744, 11], [23744, 26329, 12], [26329, 27854, 13], [27854, 29455, 14], [29455, 32193, 15], [32193, 34265, 16], [34265, 35922, 17]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 35922, 0.0]]}
olmocr_science_pdfs
2024-12-01
2024-12-01
eae5a6d903e28b051511c0d155158e4e4a688746
Implementing Distributed Consensus Disclaimer This work is not affiliated with any company (including Google). This talk is the result of a personal education project! What? - My hobby project of learning about Distributed Consensus - I implemented a Paxos variant in Go - I learned a lot about how computers reach consensus - This talk: A fine selection of some of the mistakes I made - Language used: Go - Code is likely readable for enthusiasts of other languages as well - I relied on some Go features, similar features exist in other languages Distributed Consensus Aaaargh !!! Hi there! Have the bad potato! Hot Potato Hoppy Kim Little Peter Hi folks! Wassup? Hey Peter! Hold that for me :) Still Hot Potato [Diagram of people and objects] - Swinging an object - Surprised little Peter Still using his signature "Surprised Little Peter" as a brand. More Friends Potato Game Server Instances Same potato! Many Players Protocols - Paxos - Multi-Paxos - Cheap Paxos - Raft - ZooKeeper Atomic Broadcast - Proof-of-Work Systems - Bitcoin - Lockstep Anti-Cheating - Age of Empires Implementations - Chubby - coarse grained lock service - etcd - a distributed key value store - Apache ZooKeeper - a centralized service for maintaining configuration information, naming, providing distributed synchronization Paxos Paxos Roles - **Client** - Issues request to a *proposer* - Waits for response from a *learner* - Consensus on value X - No consensus on value X - **Proposer** - **Acceptor** - **Learner** - **Leader** Paxos Roles - **Client** - **Proposer (P)** - Advocates a *client* request - Asks acceptors to agree on the proposed value - Move the protocol forward when there is conflict - **Acceptor** - **Learner** - **Leader** Paxos Roles - Client - Proposer (P) - Acceptor (A) - Also called "voter" - The fault-tolerant "memory" of the system - Groups of acceptors form a quorum - Learner - Leader Paxos Roles - Client - Proposer (P) - Acceptor (A) - Learner (L) - Adds replication to the protocol - Takes action on learned (agreed on) values - E.g. respond to client - Leader Paxos Roles - Client - Proposer (P) - Acceptor (A) - Learner (L) - Leader (LD) - Distinguished proposer - The only proposer that can make progress - Multiple proposers may believe to be leader - Acceptors decide which one gets a majority Coalesced Roles - A single processors can have multiple roles - P+ - Proposer - Acceptor - Learner - Client talks to any processor - Nearest one? - Leader? Coalesced Roles at Scale - P+ system is a complete digraph - a directed graph in which every pair of distinct vertices is connected by a pair of unique edges - Everyone talks to everyone - Let $n$ be the number of processors - a.k.a. Quorum Size - **Connections** = $n \times (n - 1)$ - Potential network (TCP) connections Coalesced Roles with Leader - P+ system with a leader is a directed graph - Leader talks to everyone else - Let \( n \) be the number of processors - a.k.a. Quorum Size - **Connections** = \( n - 1 \) - Network (TCP) connections Coalesced Roles at Scale Maximum quorum size seen in “real life” Limitations - Single consensus - Once consensus has been reached no more progress can be made - But: Applications can start new Paxos runs - Multiple proposers may believe to be the leader - dueling proposers - theoretically infinite duel - practically retry-limits and jitter helps - Standard Paxos not resilient against Byzantine failures - Byzantine: Lying or compromised processors - Solution: Byzantine Paxos Protocol Introducing Skinny - Paxos-based - Minimalistic - Educational - Lock Service The “Giraffe”, “Beaver”, “Alien”, and “Frame” graphics on the following slides have been released under Creative Commons Zero 1.0 Public Domain License Skinny "Features" - Designed to be *easy to understand* - Relatively easy to observe - Coalesced Roles - Single Lock - Locks are always advisory! - A lock service does not enforce obedience to locks. - Go - Protocol Buffers - gRPC - Do not use in production! The Skinny Distributed Lock Service Assuming a wide quorum - **Instances** - Oregon (North America) - São Paulo (South America) - London (Europe) - Taiwan (Asia) - Sydney (Australia) - **Unusual in practice** - "Terrible latency" - **Perfect for observation and learning** - Timeouts, Deadlines, Latency How Skinny reaches consensus Lock please? PHASE 1A: PROPOSE PHASE 1B: PROMISE PHASE 2A: COMMIT Commit ID 1 Holder Beaver ID 0 Promised 1 Holder ID 0 Promised 1 Holder ID 0 Promised 1 Holder ID 0 Promised 1 Holder ID 1 Promised 1 Holder Beaver Lock acquired! Holder is Beaver. PHASE 2B: COMMITTED How Skinny deals with Instance Failure SCENARIO TWO INSTANCES FAIL INSTANCES ARE BACK BUT STATE IS LOST ID 0 Promised 0 Holder 0 Lock please? ID 9 Promised 9 Holder Beaver ID 0 Promised 0 Holder 0 ID 9 Promised 9 Holder Beaver ID 9 Promised 9 Holder Beaver INSTANCES ARE BACK BUT STATE IS LOST Lock please? ID 3 Promised 3 Holder Proposal ID 3 Proposal ID 3 Proposal ID 3 Proposal ID 3 Proposal ID 3 ID 9 Promised 9 Holder Beaver ID 9 Promised 9 Holder Beaver ID 9 Promised 9 Holder Beaver ID 0 Promised 0 Holder PROPOSAL REJECTED ID 3 Promised 3 Holder ID 9 Promised 9 Holder Beaver ID 0 Promised 3 Holder ID 9 Promised 9 Holder Beaver ID 9 Promised 9 Holder Beaver ID 9 Promised 9 Holder Beaver START NEW PROPOSAL WITH LEARNED VALUES ID 9 Promised 12 Holder Beaver ID 9 Promised 9 Holder Beaver ID 0 Promised 3 Holder Beaver ID 9 Promised 9 Holder Beaver ID 9 Promised 9 Holder Beaver ID 9 Promised 9 Holder Beaver ID 9 Promised 9 Holder Beaver ID 9 Promised 9 Holder Beaver START NEW PROPOSAL WITH LEARNED VALUES PROPOSAL ACCEPTED COMMIT ACCEPTED LOCK NOT GRANTED ID 12 Promised 12 Holder Beaver ID 12 Promised 12 Holder Beaver Lock NOT acquired! Holder is Beaver. ID 12 Promised 12 Holder Beaver Skinny APIs Skinny APIs - Lock API - Used by clients to acquire or release a lock - Consensus API - Used by Skinny instances to reach consensus - Control API - Used by us to observe what's happening Lock API ```protobuf define message AcquireRequest { string Holder = 1; } define message AcquireResponse { bool Acquired = 1; string Holder = 2; } define message ReleaseRequest {} define message ReleaseResponse { bool Released = 1; } define service Lock { rpc Acquire(AcquireRequest) returns (AcquireResponse); rpc Release(ReleaseRequest) returns (ReleaseResponse); } ``` Consensus API // Phase 1: Promise message PromiseRequest { uint64 ID = 1; } message PromiseResponse { bool Promised = 1; uint64 ID = 2; string Holder = 3; } // Phase 2: Commit message CommitRequest { uint64 ID = 1; string Holder = 2; } message CommitResponse { bool Committed = 1; } service Consensus { rpc Promise (PromiseRequest) returns (PromiseResponse); rpc Commit (CommitRequest) returns (CommitResponse); } Control API ```protobuf message StatusRequest {} message StatusResponse { string Name = 1; uint64 Increment = 2; string Timeout = 3; uint64 Promised = 4; uint64 ID = 5; string Holder = 6; message Peer { string Name = 1; string Address = 2; } repeated Peer Peers = 7; } service Control { rpc Status(StatusRequest) returns (StatusResponse); } ``` My Stupid Mistakes My Awesome Learning Opportunities Reaching Out... Skinny Instance - List of peers - All other instances in the quorum - Peer - gRPC Client Connection - Consensus API Client // Instance represents a skinny instance type Instance struct { mu sync.RWMutex // begin protected fields ... peers []*peer // end protected fields } type peer struct { name string address string conn *grpc.ClientConn client pb.ConsensusClient } Propose Function 1. Send proposal to all peers 2. Count responses ○ Promises 3. Learn previous consensus (if any) ```go for _, p := range in.peers { // send proposal resp, err := p.client.Promise( context.Background(), &pb.PromiseRequest{ID: proposal}) if err != nil { continue } if resp.Promised { yea++ } learn(resp) } ``` Resulting Behavior - Sequential Requests - Waiting for IO - Instance slow or down...? Improvement #1 - Limit the Waiting for IO for _, p := range peers { // send proposal ctx, cancel := context.WithTimeout( context.Background(), time.Second*3) resp, err := p.client.Promise(ctx, &pb.PromiseRequest{ID: proposal}) cancel() if err != nil { continue } if resp.Promised { yea++ } } learn(resp) Improvement #2 (Idea) - Parallel Requests - What's wrong? Improvement #2 - Concurrent Requests - Synchronized Counting - Synchronized Learning Propose P1 Propose P2 Propose P3 Propose P4 for _, p := range peers { // send proposal go func(p *peer) { ctx, cancel := context.WithTimeout( context.Background(), time.Second*3) defer cancel() resp, err := p.client.Promise(ctx, &pb.PromiseRequest{ID: proposal}) if err != nil { return } // now what? }(p) } Synchronizing - Define response data structure - Channels to the rescue! - Write responses to channel as they come in ```go type response struct { from string promised bool id uint64 holder string } responses := make(chan *response) for _, p := range in.peers { go func(p *peer) { ... responses <- &response{ from: p.name, promised: resp.Promised, id: resp.ID, holder: resp.Holder, } }(p) } ``` Synchronizing - Counting - Because we always vote for ourselves - Learning ```go // count the votes yea, nay := 1, 0 for r := range responses { // count the promises if r.promised { yea++ yea++ } else { nay++ } } in.learn(r) ``` responses := make(chan *response) for _, p := range in.peers { go func(p *peer) { ... responses <- &response{...} }(p) } // count the votes yea, nay := 1, 0 for r := range responses { // count the promises ... in.learn(r) } What's wrong? - We did not close the channel - range is blocking forever Solution: More synchronizing! - Use `WaitGroup` - Close channel when all requests are done Ignorance Is Bliss? Early Stopping Propose P1 Propose P2 Propose P3 Propose P4 Yea: ✓ ✓ ✓ Majority Return Early Stopping (1) - One context for all outgoing promises - We cancel as soon as we have a majority - We always cancel before leaving the function to prevent a context leak ```go type response struct { from string promised bool id uint64 holder string } responses := make(chan *response) ctx, cancel := context.WithTimeout( context.Background(), time.Second*3) defer cancel() ``` Early Stopping (2) - Nothing new here ```go wg := sync.WaitGroup{} for _, p := range in.peers { wg.Add(1) go func(p *peer) { defer wg.Done() resp, err := p.client.Promise(ctx, &pb.PromiseRequest{ID: proposal}) // ERROR HANDLING. SEE NEXT SLIDE! responses <- &response{ from: p.name, promised: resp.Promised, id: resp.ID, holder: resp.Holder, } }(p) } ``` Early Stopping (3) - We don't care about cancelled requests - We want errors which are **not** the result of a canceled proposal to be counted as a negative answer (nay) later. - For that we emit an empty response into the channel in those cases. ```go resp, err := p.client.Promise(ctx, &pb.PromiseRequest{ID: proposal}) if err != nil { if ctx.Err() == context.Canceled { return } responses <- &response{from: p.name} return } responses <- &response{...} ... ``` Early Stopping (4) - Close responses channel once all responses have been received, failed, or canceled Early Stopping (5) - Count the votes - Learn previous consensus (if any) - Cancel all in-flight proposal if we have reached a majority ```javascript yea, nay := 1, 0 Canceled := false for r := range responses { if r.promised { yea++ } else { nay++ } in.learn(r) } if !canceled { if in.isMajority(yea) || in.isMajority(nay) { cancel() canceled = true } } ``` Is this fine? - Timeouts are now even more critical! - "Ghost Quorum" Effect Ghost Quorum - **Reason:** Too tight timeout - **Some instances always time out** - Effectively: Quorum of remaining instances - **Hidden reliability risk!** - If one of the remaining instances fails, the distributed lock service is down! - No majority - No consensus The Duel What's wrong? - Retry Logic - Unlimited retries! - Coding Style - I should care about the return value. ```go ... retry: id := id + in.increment promised := in.propose(id) if !promised { in.log.Printf("retry (%v)", id) goto retry } ... ... _ = in.commit(id, holder) ..." Duelling Proposers Proposal ID 1 Proposal ID 2 Proposal ID 3 Proposal ID 4 Proposal ID 5 Proposal ID 6 Proposal ID 7 Proposal ID 8 Proposal ID 9 Proposal ID 10 Proposal ID 11 Proposal ID 12 Proposal ID 13 Proposal ID 14 Proposal ID 15 Lock please? Lock please? Soon... <table> <thead> <tr> <th>NAME</th> <th>INCREMENT</th> <th>PROMISED</th> <th>ID</th> <th>HOLDER</th> <th>LAST SEEN</th> </tr> </thead> <tbody> <tr> <td>london</td> <td>3</td> <td>1062520</td> <td>1062520</td> <td>_</td> <td>now</td> </tr> <tr> <td>oregon</td> <td></td> <td></td> <td></td> <td></td> <td>connection error</td> </tr> <tr> <td>spaulo</td> <td></td> <td></td> <td></td> <td></td> <td>connection error</td> </tr> <tr> <td>sydney</td> <td>5</td> <td>1062520</td> <td>1062520</td> <td>_</td> <td>2 seconds ago</td> </tr> <tr> <td>taiwan</td> <td>4</td> <td>1062520</td> <td>1062520</td> <td>_</td> <td>1 second ago</td> </tr> </tbody> </table> Instances **oregon** and **spaulo** were intentionally offline for a different experiment. The Fix - Retry Counter - Backoff - Jitter retries := 0 retry: promised := in.propose() if !promised && retries < 3 { retries++ backoff := time.Duration(retries) * 2 * time.Millisecond jitter := time.Duration(rand.Int63n(1000)) * time.Microsecond time.Sleep(backoff + jitter) goto retry } ... Sources Further Reading Reaching Agreement in the Presence of Faults M. PEASE, R. SHOSTAK, AND L. LAMPORT SRI International, Menlo Park, California ABSTRACT. The problem addressed here concerns a set of isolated processors, some unknown subset of which may be faulty, that communicate only by means of two-party messages. Each nonfaulty processor has a private value of information that must be communicated to each other nonfaulty processor. Nonfaulty processors always communicate honestly, whereas faulty processors may lie. The problem is to devise an algorithm in which processors communicate their own values and relay values received from others that allows each nonfaulty processor to infer a value for each other processor. The value inferred for a nonfaulty processor must be that processor’s private value, and the value inferred for a faulty one must be consistent with the corresponding value inferred for each nonfaulty processor. https://lamport.azurewebsites.net/pubs/reaching.pdf Further Reading The Chubby lock service for loosely-coupled distributed systems Mike Burrows, Google Inc. Naming of "Skinny" absolutely not inspired by "Chubby" ;) example, the Google File System [7] uses a Chubby lock to appoint a GFS master server, and Bigtable [3] uses Chubby in several ways: to elect a master, to allow the master to discover the servers it controls, and to permit clients to find the master. In addition, both GFS and Bigtable use Chubby as a well-known and available location to store a small amount of meta-data; in effect they use Chubby as the root of their distributed data struc- https://research.google.com/archive/chubby-osdi06.pdf Further Watching Paxos Agreement - Computerphile Dr. Heidi Howard University of Cambridge Computer Laboratory https://youtu.be/s8JqcZtvnsM The Paxos Algorithm Luis Quesada Torres Google Site Reliability Engineering https://youtu.be/d7nAGI_NZPk Try, Play, Learn! - The Skinny Lock Server is open source software! - skinnyd lock server - skinnyctl control utility - Terraform modules - Ansible playbooks <table> <thead> <tr> <th>NAME</th> <th>INCREMENT</th> <th>PROMISED</th> <th>ID</th> <th>HOLDER</th> <th>LAST SEEN</th> </tr> </thead> <tbody> <tr> <td>london</td> <td>1</td> <td>2</td> <td>2</td> <td></td> <td>now</td> </tr> <tr> <td>oregon</td> <td>2</td> <td>2</td> <td>2</td> <td></td> <td>now</td> </tr> <tr> <td>spaulo</td> <td>3</td> <td>2</td> <td>2</td> <td></td> <td>now</td> </tr> <tr> <td>sydney</td> <td>4</td> <td>2</td> <td>2</td> <td></td> <td>now</td> </tr> <tr> <td>taiwan</td> <td>5</td> <td>2</td> <td>2</td> <td></td> <td>now</td> </tr> </tbody> </table> Find me on Twitter @danrl_com I blog about SRE and technology: https://danrl.com github.com/danrl/skinny
{"Source-Url": "https://www.usenix.org/sites/default/files/conference/protected-files/srecon20americas_slides_ludtke.pdf", "len_cl100k_base": 4912, "olmocr-version": "0.1.50", "pdf-total-pages": 83, "total-fallback-pages": 0, "total-input-tokens": 97998, "total-output-tokens": 7827, "length": "2e12", "weborganizer": {"__label__adult": 0.00028252601623535156, "__label__art_design": 0.00023567676544189453, "__label__crime_law": 0.00022220611572265625, "__label__education_jobs": 0.0006833076477050781, "__label__entertainment": 8.279085159301758e-05, "__label__fashion_beauty": 9.66787338256836e-05, "__label__finance_business": 0.00016820430755615234, "__label__food_dining": 0.00033855438232421875, "__label__games": 0.0004897117614746094, "__label__hardware": 0.0009531974792480468, "__label__health": 0.00033926963806152344, "__label__history": 0.00017213821411132812, "__label__home_hobbies": 8.45789909362793e-05, "__label__industrial": 0.0003027915954589844, "__label__literature": 0.00022733211517333984, "__label__politics": 0.00020062923431396484, "__label__religion": 0.00032210350036621094, "__label__science_tech": 0.018035888671875, "__label__social_life": 0.00015473365783691406, "__label__software": 0.00675201416015625, "__label__software_dev": 0.96923828125, "__label__sports_fitness": 0.0002377033233642578, "__label__transportation": 0.00031065940856933594, "__label__travel": 0.0001442432403564453}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 16951, 0.02828]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 16951, 0.07504]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 16951, 0.76419]], "google_gemma-3-12b-it_contains_pii": [[0, 169, false], [169, 562, null], [562, 584, null], [584, 584, null], [584, 628, null], [628, 682, null], [682, 874, null], [874, 887, null], [887, 887, null], [887, 944, null], [944, 944, null], [944, 1345, null], [1345, 1351, null], [1351, 1567, null], [1567, 1790, null], [1790, 1969, null], [1969, 2155, null], [2155, 2403, null], [2403, 2570, null], [2570, 2902, null], [2902, 3140, null], [3140, 3206, null], [3206, 3646, null], [3646, 3646, null], [3646, 3877, null], [3877, 4141, null], [4141, 4177, null], [4177, 4462, null], [4462, 4491, null], [4491, 4504, null], [4504, 4522, null], [4522, 4540, null], [4540, 4711, null], [4711, 4766, null], [4766, 4805, null], [4805, 4814, null], [4814, 4833, null], [4833, 5044, null], [5044, 5324, null], [5324, 5514, null], [5514, 5842, null], [5842, 5860, null], [5860, 5860, null], [5860, 6030, null], [6030, 6042, null], [6042, 6236, null], [6236, 6623, null], [6623, 7076, null], [7076, 7451, null], [7451, 7504, null], [7504, 7520, null], [7520, 7935, null], [7935, 8328, null], [8328, 8416, null], [8416, 8459, null], [8459, 8793, null], [8793, 8852, null], [8852, 8983, null], [8983, 9325, null], [9325, 9819, null], [9819, 10092, null], [10092, 10428, null], [10428, 10520, null], [10520, 10520, null], [10520, 10540, null], [10540, 10630, null], [10630, 11052, null], [11052, 11535, null], [11535, 12028, null], [12028, 12133, null], [12133, 12527, null], [12527, 12605, null], [12605, 12882, null], [12882, 12891, null], [12891, 13170, null], [13170, 13434, null], [13434, 14039, null], [14039, 14345, null], [14345, 14353, null], [14353, 15347, null], [15347, 16015, null], [16015, 16261, null], [16261, 16951, null]], "google_gemma-3-12b-it_is_public_document": [[0, 169, true], [169, 562, null], [562, 584, null], [584, 584, null], [584, 628, null], [628, 682, null], [682, 874, null], [874, 887, null], [887, 887, null], [887, 944, null], [944, 944, null], [944, 1345, null], [1345, 1351, null], [1351, 1567, null], [1567, 1790, null], [1790, 1969, null], [1969, 2155, null], [2155, 2403, null], [2403, 2570, null], [2570, 2902, null], [2902, 3140, null], [3140, 3206, null], [3206, 3646, null], [3646, 3646, null], [3646, 3877, null], [3877, 4141, null], [4141, 4177, null], [4177, 4462, null], [4462, 4491, null], [4491, 4504, null], [4504, 4522, null], [4522, 4540, null], [4540, 4711, null], [4711, 4766, null], [4766, 4805, null], [4805, 4814, null], [4814, 4833, null], [4833, 5044, null], [5044, 5324, null], [5324, 5514, null], [5514, 5842, null], [5842, 5860, null], [5860, 5860, null], [5860, 6030, null], [6030, 6042, null], [6042, 6236, null], [6236, 6623, null], [6623, 7076, null], [7076, 7451, null], [7451, 7504, null], [7504, 7520, null], [7520, 7935, null], [7935, 8328, null], [8328, 8416, null], [8416, 8459, null], [8459, 8793, null], [8793, 8852, null], [8852, 8983, null], [8983, 9325, null], [9325, 9819, null], [9819, 10092, null], [10092, 10428, null], [10428, 10520, null], [10520, 10520, null], [10520, 10540, null], [10540, 10630, null], [10630, 11052, null], [11052, 11535, null], [11535, 12028, null], [12028, 12133, null], [12133, 12527, null], [12527, 12605, null], [12605, 12882, null], [12882, 12891, null], [12891, 13170, null], [13170, 13434, null], [13434, 14039, null], [14039, 14345, null], [14345, 14353, null], [14353, 15347, null], [15347, 16015, null], [16015, 16261, null], [16261, 16951, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 16951, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 16951, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 16951, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 16951, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 16951, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 16951, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 16951, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 16951, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 16951, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 16951, null]], "pdf_page_numbers": [[0, 169, 1], [169, 562, 2], [562, 584, 3], [584, 584, 4], [584, 628, 5], [628, 682, 6], [682, 874, 7], [874, 887, 8], [887, 887, 9], [887, 944, 10], [944, 944, 11], [944, 1345, 12], [1345, 1351, 13], [1351, 1567, 14], [1567, 1790, 15], [1790, 1969, 16], [1969, 2155, 17], [2155, 2403, 18], [2403, 2570, 19], [2570, 2902, 20], [2902, 3140, 21], [3140, 3206, 22], [3206, 3646, 23], [3646, 3646, 24], [3646, 3877, 25], [3877, 4141, 26], [4141, 4177, 27], [4177, 4462, 28], [4462, 4491, 29], [4491, 4504, 30], [4504, 4522, 31], [4522, 4540, 32], [4540, 4711, 33], [4711, 4766, 34], [4766, 4805, 35], [4805, 4814, 36], [4814, 4833, 37], [4833, 5044, 38], [5044, 5324, 39], [5324, 5514, 40], [5514, 5842, 41], [5842, 5860, 42], [5860, 5860, 43], [5860, 6030, 44], [6030, 6042, 45], [6042, 6236, 46], [6236, 6623, 47], [6623, 7076, 48], [7076, 7451, 49], [7451, 7504, 50], [7504, 7520, 51], [7520, 7935, 52], [7935, 8328, 53], [8328, 8416, 54], [8416, 8459, 55], [8459, 8793, 56], [8793, 8852, 57], [8852, 8983, 58], [8983, 9325, 59], [9325, 9819, 60], [9819, 10092, 61], [10092, 10428, 62], [10428, 10520, 63], [10520, 10520, 64], [10520, 10540, 65], [10540, 10630, 66], [10630, 11052, 67], [11052, 11535, 68], [11535, 12028, 69], [12028, 12133, 70], [12133, 12527, 71], [12527, 12605, 72], [12605, 12882, 73], [12882, 12891, 74], [12891, 13170, 75], [13170, 13434, 76], [13434, 14039, 77], [14039, 14345, 78], [14345, 14353, 79], [14353, 15347, 80], [15347, 16015, 81], [16015, 16261, 82], [16261, 16951, 83]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 16951, 0.01997]]}
olmocr_science_pdfs
2024-11-29
2024-11-29
f9d5f00c4dfcde10cb88885ea631d910be6801d9
1 INTRODUCTION Cryptography, hereafter crypto, is widely used nowadays to protect our data and ensure confidentiality. For example, without crypto, we would not be able to securely use online banking or do online shopping. Unfortunately, previous research results show that crypto is often used in an insecure way [3, 4, 7, 9, 11]. One such problem is the choice of an insecure parameter, like an insecure block mode, for crypto primitives like encryption. Many static analysis tools exist to identify these misuses such as CryptoKEX [13], CryptoLint [4], CognicryptSAST [8], and Cryptoguard [12]. While these tools and the respective in-the-wild studies concentrate on Java and C, user studies suggest that the existing Python APIs reduce the number of crypto misuses. Acar et al. [2] conducted an experiment with 307 GitHub users which had to solve 3 crypto-related development tasks. They observed that 68.5 % of the professional developers wrote a secure solution in Python for the given task. Within a controlled experiment with 256 Python developers that tried to solve simple crypto tasks, Acar et al. [1] identified that a simple API design, like the Python library cryptography, supports developers in writing secure code. However, no empirical in-the-wild study has yet confirmed that crypto misuses in Python occur less frequently than in Java or C. To empirically evaluate crypto misuses in Python, we introduce LICMA, a multi-language analysis framework with support for 5 different Python crypto APIs and Java’s JCA API. We provide 5 different rules [4] for all Python APIs and 6 different rules [4] for JCA to detect the most common crypto misuses. With LICMA, we analyzed 895 popular Python apps from GitHub and 51 MicroPython projects to gain insights into misuses in Python. We identified that 52.26 % of the Python GitHub apps with crypto usages have at least one misuse causing 1,501 misuses. In total, only 7 % of the misuses are within the application code itself, while the remaining misuses are introduced by dependencies. Further, our study of MicroPython projects reveals that developers in the embedded domain tend to use crypto via C code. Thus, revealing the importance of hybrid static analyses, which can track program information, e.g., a call graph, across multiple languages [5, 10]. To further improve our understanding whether Python APIs are less prone to crypto misuses, we make the following contributions: - A novel, multi-language analysis tool to detect crypto misuses in Python and Java. For Python we cover crypto misuses for 5 common Python crypto APIs and for Java the standard API JCA. Table 1: Six commonly discussed crypto misuses in Java and C [4, 13] with an example of a violation in Python. <table> <thead> <tr> <th>ID</th> <th>Rule</th> <th>Python: Violation Example</th> </tr> </thead> <tbody> <tr> <td>§1</td> <td>Do not use electronic code book (ECB) mode for encryption.</td> <td><code>aes = AES.new(key, AES.MODE_ECB)</code></td> </tr> <tr> <td>§2</td> <td>Do not use a non-random initialization vector (IV) for ciphertext block chaining (CBC) encryption.</td> <td><code>aes = AES.new(key, AES.MODE_CBC, b'\0\0\0\0')</code></td> </tr> <tr> <td>§3</td> <td>Do not use constant encryption keys.</td> <td><code>kdf = PBKDF2HMAC(hashes.SHA256(), 32, b'\0\0\0\0')</code></td> </tr> <tr> <td>§4</td> <td>Do not use constant salts for password-based encryption (PBE).</td> <td><code>kdf = PBKDF2HMAC(hashes.SHA256(), 32, salt, 1)</code></td> </tr> <tr> <td>§5</td> <td>Do not use fewer than 1,000 iterations for PBE.</td> <td>Due to API design only possible in Java [4] and C/C++ [13]</td> </tr> <tr> <td>§6</td> <td>Do not use static seeds to initialize secure random generator.</td> <td>A seed can ensure that the output of a random number generator is non-deterministic. Rule 6 (§6) covers that static seeds lead to deterministic outputs. Common Java [4] and C/C++ [13] libraries expect a seed, while the analyzed Python APIs avoid this by design.</td> </tr> </tbody> </table> 2 BACKGROUND Crypto libraries enable developers to use crypto primitives, like symmetric key encryption or password-based encryption (PBE), in their application. However, studies have shown that developers struggle to use those APIs correctly and securely. For example, Krüger et al. [8] show that 95% of the Android applications using crypto have at least one crypto misuse. In the remainder of the paper, we define a crypto misuse, in short misuse, as a usage of a crypto primitive against attacks. Thus, Egele et al. [4] suggest the minimum recommended value of 1,000 iterations as defined in the PBE standard PKCS#5. 3 DESIGN AND IMPLEMENTATION OF LICMA In this section, we describe the design of our static analysis tool LICMA, and discuss the implementation in more detail. 3.1 Design A general overview of LICMA is given in Figure 1. First, we parse a source code file into the respective Abstract Syntax Tree (AST). More specifically, we use Babelfish to create a Universal Abstract Syntax Tree (UAST) which combines language-independent AST elements with language-specific elements. For simplicity, we use the term AST in the remainder of the paper. Second, we apply the LICMA analysis upon the AST to identify potential misuses of our crypto rules. Based upon the rule defining a misuse, the analysis checks for a violation of the rule within the source code and triggers a backward analysis for this task. The backward slice is created by filtering the AST with the help of XPath queries, and works as follows: First, the backward slicing algorithm (BSA) identifies all source code lines that are referred within the respective rule. An example of the slicing criterion is a function call parameter like the key for a crypto function. Second, the BSA determines for all function calls if the parameter is either hard-coded, a local assignment, or a global assignment. If one of the three cases is fulfilled, the corresponding value is returned. This value is checked against a function defined in the rule, e.g., if the value is smaller than 1,000 for §5. In the negative case, the BSA looks for the caller of the function, and checks the caller’s parameters as described above. The algorithm stops if a value is returned or no further callers to analyse are available, and returns the result of the analysis. For its reports, LICMA distinguishes between a potential misuse if it can not resolve the value of interest due to missing callers, and a definite misuse if it is resolved to an insecure option. 3.2 Implementation For our study, we implemented Python and Java analysis components. For Python, we cover 5 different crypto modules: cryptography, M2Crypto, PyCrypto, PyNaCl, ucryptolib. This selection is based 4 METHODOLOGY To analyze Python applications, we constructed two distinct data sets of popular Python and MicroPython projects. Furthermore, we compared our findings in Python programs with previous studies about Java and C code. 4.1 Searching and Downloading Python Apps Both data sets represent very different domains where Python is used, ranging from server and desktop use to low-level embedded code. How we selected the projects in both data sets for our empirical study is described in the following. 4.1.1 Python Projects from GitHub. For our evaluation of crypto misuses in Python code we focus on open-source code. Thus, we crawled and downloaded the top 895 Python repositories from GitHub sorted by stars. To further understand the influence of dependencies, we downloaded them with Python’s standard dependency manager pip for each project. Afterwards, we ended up with 14,442 Python packages of which 3,420 are unique. As our analysis works upon a per-file basis, we reduced our set to only those source code files that include the function calls referenced in our rules, e.g., AES.new (...). In addition, we filter for production code and ignore test code which should be non-existent during the execution of the application. After applying these 2 filter steps, we ended up with 946 source files from 155 different repositories. Unfortunately, Babelfish was unable to parse 35 of these files, and reached the maximum recursion depth for the AST XPath queries for at least one rule in 50 files. These 85 parsing failures are distributed amongst 61 different projects. However, for each of the projects at least 1 file with a crypto usage was analyzed successfully. In total, we successfully analyzed 861 different files within 55 Python repositories with LICMA. 4.1.2 Curated Top MicroPython Projects. As an extension to our Python application set, we crawled 51 MicroPython projects which are stated as the top announced MicroPython projects on https://awesomeopensource.com/projects/micropython. Like for the regular Python applications, we downloaded all dependencies with pip and got 113 dependencies with 1 duplicate dependency. Afterwards, we applied the same filter steps as before: The usage of crypto and the exclusion of test files. These steps, resulted in 5 files which seem to use the Python crypto libraries supported by LICMA. Note that we included the MicroPython crypto library ucryptolib in LICMA and our filtering steps. To further understand this small number of potential usages, we also analyzed our data set of MicroPython applications manually. This analysis reveals that we potentially missed five crypto usages. 4.2 Comparison with Previous Studies To understand the differences between crypto misuses for §1 to §6, cf. Table 1, in Python and previous studies in Java, with the analysis CryptoLint, [4] and C/C++, with the analysis CryptoREX, [13], we compared the reported results. As we concentrated on the same rule set, we only need a few adjustments to compare the results. First, for our meta-analysis we exclude §6 since the 5 analyzed Python modules avoid this misuse by design. Second, we merge the results for §1 of Egele et al. [4] as they split their result into two different cases: The explicit use of the block mode ECB on one side and the implicit use of this block mode due to the API design on the other. Third, due to the design of our analysis, we only consider definite findings. Crypto.int and CryptoREX do not distinguish between potential misuses and definite ones. Fourth, to enable a fair comparison, we compare only percentages rather than absolute numbers, as we are interested in the general distribution and the influence of API design on crypto misuses. We choose to compare the studies on the percentage of applications using crypto and having at least one misuse of a respective rule as introduced by Egele et al. [4]. Unfortunately, Zhang et al. [13] only reports details for the successfully unpacked firmware images before filtering for crypto usages. 5 EVALUATION In this Section, we present our evaluation of crypto misuses in real-world Python applications from GitHub and MicroPython projects. 5.1 GitHub Python Projects Overall, LICMA identified 1,501 possible misuses in our data set of Python applications attributed to 81 repositories. Thus, 52.26% of the 155 analyzed Python applications contain crypto usages have at least one misuse. As discussed in Section 3.1, we distinguish between potential and definite misuses. While a potential misuse requires a manual inspection to decide whether it is harmful, a definite misuse indicates that the analysis was able to resolve the respective crypto parameter. Thus, we know that a rule of LICMA is definitely violated by the respective API call. We identified 85 definite misuses which could be identified within one class file and thus are local. The remaining 1,416 misuses are potential misuses. **Observation 1** In total, 52.26% of the Python projects using crypto APIs contain at least a potential misuse. Only 5.66% of the misuses are local (within one class file). 5.1.1 Dependencies. From the 1,501 misuses, only 7.00% are within the application code and not in dependencies. These misuses are within 14.81% of the applications with at least one misuse. The remaining misuses are found in dependencies and can be reduced to 290 unique misuses. Thus, developers introduce most of their misuses by using dependencies rather than using the respective crypto library directly. In total, only 12 projects are affected by misuses in the application code itself. To understand the influence of dependencies within the applications with the most misuses, we inspected the 10 Python projects with more than 30 misuses. Figure 2 confirms the previous observation that most of the misuses are in dependencies and only a few projects use a crypto library directly. The Scapy repository6 is an exception as all misuses are in its code. Our investigation reveals that this repository is often used as a dependency by other projects. Thus, these findings can be attributed to dependencies as well. While, the previous results focused on the projects, we also inspected the dependencies causing most of the misuses. In total, 5 ![Figure 2: Python projects with 30 or more misuses.](image) 5.1.2 Rules and Python Cryptographic Libraries. In order to get a better understanding of the underlying reasons of the misuses, we evaluated how often a misuse per rule and library occurs (Fig. 3). Our analysis reveals that most of the misuses are related to the use of different block modes, §1 and §2, of the M2Crypto library, and constant encryption keys, §3, for the cryptography library. We assume that the few numbers of misuses of §1 and §2 of cryptography are due to the design of the library. The library suggests to use a high-level symmetric encryption class, called Fernet, instead of the low-level symmetric encryption classes which would enable the respective misuses. Most of the misuses due to insecure PBE configurations, §4 and §5, are by developers using the library PyCrypto. While, none of the 3 previously mentioned libraries make it impossible to produce a misuse of one of our 5 rules, the library PyNaCl completely prevents misuses for §1, §2, and §5. In our study, we found only 2 instances of a misuse due to a constant encryption key for PyNaCl. **Observation 3** The design of the Python crypto API cryptography supports developers in avoiding misuses due to an insecure block mode for AES encryption. 5.1.3 Reasons for Definite Misuses. Among the definite misuses, there is at least one misuse for all previously discussed rules. We identified 13 definite misuses in 5 different projects which use --- 6https://github.com/secdev/scapy the ECB encryption mode (§1). In all cases, the mode is passed explicitly with the parameter and not implicitly as in Java [4]. For 8 misuses we observed that a static IV is used, e.g. zero bytes, and thus resulting in an insecure encryption with the block mode CBC (§2). Furthermore, we identified that the scapy project which is also commonly used as a dependency uses a constant encryption key resulting in 14 misuses (§3). For example, we found a zero byte-array as key. For password-based encryption, we identified 18 misuses within 14 projects which pass a static salt instead of a randomly generated one (§4). In total, we identify 32 misuses which are due to requesting only 1 iteration instead of an value greater than 1,000 as recommended (§5). Thus, the process of generating a password is faster but very insecure, e.g., due to dictionary attacks. ### Observation 4 As a result of 58.82 % of the definite misuses, passwords are vulnerable to dictionary attacks (§4 and §5). ### 5.2 MicroPython When we applied LICMA upon the 5 source files containing crypto API usages of the MicroPython data set, we identified no misuse. For this reason, we inspected the MicroPython repositories for usages of other crypto functions not covered by LICMA and identified 5 additional files. We notice that the crypto module ucrypto11b which is provided by MicroPython, is only used by tests in 2 projects. For the remaining 3 findings, the crypto functions are written in C rather than Python. Thus, these files were removed due to our filter steps described in Section 4.1.2. Our small analysis of MicroPython projects shows that for a further exploration of MicroPython applications we need to consider custom implementations of AES in Python and C. This seems to be a common pattern for embedded code where performance is important and low-level code is often shipped as custom C blobs. Thus, we can observe the importance of hybrid analyses approaches [5, 10]. #### Observation 5 Our comparison reveals that the design of the crypto APIs in Python helps developers to avoid common misuses on the use of block modes for AES encryption in their code. ### 6 COMPARISON WITH PREVIOUS STUDIES As one motivation of this paper was to empirically shed light on the question whether Python crypto libraries help developers in writing more secure code than previous empirical studies in Java or C have revealed, we compare our results to the findings of these studies. For all applications which use crypto, we observe more secure applications than reported by Egele et al. [4]. While for Android apps using crypto libraries at least one misuse occurs in 87.90 % of the apps, we observe “only” 52.26 % of Python applications with a misuse. Unfortunately, Zhang et al. [13] only report the number of C firmware images they started to analyze and not explicitly mention how many of these actually use a crypto API. Thus, we only know that 24.18 % of the analyzed firmware images have at least one misuse. In Figure 4 we present the percentage of applications per study and per rule with a misuse. In general, we observed that misuses in Python occur less frequently than for Java and C. The misuse of ECB as an encryption mode is the most-misused in Java and C, and is significantly less with 3.23 % of the Python applications. We hypothesize that this difference is due to the design of the libraries as discussed in Section 5.1. ### 7 THREATS TO VALIDITY We evaluated top GitHub Python projects and it may be that our results fail to generalize on specialized Python applications. For our data set on MicroPython applications, we also concentrated on popular projects. Thus, our insights may not generalize to less popular or closed-source projects. However, we believe that our results provide first interesting insights on crypto misuses in Python. Currently, our analysis is limited to capabilities of Babelfish, especially the recursive maximum depth of its filter function. Furthermore, currently Babelfish only creates an AST for a single file. Thus, our analysis fails to resolve misuse over multiple files. We hope that these limitations can be lifted through further development of Babelfish. These improvements will hopefully help to reduce the number of false-positives in the potential misuses. Furthermore, it may be that our static analysis missed some misuses as Python is a dynamic typed language. We compare different application types of studies conducted in different years. Thus, it may be that the results might change when conducted on the same kind of applications now. Further, the results may differ due to the effect of different application domains and different analysis frameworks. Moreover, the percentages of applications with at least one misuse per rule that we used from Zhang et al. [13] might be too positive for C, as the number of firmware images with crypto usages is not explicitly reported. 8 RELATED WORK Several previous studies show that crypto misuses occur frequently in different languages and platforms. Egele et al. [4], Krüger et al. [8], Rahaman et al. [12], and Hazhirpasand et al. [6] analyzed Java and Android applications. They reported that 84.78% up to 99.59% of the applications using crypto have at least one misuse. Zhang et al. [13] analyzed Internet of Things (IoT) device firmwares written in C/C++, from which 24.2% contain at least one misuse. Previous work introducing new crypto misuse analyses either improve static analysis approaches for crypto misuse detection or introduce these to new languages imposing new challenges. CryptoLint [4] is the first (closed-source) static analysis for crypto misuses for Android applications introducing the six rules for crypto misuses, c.f. Table 1. While this analysis is built upon a deny-listing approach, CogniCryptSAST [8] introduces an allow-listing approach covering the standard Java library, BouncyCastle and Tink to analyze Java and Android applications for misuses. The focus of the analysis CryptoGuard [12] is a scalable deny-listing Java analysis for crypto misuses extending the rules implemented in CryptoLint [4]. CryptoREX is a framework for firmware written in C/C++ which covers the rules introduced by CryptoLint [4]. Acar et al. [1] conducted a user study with 5 different Python crypto APIs to analyze how developers perform on 5 crypto tasks with a pre-selected API. Their study reveals that APIs with a usability focus for security result in significant more secure code. In a similar study, Acar et al. [2] analyzed the security of 3 different crypto tasks and identified that more usable libraries resulted only in insecure solutions for encryption in 12.7% of the cases. 9 CONCLUSION In this paper, we presented the first empirical study of crypto misuses in Python. To conduct the study, we implemented the first multi-language analysis tool for crypto misuses with rules to detect common misuses of five different Python libraries as well as the standard Java library. We analyzed 895 popular Python apps from GitHub and 51 MicroPython projects to identify misuses. Our analysis revealed that 52.26% of the projects using a crypto API misuse the respective library. Furthermore, we observed that only 7% of the 1,501 misuses are within the application code. The analysis of embedded applications written in MicroPython revealed the importance of hybrid analysis as the only crypto calls were in C code that got shipped with the projects. To get an impression on the differences between the different domains and languages analyzed in previous studies, we compared our results against the misuses reported for Android apps [4] and C firmware images [13]. Our comparison confirms the impression that anopolitan API design actually helps developers avoiding misuses. While we concentrated on the impact of a user-friendly API design for Python, future work can verify if these results generalize to other languages, like Rust and Go. Thus, extending LICMA with new languages. Further, it may be interesting to extend the currently implemented rules in LICMA with an in-depth analysis of misuses of Python crypto APIs. ACKNOWLEDGMENTS This research work has been co-funded by the Deutsche Forschungsgemeinschaft (DFG) – SFB 1119 CROSSING (23661529) and SFB 1053 MAKI (210487104), by the German Federal Ministry of Education and Research and the Hessen State Ministry for Higher Education, Research and the Arts within their joint support of the National Research Center for Applied Cybersecurity ATHENE, by the LOEWE initiative (Hesse, Germany) within the emergencITY center. REFERENCES
{"Source-Url": "http://export.arxiv.org/pdf/2109.01109", "len_cl100k_base": 5080, "olmocr-version": "0.1.50", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 20228, "total-output-tokens": 6391, "length": "2e12", "weborganizer": {"__label__adult": 0.0005049705505371094, "__label__art_design": 0.0002892017364501953, "__label__crime_law": 0.0011272430419921875, "__label__education_jobs": 0.0005087852478027344, "__label__entertainment": 7.414817810058594e-05, "__label__fashion_beauty": 0.0001518726348876953, "__label__finance_business": 0.00020122528076171875, "__label__food_dining": 0.00032401084899902344, "__label__games": 0.0006952285766601562, "__label__hardware": 0.0012302398681640625, "__label__health": 0.0006680488586425781, "__label__history": 0.0002415180206298828, "__label__home_hobbies": 8.666515350341797e-05, "__label__industrial": 0.00049591064453125, "__label__literature": 0.00025582313537597656, "__label__politics": 0.00037741661071777344, "__label__religion": 0.0005097389221191406, "__label__science_tech": 0.045074462890625, "__label__social_life": 0.0001170039176940918, "__label__software": 0.00807952880859375, "__label__software_dev": 0.93798828125, "__label__sports_fitness": 0.00038504600524902344, "__label__transportation": 0.0004935264587402344, "__label__travel": 0.00018286705017089844}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 26149, 0.0361]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 26149, 0.2608]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 26149, 0.8934]], "google_gemma-3-12b-it_contains_pii": [[0, 2638, false], [2638, 6513, null], [6513, 9800, null], [9800, 14316, null], [14316, 18570, null], [18570, 26149, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2638, true], [2638, 6513, null], [6513, 9800, null], [9800, 14316, null], [14316, 18570, null], [18570, 26149, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 26149, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 26149, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 26149, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 26149, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 26149, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 26149, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 26149, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 26149, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 26149, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 26149, null]], "pdf_page_numbers": [[0, 2638, 1], [2638, 6513, 2], [6513, 9800, 3], [9800, 14316, 4], [14316, 18570, 5], [18570, 26149, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 26149, 0.08696]]}
olmocr_science_pdfs
2024-12-01
2024-12-01
9ac6e1e39b1646b5d47ca699e3bd945f02d8d60c
A new self-acquired knowledge process for Monte Carlo Tree Search André Fabbri, Frédéric Armetta, Eric Duchene, Salima Hassas To cite this version: André Fabbri, Frédéric Armetta, Eric Duchene, Salima Hassas. A new self-acquired knowledge process for Monte Carlo Tree Search. European Conference on Artificial Intelligence, Aug 2012, Montpellier, France. Computer Game Workshop. <hal-01240220> HAL Id: hal-01240220 https://hal.archives-ouvertes.fr/hal-01240220 Submitted on 8 Dec 2015 HAL is a multi-disciplinary open access archive for the deposit and dissemination of scientific research documents, whether they are published or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers. L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés. A new self-acquired knowledge process for Monte Carlo Tree Search André Fabbri, Frédéric Armetta, Éric Duchêne and Salima Hassas Laboratoire GAMA Abstract. Computer Go is one of the most challenging field in Artificial Intelligence Game. In this area the use of Monte Carlo Tree Search has emerged as a very attractive research direction, where recent advances have been achieved and permitted to significantly increase programs efficiency. These enhancements result from combining tree search used to identify best next moves, and a Monte Carlo process to estimate and gradually refine a position accuracy (estimation function). The more the estimation process is accurate, the better the Go program performs. In this paper, we propose a new approach to extract knowledge from the Go tree search which allows to increase the evaluation function accuracy (BHRF: Background History Reply Forest). The experiments results provided by this new approach are very promising. 1 Introduction The game of Go is a deterministic fully observable two player game. Despite its simple rules, it stands for one of the great challenge in the field of AI Game. Go tactical and strategic decisions are extremely difficult to tackle, since each move could have a high impact a long time after having been played. A single stone move could completely change the board configuration and therefore, there is no static evaluation function available during the game [22]. Professional human players succeed where programs fail, thanks to their expertise and knowledge acquired from their long experience. Recent developments in Monte Carlo Tree Search allowed to considerably increase program’s efficiency. These enhancements result from combining Tree Search used to identify best next moves to a Monte Carlo process based on random playing attempts to estimate and gradually refine a position accuracy (estimation function). Monte Carlo Tree Search programs are able to reach up a professional level by simulating thousands of pseudo random games [16]. However these program’s performances does not scale with computational power increasing [2]. A promising way to increase program’s efficiency arises from learning on-line local knowledge to enhance the relevance of random simulations used to evaluate positions [1,17,18]. In this context, one can note that the issue is not only focused on the computing power available, but in our ability to manage additional more sophisticated self-acquired knowledge. Then, in the rest of the paper, we will focus on this ability. Further work will propose additional enhancements to optimize the process associated to knowledge management in order to decrease the computing-resources consumption. In this paper we propose a new approach to collect the knowledge acquired through the tree search of estimated positions. Our proposal appears as a complementary data structure. As described in section 3, a tree search is used to define what are the best next moves to play from a completely described current position. The structure we propose to build addresses a more abstract question: if a set of relatives moves are played, what to play next? We show with our approach presented in section 4 that a natural manner to tackle this question is to constitute a Background History Reply Forest (BHRF). We then describe how to build and maintain this generic forest and how to exploit it. These two points raise new questions, but we show that a first straightforward setup produces good results. Some promising experimental results are presented in 5 and show that using BHRF allows to play better. The next section presents the general structure of knowledge involved in a learning process. The section 3 focus on the kind of knowledge used in the existing Go programs. Section 4 introduces a Background History Reply Forest (BHRF) for the Monte Carlo Tree Search. The last section sums up experiments carried on the model. A conclusion is presented in 6. 2 Knowledge in computer Go While a game is running, for each step, a Go player aims at selecting the best move according to the game overall state. The overall game state involves any information related to the current game such as the board setup, the history of played moves, local fights and also the opponent’s level. During the decision process, players need to select the relevant parts of the game to focus on. Human players accumulate knowledge by studying standard techniques, watching professional games or interacting with other players. Computer programs encode directly Go expert knowledge (apriori knowledge) or create their own knowledge using machine learning techic. This information is evaluated and stored in a data structure (knowledge acquisition or learning) for a further exploitation (knowledge exploitation or planning). Reinforcement learning methods iteratively apply these two steps to progressively build an effective policy [21,19]. 2.1 Go knowledge acquiring Knowledge is useful to evaluate a position (current state or targeted state resulting from a set of planned moves). Either generic (fitting many cases) or specific knowledge could be used to do this evaluation. For instance, understanding the shapes formed by the stones on a Goban is a relevant way to solve local fights. In this case, local patterns are a powerful way to encode Go expert knowledge [19,12]. An other way is to consider a knowledge based on high-level characteristics of the game: groups, groups stability, influences between groups, etc [11]. The representation can then focus on the intersection around the last move played to find local replies [22]. The value of this knowledge generally represents the probability to win if we reach this game state representation. The quality of the estimator determines the accuracy of the considered knowledge. The value given by poor estimators are not reliable and have to be considered with caution. Several estimators for the same knowledge can be combined to produce a more effective estimation. The knowledge values are computed based on professional game records [4,20], professional players comments [13] or self-playing [19]. These knowledge values will be exploited to choose an action according to the current game state. 2.2 Go knowledge exploitation The policy maps an action to each game state. The action is selected based on the knowledge matching that game state. A high knowledge value means a good move but the knowledge nature and its estimator might be misleading. Therefore uncertainty is generally inserted in the policy to mitigate the influence of wrong estimations. The $\epsilon$-greedy policy selects with a probability $\epsilon$ the action associated to the highest knowledge value otherwise it generally plays a random move. The softmax policy selects each action with a probability depending on the associated knowledge value [21]. A policy would be selected according to its context of application. During a tutorial process, a policy might tolerate exploratory moves but during a challenge the policy has to select the best possible action. 2.3 Reinforcement learning Reinforcement learning is a way to manage learning in an autocatalytic way. The program is not taught what to do and learns therefore by its own experience [21]. Temporal difference learning is one of the most applied method for such problems and has been successfully applied to computer games. This method dynamically bootstraps its knowledge from simulated games. The policy evolves as the simulations runs and will influence the incoming simulations. Since the knowledge is built on-line, the policy has to deal with exploiting the accumulated knowledge (exploitation) or gathering more knowledge (exploration). A good policy should produce accurate simulations to enable the learning process. A too strong policy can actually lead to a weaker program [21]. $TD(\lambda)$ methods reinforce their knowledge values according to the estimation difference of the game state between two time-step. A Monte Carlo method is a temporal difference method which reinforcement depends on the final game state of the simulation [19]. 3 Monte Carlo Go programs The main idea of Monte Carlo Tree Search is to build a tree of possible sequence of actions. The tree root corresponds to the current board situation and each child node is a possible future game state. The tree will be progressively expanded towards the most promising situation by repeating the 4 phases: descent, roll-out, update and growth (Fig.1). During the descent phase, the simulation starts from the root node and progresses through the tree until it reaches a game state outside of the tree. For each node the program will iteratively select the best action with respect to the descent policy. Once it leaves the Monte Carlo Tree, the roll-out phase generates the remaining moves according to the roll-out policy until the game reaches a final state. The update phase propagates the final game results in the node reached during the descent and the growth phase appends the first game situation outside of the tree to the overall structure [5]. Monte Carlo Go programs involve two kinds of knowledge to guide the simulations from the current game state. The Monte Carlo Tree stores knowledge on-line. This knowledge is exploited during the descent phase. The current best programs exploit Go domain specific knowledge in the roll-out phase because the tree knowledge is no more available. In the last section we will present methods that attempt to dynamically build up knowledge for the roll-out phase. Fig. 1. General MCTS process 3.1 Monte Carlo tree In the Monte Carlo tree, each node is a knowledge piece that associates a possible future board setups with an accuracy value estimated from previous Monte Carlo simulations. Board setups are very precise game state representations which will be progressively selected as the simulations run. However the built tree depends on the current board situation. Local structures are not shared between branches leading to a new kind of horizon effect [6] and at each new turn only a subtree is kept. All previously acquired knowledge in other branches is forgotten. At each step of the descent phase, the policy selects in a greedy way the best action based on the child’s node value or a default value for the resulting states outside of the tree [22]. The node’s estimator will have a huge influence on the policy’s behaviour. Since the policy is not perfect and the estimation sample is too small, the mean of Monte Carlo rewards (MCTS value) is not a reliable indicator on the long-term run [8]. The Upper Confidence bound applied to Tree estimator (UCT value) reveals to be a good trade-off between exploration and exploitation [15]. Recent results show that, in practice, a combination between the MCTS value and a biased mean estimator called RAVE ensures a good exploratory behaviour [10,8] and also minimizes the knowledge lost at each new turn, but without control. 3.2 Go a priori knowledge Contrary to the Monte Carlo tree, the Go expert knowledge is independent from the overall stones disposition and therefore can be exploited for a broader set of a board setup. The purpose of this knowledge is to guide the simulation after having left the tree structure. However the roll-out policy should not be too strong to do not disturb the learning process [9]. The knowledge encoded corresponds generally to static Go tactical rules based on the current board configuration. Sequence-like policies brought a substantial improvement by searching around the last opponent move [22]. If no rules fit the current situation, the policy plays randomly. Other roll-out policies use a linear combination of local pattern. The weights are generally computed with off-line intensive machine learning [9] but recent works obtained promising results by tuning them on-line [14,19]. 3.3 Knowledge collected from Game Several works aim at dynamically learn knowledge relative to the current game in order to exploit it during the roll-out phase (see Fig.2). The game chosen state representations are generally small move sequences or patterns. As for the Monte Carlo tree, this knowledge will be built in an autocatalytic manner but this knowledge will persist over the turns. Pool RAVE [18] exploits the RAVE values in the Monte-Carlo tree to influence the roll-out. The best RAVE values from the covered nodes (descent phase) are selected to influence the next roll-out. The roll-out policy proposed for the game of Go uses first a “fill-board heuristic” [3] to ensure a good exploratory behaviour and then applies the moves associated with one of the pooled RAVE values. Hence the selected RAVE value contributes directly to its own reinforcement. Contextual Monte Carlo [17] stores tiles of two moves played by the same player. Each tile has Monte Carlo mean value updated when the two moves appears in the same simulation. The main idea is to link the expected success with a couple of moves played by the same player. During the roll-out phase a $\epsilon$-greedy policy will select the best move according to the last player’s move. Last Good Reply Forgetting heuristic [1] associates a reply to each sequence of one or two consecutive moves. For each encountered sequence the program stores a single reply. In the update phase all the reply sequences are updated or forgotten according to the simulation result. Over the simulations the replies are frequently updated but the most persisting moves are spatially local replies [6,1]. In the roll-out phase the policy successively tries to apply the reply to the two previous ones, the reply to the previous move or a move generated from a Go expert knowledge policy if no appropriate reply is stored. 4 Proposal In this paper, we propose a new method to learn knowledge collected from game (game-based knowledge) persistent over the turns. We actually assume that we can extract knowledge from the Monte Carlo tree and reuse it during the roll-out phase. Therefore we build an independent data structure similar to the Monte Carlo tree to store game based knowledge. The roll-out policy will be modified to consider this new form of knowledge. ![Game relative knowledge for MCTS process](image_url) 4.1 Background History Reply Forest A Monte Carlo node represents a future possible board setup. If we consider the background history of the board rather than the position of the stones, a board setup is also the sequence of moves played since the beginning of the match. Hence each child node of the tree is a possible reply to that sequence. Our idea is to extend the LGRF heuristic to catch the knowledge stored in the tree over the simulations. The size of the previous sequence will be lengthened and the reply estimation will be based on the tree values. This knowledge will be more biased than the one provided by Monte Carlo nodes but it will be exploited in the roll-out phase and will persist over the turns. Hence we build a forest of search trees such that each tree root is a potential reply and each child node a previous sequence to this reply (Fig. 3). The value associated to each node comes from the Monte Carlo tree. In the update phase all nodes corresponding to sequences chosen in the descent phase are reinforced. The search trees are progressively expanded in the growth phase as done in the Monte Carlo tree [5]. This knowledge is then exploited during the roll-out phase, according to the previous moves played. The selected nodes with the longest corresponding sequences will be the most dependent on the game state. ### 4.2 BHRF exploitation For each roll-out game state, we choose a reply among all legal positions on the board. The program progresses through the associated tree search to select the nodes with the longest previous sequences (up to a maximum size parameter called depth). The policy computes on-line the UCT value for the nodes with the same previous sequence according to their last Monte Carlo rewards. Due to the biased nature of this knowledge and in order not to restrain the simulation diversity, we implemented a non deterministic policy to generate the moves at each roll-out step. The policy plays the root reply associated with a selected node among those with the longest matching sequences. If no reply move was played by the policy, a default roll-out policy is applied. The softmax policy selects a node according to a softmax distribution based on their UCT value and plays the associated move with a probability depending on its UCT value multiplied by a parameter $\alpha$. ```plaintext Algorithm 1 softmax policy for BHRF knowledge curLength = 0 for m in legalMoves do i = replyTree[m].selectNode(depth, lastmoves) nodeSelection.add(i) if n.length > curLength then curLength = n.length end if end for n = nodeSelection.softmaxUct(curLength) if randomValue() < $\alpha \times n.uctValue$ then return n.rootReply else return defaultRandomMove() end if ``` ### 5 Experimental results We implemented this proposed knowledge-based model on top of the state of art program Fuego [7]. To prove the effectiveness of our approach we tested the BHRF player against a Monte-Carlo player using a random roll-out policy. We disabled the expert heuristics involved in the Fuego roll-out policy except for the random move generation. The experimental results were carried out on a 9x9 goban against a baseline program without the BHRF heuristic. The current implementation is not thread-safe and is time-consuming. Therefore to provide a fair comparison we removed the clock limitation and each turn both programs run 10000 Monte-Carlo games on a single thread. ![Graph showing BHRF success rate over α against the baseline program](image) **Fig. 4.** BHRF success rate over α against the baseline program We first study the influence of the parameter α for the softmax policy. This parameter tunes the involvement of the BHRF knowledge during the roll-out phase (see Algo. 1). As we see in Fig. 4, the performance increases with α. The program actually performs better for α = 100 where the BHRF replies are applied quite systematically if a BHRF node matches (only 2% doesn’t). These results show that the softmax policy provides a good simulation diversity by itself. Hence we next set α at 100 and focus on the depth parameter. The depth parameter determines the “history relevance” of the selected knowledge. As the maximum depth increases, the suggested moves should be more accurate. The experiments were carried out up to a depth of 10 because of time consuming constraints. Further experiments will require an optimised BHRF implementation. --- 1 Fuego default random move generation use heuristics to avoid “suicidal” moves The figure 5 reveals that the performance of our algorithm slightly decreases as the depth parameter grows. To validate our approach, we compare the performance of the BHRF heuristic according to the number of Monte-Carlo games simulated at each turn. Table 1 shows that BHRF performs better for 10000 simulations search\(^2\). The resulting Background History Reply Forest for deep Monte Carlo search produces better estimators and actually matches to a wider set of game states. About 90% of the roll-out game states benefit from a BHRF reply when the MCTS algorithm runs 10000 games against 80% for 1000 games simulated. Table 1. Comparative between 1000 and 10000 games simulated for the softmax policy <table> <thead> <tr> <th>(\alpha)</th> <th>games simulated</th> <th>success rate %</th> </tr> </thead> <tbody> <tr> <td></td> <td>1000</td> <td>10000</td> </tr> <tr> <td>1</td> <td>58.7 ± 2.49</td> <td>63.4 ± 2.99</td> </tr> <tr> <td>5</td> <td>58.5 ± 2.49</td> <td>68.8 ± 2.87</td> </tr> <tr> <td>10</td> <td>58.5 ± 2.49</td> <td>68.8 ± 2.87</td> </tr> </tbody> </table> These results show an overall improvement when reusing game-based knowledge, that is extracted from the Monte Carlo tree. As we mentioned before, our main concern was to build self-acquired knowledge to improve Monte Carlo \(^2\) The results are given with a 95% confidence interval simulations. The computing time of this algorithm is still higher than the baseline algorithm (up to 10 times) but improvements could be made. Indeed the heuristic searches at each roll-out step among all the potential moves through the whole board contrary to the Go expert policy which one focuses around the last played move [22,7]. Furthermore we would like to point out that our main concern was to show the good impact of Game-based knowledge model. An optimised version will requires a deep modification of the Fuego libraries. 6 Conclusion In this paper we present a new approach to complement the Monte Carlo Tree Search programs. The proposed framework is inspired from the reinforcement learning paradigm, and aims at distinguishing incorporated knowledge from its exploitation. The proposed model extracts game-based knowledge from the Go Tree Search to introduce more accurate moves through simulations. The incorporated knowledge is based on history data and tends to find a trade-off between the specific knowledge stored in the tree and more biased game-relative heuristics. We show with our approach that a natural manner to complement Go tree search knowledge is to constitute a Background History Reply Forest (BHRF). We then describe how to build and maintain this generic forest and how to exploit it. These two points raise new questions, but we show that a first straightforward setup provides good results. The first proposed results underline the efficiency of our model, and allows to outperform the baseline MCTS algorithm with similar setting for up to 2/3 of the considered games. This encourages us to carry on the experiments on a larger board or with other settings (longer sequences, use of BHRF to compute initial values of leaf for the Go tree search, etc). References
{"Source-Url": "https://hal.archives-ouvertes.fr/hal-01240220/file/fabbri_armetta_duchene_hassas_wecai2012.pdf", "len_cl100k_base": 4684, "olmocr-version": "0.1.53", "pdf-total-pages": 13, "total-fallback-pages": 0, "total-input-tokens": 27342, "total-output-tokens": 6516, "length": "2e12", "weborganizer": {"__label__adult": 0.0018033981323242188, "__label__art_design": 0.0011577606201171875, "__label__crime_law": 0.00226593017578125, "__label__education_jobs": 0.0026607513427734375, "__label__entertainment": 0.00084686279296875, "__label__fashion_beauty": 0.0009512901306152344, "__label__finance_business": 0.0010929107666015625, "__label__food_dining": 0.0019664764404296875, "__label__games": 0.1605224609375, "__label__hardware": 0.002674102783203125, "__label__health": 0.00196075439453125, "__label__history": 0.0017557144165039062, "__label__home_hobbies": 0.00030159950256347656, "__label__industrial": 0.0019216537475585935, "__label__literature": 0.001476287841796875, "__label__politics": 0.00122833251953125, "__label__religion": 0.001682281494140625, "__label__science_tech": 0.2037353515625, "__label__social_life": 0.00027298927307128906, "__label__software": 0.0121917724609375, "__label__software_dev": 0.591796875, "__label__sports_fitness": 0.003009796142578125, "__label__transportation": 0.0015878677368164062, "__label__travel": 0.0009050369262695312}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 26734, 0.03807]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 26734, 0.16686]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 26734, 0.88593]], "google_gemma-3-12b-it_contains_pii": [[0, 1031, false], [1031, 3504, null], [3504, 6424, null], [6424, 9209, null], [9209, 10684, null], [10684, 13691, null], [13691, 15362, null], [15362, 16477, null], [16477, 18445, null], [18445, 19879, null], [19879, 21159, null], [21159, 23844, null], [23844, 26734, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1031, true], [1031, 3504, null], [3504, 6424, null], [6424, 9209, null], [9209, 10684, null], [10684, 13691, null], [13691, 15362, null], [15362, 16477, null], [16477, 18445, null], [18445, 19879, null], [19879, 21159, null], [21159, 23844, null], [23844, 26734, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 26734, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 26734, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 26734, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 26734, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 26734, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 26734, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 26734, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 26734, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 26734, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 26734, null]], "pdf_page_numbers": [[0, 1031, 1], [1031, 3504, 2], [3504, 6424, 3], [6424, 9209, 4], [9209, 10684, 5], [10684, 13691, 6], [13691, 15362, 7], [15362, 16477, 8], [16477, 18445, 9], [18445, 19879, 10], [19879, 21159, 11], [21159, 23844, 12], [23844, 26734, 13]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 26734, 0.04511]]}
olmocr_science_pdfs
2024-12-11
2024-12-11
7b66a028dd2187a3ffcf10075bc23588a9d389f0
Using Cooperative Mediation to Solve Distributed Constraint Satisfaction Problems* Roger Mailler and Victor Lesser University of Massachusetts Department of Computer Science Amherst, MA 01003 {mailler, lesser}@cs.umass.edu Abstract Distributed Constraint Satisfaction (DCSP) has long been considered an important area of research for multi-agent systems. This is partly due to the fact that many real-world problems can be represented as constraint satisfaction and partly because real-world problems often present themselves in a distributed form. In this paper, we present a complete, distributed algorithm called asynchronous partial overlay (APO) for solving DCSPs that is based on a cooperative mediation process. The primary ideas behind this algorithm are that agents, when acting as a mediator, centralize small, relevant portions of the DCSP, that these centralize subproblems overlap, and that agents increase the size of their subproblems along critical paths within the DCSP as the problem unfolds. We present empirical evidence that shows that APO performs better than other known, complete DCSP techniques. 1. Introduction Distributed constraint satisfaction has become a classic formulation that is used to describe a number of distributed problems including distributed resource allocation [1], distributed scheduling [8], and distributed interpretation [5]. It's no wonder that a vast amount of effort and research has gone into creating algorithms, such as distributed breakout (DBO) [10], asynchronous breakout (ABT) [9], and asynchronous weak-commitment (AWC) [11], for solving these problems. Unfortunately, a common drawback to each of these techniques is that they prevent the agents from making informed local decisions about the effects of changing their local variable value without actually doing it. For example, in AWC, agents try to a value and wait for another agent to tell them that it will not work through a nogood message. Because of this, agents never learn why another agent or set of agents is unable to accept the value, they only learn that their value in combination with other values doesn't work. In this paper, we present a cooperative mediation based DCSP protocol, called Asynchronous Partial Overlay (APO), that allows the agents to extend and overlap the context that they use for making their local decisions. When an agent acts as a mediator, it computes a solution to a portion of the overall problem and recommends value changes to the agents involved in the mediation session. This technique allows for rapid, distributed, asynchronous problem solving without the explosive communications overhead normally associated with current distributed algorithms. APO represents a new methodology that lies somewhere between centralized and distributed problem solving which exploit the best characteristics of both. In the graph coloring domain, this algorithm performs better, both in terms of communication and computation, than the AWC algorithm. This is particularly true for problems that lie near or to the right of the phase transition. In the rest of this paper, we present a formalization of the DCSP problem. We then present the APO algorithm and present an example of the execution on a simple problem. Next, we present the results of extensive * The effort represented in this paper has been sponsored by the Defense Advanced Research Projects Agency (DARPA) and Air Force Research Laboratory, Air Force Materiel Command, USAF, under agreement number F30602-99-2-0525. The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of the Defense Advanced Research Projects Agency (DARPA), Air Force Research Laboratory, or the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for Governmental purposes notwithstanding any copyright notation thereon. 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. testing that compares APO with AWC within the commonly used graph coloring domain. Lastly, we discuss some of our conclusions and future directions. 2. Distributed Constraint Satisfaction A Constraint Satisfaction Problem (CSP) consists of the following: - a set of $n$ variables $V = \{x_1, \ldots, x_n\}$. - discrete, finite domains for each of the variables $D = \{D_1, \ldots, D_n\}$. - a set of constraints $R = \{R_1, \ldots, R_m\}$ where each $R_i(d_1, \ldots, d_j)$ is a predicate on the Cartesian product $D_1 \times \cdots \times D_j$ that returns true if the value assignments of the variables satisfy the constraint. The problem is to find an assignment $A = \{d_1, \ldots, d_n|d_i \in D_i\}$ such that each of the constraints in $R$ is satisfied. CSP has been shown to be NP-complete, making some form of search a necessity. In the distributed case (DCSP), each agent is assigned one or more variables along with the constraints on their variables. The goal of each agent, from a local perspective, is to ensure that each of the constraints on its variables is satisfied. Clearly, each agent’s goal is not independent of the goals of the other agents in the system. In fact, in all but the simplest cases, the goals of the agents are strongly interrelated. For example, in order for one agent to satisfy its local constraints, another agent, potentially not directly related through a constraint, may have to change the value of its variable. when received $(ok?, (x_j, p_j, d_j, m_j))$ do update agent.view with $(x_j, p_j, d_j, m_j);$ check_agent.view; end do; procedure check_agent.view if initList ≠ 0 or mediate ≠ false do return; m' ← hasConflict(x_i); if m' and ¬3p_i > p_j ∧ m_j = true and conflicts are with lower priority neighbors d_i ← d'_i; send $(ok?, (x_j, p_j, d_j, m_j))$ to all $x_j \in agent.view;$ else do mediate; else if m_i ≠ m'_i m_i ← m'_i; send $(ok?, (x_j, p_j, d_j, m_j))$ to all $x_j \in agent.view;$ end if; end check_agent.view; Figure 2. The procedures for doing local resolution, updating the agent.view and the goodList. In this paper, for the sake of clarity we restrict ourselves to the case where each agent is assigned a single variable and is given knowledge of the constraints on that variable. Since each agent is assigned a single variable, we will refer to the agent by the name of the variable it manages. Also, we restrict ourselves to considering only binary constraints which are of the form $R_i(x_1, x_2)$. It is fairly easy to extend our approach to handle the case where one or both of the restrictions are removed. 3. Asynchronous Partial Overlay 3.1. The Algorithm Figures 1, 2, 3, 4, and 5 present the basic APO algorithm. The algorithm works by constructing a goodList and maintaining a structure called the agent.view. The agent.view holds the names, values, domains, and constraints of variables to which an agent is linked. The goodList holds the names of the variables that are known to be connected to the owner by a path in the constraint graph. As the problem solving unfolds, each agent tries to solve the subproblem it has centralized within its goodList or determine that it is unsolvable which indicates the entire global problem is over-constrained. To do this, agents take the role of the mediator and attempt to change the values of the variables within the mediation session to achieve a satisfied subsystem. When this cannot be achieved without causing a violation for agents outside of the session, the mediator links with those agents assuming that they are somehow related to the mediator’s variable. This process continues un- procedure mediate preferences ← 0; counter ← 0; for each $x_i \in \text{goodList}$ do send(evaluate? $\{x_i, p_i\}$ to $x_j$; counter + 1; end do; mediate ← true; end mediate; when receive [wait!] $\{x_i, p_i\}$ do update agentview with $\{x_i, p_i\}$; counter ← 1; if counter == 0 do choose solution; end do; when receive [evaluate] $\{x_j, p_j, labeled D_j\}$ do record $\{x_j, labeled D_j\}$ in preferences; update agentview with $\{x_j, p_j\}$; counter ← 1; if counter == 0 do choose solution; end do; Figure 3. The procedures for mediating a session. procedure choose solution select a solution $s$ using a Branch and Bound search that: 1. satisfies the constraint $c$ of agents in the $\text{goodList}$ 2. minimizes the violations for agents outside of the session if $\exists s$ that satisfies the constraints do broadcast solution for each $x_j \in \text{agent view}$ do if $x_j \in \text{preferences}$ if $d_k \in s$ violates $a_k \in x_j$ and $x_k \notin \text{agent view}$ do send(init $\{x_j, p_i, d_i, m_i, C_i\}$ to $x_j$); add $x_k$ to initlist; end if; else send(ok $\{x_j, p_i, d_i, m_i\}$ to $x_j$); end if; end if; end do; mediate ← false; check agentview; end choose solution; Figure 4. The procedure for choosing a solution during an APO mediation. til one of the agents finds an unsatisfiable subsystem, or all of the conflicts have been removed. In order to facilitate the problem solving process, each agent has a dynamic priority that is based on the size of their $\text{goodList}$ (if two agents have the same sized $\text{goodList}$ then the tie is broken using the lexicographical ordering of their names). Priorities are used by the agents to decide who mediates a session when a conflicts arises. Priority ordering is important for two reasons. First, priorities ensure that the agent with the most knowledge gets to make the decisions. This improves the efficiency of the algorithm by decreasing the effects of myopic decision making. Second, priorities improve the effectiveness of the mediation process. Because lower priority agents expect higher priority agents to mediate, they are less likely to be involved in a session when the mediation request is sent. 3.1.1. Initialization (Figure 1) On startup, the agents are provided with the value (they pick it randomly if one is not assigned) and the constraints on their variable. Initialization proceeds by having each of the agents send out an “init” message to its neighbors. This initialization message includes the variable’s name ($x_i$), priority ($p_i$), current value ($d_i$), the agent’s desire to mediate ($m_i$), domain ($D_i$), and constraints ($C_i$). The array $\text{initList}$ records the names of the agents that initialization messages have been sent to, the reason for which will become immediately apparent. When an agent receives an initialization message (either during the initialization or through a later link request), it records the information in its $\text{agentview}$ and adds the variable to the $\text{goodList}$ if it can. An variable is only added to the $\text{goodList}$ if it is a neighbor of another variable already in the list. This ensures that the graph created by the variables in the $\text{goodList}$ always remains connected, which focuses the agent’s internal problem solving on variables which it knows it has an interdependence with. The $\text{initList}$ is then checked to see if this message is a link request or a response to a link request. If an agent is in the $\text{initList}$, it means that this message is a response, so the agent removes the name from the $\text{initList}$ and does nothing further. If the agent is not in the $\text{initList}$ then it means this is a request, so a response “init” is generated and sent. It is important to note that the agents contained in the $\text{goodList}$ are a subset of the agents contained in the $\text{agentview}$. This is done to maintain the integrity of the $\text{goodList}$ and allow links to be bidirectional. To understand this point, consider the case when a single agent has repeatedly mediated and has extended its local subproblem down a long path in the constraint graph. As it does so, it links with agents that may have a very limited view and therefore are unaware of their indirect connection to the mediator. In order for the link to be bidirectional, the receive end of the link request has to store the name of the requestor, but cannot add them to their $\text{goodList}$ until a path can be identified. 3.1.2. Checking the agent view (Figure 2) After the agents receive all of the initialization messages they are expecting, they execute the check agentview procedure. In this procedure, the current $\text{agentview}$ (which contains the assigned, known variable values) is checked to identify conflicts between the variable owned by the agent and its $\text{neighbors}$. If, during this check, an agent finds a conflict with one or more of its neighbors and has not been told by a higher priority agent that they want... to mediate, it assumes the role of the mediator. An agent can tell when a higher priority agent wants to mediate because of the \( m_i \) flag mentioned in the previous section. Whenever an agent checks its `agent\_view`, it recompotes the value of this flag based on whether or not it has existing conflicts with its neighbors. When this flag is set to `true` it indicates that the agent wishes to mediate if it is given an opportunity. This mechanism acts like a tw-o-phase commit protocol, commonly seen in database systems, and ensures that the protocol is live-lock and dead-lock free. As the mediator, an agent first attempts to rectify the conflict(s) by changing its own variable. This simple, but effective technique prevents sessions from occurring unnecessarily, which stabilizes the system and saves message and time. If the mediator finds a value that removes the conflict, it makes the change and sends out an "ok" message to the agents in its `agent\_view`. If it cannot find a non-conflicting value, it starts a mediation session. An "ok" message is similar to an "init" message, in that it contains information about the priority current value, etc. of a variable. ### 3.1.3. Mediation (Figures 3, 4, and 5) The most complex and certainly most interesting part of the protocol is the mediation. As was previously mentioned in this section, an agent decides to mediate if it is in conflict with one of its neighbors and is not expecting a session request from a higher priority agent. The mediation starts with the mediator sending out "evaluate?" messages to each of the agents in its `good\_list`. The purpose of this message is tw-o-fold. First, it informs the receiving agent that a mediation is about to begin and tries to obtain a lock from that agent. This lock, referred to as `mediate` in the figures, prev ents thangent from engaging in tw-o sessions simultaneously or from doing a local value change during the course of a session. The second purpose of the message is to obtain information from the agent about the effects of making them change their local value. This is a key point. By obtaining this information, the mediator gains information about variables and constraints outside of its local view without having to directly and immediately link with those agents. This allows the mediator to understand the greater impact of its decision and is also used to determine how to extend its view once it makes its final decision. When an agent receives a mediation request, it will respond with either a “wait!” or “evaluate!” message. The “wait” message indicates to the requester that the agent is currently involved in a session or is expecting a request from a agent of higher priority than the requester. If the agent is available, it labels each of its domain elements with the names of the agents that it would be in conflict with if it were asked to take e that value. In the graph coloring domain, the labeled domain can never exceed \( O(|D_i| + n) \). This information is returned in the “ev aluate!” message. It should be noted that the agents need not return all of the names if for security reasons they wish not to. This may effect the completeness of the algorithm, because, in the worst case, the completeness relies on one or more of the agents eventually centralizing the entire problem, but does provides some degree of autonomy and privacy to the agents. When the mediator has received either a “wait!” or “ev aluate!” message from all of the agents that it has sent a request to (which it determines by using the `counter` variable), it chooses a solution. Agents that sent a “wait!” message are dropped from the mediation, but the mediator attempts to fix whatever problems it can based on the information it receives from the agents in the session. Currently, solutions are generated using a Branch and Bound search [3] where all of the constraints must be satisfied and the number of outside conflicts is minimized (like the min-conflict heuristic [7]). The search is also done using the current value assignments as the first branch in the search. These heuristics, when combined together, form a lock and key mechanism that simultaneously exploits the work that was previously done by other mediators and acts to minimize the number of changes in those assignments. As will be presented in section 4, these simple feed-forward mechanisms, combined with the limited centralization needed to solve satisfiability problems, account for considerable improvements in the algorithms runtime performance. When no satisfying assignments are found, the agent announces that the problem is unsatisfactory and the algorithm terminates. Once the solution is chosen, “accept!” messages are sent to the agents in the session, who, in turn, adopt the proposed answer. The mediator also sends “ok” messages to the agents 3.2. An Example Consider the 3-coloring problem presented in figure 6(a). In this problem, there are 8 agents, each with a variable and 12 edges or constraints between them. Because this is a 3-coloring problem, each variable can only be assigned one of the three available colors (Black, Red, or Blue). The goal is to find an assignment of colors to the variables such that no two variables, connected by an edge, have the same color. In this example, three constraints are in violation: (ND0, ND1), (ND1, ND3), and (ND6, ND7). Following the algorithm, upon startup each agent adds itself to its good list and sends an “init” message to its neighbors. Upon receiving these messages, the agents add each of their neighbors to their good list because they are able to identify a shared constraint with themselves. Once the startup has been completed, each of the agents checks its agent view. ND0, ND1, ND3, ND6, and ND7 find that they have conflicts. ND0 (priority 3) waits for ND1 to mediate (priority 5). ND6 and ND7, both in priority 4, wait for ND3 to start a mediation. ND3, having an equal number of agents in its good list, but a lower lexicographical order, also waits for ND3 to start a mediation. ND3, knowing it is higher priority, first checks to see if it can resolve its conflict by changing its value, which in this case, it cannot. ND3 starts a session that involves ND1, ND5, ND6, and ND7. It sends each of them an “ev aluate?” message. When each of the agents in the mediation receives the “ev aluate?” message, they label their domain elements with the names of the variables that they would be in conflict with as a result of adopting that value. They each send ND3 an “ev aluate?” message with this information. The following are the labeled domains for each of the agents: - ND1 - Black conflicts with ND2; Red conflicts with ND0 and ND3; Blue conflicts with ND4 - ND5 - Black causes no conflicts; Red conflicts with ND3; Blue causes no conflicts - ND6 - Black conflicts with ND7; Red conflicts with ND3; Blue conflicts with ND4 - ND7 - Black conflicts with ND6; Red conflicts with ND3; Blue conflicts with ND4 Once all of the responses are received, the mediator, ND3, conducts a branch and bound search that attempts to find a satisfying assignment to the problem that minimizes the amount of conflict that would be created outside of the mediation. If it cannot find at least one satisfying assignment, it broadcasts that a solution cannot be found. In the example, it chooses change ND5’s color to Red, ND7’s color to Red, and its own color to Blue. ND3 cannot solve the conflict between ND0 and ND1. by making these changes, so it links with ND0, leaving the problem in the state shown in figure 6(b). Note that when this happens, ND3 adds ND0 to its _good_list_ and vice versa. ND1, ND5, ND6 and ND7 inform the agents in their _agent_view_ of their new values, then check for conflicts. This time, ND0 and ND1 notice that their values are in conflict. ND1, having a higher priority, becomes the mediator and mediates a session with ND0, ND2, ND3, and ND4. Following the protocol, ND1 sends out the “evaluate” messages and the receiving agents label and respond. The following are the labeled domains that are returned: - **ND0** - Black conflicts with ND2; Red conflicts with ND1; Blue causes no conflicts - **ND2** - Black cause no conflicts; Red conflicts with ND0 and ND1; Blue conflicts with ND4 - **ND3** - Black conflicts with ND6; Red conflicts with ND1, ND5, and ND7; Blue causes no conflicts - **ND4** - Black conflicts with ND2 and ND6; Red conflicts with ND1 and ND7; Blue causes no conflicts ND1, after receiving these messages, conducts its search and solves the problem and returns the solution subproblem. It chooses to change the color of ND0 to Blue. ND0, ND1, ND2, ND3, and ND4 check their _agent_view_ and find no conflicts, so the problem is solved (see figure 6(c)). ### 3.3. Soundness and Completeness The proofs of APO’s soundness and completeness are quite lengthy, so for simplicity, we refer the reader to [6] for their full details. Below are the main ideas that are used in them. - If at anytime an agent identifies a constraint subgraph that is not satisfiable, it announces that the problem cannot be solved. Half of the soundness. - If a constraint violation exists, someone will try to fix it. The protocol is dead-lock free. The other half of the soundness. - Even trivially in the worst case, one or more of the agents will centralize the entire problem and will derive a solution, or report that no solution exists. This ensures completeness. ### 4. Evaluation To test the APO algorithm, we implemented the AWC and APO algorithms and conducted experiments in the distributed 3-coloring domain. The particular AWC algorithm we implemented can be found in [11] which includes the resolvemtc no_ good learning mechanism described in [4]. We conducted 3 sets of experiments. In the first set of experiments, following the experimental setup presented in [11], we created solvable graph instances with \( m = 2.0n \) (low-density) and \( m = 2.7n \) (high-density) according to the method presented in [7]. We generated 10 random graph for \( n = 15, 30, 45, 60, 75, 90 \) and for each instance generated 10 initial variable assignments. For each combination of \( n \) and \( m \), we ran 100 trials making a total of 1800 trials. During this series, we measured the number of messages and **cycles** used by the algorithms. During a cycle, incoming messages are delivered, the agent allows to process the information, and any messages that were created during the processing are added to the outgoing queue to be delivered at the beginning of the next cycle. The actual execution time given to one agent during a cycle varies according to the amount of work needed to process all of the incoming messages. The results from this experiment can be seen in figures 7 and 8. In the second set of experiments, we created completely random 60 node graphs of various densities from 1.8 to 2.9. This was done to test the completeness of the algorithms and to verify the correctness of their implementations. For each density value, we generated 200 random graphs each with a single set of initial values. Again, we measured the number of cycles and the number of messages used by each of the algorithms. In total, 1400 graphs were generated and tested. We stopped the execution of the algorithms at 1000 cycles for the sake of time. The results of these experiments are shown in figures 9(a) and 9(b). In the third set of experiments, we directly compared the serial run time performance of A WC against APO. For these experiments, we again generated random graphs, this time varying the size and the density of the graph. We generated 25 graphs for the values of $n = 15, 30, 45, 60$ and the densities of $d = 2.0, 2.3, 2.7$, for a total of 300 test cases. To show that the performance difference in APO and AWC was not caused by the speed of the central solver, we ran a centralized backtracking algorithm on the same graph instances. Although, APO uses the branch and bound algorithm, the backtracking algorithm used in this test provides a best case lower bound on the runtime of APO’s internal solver. Each of the programs used in this test was run on an identical 2.4GHz Pentium 4 with 768 MB of RAM. These machines where entirely dedicated to the tests so there was a minimal amount of interference by competing processes. In addition, no computational cost was assigned to message passing because the simulator passes messages between cycles. The algorithms were, how ever, penalized for the amount of time they took to process messages. Although we realize that the specific implementation of an algorithm can greatly affect its runtime performance, every possible effort was made to optimize the AWC implementation used for these experiments in an effort to be fair. For satisfiable graph instances, you can see that on low-density satisfiable graphs A WC and APO perform almost identically in terms of cycles to completion. When the density of the graphs increase to 2.7 how ever, the difference becomes remarkable. APO begins to scale more efficiently than A WC. This can be attributed to the ability of APO to rapidly identify strong interdependencies between variables and to derive solutions to them using a centralized search of the partial subproblem. We should mention that the results of the testing on A WC obtained from these experiments agree with those reported in [4] verifying the correctness of our implementation. On random, 60 variable instances, APO significantly outperforms A WC on all but the simplest of problems (see figure 9(a)). The most direct cause of this is AWC’s poor performance on unsatisfiable problem instances as previously reported in [2]. In the serial run time tests, presented in figures 10(a), 10(b), and 10(c), we also see that APO outperforms A WC. You should note that the scale used for these graphs is logarithmic. In fact, APO actually outperforms the centralized solver on graphs larger than 30 nodes. 5. Conclusions In this paper, we presented a new method for solving DCSPs called the Asynchronous Partial Overlay algorithm. The key features of this technique are that agents mediate over conflicts, the context they use to make local decisions overlaps with that of other agents, and as the problem solving unfolds, the agents gain more context information along the critical paths of the constraint graph to improve their decisions. We have shown that the APO algorithm is both sound and complete and that it performs better than the AWC algorithm on graph coloring problems of various sizes and difficulty. References
{"Source-Url": "http://jmvidal.cse.sc.edu/library/mailler04a.pdf", "len_cl100k_base": 6233, "olmocr-version": "0.1.49", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 41391, "total-output-tokens": 7325, "length": "2e12", "weborganizer": {"__label__adult": 0.0003993511199951172, "__label__art_design": 0.00038909912109375, "__label__crime_law": 0.0006203651428222656, "__label__education_jobs": 0.0009531974792480468, "__label__entertainment": 0.00012636184692382812, "__label__fashion_beauty": 0.00024008750915527344, "__label__finance_business": 0.0006265640258789062, "__label__food_dining": 0.00042939186096191406, "__label__games": 0.0012035369873046875, "__label__hardware": 0.001216888427734375, "__label__health": 0.000988006591796875, "__label__history": 0.0004298686981201172, "__label__home_hobbies": 0.00013685226440429688, "__label__industrial": 0.0007219314575195312, "__label__literature": 0.0003664493560791016, "__label__politics": 0.0005650520324707031, "__label__religion": 0.0005745887756347656, "__label__science_tech": 0.1968994140625, "__label__social_life": 0.00014090538024902344, "__label__software": 0.01280975341796875, "__label__software_dev": 0.7783203125, "__label__sports_fitness": 0.00048232078552246094, "__label__transportation": 0.0009002685546875, "__label__travel": 0.00028443336486816406}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 30002, 0.02018]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 30002, 0.36439]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 30002, 0.9236]], "google_gemma-3-12b-it_contains_pii": [[0, 4400, false], [4400, 8028, null], [8028, 13343, null], [13343, 18215, null], [18215, 20849, null], [20849, 24598, null], [24598, 27349, null], [27349, 30002, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4400, true], [4400, 8028, null], [8028, 13343, null], [13343, 18215, null], [18215, 20849, null], [20849, 24598, null], [24598, 27349, null], [27349, 30002, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 30002, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 30002, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 30002, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 30002, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 30002, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 30002, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 30002, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 30002, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 30002, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 30002, null]], "pdf_page_numbers": [[0, 4400, 1], [4400, 8028, 2], [8028, 13343, 3], [13343, 18215, 4], [18215, 20849, 5], [20849, 24598, 6], [24598, 27349, 7], [27349, 30002, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 30002, 0.0]]}
olmocr_science_pdfs
2024-11-24
2024-11-24
344d960d2471106f62809a138cefb142b8b46eea
LLM-based Approaches for Automatic Ticket Assignment: A Real-World Italian Application Nicola Arici\textsuperscript{1,2,*}, Luca Putelli\textsuperscript{1}, Alfonso E. Gerevini\textsuperscript{1}, Luca Sigalini\textsuperscript{2} and Ivan Serina\textsuperscript{1} \textsuperscript{1}Department of Information Engineering, University of Brescia, Via Branze 38, Brescia, Italy \textsuperscript{2}Mega Italia Media, Via Roncadelle 70A, Castel Mella, Italy Abstract IT service providers need to take care of errors, malfunctions, customizations and other issues every day. This is usually done through tickets: brief reports that describe a technical issue or a specific request sent by the users of the service. Tickets are often read by one or more human employees and then assigned to technicians or programmers in order to solve the raised issue. However, the increasing volume of such requests is leading the way to the automatization of this task. Since these tickets are written in natural language, in this paper we aim to exploit the new powerful pre-trained Large Language Model (LLM) GPT-4 and its knowledge in order to understand the problem described in the tickets and to assign them to the right employee. In particular, we focus our work on how to formulate the request to the LLM, which information is needed and the performance of different zero-shot learning, few-shot learning and ensemble learning approaches. Our study is based on a real-world ticket dataset provided by an Italian company which supplies IT solutions for creating and managing online courses. Keywords Automatic Ticket Assignment, Large Language Models, Prompt Engineering, Text Classification 1. Introduction Modern companies which supply IT solutions not only have to provide an effective software environment, but they also need to maintain it during the software lifecycle, to fix errors and malfunctions, to introduce new functionalities and satisfy the requests submitted by the users. This task is usually done by programmers specialized in maintenance tasks which need to take care of new issues every day. Such issues are usually submitted through ticketing systems. In these systems, the users can write a brief report that describes a problem they encountered, or a specific service they need. These reports, typically called tickets, are then distributed among the maintenance specialists which have to satisfy the users’ requests. However, in large companies which provide complex IT solutions or more than one product, different employees devoted to the maintenance can have different expertise. Therefore, there is the need to assign a ticket to the right person, i.e. an employee who has the necessary technical skills to solve the raised issue. In order to do that, typically one or more human employees have to read the ticket, understand the request and assign it to a technician. Since this task is quite time consuming, bigger companies are starting to implement automatic solutions. Although these solutions can be based on ad hoc algorithms [2, 3] or on fine-tuning generic pre-trained language models [4] such as BERT [5], they would require a considerable amount of training data and an expensive effort (by programmers and machine learning specialists) to implement such models. On the other hand, the outstanding results obtained by pre-trained large language models (LLMs) as few-shot learners (i.e. with a minimal number of training examples) [6, 7, 8] could make automatic ticket assignment available to many companies even without any particular effort. In order to verify whether that is achievable, in this work we investigate how these models can be applied to a real-world case scenario: the assignment of the tickets received by the Italian company Mega Italy Media\(^1\), which provides IT solutions in the e-learning sector for the occupational safety. In particular, in 2011 they released the DynDevice\(^2\) Learning Management System (LMS), facilitating companies in standard corporate training, allowing them to create specific courses, managing final exams [9, 10] (providing also the related certificates if the exam has been passed) and the interaction with the users [11]. The company receives many tickets related to this platform, which has to be maintained and updated constantly in order to satisfy the users’ needs. Using these tickets, we verify the performance of OpenAI GPT-4 [12], a state-of-the-art pre-trained LLM based on the Transformer architecture [13], for this task. However, it has been noted that the performance of such models can significantly vary depending on how the task requested is formulated or, in more technical terms, which prompt has been used [14, 15]. Therefore, we study different configurations and prompts into which more or less information is available to the LLM and in terms of how many examples we provide. We compare these results with a baseline into which a BERT model is fine-tuned on this task with 1000 labeled tickets. The rest of the paper is organized as follows. In Section 2, we provide the background and an overview of the state-of-the-art and the related works. In Section 3, we describe the dataset of our application. In Section 4, we describe our approaches for solving the automatic ticket assignment task, which are evaluated and discussed in Section 5. Finally, in Section 6 we propose some conclusions and future developments. The code and the datasets can be found on GitHub\(^3\) 2. Related work In recent years, several researchers have approached the support ticket domain, solving problems such as ticket categorization [2, 4, 16], ticket assignment and ticket resolution [17]; our work falls in the second category. In 2018, Uber, the famous private car transport company, proposed COTA [18] (Customer Obsession Ticket Assistant), a framework to take care of customer issues. They proposed two versions of their system: the first one combines several features, such as user information, trip information and ticket metadata, with a Random Forest algorithm for predicting the correct \(^1\)https://www.megaitaliamedia.com/en/ \(^2\)https://www.dyndevice.com/en/ \(^3\)https://github.com/nicolarici/AI-TS operator of each ticket; the second version leverages a Encoder-Combiner-Decoder approach, based on CNN and RNNs over different types of features (such as categorical, numerical, binary and text features) and a multi-classification layer. A similar approach has been developed by DeLucia and Moore [19]; the authors implemented a Random Forest model fed with features created with latent Dirichlet allocation topic modeling, latent semantic analysis and Doc2Vec [20] starting from the ticket subject and message. Han and Sun [21] proposed in 2020 DeepRouting, an intelligent system for assigning tickets to operators in an expert network. It contains two modules: one for text matching, based on a convolutional neural network trained over tri-grams derived by the ticket description, and one for graph matching, based on a Graph Convolutional Network fed with the experts graph. With Feng et al. [22], in 2021 Apple developed its personal ticket assignment system, TaDaa (Ticket Assignment Deep learning Auto Advisor). This system is based on the state-of-the-art Transformer architecture, in particular a pretrained BERT model fine-tuned to solve two classification tasks. The model has two different classifiers: the first one to assign the ticket to one of the 3000 groups, and the second one to identify the expert (that belongs to that group) that is going to solve the issue. We used a similar idea, in our much simpler context, with the BERT baseline described in Section 5. However, in this paper we show how also with a limited number of examples, pre-trained LLMs can achieve similar performance. Differently from these works, which are based on custom algorithms and models (which require a considerable effort for designing, implementing and testing), in our work we verify whether pre-trained LLMs can be used for this kind of task, even without fine-tuning. More generally, we exploit prompt engineering, which was designed precisely for obtaining the best results from these pre-trained models. Regarding this line of work, White et al. [23] provide a pattern catalog to solve common problems when conversing with a LLM. They propose 17 patterns which allow the users to better handle the input to give to the model, the output structure and format, possible errors in content, i.e. invented answers based on unverified facts, the prompt and how it can be improved to receive better responses and the interaction between the user and the model and the context needed by the model to generate a better response. Moreover, Reynolds at el. [24] showed that zero shot learning (i.e. without any example provided to the model) with a good prompt can outperform a standard few shots approach (i.e. with some examples); to do so they introduced the concept of meta-prompt, that seeds the model to generate its own natural language prompt to solve the task. A similar result has been achieved by Zhou et el. [25], where the authors propose Automatic Prompt Engineer, a framework for automatic instruction generation and selection. In their method the authors optimized the prompt by searching over a pool of instruction candidates proposed by an LLM in order to maximize a chosen score function. The LLMs, in particular ChatGPT, have been proven very effective in solving specific NLP tasks on general domains. Even in specific domains, such as public health [26, 27, 28], environmental problems [29] or legal rulings and laws [30, 31], the LLMs achieve acceptable performance. To the best of our knowledge, there are currently no applications of GPT-based models in the context of workplace security. 3. Available data Since the release of DynDevice in 2011, Mega Italia Media started facing the problem of assisting and supporting end users. Originally, this service was provided by phone calls or emails but, with the strong spread of the platform over the years, these channels were soon saturated. To help the company operators to solve the users problem, in 2013 the company developed a ticketing system; this new feature allowed the company to keep track of all the tickets opened, memorizing the status of the user’s request and who was in charge to solve the problem. Moreover, this system kept record of all the conversations between users and operators. Overall, the company has received more than 10000 tickets in the last 10 years. However, in the last period several new features and services (such as multiple interface changes, a video call system and several AI applications) were introduced, and therefore we decided to consider in our dataset only the tickets received in the last months, which are about 1300. Furthermore, to build our dataset we decided only to keep the significant information: the ticket category, object and description and the area who solved the ticket; other information such as dates and identifiers has been removed. In the following we provide an example of a ticket; please note that this example has been translated, since all our tickets are written in Italian. Example 1. CATEGORY: G. More on e-Learning/training solutions SUBJECT: Certificate with exam in presence HTML DESCRIPTION: “Certificate with Examination in Attendance” I turned it into HTML 5. Everything is fine except for the column rows that do not appear. What could be the problem? Thank you AREA: SW <table> <thead> <tr> <th>CATEGORY</th> <th>SW</th> <th>TECH</th> <th>eLEARNING</th> </tr> </thead> <tbody> <tr> <td>A. Problems in using a course</td> <td>28</td> <td>63</td> <td>173</td> </tr> <tr> <td>B. Inability to access a course</td> <td>7</td> <td>37</td> <td>28</td> </tr> <tr> <td>C. Clarification of the didactics of a course</td> <td>3</td> <td>16</td> <td>43</td> </tr> <tr> <td>D. Problems in generating reports</td> <td>29</td> <td>23</td> <td>14</td> </tr> <tr> <td>E. Problem in generating/recouping documents</td> <td>38</td> <td>41</td> <td>75</td> </tr> <tr> <td>F. User registration problem</td> <td>36</td> <td>43</td> <td>36</td> </tr> <tr> <td>G. Other on e-Learning/training solutions</td> <td>145</td> <td>129</td> <td>39</td> </tr> <tr> <td>H. HR management</td> <td>12</td> <td>8</td> <td>5</td> </tr> <tr> <td>I. e-Commerce and website management</td> <td>86</td> <td>27</td> <td>0</td> </tr> <tr> <td>M. School of Security</td> <td>2</td> <td>5</td> <td>30</td> </tr> <tr> <td>N. Commercial</td> <td>3</td> <td>9</td> <td>10</td> </tr> </tbody> </table> Figure 1: Cross table between ticket categories and macro areas who are in charge of solving the ticket. The category field contains one of the 11 predetermined categories decided by the company. A complete categories list is reported in Figure 1. The object and the description are text fields that require a slight pre-process in order to remove the HTML tags, the URLs and other special characters that can harm the classification process. Each ticket is assigned to a specific operator who is in charge of solving the raised issue. However, all the operators can be aggregated in three main macro areas: - **eLEARNING**: which handles the problems on the courses provided to the end users; - **TECH**: which solves the technical issues about the platform; - **SW**: that removes bugs and other software issues. Each area manager assigns the ticket to a single operator suited to handle the case. In the left part of the Figure 2, we reported the ticket distribution among the macro areas; as we can see the three classes are approximately equally distributed. On the contrary, as shown in the right part of Figure 2, the categories follow an unbalanced distribution, with category G being the most frequent, with more than 300 tickets compared to the least frequent. Another statistic that we extrapolate from the dataset is the cross tabulation between the categories and the area fields. As we can see in Figure 1, there is a strong correlation between some categories and some areas: the category A has a strong correlation with the eLEARNING area (and vice-versa), whereas both TECH and SW have a strong correlation with the category G. We expect tickets in these categories to be best assigned with a well constructed prompt containing this information. Other categories do not present any correlation, in some cases due to the low number of tickets, such as categories N and H. In other cases (such as categories F and E) the tickets are equally distributed between all the areas. Finally, we decided to sample with stratification, following the area distribution, approximately 250 tickets to build 5 different test sets; this way, each test set contains 18 tickets for eLEARNING, 15 tickets for TECH e 14 tickets for SW. The tickets sampled with this strategy retain also the categories distribution and the cross correlation discussed above. ![Figure 2](image-url): On the left, an histogram showing ticket distribution by the macro areas (i.e. our classification labels). On the right, an histogram showing the ticket distribution for each category considered. 4. Prompts and methods for automatic ticket assignment The base task to solve for the automatic ticket assignment is a multi-class classification, into which we have to choose which group (eLEARNING, TECH or SW) will receive the ticket. To solve this task, we decided to exploit the Python version of the OpenAI Chat Completion API, which allows interaction with pre-trained LLMs. For each call, the API requires several parameters. The most relevant ones for our work are: the model we want to query, which in our case can be GPT-4 or GPT-3.5-turbo, and the temperature, a decimal number between 0.0 and 2.0 (default 1.0), which controls randomness (higher values) or determinism (lower values) in the response generated. To have as much determinism as possible, in all trials we set temperature to 0.0. The corpus of the API request is composed by two messages: the system prompt, that contains the description of the task and the information to solve it, and the user prompt, i.e. the ticket to classify. We tested GPT in three ways: zero shot learning, few shots learning, and ensemble learning. For the zero shot learning scenario, we provided to the model insightful information in the system prompt and no examples; all the information was extracted from the database described in Section 3. These are the zero shot prompts we implemented: - **Baseline**: it describes the task, provides the basic information and imposes to GPT to answer only with the macro area name. From here on, each subsequent prompt is to be considered concatenated with this one. Example: You are the manager of a service center whose task is to divide tickets between the various human operators. The available operators, contained in square brackets are as follows: [eLEARNING, TECH, SW]. The tickets are divided into categories, listed by letters of the alphabet, contained in round brackets, which are as follows: (A. Problems in using a course, B. ...). Each ticket consists of a subject and a description. Your task is to assign the ticket to the most suitable operator, answering only with the operator’s name. - **Human**: it contains insightful information, provided by a human employee, on the role of the three areas and the problems solved. Example: SW handles technical problems with software code, new customisation and developments and ICT (Information and Communication Technologies) and SEO (Search Engine Optimisation) issues. The same information is provided for the other 2 areas. - **Categories**: it contains information related to the assignment of the tickets aggregated by category. For each category, we extract the percentage of tickets solved by each area belonging to that category (which can be seen in Figure 1). For instance, for the category A we wrote: Example: 66% of the tickets in the category “A. Problems in using a course” are assigned to eLEARNING, 24% to TECH and 11% to SW. The same information is provided for the other 10 categories. - **Areas**: it contains information about the assignment of tickets aggregated by areas. From the Figure 1, for each area, we extract the percentage of tickets belonging to each category --- 4https://platform.openai.com/docs/api-reference/chat solved by the area. For instance, for the area eLEARNING we have: Example: To eLEARNING is assigned 38% of the tickets in category A, 8% in B, 9% in C, 3% in D, 17% in E, 8% in F, 8% in G, 1% in H, 0% in I, 7% in M and 2% in N. The same information is provided for the other 2 areas. - **Summaries:** for this prompt we asked GPT-4 to summarize the issues raised by the users in 10 tickets for each area; these tickets were randomly sampled from the training dataset. For instance, for the area eLEARNING we have the following result: Example: eLEARNING solves problems related to the activation of courses, changes of certificates, platform access problems, cancellation of courses, issuing of certificates, downloading of certificates and approval of enrolment forms. The same summary is generated by GPT-4 for the other two areas and used by GPT in the system prompt. Please note that these summaries are generated separately by the model. At the moment of the ticket assignment, the LLM receives the summary without any knowledge of the 10 examples used for generating it. As a second approach we implemented the **few shots learning**. The basic idea is to give to the model some examples of classification so it can understand the pattern, generalize it and then apply what it has learned to test instances. This approach has achieved outstanding results in a lot of NLP tasks [6, 8]. All our few shots approaches use the Baseline Prompt, without additional information. Instead, we provided to the model some examples in the same format expressed in the Example 1, with the correct macro area assigned. The last approach, the **ensemble learning**, leverages the best results obtained in the past trials to try to use all the information at our disposal. Thus, for each ticket, we made \( n \) calls to the OpenAI API with different prompts, keeping model and temperature unchanged. Each result is counted as a vote, with no specific weight assigned, and the area with the most votes has the ticket assigned. In the event of a tie, the ticket is randomly assigned to one of the areas with the most votes. In our experimental evaluation we use an ensemble made by three and four prompts. ### 5. Experimental results In this section, we report the results of our experiments. For each trial, in Table 1 we report the mean and the standard deviation over the five test sets for two metrics: the accuracy and the macro F1 score, both expressed between 0.0, the worst, and 1.0, the best. In addition to the approaches described in the previous section, to provide a baseline for comparison with state-of-the-art approaches, we tested how a classical approach with BERT solves the task. Starting from a pre-trained Italian version of BERT available on HuggingFace\(^5\), we fine-tuned the model on this specific task on 907 samples for 20 epochs and we took the best performing model on a validation set made by 101 examples. To perform the classification, we add to BERT a simple feedforward layer with three neurons preceded by a 0.1 dropout layer. In training we used the Binary Cross Entropy loss function, the AdamW optimizer, with learning rate set to \( 2 \times 10^{-5} \); we set decay to 0.01 and batch size to 32. We fed this classification model with --- \(^5\)dbmdz/bert-base-italian-uncased <table> <thead> <tr> <th>Approach</th> <th>Prompt</th> <th>Accuracy</th> <th>Macro F1</th> </tr> </thead> <tbody> <tr> <td>ZS</td> <td>Baseline</td> <td>0.34 ± 0.05</td> <td>0.29 ± 0.05</td> </tr> <tr> <td>ZS</td> <td>Summaries</td> <td>0.50 ± 0.07</td> <td>0.48 ± 0.06</td> </tr> <tr> <td>ZS</td> <td>Categories</td> <td>0.53 ± 0.06</td> <td>0.49 ± 0.09</td> </tr> <tr> <td>ZS</td> <td>All Information</td> <td>0.54 ± 0.05</td> <td>0.49 ± 0.07</td> </tr> <tr> <td>ZS</td> <td>Areas</td> <td>0.56 ± 0.03</td> <td>0.50 ± 0.04</td> </tr> <tr> <td>ZS</td> <td>Human</td> <td>0.57 ± 0.03</td> <td>0.54 ± 0.04</td> </tr> <tr> <td>FS</td> <td>One Example</td> <td>0.19 ± 0.05</td> <td>0.14 ± 0.05</td> </tr> <tr> <td>FS</td> <td>Three Examples</td> <td>0.44 ± 0.02</td> <td>0.36 ± 0.04</td> </tr> <tr> <td>FS</td> <td>Five Examples</td> <td>0.44 ± 0.05</td> <td>0.34 ± 0.05</td> </tr> <tr> <td>FS</td> <td>Ten Examples</td> <td>0.56 ± 0.04</td> <td>0.51 ± 0.04</td> </tr> <tr> <td>BERT</td> <td>Only Ticket</td> <td>0.62 ± 0.07</td> <td>0.62 ± 0.07</td> </tr> <tr> <td>BERT</td> <td>Full</td> <td>0.65 ± 0.07</td> <td>0.65 ± 0.07</td> </tr> <tr> <td>EL</td> <td>Three Prompts</td> <td>0.57 ± 0.05</td> <td>0.52 ± 0.06</td> </tr> <tr> <td>EL</td> <td>Four Prompts</td> <td>0.61 ± 0.05</td> <td>0.55 ± 0.08</td> </tr> </tbody> </table> Table 1 Experimental results of our methods. In the Approach column, we specify if we use a zero-shot approach (ZS), a few-shot (FS) a fine-tuned BERT (BERT) or an ensemble learning approach (EL). In the Prompt column, we specify the additional configuration of the approach (as described in Section 4). For both Accuracy and Macro F1 we report their mean ± their standard deviation calculated over five different test sets. two types of input: one containing just the description of the ticket and one with all its three properties: category, object and description. The results obtained by the zero shot learning with no additional information (0.34 accuracy and 0.29 macro F1 score), and by BERT (0.65 accuracy and 0.65 macro F1 score), constitute the baselines of our framework. As regarding the zero shot approach, when we start adding information to the base prompt, the accuracy improves. The two trials that leverage the correlation between the area and the category reach accuracy 0.53 for the Categories Prompt and 0.56 for the Areas Prompt. The reason for this behavior could be due to the length of the prompts: the first prompt is, more or less, 200 tokens long and some information is forgotten or ignored by the LLM. Also, in these two cases we provided only information about the categories and no information about the ticket description. This information is contained in the other two prompts: the Human and Summaries prompts. For the first case, the model reaches about 0.57 accuracy and an higher macro F1 score (0.54) and with the lowest standard deviation. For the second prompt, the accuracy drops to 0.50 with an higher standard deviation (0.07), probably due to the fact that the summaries are obtained with 10 tickets only, and the accuracy changes depending on whether the tickets in the dataset are more or less similar than those used for the summaries. When we pass all the information to the model the performance is lower (0.54 accuracy), probably because the prompt reaches a critical length. For the few shots approaches, the results are not particularly good. The single example case manages to perform even worse with respect to the baseline, with an accuracy of approximately 0.19. However, as it can be seen from the Table 1, increasing the number of examples improves the accuracy; with 3 and 5 examples, we reach 0.44 accuracy. This is probably due to the fact that the tickets are very varied and a small part of them does not represent the totality of issues addressed by a macro area. Only with 10 examples we get 0.56 (with a standard deviation of 0.04), approximately the same results obtained by the zero shot approaches. The only approach that almost reaches the BERT baseline is the ensemble learning. In this case, using the best single information zero shot trials, combined with a voting system, helps the performances to get 0.57 with three prompts (Human, Areas and Categories) and 0.61 with all four prompts; in these cases the standard deviation is lower w.r.t. the BERT baseline. Also, in these scenarios, we can use all the information described in the zero shot approach without increasing the prompt length, unlike the full zero-shot case. Probably, with different tie breaking strategies (perhaps based on prediction probabilities) even better performances can be achieved; unfortunately, at the moment the Chat Competition OpenAI API does not provide any probabilistic information. The second experiment focused on comparing the performance of the two main GPT models made available by OpenAI: GPT-4, and its predecessor GPT-3.5. Although this can be interesting from the researcher’s perspective, this comparison has also an economic motivation. In fact, according to the API pricing, invoking GPT-3.5 costs more than 20 times less than GPT-4. In this experiment, we keep the same prompts and the other hyperparameters, modifying just the model. As we can see in Figure 3, the difference in performance is noticeable. The best result obtained by GPT-3.5 is with the Categories Prompt, with an accuracy of 0.50, less than 5 points lower than GPT-4; the Human prompt loses approximately 10 points, while the Summaries prompt drops 15 points. The worst results is obtained by the Areas prompt, with an accuracy of 0.37 and a drop of 20 points. This behaviour is probably due to the long list of percentages for each single areas and which can confuse the model. No difference was found in the standard deviations. An average loss of 6 accuracy points between the 3 best performing prompts (thus excluding Areas) could still justify the cost of using GPT-4 over its older but cheaper counterpart. 6. Conclusions and Future work In this work, we have shown an application of pre-trained Large Language Models for the automatic ticket assignment, based on the real-world data provided by Mega Italia Media, a company that provides IT solutions in the e-learning context. In particular, we analyzed how different prompts, with more or less information and examples, influence the performance on this task. The experimental evaluation shows that in our context the classical few-shots approach does not provide a considerable improvement. This is probably because a limited number of examples cannot capture the overall variety of tickets that the company receives. Instead, a zero-shot approach definitely improves the performance since it considers more information related to the overall context of the application (for instance a human description of the different classes or the percentage of instances belonging to each category). The best results are obtained by the ensemble methods involving three and four prompts. Their results almost reach the ones obtained by a BERT model specifically fine-tuned for this task. In contrast to BERT, which uses more than 1000 tickets between training and validation, this approach uses none. This approach can certainly be more efficient in scenarios where there is a little amount of data available. As future work, we aim to study other prompting techniques, such as the chain-of-thought prompting [32] or prompts automatically generated [15]. Moreover, we would like to explore the performance of other LLMs, especially testing the open source ones, such as OpenAssistant, Dolly, GPT-J or GPT-NeoX. This could lead to a more detailed study, not only in terms of measuring the performance of each model, but also trying to understand what the models know in this field (which involves information technology, programming languages, e-learning, etc.) how this knowledge is stored in such models [33, 34], and focus on their explainability, analysing the behaviour of the attention mechanisms [35, 36] and prevent unwanted or discriminatory behaviour [37]. References [1] M. P. Elisa Bassignana, Dominique Brunato, A. Ramponi, Preface to the Seventh Workshop on Natural Language for Artificial Intelligence (NL4AI), in: Proceedings of the Seventh Workshop on Natural Language for Artificial Intelligence (NL4AI 2023) co-located with [28] T. Mehmood, A. E. Gerevini, A. Lavelli, I. Serina, Combining multi-task learning with
{"Source-Url": "http://sag.art.uniroma2.it/NL4AI/wp-content/uploads/2023/10/paper5.pdf", "len_cl100k_base": 6963, "olmocr-version": "0.1.53", "pdf-total-pages": 13, "total-fallback-pages": 0, "total-input-tokens": 31487, "total-output-tokens": 10831, "length": "2e12", "weborganizer": {"__label__adult": 0.0005731582641601562, "__label__art_design": 0.0012979507446289062, "__label__crime_law": 0.000705718994140625, "__label__education_jobs": 0.0728759765625, "__label__entertainment": 0.00054931640625, "__label__fashion_beauty": 0.00048160552978515625, "__label__finance_business": 0.0011577606201171875, "__label__food_dining": 0.00067138671875, "__label__games": 0.0015058517456054688, "__label__hardware": 0.0013942718505859375, "__label__health": 0.0014667510986328125, "__label__history": 0.0007295608520507812, "__label__home_hobbies": 0.0002465248107910156, "__label__industrial": 0.0009741783142089844, "__label__literature": 0.0029582977294921875, "__label__politics": 0.000667572021484375, "__label__religion": 0.000885009765625, "__label__science_tech": 0.416259765625, "__label__social_life": 0.00048065185546875, "__label__software": 0.05810546875, "__label__software_dev": 0.4345703125, "__label__sports_fitness": 0.0004067420959472656, "__label__transportation": 0.0008378028869628906, "__label__travel": 0.000362396240234375}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 39281, 0.05429]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 39281, 0.15113]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 39281, 0.88213]], "google_gemma-3-12b-it_contains_pii": [[0, 2755, false], [2755, 6218, null], [6218, 9834, null], [9834, 12622, null], [12622, 15097, null], [15097, 18321, null], [18321, 21637, null], [21637, 24544, null], [24544, 26376, null], [26376, 29698, null], [29698, 33055, null], [33055, 36689, null], [36689, 39281, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2755, true], [2755, 6218, null], [6218, 9834, null], [9834, 12622, null], [12622, 15097, null], [15097, 18321, null], [18321, 21637, null], [21637, 24544, null], [24544, 26376, null], [26376, 29698, null], [29698, 33055, null], [33055, 36689, null], [36689, 39281, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 39281, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 39281, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 39281, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 39281, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 39281, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 39281, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 39281, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 39281, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 39281, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 39281, null]], "pdf_page_numbers": [[0, 2755, 1], [2755, 6218, 2], [6218, 9834, 3], [9834, 12622, 4], [12622, 15097, 5], [15097, 18321, 6], [18321, 21637, 7], [21637, 24544, 8], [24544, 26376, 9], [26376, 29698, 10], [29698, 33055, 11], [33055, 36689, 12], [36689, 39281, 13]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 39281, 0.18831]]}
olmocr_science_pdfs
2024-12-07
2024-12-07
362c4d7f5ae4488f66c8bcc0295503a542a98d60
A Certified Universal Gathering Algorithm for Oblivious Mobile Robots Pierre Courtieu, Lionel Rieg, Sébastien Tixeuil, Xavier Urbain To cite this version: Pierre Courtieu, Lionel Rieg, Sébastien Tixeuil, Xavier Urbain. A Certified Universal Gathering Algorithm for Oblivious Mobile Robots. [Research Report] UPMC, Sorbonne Universites CNRS; CNAM, Paris; College de France; Université Paris Sud. 2015. hal-01159890 HAL Id: hal-01159890 https://hal.sorbonne-universite.fr/hal-01159890 Submitted on 4 Jun 2015 HAL is a multi-disciplinary open access archive for the deposit and dissemination of scientific research documents, whether they are published or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers. L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés. Distributed under a Creative Commons Attribution - NonCommercial 4.0 International License A Certified Universal Gathering Algorithm for Oblivious Mobile Robots Pierre Courtieu\textsuperscript{1}, Lionel Rieg\textsuperscript{2}, Sébastien Tixeuil\textsuperscript{3,4} and Xavier Urbain\textsuperscript{5,1,6} \textsuperscript{1}CÉDRIC – Conservatoire national des arts et métiers, Paris, F-75141 \textsuperscript{2}Collège de France \textsuperscript{3}Sorbonne Universités, UPMC Univ Paris 06, CNRS, LIP6 UMR 7606, 4 place Jussieu 75005 Paris \textsuperscript{4}Institut Universitaire de France \textsuperscript{5}École Nat. Sup. d’Informatique pour l’Industrie et l’Entreprise (ENSIIE), Évry, F-91025 \textsuperscript{6}LRI, CNRS UMR 8623, Université Paris-Sud, Orsay, F-91405 June 4, 2015 Abstract We present a new algorithm for the problem of universal gathering mobile oblivious robots (that is, starting from any initial configuration that is not bivalent, using any number of robots, the robots reach in a finite number of steps the same position, not known beforehand) without relying on a common chirality. We give very strong guaranties on the correctness of our algorithm by proving formally that it is correct, using the Coq proof assistant. To our knowledge, this is the first certified positive (and constructive) result in the context of oblivious mobile robots. It demonstrates both the effectiveness of the approach to obtain new algorithms that are truly generic, and its managability since the amount of developed code remains human readable. 1 Introduction Networks of mobile robots captured the attention of the distributed computing community, as they promise new applications (rescue, exploration, surveillance) in potentially dangerous (and harmful) environments. Since its initial presentation [18], this computing model has grown in popularity and many refinements have been proposed (see [11] for a recent state of the art). From a theoretical point of view, the interest lies in characterising the exact conditions for solving a particular task. In the model we consider, robots are anonymous (i.e., indistinguishable from each-other), oblivious (i.e., no persistent memory of the past is available), and disoriented (i.e., they do not agree on a common coordinate system). The robots operate in Look-Compute-Move cycles. In each cycle a robot “Looks” at its surroundings and obtains (in its own coordinate system) a snapshot containing the locations of all robots. Based on this visual information, the robot “Computes” a destination location (still in its own coordinate system) and then “Moves” towards the computed location. Since the robots are identical, they all follow the same deterministic algorithm. The algorithm is oblivious if the computed destination in each cycle depends only on the snapshot obtained in the current cycle (and not on the past history of execution). The snapshots obtained by the robots are not consistently oriented in any manner (that is, the robots local coordinate systems do not share a common direction nor a common chirality). The execution model significantly impacts the solvability of collaborative tasks. Three different levels of synchronisation have been considered. The strongest model [18] is the fully synchronised (FSYNC) model where each phase of each cycle is performed simultaneously by all robots. On the other hand, the asynchronous model [11] (ASYNC) allows arbitrary delays between the Look, Compute and Move phases and the movement itself may take an arbitrary amount of time. In this paper, we consider the semi-synchronous (SSYNC) model [18], which lies somewhere between the two extreme models. In the SSYNC model, time is discretised into rounds and in each round an arbitrary subset of the robots are active. The robots that are active in a particular round perform exactly one atomic Look-Compute-Move cycle in that round. It is assumed that the scheduler (seen as an adversary) is fair in the sense that it guarantees that in any configuration, any robot is activated within a finite number of steps. **Related Work.** The gathering problem is one of the benchmarking tasks in mobile robot networks, and has received a considerable amount of attention (see [11] and references herein). The gathering tasks consists in all robots (considered as dimensionless points in a Euclidian space) reaching a single point, not known beforehand, in finite time. A foundational result [18, 8] shows that in the FSYNC or SSYNC models, no oblivious deterministic algorithm can solve gathering for two robots without additional assumptions [13]. This result can be extended [18, 8] to the bivalent case, that is when an even number of robots is initially evenly split in exactly two locations. On the other hand, it is possible to solve gathering if \( n > 2 \) robots start from initially distinct positions, if robots are endowed with multiplicity detection: that is, a robot is able to determine the number of robots that occupy a given position. While probabilistic solutions [18, 12] can cope with arbitrary initial configuration (including bivalent ones), most of the deterministic ones in the literature [11] assume robots always start from distinct locations (that is, the initial configuration contains no multiplicity points). Some recent work was devoted to relaxing this hypothesis in the deterministic case. Dieudonné and Petit [10] investigated the problem of gathering from any configuration (that is, the initial configuration can contain arbitrary multiplicity points): assuming that the number of robots is odd (so, no initial bivalent configuration can exist), they provide a deterministic algorithm for gathering starting from any configuration. Bouzid et al. [6] improved the result by also allowing an even number of robots to start from configurations that contain multiplicity points (albeit the initial bivalent configuration is still forbidden due to impossibility results in this case). In that sense, the algorithm of Bouzid et al. [6] is universal in the sense that it works for all gatherable configurations, including those with multiplicity points. Both aforementioned results assume that robots and are endowed with multiplicity detection and have a common chirality. A natural open question emerging from those works is whether any of those assumptions can be relaxed (not both of them can be relaxed at the same time, as impossibility results exist in this case [15]). Another line of work that is related to our concern that of using formal methods in the context of mobile robots [5, 9, 3, 2, 14, 8]. Model-checking proved useful to find bugs in existing literature [3] and assess formally published algorithms [9, 3], in a simpler setting where robots evolve in a discrete space where the number of possible positions is finite. Automatic program synthesis (for the problem of perpetual exclusive exploration in a ring-shaped discrete space) is due to Bonnet et al. [5], and can be used to obtain automatically algorithms that are “correct-by-design”. The approach was recently refined by Millet et al. [14] for the problem of gathering in a discrete ring network. As all aforementioned approaches are designed for a discrete setting where both the number of positions and the number of robots are known, they cannot be used in the continuous space where robots positions take values in a set that is not enumerable, and they cannot permit to establish results that are valid for any number of robots. Developed for the COQ proof assistant, the Pactole framework enabled the use of high-order logic to certify impossibility results [2] for the problem of convergence: for any positive $\varepsilon$, robots are required to reach locations that are at most $\varepsilon$ apart. Another classical impossibility result that was certified using the Pactole framework is the impossibility of gathering starting from a bivalent configuration [8]. While the proof assistant approach seems a sensible path for establishing certified results for mobile robots that evolve in a continuous space, to this paper there exists no positive certified result in this context. Expressing mobile robot algorithms in a formal framework that permits certification poses a double challenge: how to express the algorithm (that can make use of complex geometric abstractions that must be properly defined within the framework), and how to write the proof? **Our contribution** Motivated by open problems on the gathering side and on the proof assistant side, we investigate the possibility of universal gathering mobile oblivious robots (that is, starting from any initial configuration that is not bivalent, using any number of robots) without relying on chirality (unlike [10, 6]). We present a new gathering algorithm for robots operating in a continuous space that (i) can start from any configuration that is not bivalent, (ii) does not put restriction on the number of robots, (iii) does not assume that robots share a common chirality. We give very strong guarantees on the correctness of our algorithm by proving formally that it is correct, using the COQ proof assistant. To this goal we use the formal model and libraries we develop, and that has been --- previously sketched in [2] and [8]. To our knowledge, this is the first certified positive (and constructive) result in the context of oblivious mobile robots. It demonstrates both the effectiveness of the approach to obtain new algorithms that are truly generic, and its manageability since the amount of developed code remains human readable. Our bottom-up approach permits to lay sound theoretical foundations for future developments in this domain. Roadmap. The sequel of the paper is organised as follows. First, we recall the context of robot networks in Section 2. In Section 3, our algorithm is informally presented, along with the key points of its correctness proof. We present our formal COQ framework in Section 4, together with the formalization of the key concepts identified in the previous section. Section 5 investigates further some planned developments. The actual development for COQ 8.5 is available at http://pactole.lri.fr/pub/certified_gathering1D.tgz 2 Robot Networks We borrow most of the notions in this section from [18, 1, 11]. The network consists in a set of \( n \) mobile entities, called robots, arbitrarily located in the space. Robots cannot communicate explicitly by sending messages to each others. Instead, their communication is based on vision: they observe the positions of other robots, and based on their observations, they compute destination points to which they move. Robots are \textit{homogeneous} and \textit{anonymous}: they run the same algorithm (called \textit{robogram}), they are completely indistinguishable by their appearance, and no identifier can be used in their computations. They are also \textit{oblivious}, i.e. they cannot remember any previous observation, computation or movement performed in any previous step. For simplicity, we assume that robots are \textit{without volume}, i.e. they are modeled as points that cannot obstruct the movement or vision of other robots. Several robots can be located at the same point, a \textit{tower} is a location inhabited by (one or) several robots. The multiplicity of a location \( l \), that is the number of robots at this location, is denoted by \(|l|\). Visibility is \textit{global}: the entire set of robots can always be seen by any robot at any time. Robots that are able to determine the exact number of robots occupying a same position (i.e., the multiplicity of a tower) enjoy \textit{strong} multiplicity detection; if they can only know if a given position is inhabited or not, their multiplicity detection is said to be \textit{weak}. Each robot has its own local coordinate system and its own unit measure. Robots do not share any origin, orientation, and more generally any frame of reference, but it is assumed that every robot is at the origin of its own frame of reference. At a given time, robots and their positions define a \textit{configuration}. A configuration that consists of exactly two towers of same cardinalities is said to be \textit{bivalent}. The degree of asynchrony in the robot swarm is characterised by an abstract entity called the *demon* (or adversary). Each time a robot is activated by the demon, it executes a complete three-phases cycle: Look, Compute and Move. During the Look phase, using its visual sensors, the robot gets a snapshot of the current configuration. Then, based only on this observed configuration, it computes a destination in the Compute phase using its robogram, and moves towards it during the subsequent Move phase. Movements of robots are *rigid*, i.e. the demon cannot stop them before they reach the destination. A *run* (or execution) is an infinite sequence of rounds. During each round, the demon chooses a subset of robots and activates them to execute a cycle. We assume the scheduling to be *fair*, i.e. each robot is activated infinitely often in any infinite execution, and *atomic* in the sense that robots that are activated at the same round execute their actions synchronously and atomically. An atomic demon is called fully-synchronous (FSYNC) if all robots are activated at each round, otherwise it is said to be semi-synchronous (SSYNC). ### 3 Setting and Robogram We consider a set of $nG$ anonymous robots that are oblivious and equipped with global strong multiplicity detection (that is, they are able to count the number of robots that occupy any given position). The demon is supposed to be fair, and the execution model is SSYNC. The space in which they move is the real line $\mathbb{R}$. Robots do not share any common direction of the line, nor any chirality. Any initial configuration is accepted as long as it is not bivalent (including those with multiplicity points). Indeed, [18] shows that gathering is not solvable for two robots, and a formal certified proof that the gathering problem cannot be solved if bivalent positions are tolerated is available [8]. #### 3.1 Robogram In this particular case of the considered space being $\mathbb{R}$, even if there is no common frame of reference, we have that, for any configuration, the set of inhabited locations that are the *most external* is the same for all robots. Hence, those most external inhabited location define the same *center of extrema* to all robots, as well as the same set of (strictly) interior inhabited locations. Based on this remark, we can define the robogram embedded in each robot as follows: 1. If there is a unique location with highest multiplicity, the destination is that location, 2. Otherwise, if there are exactly three inhabited locations, the destination is the one in between, 3. Otherwise, if not already at one of the most external locations, the destination is the center of the most external ones. 4. Otherwise, the destination is the origin (do not move). An example execution of our robogram is presented in Figure 1. In the initial configuration (see Figure 1.(a)), only the third condition is enabled. The inner robots move toward the middle of the extremal robots. When there are three inhabited locations (see Figure 1.(b)), only the second condition is enabled, and extremal robots move toward the inner inhabited location. When a single highest multiplicity point is reached (see Figure 1.(c)), only the first condition is enabled, and all robots move toward it. After all robots gather (see Figure 1.(d)), only the fourth condition apply, and the configuration is final. This description of the protocol is obviously informal, however we present in Section 4.1 its formal version, that is, the COQ definition of our algorithm. 3.2 Key points to prove correctness Some properties are fundamental in our proof that the algorithm is a solution to the problem of gathering. Namely, that robots move towards the same location, that a legal configuration cannot evolve into a forbidden (that is: bivalent) one, and finally that the configuration is eventually reduced to a single inhabited location. Robots that move go to the same location. Note that by robots “that move” we explicitly mean robots the destination of which is not their original location, and not robots that are activated (some of which may not move). Robots enjoy global strong multiplicity detection, hence they all detect if there is a unique tower with the highest multiplicity, thus sharing the destination (Phase 1). If they do not find such a tower, they can all count how many locations are inhabited. Should they detect that there are only three of them (Phase 2) then, as previously remarked, sharing the notion of tower in between, they also share the destination. Finally if there is more than three inhabited locations none of which holding more robots than the others (Phase 3), as most external towers are the same for all robots, robots to move go the location defined as the center of those external towers, that is the same destination again. Further note that we actually just showed that all moving robots are in the same phase of the robogram, and that the resulting destination does not depend on the frame of reference of the robot. Bivalent positions are unreachable. We require that the initial configuration does not consist of exactly two towers with the same multiplicity. One of the key points ensuring this algorithm’s correctness is that there is no way to reach a position that is bivalent from a position that is not bivalent. Consider two configurations $C_0$ and $C_1$, $C_1$ being bivalent and resulting from $C_0$ by some round. Let us denote by $|x|_0$ (resp. $|x|_1$) the multiplicity of location $x$ in $C_0$ (resp. in $C_1$). By definition, $C_1$ consists of two locations $l_1$ and $l_2$ such that $|l_1|_1 = |l_2|_1 = \frac{nG_2}{2}$. As all moving robots go to the same location, we can assume without loss of generality that robots moved to, say, $l_1$, adding to its original multiplicity $|l_1|_0$ (which might have been 0). Since the configuration is now bivalent, this means that $l_2$ was inhabited in $C_0$ and such that $|l_2|_0 \geq \frac{nG_2}{2}$ (some robot in $l_2$ might have moved to $l_1$). There cannot have been only one inhabited location $l$ distinct from $l_2$ before the round because either $|l|_0 = |l_2|_0 = \frac{nG_2}{2}$ but we supposed the configuration was not bivalent, or $|l|_0 < \frac{nG_2}{2} < |l_2|_0$ but then by Phase 1 robots would have moved to $l_2$ and not $l_1$. Hence $C_0$ consisted of $l_2$ and several inhabited $l_i$ ($i \neq 2$) amongst which the robots not located in $l_2$ were distributed, but then none of the $l_i$ could have held more than $\frac{nG_2}{2} - 1$ robots, hence Phase 1 should have applied and robots should have moved to $l_2$, a contradiction. Eventually no-one moves. The termination of the algorithm is ensured by the existence of a measure decreasing at each round involving a moving robot for a well-founded ordering. We then conclude using the assumption that the demon is fair. The measure is defined as follows: we map any configuration $C_i$ to a $(p_i, m^p_i) \in \mathbb{N} \times \mathbb{N}$ such that $p_i$ is the phase number of the moving robots, and: - $m^1_i$ is the number of robots that are not at the (unique) location of highest multiplicity, - $m^2_i$ is the number of robots that are not at the inhabited location in between, - $m^3_i$ is the number of robots that are neither at a most external location nor at their center. Let $>_{\mathbb{N}}$ be the usual ordering on natural numbers, the relevant ordering $\succ$ is defined as the lexicographic extension of $>_{\mathbb{N}}$ on pairs: $$(p, m) \succ (p', m') \iff \begin{cases} \text{either } & p >_{\mathbb{N}} p', \\ \text{or } & p =_{\mathbb{N}} p' \text{ and } m >_{\mathbb{N}} m'. \end{cases}$$ It is well-founded since $>_{\mathbb{N}}$ is well-founded. We show that for any round on a configuration $C_k$ resulting in a different configuration $C_{k+1}$, $(p_k, m^p_k) \succ (p_{k+1}, m^p_{k+1})$, hence proving that eventually there is no more change in successive configurations. 4 A Formal Model to Prove Robograms To certify results and to guarantee the soundness of theorems, we use Coq, a Curry-Howard-based interactive proof assistant enjoying a trustworthy kernel. The (functional) language of Coq is a very expressive $\lambda$-calculus: the Calculus of Inductive Constructions (CIC) [7]. In this context, datatypes, objects, algorithms, theorems and proofs can be expressed in a unified way, as terms. The reader will find in [4] a very comprehensive overview and good practices with reference to Coq. Developing a proof in a proof assistant may nonetheless be tedious, or require expertise from the user. To make this task easier, we are actively developing (under the name Pactole) a formal model, as well as lemmas and theorems, to specify and certify results about networks of autonomous mobile robots. It is designed to be robust and flexible enough to express most of the variety of assumptions in robots network, for example with reference to the considered space: discrete or continuous, bounded or unbounded... We do not expect the reader to be an expert in Coq but of course the specification of a model for mobile robots in Coq requires some knowledge of the proof assistant. We want to stress that the framework eases the developer’s task. The notations and definitions we give hereafter should be simply read as typed functional expressions. The formal model we rely on, as introduced in [2], exceeds our needs as in particular it includes Byzantine robots, which are irrelevant in the present work. The reader is invited to check that the actual code is almost identical. 4.1 The Formal Model The Pactole model\(^2\) has been sketched in [2, 8] to which we refer for further details; we recall here its main characteristics. We use two important features of COQ: a formalism of higher-order to quantify over programs, demons, etc., and the possibility to define inductive and coinductive types [17] to express inductive and coinductive datatypes and properties. Coinductive types are in particular of invaluable help to express infinite behaviours, infinite datatypes and properties on them, as we shall see with demons. Robots are anonymous, however we need to identify some of them in the proofs. Thus, we consider given a finite set of identifiers, isomorphic to a segment of \( \mathbb{N} \). We hereafter omit this set \( \mathcal{G} \) unless it is necessary to characterise the number of robots. Robots are distributed in space, at places called locations. We call a configuration a function from a set of identifiers to the space of locations. The set of locations we consider here is the real line \( \mathbb{R} \). Note that from that definition, there is information about identifiers contained in configurations, in particular, equality between configurations does not simply boil down to the equality of the multisets of inhabited locations. Now if we are under the assumption that robots are anonymous and indistinguishable, we have to make sure that those identifiers are not used by the embedded algorithm. **Spectrum.** The computation of any robot’s target location is based on the perception they get from their environment, that is, in an SSYNC execution scheme, from a configuration. The result of this observation may be more or less accurate, depending on sensors’ capabilities. A robot’s perception of a configuration is called a spectrum. To allow for different assumptions to be studied, we leave abstract the type spectrum \((\text{Spect.t})\) and the notion of spectrum of a position. Robograms will then output a location when given a spectrum (instead of a configuration), thus guarantying that assumptions over sensors are fulfilled. For instance, the spectrum for anonymous robots with weak global multiplicity detection could be a set of inhabited locations, i.e., without any multiplicity information. In a strong global multiplicity setting, a multiset of inhabited locations is a suitable spectrum; that is what we use in this work. In the following we will distinguish a demon configuration (resp. spectrum), that is expressed in the global frame of reference, from a robot configuration (resp. spectrum), that is expressed in the robot’s own frame of reference. At each step of the distributed protocol (see definition of round below) the demon configuration and spectrum are transformed (i.e., recentered, rotated and scaled) into the considered robots ones before being given as parameters to robograms. Depending on assumptions, the zoom and rotation factors may be fixed for each robot or chosen by the demon at each step. They may also be shared by all robots or not, etc. **Robogram.** Robograms may be naturally defined in a completely abstract manner, without any concrete code, in our COQ model as follows. They consist of an actual algorithm \( \text{pgm} \) that takes \(^2\)Available at [http://pactole.lri.fr](http://pactole.lri.fr) a spectrum as input and returns a location, and a compatibility property \texttt{pgm\_compat} stating that target locations are the same if equivalent spectra are given (for some equivalence on spectra). \textbf{Record} \texttt{robogram} ::= { \texttt{pgm} :> \texttt{Spect.t \rightarrow Location.t}; \texttt{pgm\_compat} : \texttt{Proper (Spect.eq \Rightarrow Location.eq) pgm}. } Of course it is possible to instantiate the robogram by giving a concrete definition of the program, and proving that the compatibility property holds. In our case, the type of locations is \texttt{R.t} (from the \texttt{COQ} library on axiomatic reals) and the program as described in Section 3.1 is: \textbf{Definition} \texttt{robogram\_pgm} (s: \texttt{Spect.t}) : \texttt{R.t} := \begin{verbatim} match Spect.support (Smax s) with (* Locations of max multiplicity *) | nil ⇒ 0 (* Only happens if no robot *) if beg\_nat (length (Spect.support s)) 3 then List.nth 1 (sort (Spect.support s)) 0 (* Phase 2: between*) else if is\_extremal 0 s then 0 (* ... stay... *) else extreme\_center s (* Phase 3: center *) end. \end{verbatim} Note that this is almost exactly an ML code. The resulting instantiated robogram is defined under the name \texttt{gathering\_robogram}. 4.2 Formalising Key Points and the Main Theorem The key steps of our proof can be expressed as relatively straightforward statements. Theorem \texttt{same\_destination} states that two robots \texttt{id\_1} and \texttt{id\_2} that are in the set of moving robots (i.e., the destination of which is not their current location) compute the same destination location (in the demons’s frame of reference). \textbf{Theorem} \texttt{same\_destination} : \forall da config id1 id2, \texttt{In id1 (moving gathering\_robogram da config)} \rightarrow \texttt{In id2 (moving gathering\_robogram da config)} \rightarrow \texttt{round gathering\_robogram da config id1 =} \texttt{round gathering\_robogram da config id2}. By case on the phases of the robogram, and on the structure of the provided code. The formal proof is about 30 lines of \texttt{COQ} long. \textbf{Theorem} \texttt{never\_forbidden} says that for all demonic action \texttt{da} and configuration \texttt{conf}, if \texttt{conf} is not bivalent, then the configuration resulting from \texttt{conf} after the round defined by \texttt{da} and our robogram is not bivalent. \textbf{Theorem} \texttt{never\_forbidden} : \forall da conf, \neg forbidden conf \rightarrow \neg forbidden (round gathering\_robogram da conf). Proof is done by a case analysis on the set of towers of maximum height at the beginning. If there is none, this is absurd; if there is exactly one, the resulting configuration will have the same highest tower, a legal configuration. Now if there are at least two highest towers, then if the resulting configuration is bivalent, at least one robot has moved (otherwise the original configuration would be bivalent, to the contrary of what is assumed), and all robots that move go to the same of the resulting two towers. The rest is arithmetics, as described on page 7. The proof of this key point is less than 100 lines of CoQ script. It remains to state that for all demonic action $da$ and configuration $conf$, if $conf$ is not bivalent, and if there is at least one robot moving, then the configuration resulting from the round defined by $da$ and our robogram on $conf$ is smaller than $conf$. The ordering relation on configurations, called $lt_conf$, being the one described in section 3.2. This is directly translated into the following theorem. **Theorem** round_lt_conf : $\forall da \\text{conf}$, $\neg \text{forbidden } conf \rightarrow \text{moving gathering_robogram } da \ \text{conf} \neq \text{nil}$ $\rightarrow lt_conf (\text{round robogram } da \ \text{conf}) \ \text{conf}$. A general description on how to characterise a solution to the problem of gathering has been given in [8]. We specialise this definition here to take into account that an initial configuration is not bivalent. This is straightforward: any robogram $r$ is a solution w.r.t. a demon $d$ if for all configuration $conf$ that is not bivalent, there is a point $pt$ to which all robots will eventually gather (and stay) in the execution defined by $r$ and $d$, and starting from $conf$. **Definition** solGathering (r : robogram) (d : demon) := $\forall conf, \neg \text{forbidden } conf \rightarrow \exists pt : R, \text{WillGather } pt (\text{execute } r \ d \ \text{conf})$. The theorem stating the correctness of our robogram is then simply: for all demon $d$ that is fair, gathering_robogram is a solution with reference to $d$. **Theorem** Gathering_in_R : $\forall d, \text{Fair } d \rightarrow \text{solGathering gathering_robogram } d$. The proof is led by well-founded induction on the $lt_conf$ relation. If all robots are gathered, then it is done. If not, by fairness some robots will have to move, thus a robot will be amongst the first to move. (Formally, this is an induction using fairness.) We conclude by using the induction hypothesis (of our well-founded induction) as this round decreases the measure on configurations (theorem round_lt_conf). This proof of the main theorem is interestingly small as it is only about 20 lines of CoQ. The whole file dedicated to specification and certification of our algorithm (RDVinR.v) is about 2300 lines long. It includes 460 lines of definitions, specification and intermediate lemmas, and approximately 1460 lines of actual proof. ## 5 Perspectives We proposed a new algorithm to gather anonymous and oblivious robots on a continuous unbounded space: the real line $\mathbb{R}$, without relying on a shared orientation or chirality, and allowing for any initial configuration that is not bivalent. This protocol is certified correct for any positive number of robots (more than 2) using our actively developed CoQ framework for networks of mobile robots, which is publicly available to the research community. A next step would be to add more dimensions to the considered Euclidian space, first by considering gathering in $\mathbb{R}^2$. As the framework is highly parametric, specifying another space in which robots move is not a dramatic change: the type of locations is a parameter, it is left abstract throughout the majority of the formalism, in which a concrete instance is not needed. Another interesting evolution would be to take into account the more general ASYNC model, that is when Look-Compute-Move cycles and phases are not atomic anymore. Describing behaviours that are ASYNC in Coq may nonetheless add to the intricacy of formal proofs, and relevant libraries to ease the task of the developer will have to be provided accordingly. References
{"Source-Url": "https://hal.sorbonne-universite.fr/hal-01159890/file/hal.pdf", "len_cl100k_base": 7585, "olmocr-version": "0.1.53", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 36241, "total-output-tokens": 9714, "length": "2e12", "weborganizer": {"__label__adult": 0.0005507469177246094, "__label__art_design": 0.0006365776062011719, "__label__crime_law": 0.0009069442749023438, "__label__education_jobs": 0.0008106231689453125, "__label__entertainment": 0.0001933574676513672, "__label__fashion_beauty": 0.00028252601623535156, "__label__finance_business": 0.0004048347473144531, "__label__food_dining": 0.0006241798400878906, "__label__games": 0.001590728759765625, "__label__hardware": 0.0024318695068359375, "__label__health": 0.0013675689697265625, "__label__history": 0.0005898475646972656, "__label__home_hobbies": 0.0002841949462890625, "__label__industrial": 0.001049041748046875, "__label__literature": 0.0006513595581054688, "__label__politics": 0.000576019287109375, "__label__religion": 0.0006756782531738281, "__label__science_tech": 0.4384765625, "__label__social_life": 0.00017249584197998047, "__label__software": 0.00823211669921875, "__label__software_dev": 0.537109375, "__label__sports_fitness": 0.0005574226379394531, "__label__transportation": 0.0014438629150390625, "__label__travel": 0.00028014183044433594}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 37267, 0.02598]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 37267, 0.45983]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 37267, 0.89296]], "google_gemma-3-12b-it_contains_pii": [[0, 1147, false], [1147, 3138, null], [3138, 6931, null], [6931, 10351, null], [10351, 13351, null], [13351, 16128, null], [16128, 17139, null], [17139, 20252, null], [20252, 22962, null], [22962, 26283, null], [26283, 29145, null], [29145, 32344, null], [32344, 33086, null], [33086, 35729, null], [35729, 37267, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1147, true], [1147, 3138, null], [3138, 6931, null], [6931, 10351, null], [10351, 13351, null], [13351, 16128, null], [16128, 17139, null], [17139, 20252, null], [20252, 22962, null], [22962, 26283, null], [26283, 29145, null], [29145, 32344, null], [32344, 33086, null], [33086, 35729, null], [35729, 37267, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 37267, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 37267, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 37267, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 37267, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 37267, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 37267, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 37267, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 37267, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 37267, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 37267, null]], "pdf_page_numbers": [[0, 1147, 1], [1147, 3138, 2], [3138, 6931, 3], [6931, 10351, 4], [10351, 13351, 5], [13351, 16128, 6], [16128, 17139, 7], [17139, 20252, 8], [20252, 22962, 9], [22962, 26283, 10], [26283, 29145, 11], [29145, 32344, 12], [32344, 33086, 13], [33086, 35729, 14], [35729, 37267, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 37267, 0.0]]}
olmocr_science_pdfs
2024-12-09
2024-12-09
10811957489d89dc6d807c9caa3c3a836266c6f9
Advanced Protected Services A Concept Paper on Survivable Service-Oriented Systems Partha Pal, Michael Atighetchi, Joseph Loyall, Andrew Gronosky Information and Knowledge Technologies Unit Raytheon BBN Technologies Cambridge, USA {ppal,matighet,jloyall,agronosk}@xyz.com Charles Payne Cyber Security Group Adventium Laboratories Minneapolis, USA charles.payne@adventiumlabs.org Robert Hillman Information Directorate Air Force Research Laboratory Rome, USA robert.hillman@rl.af.mil Abstract— As newer software construction paradigms like service-oriented architecture (SOA) are adopted into systems of critical importance, it becomes imperative that technology and design artifacts exist that can be utilized to raise the resiliency and protection of such systems to a level where they can withstand sustained attacks from well-motivated adversaries. In this paper we describe a sampling of innovative services and mechanisms that are designed for the protection of systems that are based on service-oriented architectures. Keywords—survivability, service-oriented architecture I. INTRODUCTION The technology landscape of engineering distributed and networked software-based systems has evolved from socket-based network programming to distributed objects and components to web services and service-oriented architectures (SOA). The increased demand on computer-based systems to perform sophisticated tasks and to deploy new functionality quickly, both in civilian, such as the financial and manufacturing sectors, and military domains, is forcing system developers to migrate existing systems and new developments to SOA. At the same time, computer-based systems have become attractive targets of adversaries who aim to benefit by subverting or disrupting the operation of such systems. As a result, there is a need for survivable service-oriented systems—systems that not only tolerate accidental failures, but also continue to deliver an acceptable level of service despite being under attack. In some cases, e.g., critical infrastructure or military systems, systems need to be “ultra-reliable” and it is possible to draw upon additional resources as needed. In other cases, however, resources such as CPU, bandwidth, or the ability to add additional hardware may be limited. In most cases, critical systems have specified timeliness requirements covering various degrees of real time behavior. Defense against malicious adversaries is an inherently hard problem. An adversary needs to find only one flaw in a system to exploit, whereas the defense needs to identify and address as many as possible. Specific characteristics of SOA approaches add to the challenge, including their dynamism, loose-coupling, and novel messaging and interaction patterns. Moreover, current SOA environments lack the level of sophistication in protection, detection, and adaptation capabilities needed to survive against motivated, well-resourced, and determined adversaries. As a result, current service-oriented systems are at significant risk of corruption, loss of service, and maliciously initiated leakage of information. To live up to their promised potential, future service-oriented systems will need to survive sustained attacks by sophisticated and well-motivated adversaries, something that is not achievable by the way available security solutions are currently applied to systems and networks. We argue that advanced protection—a synergistic combination of protection, detection, and adaptation capabilities, complemented by the infusion of validated design principles such as defense-in-depth, single point of failure avoidance, containment and isolation—needs to be incorporated into the service-oriented architecture. Furthermore, novel techniques such as automatic generation of configurations and policies from high-level specifications are needed to address the additional risks and vulnerabilities introduced by service-oriented method of system construction. Toward that end, we have started to develop the necessary technical underpinnings required to make service- As newer software construction paradigms like service-oriented architecture (SOA) are adopted into systems of critical importance, it becomes imperative that technology and design artifacts exist that can be utilized to raise the resiliency and protection of such systems to a level where they can withstand sustained attacks from well-motivated adversaries. In this paper we describe a sampling of innovative services and mechanisms that are designed for the protection of systems that are based on service-oriented architectures. oriented information systems more robust and resilient against malicious attacks, and to demonstrate the utility of the developed advanced protection techniques in settings that exhibit various threat patterns, resource footprints, and performance requirements (e.g., tactical and tactical edge connected to an enterprise in the military context, or thin and thick clients interacting over various public and private networks in a civilian context). In this paper we describe a selected subset of the key concepts underlying the survivability of service-oriented systems. The main contribution of the paper is the introduction of advanced survivability concepts into the evolving SOA area. In addition to fostering the dialog between SOA and security researchers over the innovative concepts outlined in this paper, we expect practitioners in the field to benefit by incorporating some of these features into the design and implementation of their systems. The rest of the paper is organized as follows. In Section II we describe the innovative concepts that we introduce to enable advanced protection in SOA systems. In Section III we describe related work. Section IV concludes the paper. II. CONCEPTS FOR ADVANCED PROTECTION IN SOA We argue that in order to achieve the desired level of survivability in the context of a given service-oriented system and its operating environment, one needs a strategic combination of the following: - **Architecture Enhancements:** Modification of the original organization and interaction pattern of the given system to introduce isolation, containment, redundancy and to enable adaptive behavior. - **Innovative Defense Mechanisms:** Insertion of security and adaptive technologies that did not originally exist in the system. - **Support for Safe and Secure Composition:** Ensuring that systems created by composing architectural elements and supporting defense mechanisms are safe, properly configured and do not introduce residual vulnerabilities. In this section, we describe representative examples of concepts being developed in each of the above categories that are general enough to have wider applicability in service-oriented settings, irrespective of the specific application or service-oriented platform. A. Architecture Enhancements Current SOA-based systems strongly emphasize architectural features that promote reuse through encapsulation and flexibility through composition. The service-oriented community has also adopted a number of security principles, e.g., separation of concerns between policy decision and enforcement [1] through policy decision points (PDPs) and policy enforcement points (PEPs), multi-layer security through WS-Security and traditional demilitarized zones (DMZs), and clustering of application servers. If realized correctly and backed up by reliable implementations of underlying security mechanisms, these principles add to the protection of systems, but each one provides only a point capability and rests on a set of strong environmental assumptions about available resources and attacker sophistication. A survivable service must not make strong assumptions about the environment in which it will operate. Otherwise, an adversary will be able to easily manipulate the environment to violate key assumptions and cause unintended service behavior. For example, a system orchestrated as a workflow of sequential synchronous service invocations might have an implicit assumption about request-response delays. A denial of service attack or a partial failure at some point in the service invocation path can easily violate this timeliness assumption, causing the workflow to complete too late and therefore making results unavailable. The following paragraphs describe several ways SOAs can be enhanced to significantly increase protection and tolerance over current state of the art. A single instantiation of a service (and its service container) is a single point of failure (SPOF). Redundancy is traditionally used to mitigate SPOFs and provide load balancing. In addition, advanced redundancy-based protocols such as Byzantine Fault Tolerance [2] have been used to detect and tolerate process corruption. However, simple redundancy is susceptible to common mode failures and easily subverted by malicious adversaries. Dynamic replenishment of redundancy and use of diversity along with redundancy (see Fig. 1a and Fig. 1b) are ways to mitigate that threat. Dynamic redundancy and diversity are necessary but not sufficient to achieve a high level of survivability. Unlike traditional client-server systems, service consumers across the network do not directly connect to the service instances or replicas but rather to a service broker via an access point or a portal. Although it is common practice for SOA platform components to intercept the service requests for routing and access control purposes in a DMZ, they generally do not inspect and validate request or response payloads, thus leaving the system vulnerable to injection attacks. Furthermore, portals and service brokers do not provide application-level policies for expressing rate and size limits, thereby leaving the system open to denial of service attacks. Furthermore, SOA features like service orchestration introduce dependencies on critical services such as the discovery service, persistence service or the BPEL execution service, which become SPOFs that the designers and developers of services may not realize. Addressing these threats will require the insertion of specific resources and capabilities to absorb the initial blow of a sophisticated attack (see the diverse and redundant “crumple zone” between the network and the services in Fig. 1c). Simplistic replenishment of redundancy in the context of service replicas or in the crumple zone is easily overcome by an intelligent and motivated adversary by observing and predicting where the next service replica will be started. To counter that threat, support for adaptive behavior that is unpredictable to the attacker needs to be added to the service-oriented architecture. Finally, access rights of authenticated users need to be constrained at multiple levels to provide effective defense in depth. Otherwise, an adversary can escalate his privilege and spread attacks throughout the system after gaining an initial entry. SOA provides a level of modularity and plug and play, but in most cases service instantiation and platform implementations are not designed with containment in mind. An entire SOA platform or a key platform component like the JBoss Enterprise Service Bus (ESB) can run as a single Java virtual machine (JVM) process or with similar privileges in a single network partition, making it easy for an adversary to spread attacks between components. Similarly data and control channels can be indiscriminately mapped to the same network, leading to situations where attacks on the data channel affect the control channel as well. For these reasons, it is important that a survivable service-oriented system incorporates containment mechanisms by design. Containment regions create artificial barriers within a system to limit privilege escalation and as shown conceptually in Fig. 1d, limit the spread of attack effects between processes, hosts, and network segments. On the basis of the previous discussion, let us turn our focus toward three specific new survivability constructs: - **Service conglomerates** that eliminate single points of failure, - **Containment regions** that limit the spread of attacks, and - **Crumple zones** that strategically combine redundancy with diversity, and interject a defensive layer between two interacting parties. All three architectural enhancements are based on proven design principles and described in an abstract and vendor neutral manner, and hence generally applicable. Of these three, we describe the crumple zone in more detail because it serves as the integration point of the other concepts. A **service conglomerate** creates and maintains a set of service instances, some of which may be redundant and possibly diverse variants of one individual service that cooperate closely to defend against a specific threat such as a SPOF or corruption of a high-value service. A **containment region** creates artificial boundaries that are difficult for an adversary to cross both in terms of time, i.e., expiring unauthorized access after a period of time, and space, i.e., access/compromise in one part or layer of the system will not mean ready access/compromise of other parts and layers of the system. A **crumple zone** sets up multi-layer intermediaries in the service request-response path that bridges different trust and threat levels, and either stops a class of attacks or provides early warnings of trouble before protected services are affected. The crumple zone uses containment regions and service conglomerates to strengthen the survivability of the outermost interaction surface between clients and services. Fig. 2 displays a more detailed view of the crumple zone previously shown in Fig. 1c. It shows how the crumple zone is inserted into the interaction pattern between clients at the bottom and services at the top. Proxies contain logic for validating user input, checking attack signatures, and triggering attack effects. To tolerate those effects, the proxies need to be lightweight and easy to restart. To contain attack effects, proxies are designed to maintain as little state as possible and placed into containment regions, shown as parallelograms. The crumple zone supports layering of proxies along two axes: horizontal layering, as shown by XML Proxy 1 and XML Proxy 2, provides SPOF elimination through strategic use of redundancy and diversity by having certain proxy functionality, such as XML schema validation, implemented on different implementation substrates, e.g., programming languages and parsers. Vertical layering provides defense in depth by defining proxy chains as a set of functionally different proxy components. For instance, the two proxy service conglomerates shown in Fig. 2 combine XML checking with application-level constraint checking on publication messages sent to a Pub service through the Pub Proxy component. Proper functioning of the crumple zone requires a management and control framework as shown by the backend management service communicating with the crumple zone components to monitor and control proxies through a reverse proxy called the Admin Proxy. The management service contains logic for detecting crashes and corruption of crumple zone components and adaptive response to restart components and initiate dynamic policy reconfigurations, thereby managing the adaptive behavior of the crumple zone. Various design tradeoffs exist when implementing a crumple zone for a given SOA-based system. We need to relate the amount of redundancy, and diversity, together with the layering depth, to the cost of computing resources and performance overhead. We have started documenting the assumptions, capabilities, and tradeoffs in terms of cost-benefit-risk as part of our methodology for creating survivable designs, which can be used by practitioners to strengthen the survivability of their systems. We expect to use a combination of logical argument construction, formal methods, and experimentation to validate the claims and benefits of these architectural enhancements. We are investigating the use of domain-specific languages, e.g., Lobster [3], and micro process languages, e.g., Little JIL [4]. B. Novel Defense Mechanisms The state of the art in SOA security includes mechanisms and services for establishing trusted communication over untrusted networks, e.g., using TLS and WS-Security, policy-based authentication and authorization of services and clients, e.g., using X.509 certificates [5] and XACML[1], and hardened appliances for message checking, e.g., Layer 7 XML gateways [6]. While useful as building blocks, these capabilities are not sufficient to support the architectural survivability concepts described in the previous section. New multi-function defensive mechanisms needed to support the crumple zone concept include proxies that provide protection against Java serialization attacks [7] and can perform anomaly detection capabilities to detect an unexpected increase in rate or size of application-level messages. Furthermore, management of point-to-point SSL [8] connections becomes an issue when dealing with complex interaction patterns spanning many services in a service conglomerate while trying to support end-to-end message integrity across multiple service to service interactions. This section describes two novel defense mechanisms we are investigating in more detail, namely advanced proxy services and service-layer Virtual Private Groups. Advanced Proxies: Proxy services are becoming more available as part of SOA platforms, for example, AquaLogic [9] includes proxies for services that connect to its ESB. Our envisioned proxies go beyond those of other SOA platforms in that they also contain capabilities to detect and protect against service flood and other injection based attacks. Fig. 3 illustrates the envisioned proxy services. Fig. 3 (a) shows an XML proxy, which interprets the service requests and responses at the level of XML messages and applies signature-based checks as well as size- and rate-based checks. Fig. 3 (b) shows the proxy interpreting the service requests and responses up to the application level and then applying signature and anomaly based checking. Service Layer Virtual Private Groups (slVPGs): The infusion of architecture enhancements and innovative defense mechanisms described here challenges system self-protection. Service conglomerates and the crumple zone, for example, inject new defenses into the communication path that must integrate seamlessly with existing defenses providing authentication, confidentiality, and integrity guarantees along that path. Not surprisingly, the existing defenses, which include SSL and WS-Security [10], were not designed to facilitate in-transit packet inspection and directly modifying their use to do so would have many drawbacks, including a higher attack exposure for the new defenses and more complex key management overall. For this reason, we explore the use of sIVPGs to guarantee authentication, confidentiality, and integrity between the client and the protected service. The sIVPG resembles existing defenses in operation but shares its cryptographic credentials transparently with authorized intermediaries like the crumple zone proxies. The sIVPG allows those proxies to peer into protected data streams without affecting the end-to-end guarantees on those streams. The sIVPG can also make the use of service conglomerates transparent to the client since all service instances share the same sIVPG credentials. The sIVPG relies on a protected and robust key distribution scheme, which we will integrate into our larger defense management strategy. System and component tests will include efforts to observe and circumvent sIVPG key sharing. We previously invoked VPGs at the network layer [11] and we observed many benefits from their use (see [12]). However, unlike that earlier incarnation, which relied on a closed, proprietary implementation and protocol [13], our implementation of sIVPGs will follow the practice described in [14], where we leveraged the features of robust, open source standards and technologies. The sIVPG will provide similar guarantees to existing defenses while facilitating the use of robust defenses for survivability. C. Support for Composition-Oriented Software Construction Service-orientation encourages decoupled development of functionality as services which then need to be composed together to perform organization-level tasks. For example, an order fulfillment system might be composed of services for order entry and payment validation. This composition-oriented method of software construction needs to integrate and interoperate with the advanced survivability features described earlier, many of which are implemented as services, and some (mostly the architectural enhancements) impose specific constraints on how services are allowed to interact with each other. The challenge is twofold: first, to integrate services, including defense services, in a way that does not inadvertently open new vulnerabilities; and second, to deploy services in a way that the combined resource footprint and run-time cost of business services and survivability services falls well within system requirements. Examples of how improper composition may undermine the protection and continued functioning of the system include: - A service that was behind a firewall becomes connected to other hosts on the unprotected network, creating a bypass around the firewall that attackers can exploit. - Authentication is only present on particular entry points into the system but not on others, opening up backdoors. - Incorporating authentication without encryption of data causes sensitive application data to be sent “in the clear”. A special case of this is composition of a distributed password authentication service without encryption, where passwords are sent or stored in plain text. - Byzantine fault tolerance requires several replicas and complex agreement protocols, which might push the request-response time to an unacceptable level. - Use of diversity to avoid common mode failures requires multiple operating systems and platforms. The organization now needs system administration expertise for all of these platforms and the increase in complexity might lead to misconfiguration of parts of the system. SOA developers and system integrators currently do not have much support for validating and checking their deployment configurations for errors and unsafe patterns. To address this issue, we are exploring the following innovative concepts: - **Safe and Unsafe Composition Patterns**: Define tell-tale characteristics of inherently unsafe compositions. - **Characterization of Defense Mechanisms and Services Using Metadata**: Empirically determine metadata capturing resource footprint and performance overhead and associate them with the defense mechanisms and services in a secure way. - **Analysis and Automated Configuration Generation**: Analyze the configuration of a collection of configurable elements in a SOA system to look for consistency or unsafe patterns and generate consistent configuration from high level specifications. In the following paragraphs we briefly summarize the basic ideas and resulting benefits for each of these concepts. In the **safe and unsafe composition patterns** thrust, the idea is to construct and study a number of composition use cases and identify patterns that are inherently unsafe and should be avoided. With a catalog of “unsafe” composition patterns, SOA designers and integrators should at least be able to identify and eliminate them from their designs and systems, thereby achieving a basic level of protection. By **characterizing of defense mechanisms and services using metadata**, we are making the “contract” between the defense provider, i.e., the defense mechanisms and services, and the consumer, i.e., the system which integrates the defense, more explicitly aware of the resource requirement and performance overhead. With such metadata attached to the defense mechanisms and security services, it is conceivable that a pre-deployment time tool will analyze the intended service descriptor and configuration settings of the relevant elements in the target SOA container, and present an estimate of whether any resource or performance requirements are at risk. In analysis and automated configuration generation, we are leveraging prior work [12] [14] to generate a consistent set of configurations based on a high-level specification such as conversations. A conversation describes authorizations for a set of consumers to engage in specific service interactions. In this context we use the term “authorizing” in a general sense to include authentication as the basis to authorize entities, and additional protection requirements such as confidentiality on the authorized interactions. Each conversation clarifies the desired permissible relationships between the named consumers and providers with regard to named services. A survivable SOA system will need to integrate multiple defense mechanisms and security services, each of which will have their own set of configurable parameters. It has been argued that incorrect configurations account for a large proportion of security vulnerabilities today. Automated configuration generation and checking for predefined safety and consistency properties is a decisive step in addressing this problem. III. RELATED WORK Research in survivability and intrusion tolerance, ongoing work in standardizing SOA security, and best-of-breed security available in the SOA market place are all relevant for the work described in this paper. In the commercial space of SOA security products, related work includes hardened security appliances, like the Layer7 XML space of SOA security products, related work includes hardened security appliances, like the Layer7 XML appliance [6] and F5 BIG-IP ASM [15] as well as endpoint security monitoring systems, e.g., Cisco CSA [16]. Commercial products started supporting a number of OASIS security standards, in particular WS-Security [10] and related subparts such as SAML [17], XML Signature [18], and XML Encryption [19]. Many researchers exploring adaptive cyber defense, including the authors, have also developed special purpose architectures and supporting mechanisms for intrusion detection and response, intrusion tolerance, and graceful degradation. Many of the design principles and defense mechanisms underlying the advanced survivability concepts described in this paper have been validated through multiple rounds of R&D and evaluation. We summarize a few of these precursor efforts. The ITUA [20] project developed technology and system design techniques for building information systems that will tolerate, i.e., continue to function without violating program and data integrity, a specific class of attacks, namely, the attacks that introduce corruption in communication and application level interaction in distributed object applications. In addition to corruption tolerant algorithms, ITUA developed architecture for managing distributed object replicas and the hosts on which they run. The Willow architecture [21] achieves intrusion tolerance using a combination of disabling of vulnerable network elements when a threat is detected or predicted, replacing failed system elements, and reconfiguring the system if non-maskable damage occurs. Willow uses its own event-notification service as the control mechanism of its scalable architecture. Dependable Intrusion Tolerance (DIT) [22] comprises functionally redundant HTTP commercial off the shelf servers. These servers run on diverse operating systems and platforms, use hardened intrusion-tolerant proxies that mediate client requests and verify the behavior of server and other proxies, and include monitoring and alert-management components based on the EMERALD Intrusion Detection System. The system adapts its configuration dynamically in response to intrusions and other faults. Malicious and Accidental Fault Tolerance for Internet Applications (MAFTIA) [23] is a European project developing an open architecture for transactional operations on the Internet. MAFTIA models a successful attack on a security domain, leading to corruption of processes in that domain, as a fault; the architecture then exploits approaches to fault tolerance that apply regardless of whether the faults are due to accidents or malicious acts. MAFTIA is explicitly middleware-based and provides both protection from and tolerance of intrusions. The Saber [24] system uses several mechanisms including intrusion detection, automatic code patching, process migration, and filtering of distributed denial-of-service floods for defense, but focuses primarily on server availability. As part of the DARPA OASIS Dem/Val program and BBN’s DPASA project [11], we designed and evaluated a high watermark survivability architecture that provides strong guarantees for attack tolerance and survival, intrusion detection, and situational awareness. The goal of the CSISM project [25] was to develop automated reasoning mechanisms that when incorporated in the survivability architecture will minimize the role of human experts and pave the way for truly self-regenerative survivable systems. CSISM implemented multi-layer reasoning, with fast reaction rules designed to take effective defensive actions within 250 ms of attack initiation, and a more deliberate cognitive reasoning process based on interpretation and hypothesis generation, response selection, and learning to take system wide defense actions. IV. CONCLUSION Securing critical service-oriented systems is an elusive goal as it requires eliminating every vulnerability, known and unknown, past, present, and future. Determined adversaries only need to find a single vulnerability to successfully exploit, meaning that the odds are stacked in their favor. We suggest a focus on building systems that are survivable instead, using technologies that combine protection, detection, and adaptation capabilities. The wide range of application and network contexts in which service-oriented systems are expected to be deployed implies that there is no one single architecture or configuration to achieve survivability. Designing a survivable system is necessarily a careful balance between requirements, capital and operating expense of the added security measures and the perceived benefits determined based on imperfect and often subjective evaluation of security, and its effect on other requirements such as performance and system size. The advanced protection concepts we described in this paper work with, utilize, and augment existing security standards and protection mechanisms, and are designed to be tailored for specific contexts. In addition to providing key architectural and protection concepts, it is important to characterize the cost and benefit of the architectural constructs, security services and defense mechanisms so that designers can make informed choices about including them in their systems. The major contribution of the work described here is the formulation of advanced protection concepts and a methodology to apply them to service-oriented systems. We expect that the concepts, the methodology, and instantiation and validated use cases of a representative sample of the technologies described in this paper in the form of a survivable service-oriented system will provide a foundational basis for engineering dependable service-oriented systems. ACKNOWLEDGMENT This material is based upon work supported by the Air Force Research Laboratory under Contract No. FA8750-09-C-0216. 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 AFRL. The authors wish to thank the other APS team members including Jon Webb and Matt Gillen at BBN, and Dick O’Brien and John Ghode at Adventium. REFERENCES Advanced Protected Services A Concept Paper on Survivable Service Oriented Systems Presented by Aaron Adler Partha Pal, Michael Atighetchi, Joseph Loyall, Andrew Gronosky, Charles Payne, Robert Hillman This work is supported by the US Air Force Research Laboratory Outline • Distributed System Technology Landscape • Survivable Systems • APS Concepts • Achievements So Far • Next Steps and Conclusion Evolving Technology Landscape - More functionality pushed down to the "platform" making it more complex to configure and manage - Various interaction paradigms Sockets—transporting bytes SOA Loosely coupled interaction with container deployed services Location and implementation transparent distributed objects Request-Response Message/Queues Eventing/Pub-Sub Streaming/Complex Event Processing Increasing Role of Information Systems Distributed and Networked Information Systems are increasingly intertwined with military operation as well as civilian life. Unfortunately attacks are on the rise as well. Determined and motivated actors– the Estonia incident, attacks on Israeli systems. Other publicly known instances such as the attacks on DoD systems and defense contractor sites, attacks on Google, recent auction of facebook account information (Kirllos, $45 per 1000 accounts). SOA Background Service Oriented Architecture (SOA) facilitates loosely coupled interaction and composition oriented system construction. In a typical SOA offering: - Service Containers – possibly different kinds - Containers running on virtual machines - The term “Service Consumers” indicates that they do not offer services to others – deployed services can consume services provided by other deployed or infrastructure services - Different means of packaging functionality/computation as services such as EJB, Servlets, POJO under WS stack… - Different ways to access the services e.g., RMI, HTTP/S… - SOA services may depend on non-SOA back end systems Many modern information systems, including military systems are migrating to SOA to take advantage of easier enabling of new capabilities and interoperation. ### State of the Practice <table> <thead> <tr> <th>State of the Practice</th> <th>Limitations</th> </tr> </thead> <tbody> <tr> <td>Network &amp; Transport Layer Security (e.g., IPSec, TLS)</td> <td>Protects network only, ineffective against compromised process or host</td> </tr> <tr> <td>Application Layer Security (e.g., DMZs, App Firewalls)</td> <td>Signature based, static configuration and lack of diversity</td> </tr> <tr> <td>Service Infrastructure and Platform Security (e.g., WSS)</td> <td>Too many standards; a protocol construction kit rather than a solution</td> </tr> </tbody> </table> ### Key Security Concerns - Usual measures such as Authentication, Access Control, Encryption and Message Signing are not enough for “Fighting Through” attacks from a determined adversary - Need to continue to provide service to legitimate consumers - Need to contain the attack effects - Need to recover (from failures), reconnect (lost connections), regain (lost defenses) - Tall stacks, complex and large code base – hard to construct an overarching assurance argument using the entire platform as a Trusted Computing Base (TCB) - Need to focus on slices, and possibly a root of trust outside the stack Advanced Protected Services Need to improve the survivability and protection of next generation service-oriented architectures and systems and applications built using SOA Current high-water mark in survivable system: OASIS Dem/Val - Survived 75% of attacks, even when the attacker was given insider access and privilege (red team would actually start the system, after placing attack code) - A number of survivability design principles that go beyond “defense in depth” - Single Point of Failure (SPOF) elimination, redundancy and diversity, containment, hardware or cryptographic root of trust, Crumple zones (many appear in the recent SANS/MITRE Common Weakness Enumeration, CWE) - Availability is still the easiest target, and flaws in COTS components still the major risk (and a fact of life) OASIS Dem/Val demonstration was not service-oriented. APS aims to achieve similar levels of resiliency with SOA Key Ideas – Extend SOA concepts and design techniques to include elements that facilitate survivable design • Specifically focused on “tolerance” or “survival” • Strategic concepts like containment and adaptive behavior – Develop mechanisms, protocols, and supporting services to realize the architecture enhancements – Develop an environment, and techniques and composition patterns enabling context-specific customization • Survivability cost and benefit balanced against the threats and footprint requirements of the deployment environment Show incremental progress by periodic demonstrations and metrics evaluations, culminating in a red team exercise at the end Architecting for Survivability “key asset” Introduce redundancy Introduce diversity Introduce physical barriers using DMZ SPOF? diversity? accessibility of 4 replicas? applications accessing the key asset over the network 4 replicas are still accessible run same attack 4 times? Key APS Architectural Concepts Containment Regions limit the spread of attacks Crumple Zones absorb the effects of attacks Network includes Application Proxies Process (JVMs, AS Containers) Host (may be virtual) Network Conglomerates for managed redundancy and collaboration Redundant and collaborating services Focusing on Crumple Zone Different Deployment Options Protecting the Provider Domain Protecting the Consumer Domain Protecting both Domains Including inter-client interactions Crumple Zone: The Concept Notional depiction of crumple zone Filtering and checking at various layers • Application level (mechanism specific) • Network level Maximizing end to end integrity, confidentiality and access control while allowing filtering and checking: sIVPG Self protection: authentication and access control of control and data within crumple zone Self management: watchdogs, restarts Other APS Concepts at Play in CZ Containment in CZ SPA Need to protect corruption across streams and functions Adaptive response in CZ Unavailability of key functions may render the protected services unavailable Need redundancy, watchdog, restart at various levels and diversity in key CZ functions CZ as a conglomerate Multiple functions, some redundant, cooperate to provide the protected service. Svc1 Consumer$_1$ Svc1 Consumer$_2$ Svc1 Consumer$_n$ Some are shared by conglomerates. Deployed Svc$_{1,2}$ Visible SVC1 EP CZ MGMT One Realization (SSL, EJB) Service requester and provider SSL end point function Key sharing function Escrow and decision function E2E integrity envelope is not all the way, but minimal key sharing and control - Split done within the message layer, i.e., RMI Easier handling of escrow and decision for both request and response Multiple possibilities for situating the escrow Different configurations have different assurance guarantees – all using the same basic building block functions... Mechanism in Support of CZ: sIVPG JSSWG Control Case E: SSL/TLS + XML Signature Inspection and Filtering in the Crumple Zone Without sIVPGs - Multiple connections imply new Proxy certificates and less flexible Proxy configuration With sIVPGs* (service level Virtual Private Groups) - In effect, the proxies are able to see the messages in clear text - Proxies do not require their own certificates * An abstract representation, does not show CZ details like message routing, escrow etc. Support for Safe Composition Without help for composition: • Expecting some defense to be a silver bullet, but leaving major vulnerabilities unprotected • Inadvertently introducing vulnerabilities during composition • Including defenses that provide little benefit at too great a cost – Define a set of operational use cases, identify the vulnerabilities and footprint, performance, and overhead constraints of the use case – Develop benefit/cost ratios for each protection technique and use case – Rank the techniques according to their benefit/cost ratio, taking into account the additional vulnerabilities and dependencies on other techniques – Define and enforce policies/contracts on the composition, using automated checkers – Define automated configuration generators from high level specifications of the composition patterns and characteristics of the use cases Achievements So Far - Assessment of ONR RI VMs - Reviewed a set of security community guidance documents - APS requirements - APS platform (baseline) - Survivability enhancements - Design, Implementation, Testing and Evaluation Ongoing Tasks Conclusion • Goal: engineering of survivable service-based systems – Robust and repeatable methodology – Catalog of building blocks with cost-benefit annotation – Best practices • Defending against a sophisticated adversary is difficult, critical information systems need to be more resilient under a wider range of hostile environments and contested situations • No protection is absolute, but with the right combination of sound engineering and innovative techniques, we can raise the bar pretty high – As demonstrated in OASIS Dem/Val • Work in progress, with good initial results – We just successfully demonstrated a version of the crumple zone
{"Source-Url": "https://apps.dtic.mil/dtic/tr/fulltext/u2/a556062.pdf", "len_cl100k_base": 7694, "olmocr-version": "0.1.53", "pdf-total-pages": 26, "total-fallback-pages": 0, "total-input-tokens": 55347, "total-output-tokens": 10194, "length": "2e12", "weborganizer": {"__label__adult": 0.00046706199645996094, "__label__art_design": 0.0008134841918945312, "__label__crime_law": 0.0016527175903320312, "__label__education_jobs": 0.0009098052978515624, "__label__entertainment": 0.00015401840209960938, "__label__fashion_beauty": 0.00021982192993164065, "__label__finance_business": 0.0006699562072753906, "__label__food_dining": 0.0003690719604492187, "__label__games": 0.0008335113525390625, "__label__hardware": 0.00238800048828125, "__label__health": 0.0008282661437988281, "__label__history": 0.0004200935363769531, "__label__home_hobbies": 0.00012576580047607422, "__label__industrial": 0.0008678436279296875, "__label__literature": 0.0004162788391113281, "__label__politics": 0.0004742145538330078, "__label__religion": 0.0005230903625488281, "__label__science_tech": 0.32177734375, "__label__social_life": 0.00012993812561035156, "__label__software": 0.0271453857421875, "__label__software_dev": 0.6376953125, "__label__sports_fitness": 0.0002665519714355469, "__label__transportation": 0.0006794929504394531, "__label__travel": 0.00020933151245117188}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 46143, 0.00967]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 46143, 0.26649]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 46143, 0.90672]], "google_gemma-3-12b-it_contains_pii": [[0, 4084, false], [4084, 4616, null], [4616, 10275, null], [10275, 13999, null], [13999, 18793, null], [18793, 24151, null], [24151, 29831, null], [29831, 34378, null], [34378, 36539, null], [36539, 36806, null], [36806, 36943, null], [36943, 37347, null], [37347, 37841, null], [37841, 38659, null], [38659, 40035, null], [40035, 40951, null], [40951, 41626, null], [41626, 42236, null], [42236, 42417, null], [42417, 42822, null], [42822, 43367, null], [43367, 43862, null], [43862, 44355, null], [44355, 45228, null], [45228, 45480, null], [45480, 46143, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4084, true], [4084, 4616, null], [4616, 10275, null], [10275, 13999, null], [13999, 18793, null], [18793, 24151, null], [24151, 29831, null], [29831, 34378, null], [34378, 36539, null], [36539, 36806, null], [36806, 36943, null], [36943, 37347, null], [37347, 37841, null], [37841, 38659, null], [38659, 40035, null], [40035, 40951, null], [40951, 41626, null], [41626, 42236, null], [42236, 42417, null], [42417, 42822, null], [42822, 43367, null], [43367, 43862, null], [43862, 44355, null], [44355, 45228, null], [45228, 45480, null], [45480, 46143, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 46143, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 46143, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 46143, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 46143, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 46143, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 46143, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 46143, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 46143, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 46143, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 46143, null]], "pdf_page_numbers": [[0, 4084, 1], [4084, 4616, 2], [4616, 10275, 3], [10275, 13999, 4], [13999, 18793, 5], [18793, 24151, 6], [24151, 29831, 7], [29831, 34378, 8], [34378, 36539, 9], [36539, 36806, 10], [36806, 36943, 11], [36943, 37347, 12], [37347, 37841, 13], [37841, 38659, 14], [38659, 40035, 15], [40035, 40951, 16], [40951, 41626, 17], [41626, 42236, 18], [42236, 42417, 19], [42417, 42822, 20], [42822, 43367, 21], [43367, 43862, 22], [43862, 44355, 23], [44355, 45228, 24], [45228, 45480, 25], [45480, 46143, 26]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 46143, 0.01767]]}
olmocr_science_pdfs
2024-12-10
2024-12-10
6814877133b8e418c4ef526462d6a0a6b232931f
A Model-Driven Approach to Generate Relevant and Realistic Datasets Adel Ferdjoukh, Eric Bourreau, Annie Chateau, Clémentine Nebut To cite this version: lirmm-01397311 HAL Id: lirmm-01397311 https://hal-lirmm.ccsd.cnrs.fr/lirmm-01397311 Submitted on 15 Nov 2016 HAL is a multi-disciplinary open access archive for the deposit and dissemination of scientific research documents, whether they are published or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers. L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés. A Model-Driven Approach to Generate Relevant and Realistic Datasets Adel Ferdjoukh, Eric Bourreau, Annie Chateau, Clémentine Nebut Lirmm, CNRS and University of Montpellier {firstname.lastname}@lirmm.fr Keywords: Relevant datasets generation, Meta-model instantiation, Probabilistic simulation Abstract: Disposing of relevant and realistic datasets is a difficult challenge in many areas, for benchmarking or testing purpose. Datasets may contain complexly structured data such as graphs or models, and obtaining such kind of data is sometimes expensive and available benchmarks are not as relevant as they should be. In this paper we propose a model-driven approach based on a probabilistic simulation using domain specific metrics for automated generation of relevant and realistic datasets. 1 Introduction & Motivations Developing software handling complex structured data requires to dispose of datasets to validate the built software. For example, when developing algorithms to assist the reconstruction of genomic sequences, sets of DNA sequences are required to experiment the algorithms. Similarly, to validate a program handling models (called a model transformation), a poll of relevant models is required. Disposing of such datasets of structured data is usually complex. Data is itself complex, and the dataset must fulfil properties such as relevancy and realism: it must contain data that look like real data. Some approaches propose an ad hoc generation of test cases, for instance in [10], the author presents an approach for generation of uniform lambda terms for testing a compiler of Haskell language. However, characterizing data is not fully intuitive in the proposed way. In this paper, we propose an alternative approach for automated generation of relevant datasets. Our approach uses domain specific metrics and simulates usual probability distributions in order to generate relevant and realistic datasets. The approach is model-based: the wished data is modelled in a metamodel, and the data generation is achieved through the metamodel instantiation. Though metamodels are a strong tool to represent the abstraction underlying data, existing metamodel instantiation approaches encounter difficulties to adapt to various concrete situations, and suffer from a lack of realism in produced models. Our contribution is to inject relevance and realism into the model generation process approaching the characteristics of the desired models by the mean of a priori probability distributions concerning metrics about elements in models. The rest of the paper is organised as follows. Related work is presented in Section 2. Section 3 relates the simulation of probability distribution and its integration to our original approach GRIIMM. Section 4.1 presents our first case study, the generation of real-close skeletons of Java projects. The second case study, generation of relevant scaffold graphs, is described in Section 4.2. 2 Related work We give here an overview of contributions from the literature that are close to our proposal, i.e. in the fields of model generation through automated metamodel instantiation. Many underlying techniques have been used. Cabot et al. [2] translate a metamodel and its OCL constraints into constraint programming. In [9], Mougenot et al. use random tree generation to generate the tree structure of a model. Wu et al. [12] translate a meta-model into SMT (Satisfiability Modulo Theory) in order to automatically generate conform models. In [3], Ehrig et al. transform a meta-model into a graph grammar which is used to produce instances. The advantages and drawbacks of our original approach relatively to the other generating methods have been discussed in [4]. Nevertheless, only two approaches have treated the problem of relevance and realism of generated models. In [9], authors use a uniform distribution during the generation process and add weights in order to influence the frequency of appearance of different elements. In [12], authors describe two techniques to obtain relevant instances. The first one is the use DOI reference number: 10.18293/SEKE2016-029 of partition-based criteria which must be provided by the users. The second one is the encoding of common graph-based properties. For example, they want to generate acyclic graphs, i.e. models. Our goal being the generation of relevant and realistic data, we infer characteristics from real models, in a way that allows us to generate models which are close to reality. 3 Generation of relevant models \textit{G}RIMM (\textit{G}enerate \textit{I}nstances of \textit{M}eta-\textit{M}odels) method \cite{4, 5} relies on translating meta-models into constraint satisfaction problems (CSP) in order to produce conform instances (models). In a nutshell, we encode the classes, references and OCL constraints of a meta-model into a set of variables connected by constraint relationships. A CSP solver performs a smart exhaustive search for values which satisfy the given constraints. Generation is fast and provides models which are guaranteed to be conform to the meta-model. The main remaining issue is related to the usefulness of generated models. Indeed, we have to produce models that are as realistic as possible, regarding to the data it is supposed to simulate. We propose here a method that intends to achieve this goal. The declarative approach is intrinsically deterministic, since the solver follows a deterministic algorithm to produce a unique solution. The CSP solver can easily produce thousands of solutions, but they are often far from the reality. Here we take into account the flexibility given by the CSP to encode various parameters before the solving process, and the fact that some elements of the real models follow usual probability distributions. These distributions are simulated and, \textit{a priori}, injected to the CSP, in order to produce generated models closer to real ones. 3.1 Sampling probability distributions Generating samples of well-known probability distributions is a way to add randomness to the deterministic CSP solving process. The idea is to get models that have more diversity in their elements’ degrees and their attributes’ values in order to cover a lot of possible values. For example, when generating UML models, we want to generate a package which has 5 classes, another one with 7 classes and so on. Figure 1 shows the basic operation with which we can sample all usual probability distributions whatever they are continuous or discrete. Thus, to generate a sample of a random variable \(X\) we need its cumulative function \(F(X)\) and a sample of uniform values \(u\). Result values \(x\) are obtained by an inversion of \(F\): \[ u = F(x) \Rightarrow x = F^{-1}(u). \] Previous method is then adapted to each probability distribution we want to sample. **Discrete distribution on a finite set** For all discrete distribution, are given the probabilities of a finite set of values. The cumulative function is then deduced from the accumulation of probabilities and a sample can be easily generated. **Inverse cumulative function method** This method is used for continuous distribution if their inverse cumulative function is easily computable. This method is used to simulate the exponential distribution (\(e^{\lambda}\)). **Normal distribution: Box Muller transform** Sometimes, inverting a cumulative function is difficult. In these cases, special algorithms are used. For example, a normal distribution \(\mathcal{N}(\mu, \sigma)\) does not have a known inverse function, so previous method is useless. However, many other methods exist to simulate a normally distributed sample. Our implementation uses Box Muller algorithm. For a more complete overview about probability and simulation, please refer to \cite{7} ![Figure 1: Simulation of random values \(x\) given a cumulative function \(F(X)\) of a random variable \(X\) and uniform \(u\)](image) 3.2 Integration into \textit{G}RIMM Many methods coming from the area of random graphs (see for example, \cite{1}) use specific degree distributions to generate random graphs. Our idea is to apply such a method to randomly generate relevant models. Indeed, models are also graphs, in which vertices and edges are typed (classes and relations). There exist many domain-based metrics on the elements of models. We propose to use those metrics (viewed as probability distributions) in order to improve the relevance of randomly generated models. **The degree distribution of a link** As well as in graphs, choosing the number of elements to link with a vertex (its degree) is a key to generate realistic models. The observation of real models shows us that the degrees are diverse. So the greater is the diversity of degrees, the more realistic will be the models. In our method, the users provide probability distributions on the degree of some associations or references. Then, these distributions are simulated and integrated to the G\textsuperscript{RIMM} process. **Distribution on the value of an attribute** The values of an attribute are also very important for the relevance of models. Indeed, generated models should have attributes with values that are close to real models. Distributions for attributes are given by the user. A probability is defined for each possible value, and simulation will choose adequate values and assign them to class instances. **Improving the connectivity** Molloy and Reed show in [8] that the parametrisation of a random graph generator can influence the connectivity of the generated graphs. Indeed, choosing the adequate number of vertices and edges, and the right degree distribution gives graphs that are more connected. Our method takes into account this important aspect during the simulation process in order to get the most connected models. Figure 2 shows the different inputs (white boxes) and the different steps (grey boxes) of our new tool \textit{G}R\textit{RIMM} (Generating Randomized and Relevant Instances of Meta-Models). <table> <thead> <tr> <th>Metric</th> <th>Theoretical distrib.</th> </tr> </thead> <tbody> <tr> <td>Class/Package</td> <td>(\epsilon(\frac{1}{\sqrt{n}}))</td> </tr> <tr> <td>Methods/Type</td> <td>(\epsilon(\frac{1}{\sqrt{n}}))</td> </tr> <tr> <td>Attributes/Type</td> <td>(\mathcal{N}(3.46, 2.09))</td> </tr> <tr> <td>Constructor/Type</td> <td>(\mathcal{N}(0.73, 0.26))</td> </tr> <tr> <td>Sub-Classes/Class</td> <td>(\epsilon(\frac{1}{\sqrt{n}}))</td> </tr> <tr> <td>% Interface/Package</td> <td>(\epsilon(\frac{1}{\sqrt{n}}))</td> </tr> <tr> <td>Parameters/Methods</td> <td>(\mathcal{N}(0.87, 0.25))</td> </tr> </tbody> </table> Table 1: Chosen code metrics with their theoretical probability distribution. \(\epsilon\): Exponential distribution, \(\mathcal{N}\): Normal distribution. relevant skeletons of Java programs using real code measurements. We choose Java for facility to find real programs to collect desired measurements. However, our method can be applied to any programming language. We collected 200 real Java projects coming from two corpus (Github and Qualitas corpus\(^1\)). For more heterogeneity, we chose projects having different sizes (big project for qualitas corpus and smaller ones from github) and different origins (well-known software such as Eclipse, Apache or ArgoUML and also small software written by only one developer). We measured metrics related to their structure, such as the percentage of concrete classes/abstract classes, the average number of constructors for a class, the visibility of fields and methods, etc [6]. To measure these metrics we used an open source tool called Metrics\(^2\). After that, we use R software\(^3\) to compute histogram of each metric in order to deduce its theoretical probability distribution. Table 1 gives the different metrics and their theoretical probability distributions. According to these metrics, we automatically generate Java programs having the same characteristics as the real ones. To achieve this goal, we design a meta-model representing skeletons of Java projects and we adjoin some OCL constraints. 300 Java projects are generated using three versions of our approach. Four corpus are then compared: (1) projects generated by \textit{G}R\textit{RIMM} but without OCL (2) projects generated by \textit{G}R\textit{RIMM} (3) projects generated by \textit{G}3\textit{RIMM} (4) real Java projects. Figure 3 gives the distributions of constructors per class for each corpus. We observe that the two first versions without probability distributions give results that are very far from the characteristics of real models. On the other hand, introducing simulated probability distributions leads to substantial improvement. We see that the distribution of the number \(^2\) Metrics tool: [http://metrics.sourceforge.net](http://metrics.sourceforge.net) \(^3\) R software: [https://www.r-project.org/](https://www.r-project.org/) of constructors of generated models are close to real ones. Moreover, these results are always better when adding probabilities for all other measurements presented in Table 1. 4.2 Scaffold graphs generation Scaffold graphs are used in Bioinformatics to assist the reconstruction of genomic sequences. They are introduced late in the process, when some DNA sequences of various lengths, called contigs, have already been produced by the assembly step. Scaffolding consists in ordering and orienting the contigs, thanks to oriented relationships inferred from the initial sequencing data. A scaffold graph is built as follows: vertices represent extremities of the contigs, and there are two kind of edges. Contig edges link both extremities of a given contig (strong edges in Figure 5), whereas scaffolding edges represent the relationship between the extremities of distinct contigs. Contig edges constitute a perfect matching in the graph, and scaffolding edges are weighted by a confidence measure. Those graphs are described and used in the scaffolding process in [11] for instance. The scaffold problem can be viewed as an optimisation problem in those graphs, and consists in exhibiting a linear sub-graph from the original graph. Therefore it can be considered as well as a model transformation, when models conform to the Scaffold graph meta-model that we designed. Producing datasets to test the algorithms is a long process, somehow biased by the choices of the methods (DNA sequences generation, assembly, mapping), and there does not exist a benchmark of scaffold graphs of various sizes and densities. Moreover, real graphs are difficult and expensive to obtain. Thus, it is interesting to automatically produce scaffold graphs of arbitrary sizes, with characteristics close to the usual ones. In [11], the authors present some of these characteristics, that are used here to compare the GRIMM instances vs. the “hand-made” graphs. The probability distribution chosen to produce the graph emerges from the observation that the degree distribution in those graphs is not uniform, but follows an exponential distribution. We compare several datasets, distributed in several classes according to their sizes: (1) graphs generated by GRIMM, (2) graphs produced by GRIMM and (3) real graphs of different species, described in [11]. For each real graph, 60 graphs of the same size are automatically generated. 30 graphs are naively generated using the original GRIMM method [4, 5], and 30 others are generated after the simulating of probability distribution. These models are then compared in term of visual appearance (Figure 5), degree distribution (Figure 4) and according to some graph measurements (Table 2). We see in Figure 5 three models (scaffolds graphs) corresponding to the same species (monarch butterfly). Strong edges represent contig edges, other edges are scaffolding edges. It refers to mitochondrial DNA of monarch butterfly. Table 2: Comparing graph metrics on real scaffold graphs and average for 60 generated ones for each species. <table> <thead> <tr> <th>Species</th> <th>nodes</th> <th>edges</th> <th>min/max degree</th> <th>h-index</th> <th>min/max degree</th> <th>h-index</th> <th>Real graphs</th> </tr> </thead> <tbody> <tr> <td>monarch</td> <td>28</td> <td>33</td> <td>1/9</td> <td>3</td> <td>1/4.6</td> <td>4</td> <td>7</td> </tr> <tr> <td>ebola</td> <td>34</td> <td>43</td> <td>1/9</td> <td>3</td> <td>1/4.83</td> <td>4.6</td> <td>1/5</td> </tr> <tr> <td>rice</td> <td>168</td> <td>223</td> <td>1/9</td> <td>8</td> <td>1/6.03</td> <td>5.93</td> <td>1/6</td> </tr> <tr> <td>sacchr3</td> <td>592</td> <td>823</td> <td>1/9</td> <td>10</td> <td>1/7</td> <td>7.6</td> <td>1/7</td> </tr> <tr> <td>sacchr2</td> <td>178</td> <td>2411</td> <td></td> <td></td> <td>1/7.53</td> <td>4.11</td> <td>1/4.11</td> </tr> <tr> <td>lacticobaccillus</td> <td>3796</td> <td>5233</td> <td></td> <td></td> <td>1/8.06</td> <td>7.8</td> <td>1/12</td> </tr> <tr> <td>pandora</td> <td>4092</td> <td>6722</td> <td></td> <td></td> <td>1/8.23</td> <td>7.96</td> <td>1/7</td> </tr> <tr> <td>anthrax</td> <td>8110</td> <td>11013</td> <td></td> <td></td> <td>1/8.3</td> <td>8.03</td> <td>1/7</td> </tr> <tr> <td>gloeobacter</td> <td>9034</td> <td>12402</td> <td></td> <td></td> <td>1/8.46</td> <td>8</td> <td>1/12</td> </tr> <tr> <td>pseudomonas</td> <td>10496</td> <td>14334</td> <td></td> <td></td> <td>1/8.43</td> <td>8</td> <td>1/9</td> </tr> <tr> <td>anopheles</td> <td>84090</td> <td>113497</td> <td></td> <td></td> <td>1/8.96</td> <td>9</td> <td>1/51</td> </tr> </tbody> </table> 5 Conclusion & Discussion In this work, we presented a model driven approach to generate realistic and useful datasets. Our approach exploits domain-based metrics and the simulation of probability distributions to tackle the issue of relevance for generated instances. We evaluated our work by applying the method to two different fields: generation of source code skeletons in Software Engineering and generation of scaffold graphs in Bioinformatics. The method follows four main steps: (1) Design a meta-model to represent the domain, (2) Collect metrics on real models (The metrics can also be related to a specific use, so given by an expert), (3) Sample probability distributions with respecting previous metrics and (4) Generate realistic and relevant instances using $G^\text{RIMM}$ tool. We observed a substantial improvement of relevance when simulated probabilities samples are added to the model generator. New generated instances have characteristics very close to real models, improving their usefulness for testing programs. This is especially interesting when data is rare, difficult or expensive to obtain, like in the case of scaffold graphs. REFERENCES
{"Source-Url": "https://hal-lirmm.ccsd.cnrs.fr/lirmm-01397311/document", "len_cl100k_base": 4526, "olmocr-version": "0.1.53", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 20973, "total-output-tokens": 5374, "length": "2e12", "weborganizer": {"__label__adult": 0.0004115104675292969, "__label__art_design": 0.00039839744567871094, "__label__crime_law": 0.00036835670471191406, "__label__education_jobs": 0.001617431640625, "__label__entertainment": 7.921457290649414e-05, "__label__fashion_beauty": 0.00020778179168701172, "__label__finance_business": 0.0003504753112792969, "__label__food_dining": 0.00037789344787597656, "__label__games": 0.00048232078552246094, "__label__hardware": 0.0007643699645996094, "__label__health": 0.0007939338684082031, "__label__history": 0.0003330707550048828, "__label__home_hobbies": 0.00013625621795654297, "__label__industrial": 0.0005145072937011719, "__label__literature": 0.00040650367736816406, "__label__politics": 0.0002918243408203125, "__label__religion": 0.000507354736328125, "__label__science_tech": 0.068359375, "__label__social_life": 0.00017321109771728516, "__label__software": 0.00785064697265625, "__label__software_dev": 0.91455078125, "__label__sports_fitness": 0.0003502368927001953, "__label__transportation": 0.0005970001220703125, "__label__travel": 0.00022685527801513672}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 21219, 0.057]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 21219, 0.32119]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 21219, 0.85787]], "google_gemma-3-12b-it_contains_pii": [[0, 1088, false], [1088, 5232, null], [5232, 9875, null], [9875, 14048, null], [14048, 17007, null], [17007, 21219, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1088, true], [1088, 5232, null], [5232, 9875, null], [9875, 14048, null], [14048, 17007, null], [17007, 21219, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 21219, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 21219, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 21219, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 21219, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 21219, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 21219, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 21219, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 21219, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 21219, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 21219, null]], "pdf_page_numbers": [[0, 1088, 1], [1088, 5232, 2], [5232, 9875, 3], [9875, 14048, 4], [14048, 17007, 5], [17007, 21219, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 21219, 0.22]]}
olmocr_science_pdfs
2024-12-09
2024-12-09
5105b7414701dd281850025790bb8de66de129fe
AGENT-BASED SOFTWARE ARCHITECTURE FOR MULTI-ROBOT TEAMS João Frazão, Pedro Lima Institute for Systems and Robotics Instituto Superior Técnico, Av. Rovisco Pais, 1049-001 Lisboa, Portugal {jfrazao,pal}@isr.ist.utl.pt Abstract: This paper describes an agent-based software architecture that intends to close the gap between hybrid systems and software agent architectures. The developed concepts and tools provide support for: task design, task planning, task execution, task coordination and task analysis for a multi-robot system. Copyright © IFAC Keywords: Multi-robot systems, Agents, Software Architecture, Cooperation. 1. INTRODUCTION In general, any software architecture should be capable of handling a family of applications. Furthermore, a non-ad-hoc architecture, based on design principles and clear concepts, allows researchers with different backgrounds to talk and share each other’s experiences with less effort. Last, but not the least, it allows them to integrate their work on a larger project. There are currently available several software tools for the mission design and development for teams of real robots like TeamBots, Mission Lab and CHARON. TeamBots (Balch, 2002) is a collection of Java application programs and libraries designed to support multiagent systems. It supports simulation of robot control systems and execution of the same control systems on mobile robots. It includes a communication package (RoboComm), and Clay, a library to support behavior-based control systems. The simulation environment is written entirely in Java. Execution on mobile robots sometimes requires low-level libraries in C, but Java is used for all higher-level functions. Mission Lab (Arkin, 2002) is a mission specification software that uses visual programming and reusable components. It is composed by several subsystems such as console display, a visual configuration editor, a simulator, and a runtime and usability data logging module. MissionLab generates code that runs under a distributed architecture (e.g., the main user’s console can run on one computer while multiple robot control executables are distributed across a network, potentially on-board the actual robots they control). CHARON (Esposito and Kumar, 2002) is a language for modular specification of interacting hybrid systems based on the notions of agent and mode. It provides operations for both an hierarchical description of the system architecture (referring to the agents relations), and an hierarchical description of the behavior of an agent. The discrete and continuous behaviors of an agent are described using modes. A mode is basically a hierarchical state machine, that is, a mode can have submodes and transitions connecting them. Agents in CHARON can communicate via shared variables and communication channels. Both event-driven discrete state and time-driven continuous state system descriptions are supported. In this paper, we describe an agent-based software architecture aiming at a considerably large set of applications involving multi-robot teams, based on simple and hopefully clear design principles that enable the development of multi-robot tasks under different architectural concepts at different levels of abstraction and by researchers with different backgrounds. 2. CONCEPTUAL MODEL The conceptual model of the agent-based software architecture includes different types of agents that can be combined both hierarchically and in a distributed manner. The architecture support information fusion between several sensors and the sharing of information between the agents by a Blackboard (Roth, 1985) and is geared towards the cooperation between robots. Agents are generically organized hierarchically: “At the top of the hierarchy, the algorithms associated with the agents are likely to be planners, whilst at the bottom they are interfaces to control and sensing hardware. The planner agents are able to control the execution of the lower level agents to service high-level goals.” (Esposito and Kumar, 2002). The fundamental differences between our approach and the previous described ones are the use of a distributed blackboard for data sharing; the introduction of new agents types like the exclusive agent as well the introduction of new agent execution modes. The elements of the architecture are the Agents, the Blackboard, and the Control/Communication Ports. Next, each of them is described in detail. 3. ELEMENTS 3.1. Agent We define an Agent as an entity with its own execution context, its own state and memory and mechanisms to sense and take actions over the environment. Agents have a control interface used to control their execution. The control interface can be accessed remotely by other agents or by a human operator (Henning and Vinoski, 1999). Through the control interface, an Agent can be enabled, disabled and calibrated (see the execution modes). Agents share data by a data interface. Through this interface, the agents can sense and act over the world. There are Composite Agents and Simple Agents. • **Composite agents** are Agents that are composed by two or more agents. The principle behind composite agents is to abstract a group of related agents. An agent society can have several types of groups. Groups represent the way that agents relate or interact with each other. Composite agents allow a group of agents to be faced as a single agent by designers, by operators or by other parts of the system. For this to be possible, a composite agent must take control over the agents that compose him. Moreover, composite agents must be easy to use: their usage should be only a matter of choosing the right type of composite agent and then plugging the controlled agents. • **Simple agents** are agents that do not control other agents; they do not even need to know about the existence of other agents. Simple agents represent hardware devices, data fusion and control loops. The supported agent types are: • **Concurrent Agent:** composite agent that represents the simultaneous execution of two or more agents. All the agents plugged to this composite agent will execute simultaneously. • **Exclusive Agent:** composite agent represents the exclusive execution of agents. It is used to make sure that only one of the plugged agents is executing at a given time. This is a type of agent similar to the micro-agents of the SocRob project, developed by this group (Lima and Custódio, 2002). • **Periodic Agent** – This agent executes a given function periodically. The period is specified. This agent can be used for data fusion and control loops. • **Sensor Agent** - A driver or a server to an hardware device of the sensor type. These are customized for each type of sensor. Usually they take data from the sensor to the blackboard. • **Actuator Agent** - A driver or a server to an hardware device of the actuator type. These are customized for each type of actuator. Usually they take commands from the blackboard to the actuator. The possible combinations among these agent types provide the flexibility required to build a Mission for a cooperative robotics project (Gamma et al., 1995). For special interactions that are not currently supported, the architecture is open to include other types of agents. We refer to the mission as the top-level task that the system should execute. In the same robotic system, we can have different missions. The mission is a particular agent instantiation. The agents implementation is made to promote the reusability of the same agent in different missions. 3.2. Blackboard The Blackboard is a distributed structure that gives support to the data exchange between the Agents. Each entry on the blackboard is a collection of samples ordered by their creation time. Since all the data shared between the agents goes through the blackboard, reads and writes are concurrent to maximize performance. 3.3. Ports Ports are an abstraction to keep the agents decoupled from other agents. When an agent is defined, his ports are kept unconnected. This approach enables using the same agent definition in different places and in different ways. There are two types of ports: control ports and data ports (Figure 1). Control ports are used within the Agent hierarchy to control agent execution. Each agent is endowed with one upper control interface. The upper interface has two defined control ports. ![Diagram of Agent Control and Data Ports](image) Figure 1 – Agent Control and Data Ports. One of the ports is the input control port; we can see it like the request port from where the agent receives notifications of actions to perform from higher-level agents. The other port is the output control port through which the agent reports progress to the high level agent. This is what we denote as a consistent interface for control. *Composite agents* also have a lower level control interface from where they can control and sense the agents beneath him. The lower level control interface is customized in accordance to the type of agent. For instance, an *Exclusive Agent* has as many lower level control ports as agents that he is controlling. An additional data input port is used to enable the exclusive agent receiving the events that select which agent to execute (Fig. 2). ![Diagram of a Composite Agent and two controlled agents](image) Fig. 2 – A Composite Agent and two controlled agents beneath him. *Data ports* are used to connect the agents to the blackboard data entries, enabling agents to share data. More than one port can be connected to the same data entry. Several agents can be reading from the same place at the same time (Fig. 3). However if a data entry has more than a write port connected, some sort of contention resolution mechanism (such as in an *Exclusive Agent*) must be used. The *data ports* are linked together through the *blackboard*. For configuration flexibility of the agent’s hierarchy, the agent *ports* are not assigned in the definition of the agent. ![Diagram of Agent A writing data on the Blackboard](image) Fig. 3 – Agent A is writing a value on the Blackboard that Agent B is reading. *Ports* are assigned in the instantiation of the agent hierarchy. 4. EXECUTION MODES Traditionally, in Robotics, there is a trend towards giving importance only to the run-time impact of the robotic system architecture. Unfortunately, during several research phases, robots are stopped most of the time. Much time and resources are consumed in system design, system calibration and system analysis. These are very relevant issues often forgotten by Robotics researchers. A well-designed architecture targets the support and speed-up of these development phases. Usually, properties such as system distribution and concurrency are relevant during the mission execution, since they provide better resource allocation and robustness. Centralization and persistency are important properties when dealing with the robots prior to the mission execution or handling the data acquired after the mission execution. Those properties also help managing different missions for a team of robots. Even during mission execution, system distribution is not required all the time for all the aspects. To control the robots it is better to think of them as a fleet, and to be able to exert control over the fleet from a central place, when needed. Under this architecture, a different *execution mode* exists for each development phase of a multi-robot system. The system hardware is composed by a central station and by the robots. The robots and the central station use a wireless network for communication. The centralized *execution modes* of the software architecture are located on the central station. In spite of being centralized, they do interact with the robots (Fig. 4). The control mode follows a distributed approach. This mode is spread across the robots (Fig. 4). ![Diagram](image-url) Next, we describe each of the five execution modes available for the elements described in the previous section. First, we describe the Control Mode that refers mostly to the run-time interactions between the elements. Afterwards, we describe the Design Mode, the Calibration Mode, the Supervisory Control Mode and finally the Logging and Data Mode. ### 4.1. Control Mode The control exerted by an upper-level agent over a lower-level agent is accomplished through special and well-defined functions: *start*, *stop*, *set* and *reset*. In this sense if we *stop* the agent that encapsulates the whole fleet, he will request his lower-level agents to *stop*, so a cascading reaction will stop all the agents’ hierarchy inside each of the robots, from the top down to the lowest level hardware agents, including the robots. A similar behavior happens with the *start* command. ### 4.2. Design Mode The Design Mode is similar to a graphics-drawing program. In these programs, there are different tools for the different graphic objects, such as lines, squares and so on (MacKenzie and Arkin, 1998). In the Design Mode, instead of drawing tools for each type of graphic we have a drawing toolbox for each type of the supported agents, plus one additional toolbox for linking agents written in pure code. The output is a meta-language that represents an instantiation of the supported agents or the included code files when the agent is implemented in pure code. The language describes the connections between the agents. This meta-language is then transferred to the target robots for execution. ### 4.3. Calibration Mode Usually, robots have controllers, sensory processing and hardware that must be configured or calibrated. Controllers, behaviors and perceptual processes have parameters that must be tuned. Usually this data is kept in text files for ease of modification without the need to recompile the code. For more complex calibration procedures (like color segmentation) special configuration processes must be executed sometimes. To simplify the calibration procedure for the robot fleet, each agent has an associated calibration window, which can be requested remotely before the start of the mission. The calibration data is persistent and can be used in a later mission. To keep management of the fleet a simple job, the calibration data is stored in the central station. This data is distributed to the robots before run time. The operator does the calibration following the instructions appearing in the remote window. For each agent involved the mission, the program asks the operator if he/she wishes to make a new calibration, to skip, to save or to load a previous one. This is done in a top-down manner. Answering *skip* to the agent that encapsulates the whole fleet will produce the result of all robots with all their agents being calibrated by the latest data used. This mode provides support on managing the data calibration files. It also supports the way the various data types are written and read from the files. ### 4.4. Supervisory Control Mode Each of the agents has, in addition to the Calibration window, an associated Supervisory Control window, corresponding to the Supervisory Control Mode, designed to be user-friendly. Therefore, the agent that controls the motors has a user-interface appropriated for its specific task. This user-interface is different from the user-interface to a (higher-level) planner agent. There are common features to all agents like the request to start, the request to stop or the request to logging. These common features are present on the associated windows and are provided automatically. The supervisory control window uses the same program interface through which the agents receive control requests from higher-level agents and get data from the same program interface through which the agents report success, failure or progress to the higher-level agents. The only difference is the use of a graphical window for ease of human use. If the operator chooses to control an agent from the hierarchy, the framework should disable all control requests arriving at the controlled agent from other agents. In the supervisory control window, there is also a blackboard view. In the blackboard view, the supervisor can consult or modify the various types of variables. This is an extension of the blackboard view interface of the SocRob project (Lima et al., 2000). 4.5. Logging and Data Mode Each of the agents can keep a logging file. If the supervisor chooses an agent whose activities are to be logged, that file is written locally inside each of the robots. After the mission ends, the log files are stored in the central station. During run-time, an operator can also choose to consult the logging of a particular agent. This mode logs, with the corresponding time tag, all the requests arriving and all reports departing an agent. Changes in the variables inside the blackboard can also be selected to be automatically logged by this mode, with the corresponding time tag. Additional logging should be made inside the code of the agent. 5. AGENT ARCHITECTURE APPLIED ON RESCUE PROJECT Under the reference scenario for the Rescue project (Lima et al., 2003), a land robot should be able to build a topological map and be able to locate itself on that map as well as to show different navigation capabilities, such as topological navigation with obstacle avoidance. With the topological navigation the robot should be able to go from one topological state to an arbitrary topological state. It should be able to change from Topological Navigation to either Waypoint Navigation or User Operated Navigation. The following steps describe part of the top-down instantiation of such a Rescue Mission. Figure 5 shows the first system decomposition. Sensor and Actuator agents where kept out of the diagram for the ease of interpretation. In addition to one agent per sensor and one per actuator, the system is split into five main Agents. All these agents are running simultaneously, therefore they are inside a Concurrent Agent. Each of the agents is responsible for a subsystem: - **Features Transform** – This group of agents is responsible for picking raw data from the several sensors (sonar, laser, compass and image). The raw data is subsequently transformed into features that the Topological agents can use (Vale and Ribeiro, 2002; Vale and Ribeiro, 2003). - **Navigation System** – This group of agents is responsible for the either the topological or the metric navigation of the robot. The Navigation sub-system includes obstacle avoidance behavior. - **Topological Localization** – This agent gets the data-features and, comparing then with information taken from the topological map, determines where the robot is on the topological map (Vale and Ribeiro, 2002; Vale and Ribeiro, 2003). - **Topological Mapping** – This agent is responsible for picking the features and building the topological map (Vale and Ribeiro, 2002; Vale and Ribeiro, 2003). - **Metric Localization** – This agent is responsible for picking raw data from several sensors (odometric, GPS and compass). This data is fused together to determine the robot metric position and velocity. The Fig. 6 depicts the data exchanged by the top rescue agents. The arrows represent data connections between the agents. As explained before, these connections are made throughout the blackboard. Arrows represent more than a value being exchanged. An arrow denotes that the starting agent is writing the data on blackboard entries. The pointed agent is reading the data from the blackboard entries. For ease of image reading only the TopologicalMap and TopologicalPosition data entries where represented. If the arrow forks it means that more than one agent is reading the same data. When the arrow is double it means that the agent is reading and writing data. In the figure, the TopologicalLocalizationAgent is reading the TopologicalMap data and writing the TopologicalPosition data. Fig. 6 – Data Flow for the first system decomposition. All the values on the blackboard of the land robot are readable over the network (Henning and Vinoski, 1999). The land robot can ask the aerial robot to meet him. For now the aerial robot only has two behaviors: parametric navigation and camera target following. First the blimp tries to get to the land robot position using the blackboard land robot parametric position. If successful the blimp changes to camera target following, thus using an exclusive agent to change from one behavior to the other. 6. CONCLUSIONS AND FUTURE WORK We have described an agent based software architecture whose key-points are: - Agents as Reusable Software Components. Agents can be controllable and can control other agents over the network. - Blackboard as a mean to share data over the network, addressing the problems of different agent execution rates and different agent locations. - Several Execution modes as a mean to increase the overall system usability. We have shown how to use the Proposed Agent Software Architecture applying it to the work already developed on the robots of our Rescue Project. Future work on this project includes moving the Topological Mapping Agent to the aerial robot instead of the Land Robot and the development of cooperative navigation agents. We also plan to use the software architecture on another R&D project where we are currently involved with a Portuguese company. ACKNOWLEDGMENTS - Work partially supported by POSI in the frame of QCA III and by the FCT Project Rescue - Cooperative Navigation for Rescue Robots (SRI/32546/99-00). REFERENCES E. Gamma, R. Helm, R. Johnson, and J. Vlissides. “Design Patterns: Elements of Reusable Object Oriented Software”, Addison-Wesley, Reading, MA, 1995.
{"Source-Url": "http://welcome.isr.tecnico.ulisboa.pt/wp-content/uploads/2015/05/582_JfrazaoPal-IAV04.pdf", "len_cl100k_base": 4376, "olmocr-version": "0.1.53", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 20541, "total-output-tokens": 5275, "length": "2e12", "weborganizer": {"__label__adult": 0.0003705024719238281, "__label__art_design": 0.0004723072052001953, "__label__crime_law": 0.0005831718444824219, "__label__education_jobs": 0.0006151199340820312, "__label__entertainment": 7.43865966796875e-05, "__label__fashion_beauty": 0.0001556873321533203, "__label__finance_business": 0.0002313852310180664, "__label__food_dining": 0.0004420280456542969, "__label__games": 0.00109100341796875, "__label__hardware": 0.00199127197265625, "__label__health": 0.0005707740783691406, "__label__history": 0.00032591819763183594, "__label__home_hobbies": 0.00015544891357421875, "__label__industrial": 0.0009522438049316406, "__label__literature": 0.000209808349609375, "__label__politics": 0.00029540061950683594, "__label__religion": 0.0003695487976074219, "__label__science_tech": 0.0740966796875, "__label__social_life": 8.13603401184082e-05, "__label__software": 0.008331298828125, "__label__software_dev": 0.90673828125, "__label__sports_fitness": 0.0005764961242675781, "__label__transportation": 0.0011615753173828125, "__label__travel": 0.0002484321594238281}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 23658, 0.02038]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 23658, 0.75458]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 23658, 0.91095]], "google_gemma-3-12b-it_contains_pii": [[0, 4045, false], [4045, 8342, null], [8342, 11842, null], [11842, 15886, null], [15886, 20008, null], [20008, 23658, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4045, true], [4045, 8342, null], [8342, 11842, null], [11842, 15886, null], [15886, 20008, null], [20008, 23658, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 23658, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 23658, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 23658, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 23658, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 23658, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 23658, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 23658, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 23658, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 23658, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 23658, null]], "pdf_page_numbers": [[0, 4045, 1], [4045, 8342, 2], [8342, 11842, 3], [11842, 15886, 4], [15886, 20008, 5], [20008, 23658, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 23658, 0.0]]}
olmocr_science_pdfs
2024-12-10
2024-12-10
4ab818ec603e38b7e33c4cf2412b6a2387980b71
Building an Agent-Based Laboratory Infrastructure for Higher Education Hong LIN, Khoi NGUYEN, Muna SAQER Department of Computer and Mathematical Sciences University of Houston-Downtown 1 Main Street, Houston, Texas 77002, USA ABSTRACT We present an ongoing project at the University of Houston-Downtown (UHD) that aims to build a grid as a laboratory environment to support undergraduate education. We intend to use this PC clusters centered grid to allow students to perform laboratory exercises through web interfaces. In order to accommodate lab packages of a growing number of courses, we design the system as a modular system using multi-agent modeling. Students are recruited to implement the units of the system as senior student project topics or research activities sponsored by the Scholar’s Academy of UHD. Through these projects, we geared our research toward higher education and provided students with opportunities to participate in building a computational infrastructure for curriculum improvement. This is very important for a minority-serving institution (MSI) with limited resources such as UHD. Keywords: Undergraduate Education, Education Infrastructure, Laboratory, Grid, Multi-Agent Systems, Computer Cluster. 1. INTRODUCTION AND BACKGROUND Agent-oriented design has become one of the most active areas in the field of software engineering. The agent concept provides a focal point for accountability and responsibility for coping with the complexity of software systems both during design and execution [1]. It is deemed that software engineering challenges in developing large scale distributed systems can be overcome by an agent-based approach [2]. In this approach, a distributed system can be modeled as a set of autonomous, cooperating agents that communicate intelligently with one another, automate or semi-automate functional operations, and interact with human users at the right time with the right information. A distributed learning system typically involves many dynamically interacting educational components, each with its own goals and needs for resources while engaged in complex coordination. It is very difficult to develop a system that could meet all the requirements for every level of educational hierarchy since no single designer of such a complex system can have full knowledge and control of the system. In addition, these systems have to be scalable and accommodate networking, computing and software facilities that support many thousands of simultaneous users concurrently working and communicating with one another [3]. We have studied the implementation of Collaborative Agent System Architecture (CASA) [4] with Chemical Reaction Model (CRM) [5-6]. CASA is a model that can catch the interactive and dynamic nature of e-learning systems. Our research results are published in [7-8]. Following our existing work on the design methodology of multi-agent systems, we exploit this methodology in a project that aims at a grid system for laboratory use in undergraduate education. The new method will provide a solution to current problems in design of comprehensive environments to support lab activities in teaching courses on parallel/distributed systems and networks, to respond the increasing need for effective convey of the knowledge of current technology to students to equip them for a career in the modern fast-changing computer industry. One of the most important parts of this project is designing labs that can be performed through the Internets. Our first step is implementing lab packages for our parallel computing and computer networking courses in a grid that encompass lab facilities centered at a Beowulf cluster. We will then extend our lab environment to include other CS and Mathematical courses. The challenge we are facing, however, is that we need to build an infrastructure that will accommodate multiple courses in different disciplines. The problem we are solving include: (1) an interface that is extensible to incorporate more lab modules and customizable to different course structures; and (2) an computational backbone that provides services for various lab activities, such as testing a parallel program, production of network phenomena, performance analysis. Performing these activities requires coordination among multiple nodes. Also, the architecture of the system requires extensibility and scalability to accommodate multiple course modules. To address the first problem, we follow the practice we had when we built the lab package for our CSI course. Outstanding features of this package include a lab explorer that allows students to browse through lab activities and the ability to invoke programs through the interface. We adopt the same structure in the lab package we designed for our parallel computing and networking courses. To address the second problem, we need to build an array of servers that run on a computational grid. A grid is a system of networked computing and storage sources (see Grid.org) that allows the sharing of information and computational powers. The grid is also a platform on which experiments of distributed data processing and computation can be exercised. Services are provided by different nodes of the grid system. The design of the grid must meet certain criteria so that the incorporation of any unit fits into our long term blueprint. For example, as aforementioned, the underlying infrastructure must support incremental and dynamic addition of lab exercises into the lab package. This is to support our ongoing construction of closed labs for our courses in parallel computing, computer networking, and other courses [9]. On the other hand, however, the complexity of the system makes the design of its infrastructure difficult. Our existing research results suggest that the agent model is a powerful tool to solve problems in a distributed system. Therefore, we use agent technology to build the architecture of the grid system to manage the coordination and communication among the nodes and handle the load balancing issues. We envision that our practice will provide a solution to the problem of immersing current technologies into educational efforts which have been continuously made at UHD through the development of a comprehensive lab environment. 2. THE PROJECT As described above, agent system provides an architectural model for distributed networking system. As an active research area, the study in agent technology strives to apply intelligent information processing technologies to complex software systems. Features of an agent system have been summarized in the literatures, for example, according to Griss and Pour [10], an agent shows a combination of a number of the following characteristics: autonomy, adaptability, knowledge, mobility, collaboration, and persistence. These features exist in different types of agent systems such as collaborative agents, interface agents, reactive agents, mobile agents, information agents, heterogeneous agents, and economic agents. Because of the Gamma language’s higher-order operations and its closedness to specifications (no artificial sequentiality), these features can be described directly without being adapted to fit into proprietary frameworks. Since this paper focuses on the architectural design of the grid system, we omit some technical details about CRM. Interested readers can refer to our publications for explanations of our methods. In [7], a sequence of case studies shows that features of various agent systems can be grasped by the Gamma language succinctly. In [8], we give a comprehensive example of specifying a course material maintenance system using the Gamma language. In addition, part of our work in constructing the cluster is presented at the 16th IASTED International Conference on Modeling and Simulation (MS 2005) [9]. The Design The project includes a sequence of major steps: grid construction, lab design, client/server model definition, definition of the interface of functional units, agent-based architecture construction, a module language for program refinement, and architecture specification in the Chemical Reaction Model. Our plan can be described as a pyramid-shaped model illustrated in Figure 1. The system will be designed using a bottom-up strategy (the Design Theme). We construct the grid and design lab modules using existing toolkits, such as Globus Toolkit 3, Java, and Apache Server. The services provided by the system are implemented in client/server architecture. A Java based user interface delivers the services on the web. Servers run on the clusters. Multiple servers interact with one another in the agent based infrastructure. A formal definition of the interfaces of functional units of the system forms the basis for multi-agent system design. Each agent is then designed in the Module Language we have proposed for specifying multi-agent systems [8]. The overall system is specified in the Chemical Reaction Model. In Figure 1, we can see the multi-agent system is the conceptual model for implementing grid services, and the interfaces of functional units define the interaction among functional units and are the central part of the agent system. The interface also separates the architectural design from the design of individual functional units. Adding/deleting services or features in the grid can be done in a top-down strategy (the Application Theme). If a service of a new type is to be added into the system, for example, it is added into the architectural specification. Through an automatic transformation procedure, the specification is re-written into a multi-agent system in the module language. The actual program that codes the services is then incorporated into the system through the standard interface. Therefore, updating services or lab exercises in the system will not cause any change in other parts of the system and correctness and reliability of the system can be ensured to the maximum extent. A Show Case The following is a list of labs we are using in our parallel computing and networking courses. These labs are carefully designed based on the goals of the course set forth in its syllabus and pursuit in our teaching experience. Lab topics are either typical topics of the area or problems we tackle within the course projects. Our lab design emphasizes the operability and vividness as well as the manifestation of the basic concepts and typical technologies. We also address the role played by the cluster when we design the labs. - **Topology**: Circuiting messages in a ring - **Collective communications**: Matrix transpose - **Group management**: Matrix multiplication with Fox’s algorithm - **Scientific computation**: Solving linear systems with Jacobi’s algorithm - **Combinatorial search**: Traveling salesman problem - **Parallel I/O**: Vector processing - Summation - **Performance analysis**: Visualization with Upshot – Trapezoidal rule problem - **Parallel library**: Solving linear system with ScaLapack - **Scalability analysis**: Bitonic sorting - **LAN configuration**: The use of NICs and hubs - **Network analysis**: Monitoring a chat room - **Address resolution**: Experiment with ARP burst - **IP masquerading**: Clustered web servers - **WAN configuration**: The use of routers - **Performance tuning**: Deal with congestion - **Service configuration**: The configuration of a networked file system Here we show one example lab we have designed. This lab allows students to use standard metrics to analyze the performance of a parallel program. The students predict the performance of the parallel program they choose, load the program onto the cluster, compile and run the program, and then compare the predicted results to the experimental results. As illustrated in Figure 2, one lab session is organized in a series of tasks and each task a series of activities. In this lab, students study some standard measurement criteria, viz. speedup and efficiency, for performance analysis of parallel algorithms in Task Activity 1 and 2, and predict the speedup and efficiency of the chosen program given the size of the problem input and the number of nodes in Activity 3. Task 2 requires the students to load the chosen program onto the cluster and then compile the code. The students can click on the C++ Compiler button in the bottom of the page to compile the code once the loading is finished. Task 2 Activity 1 walks the students through the program loading process. Activity 2 asks the students to compile the code. The code is then checked in Activity 3 by a program to ensure its correctness. Erroneous code causes the students to be asked to correct the code till it is errorless. In Task 3, the students can analyze the experimental performance of the program by using MPICH JumpShot profiling software and compare the experimental results to the theoretical predicts, which have been done in Task 1. In Activity 1, the students are required to insert profiling commands into the program and obtain a profile of the program by running it. In Activity 2, the students start up the JumpShot program from the program menu to obtain a Gantt chart of the program. The students then calculate the actual performance data by using the logged timing data and compare the experimental results to the predicted. This is done in Activity 3. Figure 3 shows some snapshots of the lab activities. Figure 3(a) shows the window that takes the student’s response to performance prediction questions. Figure 3(b) shows the moment when the student opens a program through a dialog window and monitor the execution of the program through a popup window. Figure 3(c) shows a text window in which the student adds profiling statements into the program. **Figure 2 The Main Window of the Lab platform** **Figure 3 Snapshots of Lab – Performance Analysis** ### 3. STUDENT PROJECTS Research at UHD is tightly coupled with its educational programs. Student involvement is an indispensable part of our research. For years, UHD’s Scholar’s Academy (SA) has been pairing up faculty and students and hosting organized research. Outstanding students are invited to present their work at the annual Student Research Conference (SRC). The Department of Computer and Mathematical Sciences has also widely recruited students in building the Labs and developing lab software. Senior student projects have been carried out throughout the design of the laboratory. Also, volunteering student research assistants constantly work in the UHD Grid Computing Lab to configure the clusters and implement research modules. With the limited resources of an undergraduate institution such as UHD, it is very important to involve students in research programs, not only to create activities for students to obtain hands-on experiences, but to couple research and education seamlessly. In the following, we present three student projects that are directly related to the project of building an integrated lab environment. **A Pioneer Work: Cluster Configuration and Testing** Parallel Computing course is an important part of Computer Science curriculum. We teach students to use Message Passing Interface (MPI) to design and test parallel programs. Since the Parallel Computing course is a writing course, students are also given a writing project which requests the students to write a report about applications of parallel programming. We are building a lab environment which can give the students hands-on experience in solving real-world large scale applications so that the students can get an image of the real performance of the parallel programs. To this end, a Beowulf cluster is constructed, configured, and tested using 15 similar computers and 1 newer, faster server using the MPI. The operating platform is Fedora 2 (Linux Red-Hat). The Beowulf cluster is a rather simple architecture that many could recognize. There are two different configurations for the Beowulf: Class I and Class II. The Class I Beowulf is built entirely of commodity hardware and software. This type of cluster is usually less expensive than the Class II clusters that use specialized hardware to achieve higher performance. Intuitively, this project is geared towards a Class I Beowulf cluster. As shown in Figure 4, it consists of 15 nodes (computers) and 1 server. The server operates as the master node, and the 15 nodes serve as computational slaves. They are connected via a high-speed Ethernet and switch. All day-to-day operations and coding are done on the server. Figure 4 Class I Beowulf Cluster This project focuses on the MPICH implementation on a Class I Beowulf cluster running on Fedora 2. Since MPICH is mirrored across the cluster, users can send MPI commands such as `mpirun` on the cluster. Packets of data are sent to a desired number of nodes on the cluster that are in turn sent back to the server to accomplish a given task. The whole purpose of this Class I cluster is to achieve equivalent or greater processing compared to specialized computers and/or scalable parallel machines. Due to limited resources, a performance comparison to a Class II cluster or a scalable parallel computer (SPC) could not be made. Benchmarks on this cluster were made using MPI programs on a time-based analysis. Whatever program ran on the cluster, timings from start to finish of calculations were recorded. Design of Lab Interface The project goal is to design a layout interface for performing lab activities on a cluster of PCs. The main program is stored on the root node of the cluster. Students can upload a program onto the cluster, run it, and monitor the result. The lab allows students to use existing parallel computers, high-performance workstations, and vector computers to experiment using Linux operating system and java interface program. Simple parallel architecture ideas and basic analytical models of parallelism will be presented. The students will be able to run sample C++ program and see and analyze the result. For this project, the first step was to carefully and manually design the lab layout and sketch the main menu layout. The second step was to add the lab’s tasks and lab’s activities to the main menu. The following step was to add activities such as print, close, open, save for the labs. The next step was to start thinking about how to automate the process. Java introduced the layout for the GUI (Graphical User Interfaces). It allows fields to automatically grow and shrink depending on how much screen is available. In this project some of the features of great quantity objects are combined with features from Java Layouts to create labs layouts. The targeted versatility of the use of the lab package is ensured by the following criteria in our development plan: - **Scalability**: We can add new nodes into the grid or delete nodes from the grid. - **Extensibility**: The design of the lab environment makes it possible to incorporate other software packages to enhance the functionality. - **Customizability**: Object-oriented design of the architecture and standardized interfaces of objects make the lab composition easy. - **Accessibility**: The lab software creates an interface for the users to control node activities through the web browser. - **Robustness**: The client-side component of the lab software ensures the correctness of the program before loading it onto the grid for execution. The architecture of the lab package is an extension of the framework of the labs designed for our CSI course. The overall design for this GUI was that it would be simple, reliable, and portable. Although currently the software package developed is merely a prototype, it allows for further extension in accordance with our architectural design depicted as above. The GUI was developed with Java. Java is well known for its stability and portability. The GUI was developed with the Java 2 SDK with netBeans by Sun Microsystems. The main points for the flow of the GUI are: - **Card/Tab-Layout style Window** - Menu bar with options - exit, help - **Tabs will contain:** - Introduction (background information on clusters/MPI) - User window for loading, compiling/building, and running their MPI programs - **Demonstration Programs** - Sorting Algorithms & sample distribution programs Layout manager is an abstract class which handles constraints and simplifies implementation of new layouts. It's used as the super class for most of the other layouts. It provides a configurable horizontal and vertical margin around all components. In addition, it has an option to allow the layout to include invisible components in its layout policy. The main menu is designed in a way that it contains all other layouts screens. The main menu frame obtains the tree, the panel, and the upper and lower toolbars. Each toolbar has some action activity provide by the menus or buttons. The panel obtains the lab tasks and activities. The screens cards are controlled by the tree, the panel or the toolbars items (Figure 5). The GUI was coded utilizing the JSwing packages and forms. All layouts were created as NULL layouts, for it offered more flexibility in placing items such as text windows and action buttons. The GUI was built upon a Frame form. Frames are typically used as stand-alone top-level windows as the main user interface to the application. Therefore, it was the optimal choice for the GUI. The Introduction window/tab has general information on the cluster, MPI, and the GUI. A simple JTextpane was added to the base frame that contained the text. Figure 6 is the actual screen shot of the Introduction window. For a user to load, compile/build, and run MPI programs on the cluster, a separate window, called Your MPI, was created. Here users can open their MPI program source code, compile & build it, and execute it. This window was added as a JPanel. JPanels are used to place other objects such as buttons and text areas on. On this panel, Open, Build, and Run it! buttons were added. Actions were assigned to each button to execute the said tasks. Also, a JTextArea was also added to display important messages and instructions. Mouse event listeners were added as reminders for the action buttons. Figure 7(a) shows the window displaying instructions. Figure 7(b), (c), and (d) show actual screenshots of a “Open File”, “Build”, and “Run it!” action, respectively, in the Your MPI window: The “build” action button builds the opened file. Hence, the “Run it!” button executes the program. Also added was the Demo window for users to run sample programs. Within this window are a set of more tabs – one for each sample program. The sorting programs, Mergesort and Quicksort are located here to sample. Also included are the Cpi and a basic I/O program. This GUI offers the bare minimum features for running MPI programs on the cluster. Further development can be made on the GUI in areas of graphics and content. Both the student projects have been presented at the Student Research Conference of the University of Houston-Downtown (Figure 8). We present a method for designing a computational grid that supports online lab exercises, as part of our Information Technology track of curriculum design. A lab package is designed to support the learning process in courses of parallel computing and networking. The grid is centered at a Beowulf cluster, which provides a computational backbone of the grid, and services are deployed in distributed nodes of the computing networks and organized by a multi-agent system. To address high level architectural design issues, such as scalability, extensibility, and modularity, we use Chemical Reaction Model to formally specify the architecture and we facilitate a transformational method for implementing the system to the module interface level. We have developed the lab with an interface that accommodates different lab activities in different courses and demonstrated the design by show cases. Students have been involved in the implementation of the laboratory in forms of senior student projects and SA sponsored research projects. This makes our research coupled with education tightly. 4. CONCLUSIONS We present a method for designing a computational grid that supports online lab exercises, as part of our Information Technology track of curriculum design. A lab package is designed to support the learning process in courses of parallel computing and networking. The grid is centered at a Beowulf cluster, which provides a computational backbone of the grid, and services are deployed in distributed nodes of the computing networks and organized by a multi-agent system. To address high level architectural design issues, such as scalability, extensibility, and modularity, we use Chemical Reaction Model to formally specify the architecture and we facilitate a transformational method for implementing the system to the module interface level. We have developed the lab with an interface that accommodates different lab activities in different courses and demonstrated the design by show cases. Students have been involved in the implementation of the laboratory in forms of senior student projects and SA sponsored research projects. This makes our research coupled with education tightly. 5. ACKNOWLEDGEMENT This research is partially supported by NSF grant “Acquisition of a Computational Cluster Grid for Research and Education in Science and Mathematics” (#0619312). Some of the student research projects are supported by U.S. Army Research Office Award #W911NF-04-1-0024 through Scholars Academy of UHD. 6. REFERENCES
{"Source-Url": "http://www.iiisci.org/journal/cv$/sci/pdfs/zt209ah.pdf", "len_cl100k_base": 4873, "olmocr-version": "0.1.50", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 18240, "total-output-tokens": 5851, "length": "2e12", "weborganizer": {"__label__adult": 0.000614166259765625, "__label__art_design": 0.0017528533935546875, "__label__crime_law": 0.000720977783203125, "__label__education_jobs": 0.1405029296875, "__label__entertainment": 0.0002205371856689453, "__label__fashion_beauty": 0.0004167556762695313, "__label__finance_business": 0.0008325576782226562, "__label__food_dining": 0.0007491111755371094, "__label__games": 0.0012035369873046875, "__label__hardware": 0.00341796875, "__label__health": 0.00146484375, "__label__history": 0.0012798309326171875, "__label__home_hobbies": 0.0004367828369140625, "__label__industrial": 0.0016536712646484375, "__label__literature": 0.0008606910705566406, "__label__politics": 0.0006017684936523438, "__label__religion": 0.0011167526245117188, "__label__science_tech": 0.32421875, "__label__social_life": 0.0004940032958984375, "__label__software": 0.020355224609375, "__label__software_dev": 0.494384765625, "__label__sports_fitness": 0.0005893707275390625, "__label__transportation": 0.0017232894897460938, "__label__travel": 0.0005240440368652344}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27708, 0.01604]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27708, 0.56625]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27708, 0.92842]], "google_gemma-3-12b-it_contains_pii": [[0, 5897, false], [5897, 11674, null], [11674, 16169, null], [16169, 21080, null], [21080, 25331, null], [25331, 27708, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5897, true], [5897, 11674, null], [11674, 16169, null], [16169, 21080, null], [21080, 25331, null], [25331, 27708, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 27708, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27708, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27708, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27708, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27708, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27708, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27708, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27708, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27708, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27708, null]], "pdf_page_numbers": [[0, 5897, 1], [5897, 11674, 2], [11674, 16169, 3], [16169, 21080, 4], [21080, 25331, 5], [25331, 27708, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27708, 0.0]]}
olmocr_science_pdfs
2024-11-28
2024-11-28
3d9ba14e126fa68c4bcdc24f96aa30e886a8fd9f
WHY ENGINEERS SHOULD CONSIDER FORMAL METHODS C. Michael Holloway NASA Langley Research Center Mail Stop 130 / 1 South Wright Street Hampton, Virginia 23681-0001 E-mail: c.m.holloway@larc.nasa.gov ABSTRACT This paper presents a logical analysis of a typical argument favoring the use of formal methods for software development, and suggests an alternative argument that is simpler and stronger than the typical one. INTRODUCTION For more than twenty-five years, some people have touted formal methods as the best means available for developing safe and reliable digital systems. To many within the research community, the efficacy — or more accurately, the necessity — of formal methods is now accepted as proved. One well-known researcher expressed this attitude succinctly when he wrote concerning software engineering: “It is clear to all the best minds in the field that a more mathematical approach is needed for software to progress much.” [1] Despite this bold assertion, the attitude of many of the best minds among practicing engineers has been quite different, with far more rejecting formal methods than embracing them. Although the situation has changed somewhat within the last several years, especially within the hardware design community [2], the acceptance and regular use of formal methods is still far less than proponents want. Formal methods researchers and practitioners have tried to analyze the causes of this lack of acceptance in opinion pieces [3, 4], case studies [5], and small experiments [6]. Suggested causes include lack of adequate tools, lack of mathematical sophistication in developers, incompatibility with current techniques, high costs, and over-selling by advocates. Despite reaching different conclusions, all of these attempts (my own included [7]) have, by and large, addressed the issue in a similar way. They have each attempted to determine why engineers are not routinely using existing formal techniques and tools. The shared assumption seems to be that the idea of formal methods has been proved to be good; the acceptance problem lies in the details, not the idea. That formal methods advocates share this assumption is not surprising. Nevertheless, the reluctance of many engineers to use, or support the development of, any formal method or tool suggests another possibility: perhaps the acceptance problem lies not in the details, but in the way the idea has been communicated to engineers. This paper presents the preliminary results of my effort to investigate this possibility. The structure of the paper is as follows. The next section states the specific question I considered. This is followed by an example of a typical rationale for formal methods. A logical analysis of this rationale is then given, followed by a revised rationale designed to correct the flaws in the original one. Brief concluding remarks complete the body of the paper. An appendix provides an overview of the basic principles of logical reasoning that are used in this paper. Readers unfamiliar with the definitions of terms such as proposition, deductive argument, and inductive argument should read this appendix before the next section. THE QUESTION In as simple and abstract terms as possible, and ignoring possible subtleties, the problem we are considering can be stated as follows. Group one makes an assertion and provides arguments they believe prove this assertion. Group two, by their actions if not necessarily their words, denies the assertion. Group one’s assertion is either true or false. If the assertion is false, then group two is justified in denying it. If the assertion is true, then group two may or may not be justified in denying it. They are justified in denying the assertion if the arguments supplied by group one are insufficient to prove the truth of the assertion. They are not justified in denying the assertion if the arguments supplied by group one are sufficient. Note that, by definition, if the assertion is false, group one’s arguments supporting it cannot be sufficient. Thus, to determine whether group two’s denial of the assertion is justified, we need only consider the sufficiency of the arguments supplied by group one. In our particular case, group one consists of formal methods advocates. Group two consists of industry engineers. The assertion is that engineers of computer systems should use appropriate formal methods. To simplify our discussion, we will restrict ourselves to computer software, recognizing that the line between software and hardware is becoming increasingly blurred. Thus, the question is: Do the arguments supplied by formal methods advocates adequately support the assertion that software engineers should use appropriate formal methods? **TYPICAL RATIONALE** To begin to answer this question, let us consider a typical rationale for formal methods. The rationale given here is based on the arguments given previously by NASA Langley formal methods team members (myself included) [8], augmented by arguments from other Langley-sponsored work [9, 10]. Software is notorious for being late in delivery and unpredictable and unreliable in operation. According to a 1994 article by Wayt Gibbs, “Studies have shown that for every six new large-scale software systems that are put into operation, two others are cancelled. The average software development project overshoots its schedule by half; larger projects generally do worse. And three quarters of all large systems are operating failures that either do not function as intended or are not used at all.” [11] When compared to other engineering disciplines, software engineering does not come out looking good. But this should not be surprising, because in at least two respects, software is different from the physical objects, materials, and systems with which traditional engineers work. First, in physical systems smooth changes in inputs usually produce smooth changes in outputs. That is, most physical systems are continuous. This allows the behavior of the system to be determined by testing only certain inputs, and using extrapolation and interpolation to determine the behaviors for untested inputs. Software systems are, by their very nature, discontinuous. A small change in input may change the outcomes at several decision points within the software, causing very different execution paths and major changes in output behavior. As a result, using extrapolation and interpolation to estimate output behaviors for untested inputs is risky at best, and exceedingly dangerous at worst. Software differs from physical systems in another way: its complexity. Much of the functionality of modern systems is provided by software; therefore, much of the complexity of these systems is expressed in the software, also. The greater the complexity, the more likely design flaws — flaws in the intellectual construction of the system that cause it to do the wrong thing under some conditions — are to occur. Design flaws are the only way that software can go wrong; software does not wear out like physical components. Thus, to ensure that a software system does what it is intended to do, design flaws must be handled in some way. Many different approaches to handling design flaws have been proposed. All of these may be grouped in one of the following three categories: testing, design diversity, or fault avoidance. The discontinuity of software poses problems for testing-based approaches. For systems with low reliability requirements, testing for long enough to show statistically that the system meets its requirements may be possible. But for high integrity software systems, such testing would require much more time than is feasible. For example, to measure a $10^9$ probability of failure for a 1 hour mission, one must test for more than 109 hours (114,000 years) [12]. Thus, for such systems, testing-based approaches are inadequate. The basic idea behind approaches of the design diversity type is to use separate teams to produce multiple versions of the software. The hope is that the design flaws will manifest errors independently or nearly so, and that voters can be used at run-time to mask the effect of those flaws. If the independence assumption is valid, ultrareliable-level estimates of system reliability can be obtained even with failure rates for individual versions of $10^{-4}$/hour. However, the independence assumption does not appear to be valid. In several experiments for low reliability software, the assumption was rejected at the 99% confidence level [13, 14]. Furthermore, the independence assumption cannot be validated for high reliability software because of the exorbitant test times required [12]. As a result, design diversity is inadequate, also. Because design flaws cannot be handled adequately by approaches based on either testing or design diversity, fault avoidance techniques offer the best hope. Of possible fault avoidance techniques, formal methods are the most rigorous; therefore, they are the most promising. Hence, to phrase the conclusion in the language used earlier, software engineers should use appropriate formal methods. **CRITIQUE** We want to determine if this argument provides sufficient justification for its conclusion. To do this, we can examine the structure of the argument by stripping away the verbiage. This will leave us with only the essential propositions and the relationships between them. Doing this yields the following (for reference, each proposition is given a label). Software is bad (P1). Software differs from physical systems in at least two ways (P2): software is discontinuous (P3), and software is complex (P4). Software is complex (P4), and complexity results in design flaws (P5); therefore, software has design flaws (P6). Design flaws must be handled (P7). The three ways to handle design flaws are testing, design diversity, and fault avoidance (P8). Because software is discontinuous (P3), testing is inadequate (P9). Also, because software is discontinuous (P3), design diversity is inadequate (P10). Because there are only three ways to handle design flaws (P8), and the other two are inadequate (P9, P10), fault avoidance must be used to handle design flaws (P11). Because formal methods are the most rigorous fault avoidance method (P12), and the greater the rigor, the more promising the method (P13), formal methods are the most promising fault avoidance method (P14). Because software has design flaws (P6), and design flaws must be handled (P7), and fault avoidance methods must be used to handle design flaws (P11), and formal methods are the most promising of these methods (P14), software engineers should use appropriate formal methods (P15). Figure 1 gives a graphical depiction of the structure of the argument. ![Figure 1: Structure of Typical Argument](image) After examining this structure, we can make the following observations: - The conclusion depends immediately on the following propositions: 1. Software has design flaws (P6) 2. Design flaws must be handled (P7) 3. Fault avoidance methods must be used to handle design flaws (P11) 4. Formal methods are the most promising of these methods (P14) We will now consider the implications of each of these observations. **Complexity** A complex argument is not necessarily a bad argument. Some conclusions can only be reached by long, complicated arguments. In such cases, complexity is essential; however, one should keep in mind that most people react to a complicated argument in one of two ways. Some reject it out of hand. Being unwilling to invest the effort needed to analyze the argument carefully, these people are also unwilling to believe that which they do not understand. Others accept a complicated argument without question, assuming that anything so complicated must be true. In trying to make the case for formal methods, we certainly do not want to give the former group cause to reject our argument out of hand. Nor do we want the latter group to accept our argument unthinkingly; those who do so are likely to give up when practical difficulties arise. If it is possible to construct a simpler argument, we should do so. To paraphrase C.A.R. Hoare's comment on software design [15], there are two ways of constructing most arguments. One way is to make it so simple that there are obviously no deficiencies and the other is to make it so complicated that there are no obvious deficiencies. In the revised rationale that I present later, I opt for the first approach. **Unnecessary Propositions** From a strictly logical point of view, unnecessary propositions are just that: unnecessary. Taking this view, however, ignores the fact that other reasons besides logical necessity may exist for including certain propositions in an argument. For example, beginning the argument for formal methods with a discussion of the sad state of current software development practices may well serve to encourage an audience to listen closely to what follows. On the other hand, if someone is unconvinced that the state of practice is as bad as is claimed, that person may be less likely to listen to what follows. Logically, propositions P1 and P2 do not need to be in the argument. Rhetorically, cases can be made both for and against including one or both of them. In my revised rationale, I leave them out. Immediate Dependency It is upon the truth or falsity of the propositions on which the conclusion immediately depends that the sufficiency of this argument rests. If it is certain that software has design flaws, design flaws must be handled, fault avoidance methods must be used to handle design flaws, and formal methods are the most promising of these methods, then it is equally certain that formal methods will benefit software engineers. Let us look at each proposition and see how certain it is. Does software have design flaws? Anyone who has ever spent more than a few minutes in front of a computer knows that it does. We do not even need the two propositions used in the argument as support. This proposition is indisputably true. Must design flaws be handled? In computer games, VCRs, and personal entertainment systems, failing to handle design flaws might not have serious consequences. In avionics, reactor control, and anti-lock brakes, failing to handle design flaws might have life threatening consequences. Thus, for the most important types of computer systems, this proposition is also indisputably true. Must fault avoidance techniques be used to handle design flaws? In the given rationale, this proposition is claimed to follow from three other propositions: (P8) the three ways to handle design flaws are testing, design diversity, and fault avoidance, (P9) testing is inadequate, and (P10) design diversity is inadequate. This approach seems to me to be unnecessary for, and potentially harmful to, the argument. It is unnecessary because not even the most ardent supporters of testing or design diversity argue that fault avoidance techniques should be abandoned. It is potentially harmful because some people who are unconvinced by the arguments against testing or design diversity might not listen to the rest of the argument. The need for fault avoidance techniques is as self-evidently clear as the previous two propositions we have considered. This proposition could be established much more easily than is done here. So far, the three important propositions we have examined are true. If the fourth proposition is true, then the rationale will turn out to be a sound deductive argument for its conclusion. Are formal methods the most promising fault avoidance method? The rationale claims they are because formal methods are the most rigorous fault avoidance method (P12), and the greater the rigor, the more promising the method (P13). Alas, this is begging the question. All the claimed benefits from formal methods are derived from the rigor they enforce. If rigor is promising, then formal methods are promising. But the argument does not prove that rigor is promising, it simply asserts it: P14 and P13 assert the same thing, using different words. Thus, although three of the four essential propositions have been shown to be true, the fourth has not. Only those who already believe that rigor is good should find the given rationale sufficient. Everyone else should remain unconvinced. REVISED RATIONALE The typical rationale failed, but it came close. It could be completed by simply establishing the truth of P14 without begging the question; however, doing so would result in a rationale that still retains the unnecessary complexity noted in the previous section. So, instead of attempting a repair job, let us develop a different rationale all together. Using the same style as used in the previous section, the revised rationale is as follows. Notice that the original fifteen propositions have been replaced by only five, and that the structure is so simple as to not need a graphical representation. Software engineers strive to be true engineers (Q1); true engineers use appropriate mathematics (Q2); therefore, software engineers should use appropriate mathematics (Q3). Thus, given that formal methods is the mathematics of software (Q4), software engineers should use appropriate formal methods (Q5). This is a valid deductive argument, in which the truth of the conclusion rests upon the truth of two premises: Q3 and Q4. In turn, the truth of Q3 rests upon the truth of two other premises: Q1 and Q2 (and unstated premises that relate striving to be an engineer with doing what engineers do). To show that the conclusion is true, we need only show that Q1, Q2, and Q4 are each true. This is a simple task. Because formal methods are defined as the mathematics of computer software and hardware systems [16], Q4 is true by definition. Hundreds, perhaps thousands, of references could be cited from the late 1960's (when the term "software engineering" was coined) to the present to establish the truth of Q1. For example, Roger Pressman writes [17]: "An early definition of software engineering was proposed by Fritz Bauer at the first major conference dedicated to the subject: The establishment and use of sound engineering principles in order to obtain economically software that is reliable and works efficiently on real machines. Although many more comprehensive definitions have been proposed, all reinforce the importance of engineering discipline in software development." Similarly, the truth of Q2 can be established by myriad citations. Again, one will suffice: "Professional engineers are expected to use discipline, science, and mathematics to assure that their products are reliable and robust." [18] We have proven Q1, Q2, and Q4 to be true. Q3 follows by deduction from Q1 and Q2. Q5 follows by deduction from Q3 and Q4. Thus, software engineers should use appropriate formal methods. Please note that the word "appropriate" is important. Using inaccurate or incomplete mathematics can cause disasters in traditional engineering [19]. There is no reason to suspect that the same cannot happen with formal methods. CONCLUDING REMARKS In this paper, I presented an analysis of a typical rationale used to convince engineers of the potential usefulness of formal methods. This analysis revealed that the typical rationale is complicated, but fails to establish the truth of an essential proposition. As a result, I presented a simple revised rationale, which I believe shows conclusively why engineers should consider formal methods. The ideas in this revised rationale are not original. Rushby includes the basic concepts, although his other detailed discussions tend to distract from them [9, 10]; and Parnas states them succinctly [20]. The contribution of this paper is in presenting the ideas in the context of an analysis of other approaches, and in a forum likely to be populated by engineers. I believe that engineers will consider formal methods, and that, as one industry engineer says, "formality will eventually become the norm in software development." [21] This does not mean that all current formal methods tools and techniques are ready for immediate use. Unfortunately many current formal methods tools and techniques more closely resemble the Wright Flyer than the 777, but with the diligent, cooperative work of mathematicians, logicians, and engineers, researchers and practitioners, the situation can change quickly. I believe it will. APPENDIX: LOGICAL REASONING This appendix summarizes the basic ideas of logical reasoning [22]. The reader familiar with these ideas may skip it. The reader interested in more information should consult [23, 24]. Propositions, Premises, and Conclusions A logical argument consists of a series of statements. These statements are not just any old statements; each one must be either true or false. Such statements are called propositions. Commands, questions, and requests are not propositions, and thus are not formally part of a logical argument. To construct an argument, propositions are grouped in such a way that one of them is asserted to follow from the others. The proposition that is affirmed on the basis of the others is called the conclusion; the other propositions in the argument are called the premises. In the following example, the first two propositions are the premises, and the third proposition is the conclusion: All cats are clever. Dixie is a cat. Therefore, Dixie is clever. Of course, most arguments in real life are not written so simply as this example, which means that identifying the premises and conclusions can be more difficult. Not only do real life arguments frequently contain extraneous information, all of the premises and conclusions are often not stated explicitly. The technical term for an argument in which only parts are stated is an enthymeme. Because of the vast amount of knowledge that is assumed in almost any statement we make, most real-world arguments are, in fact, almost always enthymemes of some type. Those given in the body of the text are, too. For example, in my revised rationale, I assert that software engineers should use appropriate mathematics follows from software engineers strive to be true engineers and true engineers use appropriate mathematics. Strictly speaking, additional premises are needed to define the meanings of, at least, strive and should. Validity and Soundness In a valid argument, if all of the premises are true, then the conclusion must necessarily be true. An argument is sound if it is valid and all of its premises are known to be true. A sound argument proves its conclusion. That is, if an argument is sound, then we have no choice — short of abandoning reason — but to believe its conclusion. An unsound argument is a valid argument with at least one false premise. An invalid argument is one in which all of the premises can be true, but the conclusion still be false. Neither unsound nor invalid arguments tell us anything about whether their conclusion is true or false. The following is an example of an argument form that is always valid: - Premise 1: If P, then Q - Premise 2: P - Conclusion: Therefore, Q The first premise asserts nothing about the truth or falsity of either P or Q alone, but it does say that if P is true, then Q will also be true. The second premise asserts that P is in fact true. From these two premises, concluding that Q is true is always valid. This particular form of argument is called modus ponens (from the Latin modus, meaning "method", and ponere, meaning "to affirm"). By substituting various propositions for P and Q, many valid arguments can be created. Whether such arguments are sound depends on the truthfulness of the chosen P and Q and on the truthfulness of "If P, then Q." For example, if we let P be "I work for NASA," and Q be "I am a civil servant", we get the following sound argument: If I work for NASA, then I am a civil servant. I work for NASA. Therefore I am a civil servant. On the other hand, if we let P be "I work for NASA," and Q be "I am involved in the space program", the resulting argument is valid, but unsound. **Fallacies** An invalid argument will contain either a formal fallacy or an informal fallacy. A formal fallacy is one in which there is something incorrect about the form of the argument. A common example, which is a perversion of modus ponens, is known as affirming the consequent. It looks like this: - Premise 1: If P, then Q - Premise 2: Q - Conclusion: Therefore, P Here is an example: If Boeing built it, the plane is a jet; the plane is a jet; therefore, Boeing built it. An informal fallacy is one in which something other than the form is wrong. There are many types of informal fallacies. The only one important to us here is called petitio principii in Latin, and begging the question in English. In an argument that commits this fallacy, one of the premises from which the conclusion is deduced is the conclusion itself, usually in different words. Such an argument is valid, because P does imply P, but useless. Here is an example: Volleyball is more fun to play than baseball, because baseball is not as much fun to play as volleyball. Of course, in real life, arguments that beg the question tend to do so more cleverly than that. **Inductive Arguments** The discussion so far has been about deductive arguments. Inductive arguments are different. Rather than establishing the truth of a conclusion with certainty, an inductive argument only establishes the truth of a conclusion with probability. We do not speak of the validity or soundness of an inductive argument; we speak of its strength. A strong inductive argument has high probability that its conclusion is true; a weak inductive argument has low probability that its conclusion is true. Strong arguments are often said to be compelling or convincing. Here are three examples of strong inductive arguments: - Greg Maddux is pitching today; therefore, the Braves will win the game. - Children who study Latin score higher on English vocabulary tests than do children who do not study Latin; therefore, studying Latin improves a child's vocabulary. - Many people who spend a lot of time in the sun get skin cancer; therefore, if you spend a lot of time in the sun, you will get skin cancer. Each of these is an inductive argument because its premises do not guarantee the truth of its conclusion. Greg Maddux occasionally loses a game. Factors other than studying Latin might account for the differences in vocabulary. Not everyone who spends a lot of time in the sun gets skin cancer. Each of these is a strong inductive argument, because its premises make the probability high that its conclusion is true. Greg Maddux does not lose often. Many English words come from Latin. A sun worshipper's probability of getting skin cancer is high. Strictly speaking, one ought never use the term prove in connection with inductive arguments; even the strongest possible inductive argument does not prove anything. Nevertheless, the term is often used in common speech. For example, only a particularly petulant person is likely to object to someone saying, "Studies have proven that prolonged exposure to the sun increases one's chances of getting skin cancer." **REFERENCES** 1.3-21 **BIOGRAPHICAL SKETCH** C. Michael Holloway is a research engineer at the NASA Langley Research Center in Hampton, Virginia. He has been a member of the NASA Langley formal methods team since 1992, and is the creator and maintainer of the team's WorldWide Web pages. His professional interests include programming language theory and high integrity software. His personal interests include theology, history, education, and volleyball. Mr. Holloway was graduated from the School of Engineering and Applied Science at the University of Virginia with a B.S. in Computer Science in 1983.
{"Source-Url": "https://ia601506.us.archive.org/zipview.php?zip=/3/items/ieee-us-government-works-dir/ieee-us-government-works-dir.zip&file=10.1109@dasc.1997.635021.pdf", "len_cl100k_base": 5603, "olmocr-version": "0.1.53", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 21412, "total-output-tokens": 7207, "length": "2e12", "weborganizer": {"__label__adult": 0.00042319297790527344, "__label__art_design": 0.00037384033203125, "__label__crime_law": 0.000431060791015625, "__label__education_jobs": 0.0022754669189453125, "__label__entertainment": 8.96453857421875e-05, "__label__fashion_beauty": 0.00020039081573486328, "__label__finance_business": 0.0003559589385986328, "__label__food_dining": 0.0004286766052246094, "__label__games": 0.0006394386291503906, "__label__hardware": 0.00102996826171875, "__label__health": 0.0006170272827148438, "__label__history": 0.00026535987854003906, "__label__home_hobbies": 0.00011813640594482422, "__label__industrial": 0.0004677772521972656, "__label__literature": 0.000812530517578125, "__label__politics": 0.0003123283386230469, "__label__religion": 0.0007109642028808594, "__label__science_tech": 0.036956787109375, "__label__social_life": 0.00014531612396240234, "__label__software": 0.004871368408203125, "__label__software_dev": 0.947265625, "__label__sports_fitness": 0.00034236907958984375, "__label__transportation": 0.0007004737854003906, "__label__travel": 0.00016748905181884766}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 31851, 0.02818]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 31851, 0.77662]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 31851, 0.93286]], "google_gemma-3-12b-it_contains_pii": [[0, 4210, false], [4210, 9541, null], [9541, 13388, null], [13388, 18537, null], [18537, 23440, null], [23440, 28141, null], [28141, 31851, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4210, true], [4210, 9541, null], [9541, 13388, null], [13388, 18537, null], [18537, 23440, null], [23440, 28141, null], [28141, 31851, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 31851, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 31851, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 31851, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 31851, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 31851, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 31851, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 31851, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 31851, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 31851, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 31851, null]], "pdf_page_numbers": [[0, 4210, 1], [4210, 9541, 2], [9541, 13388, 3], [13388, 18537, 4], [18537, 23440, 5], [23440, 28141, 6], [28141, 31851, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 31851, 0.0]]}
olmocr_science_pdfs
2024-12-06
2024-12-06
f8d7c3f71a696935e3df3f6765ab7da056836c74
Reinforcement Learning for Language Models Stanford CS224N Custom Project Gary Qian Stanford University gqia189@stanford.edu Wanqiao Xu Stanford University wanqiaox@stanford.edu Paul Dupenloup Stanford University paul.dupenloup@stanford.edu Abstract Recent interest in Large Language Models (LLMs) and human alignment calls for effective finetuning methods. In this work, we investigate how reinforcement learning (RL) can be used to finetune the downstream performance of pretrained Language Models (LMs). Recently, on-policy RL algorithms have shown promise for text generation tasks. However, they face several empirical challenges, including (1) training instability due to the large action space and (2) sample inefficiency. In this paper, we explore methods to address both of these limitations. First, we implemented a variety of sampling techniques which effectively restrict the total action space without compromising performance, and which show significant improvement over vanilla proximal policy optimization (PPO). Second, we implemented an off-policy and value-based algorithm: Deep-Q Learning (DQN). We demonstrate the DQN can be applied to finetuning language models for downstream applications. However, further exploration and tuning is required to determine whether it can achieve better sample efficiency compared to on-policy algorithms. 1 Key Information to include - Mentor: Jesse Mu - Sharing project: Paul is sharing this project with CS234 - Late days: Wanqiao and Gary have 4 late days left each (8 total) and Paul has 0. However we are submitting 3 days late. As per the Ed post on fractional late days, Wanqiao and Gary have enough days remaining, whereas Paul will incur a 1 day late penalty. 2 Introduction With the recent surge of interest of LLMs, there has been much recent interest in finetuning pretrained models to align with human preference [1]. The finetuning process on natural language generation (NLG) tasks can be naturally framed as a sequential decision-making problem, where the model generates subsequent tokens based on context and aims to maximize sentence-level performance metrics. Indeed, there have been heated discussions around the effects and necessity of reinforcement learning with human feedback (RLHF) in fine-tuning LLMs. The use of RL for NLG encounters several challenges, such as training instability due to the combinatorially large action space, high variance in automated language metrics, and reward hacking. Recently, the authors of RL4LM [2] proposed a novel on-policy RL algorithm named Natural Language Policy Optimization (NLPO). Notably, NLPO aims to address the large sample space issue by merging an on-policy PPO algorithm with a top-$p$ truncation sampling technique. However, NLPO has two primary limitations that we aim to improve in this work. First of all, naive truncation sampling methods like top-$p$ can hinder high-quality generation. For example, top-$p$ may truncate the action space too aggressively if only a few tokens take up the upper $p\%$ of the sampling distribution, resulting in repetitive text [3]. Meanwhile, if most tokens have low probabilities of getting sampled, top-$p$ does not guarantee that the generated text will be of... high quality. Alternative sampling algorithms have been proposed that may produce more desirable behavior [3]. Second of all, the RL4LM library only implements on-policy algorithms, and does not implement any off-policy RL algorithms. Off-policy algorithms learn a policy function by evaluating or improving another policy, while on-policy algorithms learn a policy function from the same data that the policy is executed on. The former may offer several advantages, including better sample efficiency and more flexibility in data usage. These benefits could be especially critical for finetuning language tasks, since human labeling of data is prohibitively expensive or sometimes infeasible [4]. Inspired by this line of work, we aim to design RL algorithms that efficiently finetune pretrained LMs to align with preference metrics in NLP tasks. Specifically, we aim to explore methods to address both of the above-mentioned limitations. In this report, we detail our improvements to the sampling component of NLPO as well as our implementation of an off-policy algorithm. 3 Related Work In the NLP context, RL has been used to improve model behavior in many tasks such as automatic translation [5, 6], question generation [7], summarization [8][9], dialogue generation [10][11], and text-based games [12][13], to name a few. RL has recently been actively applied to ensure that LMs align with human preferences [8][14][15][16]. The use of RL in NLP is a fast-growing subfield with potential applications to various downstream tasks, yet it is still up for debate if RL is the right route or even necessary for improving language modeling and alignment. On the RL side, large action space has been a challenge to efficient exploration. Common tasks in NLG involve generating the next token, which in principle has the whole vocabulary as candidates. When cast as an RL problem, the set of possible next tokens becomes a huge discrete action space. This poses challenges to many RL algorithms which are usually designed to deal with much smaller action spaces. Prior studies utilize sampling ideas [17][18] and penalization of less likely actions in a critic [19][20] to address the large action space problem. Since then, there have also been follow-up papers that attempt to eliminate actions [21] or generate small candidate action sets [22] for more efficient and stable exploration. Many of these previous efforts at integrating RL and NLP exclusively focus on on-policy algorithms such as PPO. However, in certain settings, off-policy RL may be more sample efficient, as this approach allows for reusing datasets collected from prior interaction with a potentially different behavior policy [4]. Several prior papers have applied offline RL to NLP and more broadly to sequence generation problems [23][24][25], suggesting potential benefits of an off-policy approach. 4 Approach Sampling algorithms. The first part of our project aims to improve the performance of the NLPO algorithm by implementing other truncation techniques on top of PPO. We describe them in detail below. In the following specifications, let $V$ denote the vocabulary, $x^{(i)}$ the $i$-th token in an input sentence, $x_{<i}$ the prefix before the $i$-th token, $\theta$ the parameters of the model, $h$ the entropy of the predictive distribution of the model, $P$ the sampling probabilities, and $A_{<i}$ the set of tokens allowed by a given sampling algorithm on the $i$-th step: 1. Typical decoding [26]: This approach extends the top-$p$ method. The algorithm sorts tokens in the vocabulary in order of $[h_{\theta,x_{<i}} + \log p_{\theta}(x|x_{<i})]$. Given a fixed probability $p$, the algorithm then takes $j$ highest-scoring tokens to cover $p$ percent of the distribution. The allowed set of tokens on the $i$-th step is $A_{<i} = \{x^{(1)}, \ldots, x^{(j)}\}$. 2. $\epsilon$-sampling [3]: This algorithm truncates any token with probability no greater than $\epsilon$. The allowed set of tokens on the $i$-th step is: $A_{<i} = \{x \in V : P_{\theta}(x|x_{<i}) > \epsilon\}$. 3. $\eta$-sampling [3]: This algorithm extends $\epsilon$-sampling by truncating tokens below a minimum $\epsilon$ value and an entropy-dependent probability threshold. The allowed set of tokens can be expressed as follows (where $\alpha$ and $\epsilon$ are hyperparameters): $$A_{<i} = \{x \in V : P_{\theta}(x|x_{<i}) > \eta, \eta = \min(\epsilon, \alpha \exp(-h_{\theta,x_{<i}}))\}.$$ 4. **Mirostat [27]**: This algorithm uses an adaptive top-$k$ sampling algorithm to actively tune the value of $k$, so as to maintain the perplexity of the generated text at a desired value. Specifically, the algorithm (1) estimates a value of $s$ using minimum mean-squared errors (assuming tokens follow Zipf’s law) and (2) estimates the value of $k$ as a function of the estimated $s$ and a target surprise value ($\mu$). The allowed set of tokens on the $i$-th step is $$A_{x^{(i)}} = \{x^{(1)}, \ldots, x^{(k)}\} \text{ where } k = \left((s + 1)2^n\right)/(1 - |\nu|^{-(s+1)})^{2^i}$$ The baselines we compare to are vanilla PPO and NLPO, where the latter uses a top-$p$ sampling technique on top of PPO to truncate the action set. Given a fixed probability $p$, the top-$p$ algorithm truncates tokens that are outside the minimal set of (most probable) tokens that accounts for at least $p$ percent of the distribution [3]. Note that tokens with up to $(1 - p)$ probability may be truncated simply because other high-probability tokens cover probability $p$, which is an important limitation of this baseline sampling algorithm. **Delayed masking strategy.** On a high-level, the NLPO algorithm masks out actions using top-$p$ sampling. The implementation of NLPO in RL4LM contains two distinct masking strategies. Both train an unmasked policy. One strategy then masks out some actions under this policy at generation. The other strategy is to maintain a temporally static masked policy, and generate new tokens under the masked policy. The masked policy is synced with its unmasked counterpart every $n > 1$ training steps. In the following, we will refer to the first strategy with perfect syncing as usual, but call the second strategy with delayed syncing as “learned” versions of the sampling method, as it can be seen as learning a separate masked policy. We have leveraged the existing codebase for the NLPO algorithm [28], as well as a stand-alone codebase Transformer Reinforcement Learning X repository (TRLX) [29]. RL4LM has NLPO with top-$p$ and learned top-$p$ implemented. TRLX has vanilla PPO implemented but does not have any existing implementation of sampling methods. Thus, we re-implemented top-$p$ and learned top-$p$ on TRLX. The implementation of all other sampling algorithms described above, as well as their learned counterparts, is entirely our own and coded from scratch in both codebases. **Off-Policy Algorithm.** In the second part of our project, we implement Deep Q-Network (DQN) [30], a vanilla off-policy RL algorithm, catered to language generation. The goal of DQN is to train an action-value function $Q_\theta : \mathcal{S} \times \mathcal{A} \to \mathbb{R}$ parametrized by a deep neural network. Vanilla DQN performs $\epsilon$-greedy exploration. At each time step, a random action is selected with probability $\epsilon$, and a greedy action is selected with probability $1 - \epsilon$. The greedy action is one that maximizes the action-value function given the current state $s$. In the NLP context, the action $a$ is the next token chosen from the set of possible next tokens in our vocabulary $\mathcal{V}$, and the state $s$ corresponds to the context embedding of tokens seen thus far. Then, a next state $s'$ and a reward $r$ are observed. The reward $r$ corresponds to a textual metric (e.g. BLEU score) that depends on the particular NLG task. The loss function typically used is the temporal-difference (TD) loss, which computes the squared difference between the value of a given state-action pair and the value of the bootstrapped best future action (known as the target). More concretely, the loss function can be expressed as $L = \mathbb{E}[(y - Q(s, a))^2]$, where $y$ denotes the value of the target. The target value can be expressed as $y = r + \gamma \max_{a'} Q(s', a')$, where $\gamma$ denotes the discount rate. As described, Q-learning is off-policy, as it tries to learn the greedy policy while using a different behavior policy for acting in the environment. The loss is minimized using stochastic gradient descent. In order to make the network updates more stable, DQN leverages a technique known as *Experience Replay*. At each step of the data collection process, each single-step transition gets added to a replay buffer. During training, rather than simply using the latest data point to compute the loss, the algorithm samples a mini-batch of data from the replay buffer. By using uncorrelated samples in each batch and reusing data throughout training, this technique is both more stable and more sample efficient than vanilla Q-learning. To further improve stability, the parameters of the network $\theta$ used in the target estimation are fixed for multiple updates of the algorithm. This fixed target network therefore uses a different set of parameters $\theta^-$ than the parameters being updated, which mitigates potential instability stemming from the otherwise non-stationary targets. The update step can be succinctly expressed as $$\theta \leftarrow \theta + \alpha (r + \gamma \max_{a'} Q(s', a'; \theta^-) - \hat{Q}(s, a; \theta)) \nabla_{\theta} \hat{Q}(s, a; \theta),$$ where $\alpha$ is the learning rate. We include the detailed pseudo code for DQN in the appendix [4]. The baselines we compare to are the on-policy algorithms detailed above (i.e., PPO and NLPO). We leverage an off-the-shelf implementation of DQN [31] and modify it to perform language generation. Please note that deep RL algorithms are usually extremely difficult to debug and tune, as training is often unstable and takes a significant amount of time. Further more, adapting the codebase and integrating it within the RL4LM framework has proven to be a conceptually ambiguous and challenging task which requires substantial coding, troubleshooting, and debugging. Given the computational and time limits in this course, we consider getting a working bug-free version of DQN in RL4LM a success criterion for this part of the project. 5 Experiments 5.1 Data and evaluation method We perform experiments on two separate NLG tasks: a synthetic task and an IMDB text continuation task. **Synthetic generation of increasing numbers.** Due to compute constraints, and to test the implementation of our sampling techniques, we first choose a synthetic task. The dataset is a dummy dataset that contains prompts of only padding tokens. The task is to generate a sequence of increasing numbers. The reward and evaluation metric is the percentage of number pairs in ascending order in a sentence. We take each prompt length to be exactly 5, and for each rollout, the model generates 20 new tokens. **IMDB text continuation.** With promising results on the synthetic task, we then run our methods on an IMDB positive text continuation task (Hugging Face data id: lvwerra/gpt2-imdb). The task is to complete a given snippet of a movie review as positively as possible. We take each prompt length to be exactly 5, and for each rollout, the model generates 40 new tokens. The output is evaluated using the *sentiment-analysis* pipeline in Hugging Face [32], which assigns a positiveness score between $[0, 1]$ to each sequence. As an additional evaluation metric for this task, we also examine the perplexity of the output. 5.2 Experimental details We use the smallest version of GPT-2 [33] with 124M parameters as our common backbone pretrained model for all tasks, and then finetune each task using the downstream metrics detailed above. The GPT-2 model utilizes a transformers design and is pre-trained in a self-supervised approach on text data scraped from all outbound web page links on Reddit, excluding any Wikipedia pages. The tokenizer used is a variant of Byte Pair Encoding (BPE) that operates on individual bytes, and the size of the vocabulary is 50,257. The GPT-2 model used in the IMDB task is first fine-tuned on the IMDB dataset, then loaded in for further finetuning using RL. **Sampling methods.** The model configuration for the synthetic task is outlined in Table 2 in the appendix. We use the Adam optimizer with minibatches of size 64. We use a learning rate of 0.00001. The PPO policy network parameters are updated 5 gradient steps per minibatch, and for the learned or delayed version, the masked policy is synced with the unmasked policy every 100 training steps. We train on this task for 450 training epochs. We also perform a hyperparameter sweep for all sampling methods on the synthetic task. These values are outlined in the appendix in Table 3. Specifically, we sweep the values of $\mu$ for mirostat, $p$ for typical and top-$p$ sampling, $\eta$ for $\eta$-sampling, and $\epsilon$ for $\epsilon$-sampling. The model configuration for the IMDB text generation task is outlined in Table 5 in the appendix. We use the Adam optimizer with minibatches of size 32. We use a learning rate of 0.00001. The PPO policy network parameters are updated 5 gradient steps per minibatch, and for the learned or delayed version, the masked policy is synced with the unmasked policy every 100 training steps. We train on this task for 450 training epochs. **DQN.** Our goal for the DQN implementation is to get a working bug-free vanilla version of the algorithm for language generation tasks. Therefore, we leave the implementation and testing of combining DQN with sampling methods to future work, which we will discuss in detail later. The model configuration for DQN is outlined in Table 4 in the appendix. We use the Adam optimizer with minibatches of size 32, and set the learning rate to be 0.0001. We load the pretrained GPT-2 model as the value model, and add a multi-layer perceptron (MLP) module on top of the value model as the action-value head. The MLP takes as input the output hidden state of dimension 768 from the value model, and outputs an array of Q-values corresponding to the value of each token in the vocabulary given the hidden state. The MLP has three linear layers with a hidden size of 64, with ReLU activation functions in between. We include an illustration of the Q-network structure in Figure 4 in the appendix. The target Q-network shares the same structure as the Q-network, but is updated every 50 training steps. We set the replay buffer to be of size 1,500,000, essentially storing all possible transitions during training. The exploration policy, or behavior policy, is \( \epsilon \)-greedy with \( \epsilon \) annealed from 1 to 0.05 linearly over the first ten thousand steps and fixed at 0.05 afterwards. We train on the IMDB task for 35,000 steps. 5.3 Results ![Figure 1: Comparison of delayed (or learned) masking on sampling methods](image) **Sampling methods.** Due to compute constraints we performed a hyperparameter sweep for each individual sampling method only on the synthetic generation of increasing numbers task. The results of the hyperparameter sweep for each method are reported in the appendix in Figures 6, 7, 8, and 9. We then used the best performing hyperparameter for the IMDB text continuation task. Figure 1 demonstrates that the delay masking strategy (“learned” strategy) significantly decreases the variance of the training process. Moreover, with the delay masking strategy, all algorithms (except Mirostat) obtain better training scores after 400 steps. It is clear that the learned strategy improves performance. Thus, we only consider the learned versions of the sampling algorithms moving forward. Figure 2 shows the training performance of all the algorithms. For the sentiment score, we find that \( \epsilon \), \( \eta \), and top-\( p \) all perform better than the baseline PPO algorithm with no truncation sampling. Notably, after 450 training steps, \( \epsilon \)-sampling performs better than all other alternative methods, and also outperforms the NLPO baseline which uses top-\( p \) sampling. We also observe an unexpected behavior of our methods. Typical sampling and \( \eta \)-sampling are more sophisticated information-based extensions of top-\( p \) and \( \epsilon \)-sampling, respectively, yet perhaps surprisingly, their simpler counterparts perform better on both tasks that we considered. Moreover, the most complicated method, Mirostat, performs the worst. We suspect that more tuning is needed to improve these algorithms, as they may be harder to optimize and more sensitive to hyperparameters. For the perplexity score, we find that all methods result in higher perplexity scores than top-\( p \), which overall performs well on both evaluation metrics. We note that more complicated methods such as Typical, $\eta$, and Mirostat achieve larger perplexity scores than this baseline. An explanation for this is that these methods tune the parameters according to an entropy threshold that may result in generating sentences with higher perplexity. Notably, both $\epsilon$ and $\eta$ sampling perform relatively well across both metrics (though $\epsilon$ sampling’s high sentiment score does come at the expense of a high perplexity score). ![Figure 2: Performance of $\epsilon$-sampling, $\eta$-sampling, typical sampling, NLPO, and PPO on the IMDB text generation task validation set](image) <table> <thead> <tr> <th>Algorithm</th> <th>Mirostat</th> <th>Typical</th> <th>Top-$p$</th> <th>Eta</th> <th>Epsilon</th> <th>No Truncation</th> </tr> </thead> <tbody> <tr> <td>$\mu = 4$</td> <td>$p = 0.2$</td> <td>$p = 0.95$</td> <td>$\eta = 3e^{-4}$</td> <td>$\epsilon = 1e^{-7}$</td> <td></td> <td></td> </tr> <tr> <td>Perplexity</td> <td>106.13</td> <td>73.49</td> <td>64.35</td> <td>81.45</td> <td>96.93</td> <td><strong>46.75</strong></td> </tr> <tr> <td>Sentiment Score</td> <td>0.678</td> <td>0.8446</td> <td>0.982</td> <td>0.962</td> <td><strong>0.993</strong></td> <td>0.919</td> </tr> </tbody> </table> Table 1: Out-of-sample test results after 450 steps As shown in Table 1, we find that the relative performance of our algorithms on the training and validation data sets holds for the held out test set. $\epsilon$ sampling performs the best in terms of achieving the highest sentiment score, however it also achieves the second highest perplexity score. Perhaps unsurprisingly, no truncation results in the lowest perplexity score, as restricting the action space may come at the expense of producing plausible text. Our results suggest that alternative sampling techniques can be combined with PPO to effectively restrict the action space without compromising performance on certain metrics, however further work is required to quantify the tradeoff between sentiment score and perplexity for this particular task. Here we show sample generations from each of the algorithms for a randomly picked prompt, which exemplify the trends explained above: I used to watch this show when I was a little girl. When I think about it, I only remember it vaguely. If you ask me, it was a good show. Two things I remember vaguely are the opening sequence and theme song. In my opinion, Mirostat: it regularly uses the two-handed and the "G"-in-the-back-the-back-in-front-you-and-then-the-back-right-side- Typical: this before seeing it, I know it did look similar to the other original and the other person got the real story of this great "Masters of the Past". The good about what they did is top-p: movies in this movie I really recommend this movie for this site because I love this movie. If you're looking for a love of an epic adventure, this is an easy choice. This movie was a Eta: them a long time ago, so I knew that I am truly a great, great, great, great grandmother, great-grandpa, great, great aunt-wife, great-grandmother, Epsilon: a lot of films in the seventies and I saw this film in a high class and high school in New York. I was introduced with this wonderful plot development that is very well done. Unfortunately, No Trucation: many films which attempt to depict America’s most popular culture (in terms of cinema itself), but which in any case never fully captures or entertains. A truly incredible film in its own right, Figure 3: Performance DQN on the IMDB text generation task validation set DQN. We successfully implemented vanilla DQN in the RL4LM framework, which is catered to language generation. The implementation and debugging turned out to be substantially more challenging than we initially believed. Thus, due to computational and time constraints, we could only run our DQN algorithm for approximately 30k steps. As shown in Figure 3, the algorithm is not able to learn much over the short course of training, and the initial performance is relatively noisy and unstable. We expect to potentially see convergence and improved performance by significantly extending the training time. It is important to note that for every 4 gradient steps of the PPO algorithm, 128 new sentences need to be generated, which translates to $128 \times 40/4 = 1280$ new tokens, or equivalently $128/4 = 32$ new sentences generated per step. In contrast, every gradient update of DQN corresponds to only 1 newly generated token, or $1/40 = 0.025$ newly generated sentences. Moreover, our implementation of DQN only loads one GPT-2 model (as the value model), whereas PPO uses 2 GPT-2 models (one as the policy model, the other as the value model). For a fairer comparison, we could consider off-policy variants of actor-critic algorithms in the future. DQN suffers from many well-known issues, which could partly explain why DQN performs so poorly on the IMDB task. These include: 1. **Sensitivity to hyperparameters**: DQNs can be more sensitive to the choice of hyperparameters, such as learning rate, discount factor, and network architecture. PPO is often considered more robust to hyperparameter choices. Since we are constrained by time and compute, we are not able to tune the hyperparameters of DQN. 2. **Slow convergence**: DQN usually takes a long time to converge. For the IMDB task this is problematic especially because the reward is noisy and sparse (reward is only given at the end of a sentence). Sparse rewards pose a challenge to TD-style updates and make it hard for Q-values to converge. Additionally, in DQNs, the target Q-values change during training, making the optimization problem non-stationary. This can also lead to instability and slow convergence. 3. **Correlated data**: as an off-policy algorithm, DQN reuses samples from the replay buffer, which consists of previously collected single-step transitions and rewards. Unlike PPO which samples independent trajectories, the training data for DQN exhibits complex dependency, which could lead to instability and slow convergence. 4. **Inefficient exploration**: the exploration strategy employed by DQN is naive dithering, namely $\epsilon$-greedy. Exploration is only performed uniformly randomly with a small probability, which is highly inefficient in large state spaces (which are typical of NLG tasks). Indeed, from our inspection of generated texts from DQN, the tokens are often repeated or random (out-of-context). The poor performance of DQN can also be explained by our specific implementation of the algorithm. First of all, we used a randomly initialized MLP to model the Q-function on top of the GPT-2 language model. The initial approximation of the Q-function would introduce errors in the estimates which can propagate and accumulate during training and destabilize learning. We have tried to adopt DQN to include a KL divergence reward (to penalize deviation away from GPT-2). However, our empirical results, shown in Figure 11 in the appendix, are not successful, possibly due to the relatively large scale of the KL term compared to the Q-function estimates. Another possible strategy to reduce error propagation is to freeze GPT-2 and train the MLP to learn an accurate representation of the Q-function before any fine tuning is performed. Finally, we comment on the choice of architecture to implement DQN for NLG tasks. As discussed above, using a randomly initialized MLP head can cause our model to lose a crucial amount of representation power from the pretrained GPT-2 model. We suspect that this may be the reason why our outputs from DQN are often incoherent sentences with many repeated tokens. A solution for this is to implement an alternative architecture in the future where the output logits from GPT-2 are directly finetuned, treating them as surrogates for initial Q-values. Intuitively, the higher the Q-value, the more desirable the corresponding action. The same holds true for logits. Thus, the logits might be a good starting point for learning the Q-values. 6 Conclusion Our work addresses two of the key empirical challenges faced by on-policy RL algorithms for natural language tasks: (1) training instability due to the large action space and (2) sample inefficiency. Due to time and compute constraints, as well as the inherent complexities of debugging and tuning deep RL algorithms, we were not able to complete all of the ambitious stretch goals that we outlined in our project proposal. Nonetheless, our preliminary results suggest that it is possible to leverage truncation sampling techniques to effectively restrict the action space without compromising performance on certain evaluation metrics, though further work is required to quantify the tradeoff between task preference metrics (such as sentiment score) and naturalness metrics (such as perplexity score). In addition, our implementation of a functioning DQN algorithm suggests that off-policy algorithms may be suitable for finetuning language models for downstream applications. Moving forward, potential future directions for further research include: comparing the performance of our sampling algorithms on a wide variety of NLG tasks (e.g., summarization, machine translation, question answering); additional tuning and training of our DQN algorithm; and combining both outputs of our work, i.e., incorporating our sampling techniques into DQN. Overall, we hope that our work can inform how RL can be used to improve language modeling and alignment, and provide a meaningful contribution to a fast-growing subfield with many potential applications to various downstream tasks. References A Appendix Algorithm 1 Deep-Q Learning pseudo code ``` Input $C$, $\alpha$, $D = \{\}$, maxIter Initialize $\theta$, $\theta^- = \theta$, $t = 0$ while $t < \text{maxIter}$ do Sample action $a_t$ given $\epsilon$-greedy policy for current $\hat{Q}(s_t, a; \theta)$ Observe reward $r_t$ and next state $s_{t+1}$ Store transition $(s_t, a_t, r_t, s_{t+1})$ in replay buffer $D$ Sample random minibatch of tuples $(s_i, a_i, r_i, s_{i+1})$ from $D$ for $j$ in minibatch do if episode terminated at step $i+1$ then $y_i = r_i$ else $y_i = r_i + \gamma \max_{a'} \hat{Q}(s_{i+1}, a'; \theta^-)$ end if SGD on $(y_i - \hat{Q}(s, a))^2$ for parameters $\theta$, where $\delta \theta = \alpha (y_i - \hat{Q}(s_i, a_i; \theta)) \nabla_{\theta} \hat{Q}(s_i, a_i; \theta)$ end for $t = t + 1$ if $\text{mod}(t, C) == 0$ then $\theta^- \leftarrow \theta$ end if end while ``` Figure 4: GPT-2 with an MLP head as a Q-network **Model Params** | **value** --- | --- **On-policy agent** | batch size: 64 learning rate: 0.00001 steps per update: 1280 total number of steps: 256000 epochs per update: 5 discount factor: 0.99 gae lambda: 0.9 clip ratio: 0.2 value function coeff: 0.1 target update iterations: 100 for NLPO/top-\(p\), 1 for others **Off-policy agent** | batch size: 5 learning rate: 0.0001 replay buffer size: 1500000 warm start: 20 polyak target soft update rate: 0.005 discount factor: 1 exploration rate: annealed linearly from 1 to 0.05 decoding | sampling: true top k: null min length: 20 max new tokens: 20 tokenizer | padding side: left truncation side: left max length: 5 Table 2: Model configuration for each method on the synthetic task <table> <thead> <tr> <th>Method</th> <th>Hyperparameters</th> <th>Best hyperparameter value</th> </tr> </thead> <tbody> <tr> <td>top-(p)</td> <td>(p \in {0.89, 0.90, 0.92, 0.95, 0.99})</td> <td>0.95</td> </tr> <tr> <td>typical</td> <td>(p \in {0.2, 0.9, 0.92, 0.95})</td> <td>0.2</td> </tr> <tr> <td>(\epsilon)</td> <td>(\epsilon \in {0.0001, 0.00001, 0.000001, 0.0000001})</td> <td>0.0000001</td> </tr> <tr> <td>(\eta)</td> <td>(\eta \in {0.004, 0.002, 0.0009, 0.0006, 0.0003})</td> <td>0.0003</td> </tr> </tbody> </table> Table 3: Hyperparameter sweep for each method on the synthetic task **Model Params** | **value** --- | --- batch size: | 32 | learning rate: | 0.0001 | discount factor (\(\gamma\)): | 1 | target network update interval (C): | 50 | initial exploration fraction (\(\epsilon\)): | 1.0 | final exploration fraction (\(\epsilon\)): | 0.05 | Table 4: Model configuration of DQN Figure 5: Performance of all methods with the best hyperparameter <table> <thead> <tr> <th>Model Params</th> <th>value</th> </tr> </thead> <tbody> <tr> <td>On-policy agent</td> <td>batch size: 32&lt;br&gt;learning rate: 0.0001&lt;br&gt;steps per update: 128&lt;br&gt;total number of steps: 12800&lt;br&gt;epochs per update: 4&lt;br&gt;discount factor: 1&lt;br&gt;gae lambda: 0.95&lt;br&gt;clip ratio: 0.2&lt;br&gt;value function coeff: 1&lt;br&gt;target update iterations: 1</td> </tr> <tr> <td>Off-policy agent</td> <td>batch size: 5&lt;br&gt;learning rate: 0.001&lt;br&gt;replay buffer size: 1500000&lt;br&gt;warm start: 20&lt;br&gt;polyak target soft update rate: 0.005&lt;br&gt;discount factor: 1&lt;br&gt;exploration rate: annealed linearly from 1 to 0.05</td> </tr> <tr> <td>decoding</td> <td>sampling: true&lt;br&gt;top k: null&lt;br&gt;min length: 0&lt;br&gt;max new tokens: 40</td> </tr> <tr> <td>tokenizer</td> <td>padding side: left&lt;br&gt;truncation side: right&lt;br&gt;max length: 984</td> </tr> </tbody> </table> Table 5: Model configuration for each method on the IMDB task Figure 6: Hyperparameter sweep on NLPO (using top-$p$ sampling) Figure 7: Hyperparameter sweep on typical sampling Figure 8: Hyperparameter sweep on $\epsilon$-sampling Figure 9: Hyperparameter sweep on $\eta$-sampling Figure 10: Performance of $\epsilon$-sampling, $\eta$-sampling, typical sampling, NLPO, and PPO on the IMDB text generation task (from the TRLX repo) Figure 11: Performance of DQN on the IMDB text generation task with KL regularization
{"Source-Url": "http://web.stanford.edu/class/cs224n/final-reports/final-report-170040536.pdf", "len_cl100k_base": 8128, "olmocr-version": "0.1.49", "pdf-total-pages": 17, "total-fallback-pages": 0, "total-input-tokens": 41459, "total-output-tokens": 11582, "length": "2e12", "weborganizer": {"__label__adult": 0.0009016990661621094, "__label__art_design": 0.0014333724975585938, "__label__crime_law": 0.0006623268127441406, "__label__education_jobs": 0.00852203369140625, "__label__entertainment": 0.0009317398071289062, "__label__fashion_beauty": 0.0005130767822265625, "__label__finance_business": 0.0004105567932128906, "__label__food_dining": 0.0007772445678710938, "__label__games": 0.0030117034912109375, "__label__hardware": 0.0011491775512695312, "__label__health": 0.0015592575073242188, "__label__history": 0.0007104873657226562, "__label__home_hobbies": 0.00018727779388427737, "__label__industrial": 0.00072479248046875, "__label__literature": 0.0042724609375, "__label__politics": 0.0006103515625, "__label__religion": 0.0011491775512695312, "__label__science_tech": 0.364013671875, "__label__social_life": 0.00041794776916503906, "__label__software": 0.015533447265625, "__label__software_dev": 0.5908203125, "__label__sports_fitness": 0.0005869865417480469, "__label__transportation": 0.0008087158203125, "__label__travel": 0.000339508056640625}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 42882, 0.04097]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 42882, 0.19613]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 42882, 0.8476]], "google_gemma-3-12b-it_contains_pii": [[0, 3243, false], [3243, 7709, null], [7709, 12989, null], [12989, 17340, null], [17340, 20311, null], [20311, 22289, null], [22289, 25039, null], [25039, 29738, null], [29738, 33679, null], [33679, 37560, null], [37560, 38842, null], [38842, 39858, null], [39858, 41383, null], [41383, 42425, null], [42425, 42541, null], [42541, 42646, null], [42646, 42882, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3243, true], [3243, 7709, null], [7709, 12989, null], [12989, 17340, null], [17340, 20311, null], [20311, 22289, null], [22289, 25039, null], [25039, 29738, null], [29738, 33679, null], [33679, 37560, null], [37560, 38842, null], [38842, 39858, null], [39858, 41383, null], [41383, 42425, null], [42425, 42541, null], [42541, 42646, null], [42646, 42882, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 42882, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 42882, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 42882, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 42882, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 42882, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 42882, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 42882, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 42882, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 42882, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 42882, null]], "pdf_page_numbers": [[0, 3243, 1], [3243, 7709, 2], [7709, 12989, 3], [12989, 17340, 4], [17340, 20311, 5], [20311, 22289, 6], [22289, 25039, 7], [25039, 29738, 8], [29738, 33679, 9], [33679, 37560, 10], [37560, 38842, 11], [38842, 39858, 12], [39858, 41383, 13], [41383, 42425, 14], [42425, 42541, 15], [42541, 42646, 16], [42646, 42882, 17]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 42882, 0.08095]]}
olmocr_science_pdfs
2024-11-26
2024-11-26
bd7356f28d2bcd1243afd1e4fe02bdaa293d3945
In this assignment, you will implement a simple web application and gain experience with TypeScript and HTML. Once you are done, follow the instructions on page 9 to submit the coding and written portions in GradeScope. The following completed files should be directly submitted for the “HW1 Coding” assignment: fib.ts prime.ts index.tsx as well as index.css if you completed extra credit. For the “HW1 Written” assignment, submit your written answers for problems 4(c) and 7(b). To get started, check out the starter code using the command: Install the required libraries, run the command npm install --no-audit in the hw-fib directory. The initial application does nothing at all. (You will add all of its functionality below.) However, the provided source code includes the function fib defined in fib.ts with the following shape: ```typescript export const fib = (n: bigint): bigint => { .. }; ``` This function takes a non-negative integer n as input and returns the n-th Fibonacci number, denoted fn. In case you have not seen Fibonacci numbers before, they are defined as follows. The first two Fibonacci numbers are defined to be f0 = 0 and f1 = 1. For n ≥ 2, the n-th Fibonacci number is defined recursively as fn = fn−2 + fn−1. (Note that this formula only works for n ≥ 2.) The fib function provided calculates the n-th Fibonacci number using exactly these formulas. Have a look at the code and make sure it all makes sense. The provided code also includes a check to make sure that the user passed in a non-negative number. This is not strictly necessary (since the function specificication says that n is non-negative), but it is a good idea to include it to help catch any bugs in other parts of the code. Writing such checks is called “defensive programming”. The starter code also includes a file fib_test.ts with tests for the the fib function. We will learn more about testing in future assignments, but for now, note that each call to assert.deepStrictEqual passes in two numbers: the actual return value of fib(n), for some n, and the expected answer. The function assert.deepStrictEqual checks that the two numbers are the same. If not, it prints an error message. Confirm that the fib function provided passes the tests provided by running the command npm run test. You will see that the tests for some other functions (e.g., fastFib) are failing because those functions are not yet implemented. You will implement them later in the assignment. The npm run test command also runs tests from the file prime_test.ts for the functions in prime.ts which we will look at later in the assignment. 1. Nail Our Colors to the Fast (12 points) The following parts describe coding work. The provided \texttt{fib} function is a direct translation of the mathematical definition of Fibonacci numbers into TypeScript, making it easy to understand. Unfortunately, it is unacceptably slow, running in time \( \Theta(2^n) \). In this problem, you will implement a faster version, \texttt{fastFib}, with the following shape: \begin{verbatim} export const fastFib = (n: bigint): FibPair => { ... }; \end{verbatim} This version also takes \( n \) as an input, but instead of returning just \( f_n \), it returns something called \texttt{FibPair}. The latter is a record type defined as follows: \begin{verbatim} export type FibPair = {curFib: bigint, prevFib: bigint}; \end{verbatim} As you can see, each \texttt{FibPair} includes not only that particular Fibonacci number, in the \texttt{curFib} field, but also the previous Fibonacci number, in the \texttt{prevFib} field. For example, the 3rd Fibonacci number would be represented by the record \{\texttt{curFib}: 2, \texttt{prevFib}: 1\} since \( f_3 = 2 \) and \( f_2 = 1 \). Note that \texttt{fastFib} requires an input \( n \) that is at least 1. This is because, for \( n = 0 \), there is no such thing as the previous Fibonacci number, so there isn’t any sensible record to return. (a) Implement the body of \texttt{fastFib} using recursion. Specifically, a call to \texttt{fastFib(n)}, if \( n \) is not a base case, should call \texttt{fastFib(n-1n)}. Use only \texttt{const} declarations. Do not mutate anything! (b) Verify that the tests for \texttt{fastFib} now pass when you run \texttt{npm run test}. 2. Virtue Is Its Own Record (8 points) The following parts describe coding work. Now that we have \texttt{fastFib}, there is no reason to use the old, slow version. (a) Change the implementation of \texttt{fib} to work by calling \texttt{fastFib} instead. Note that you cannot simply write “return \texttt{fastFib(n)}” for two reasons. First, \texttt{fastFib} does not accept all the inputs that \texttt{fib} does. Second, \texttt{fastFib} does not return a \texttt{bigint}, like \texttt{fib} is supposed to. (It returns a \texttt{FibPair}, which is a record, not an integer.) Your implementation will need to address both of these issues. (b) Verify that the tests for \texttt{fib} still pass when you run \texttt{npm run test}. 3. The Odd Tuple\(^1\) (10 points) The following parts describe coding work. The function `fastFib`, above, used a record to store a given Fibonacci number paired with the previous one. In general, records and tuples provide equivalent functionality. This means that we could have used tuples to define our function instead. In this problem, we will do that. The starter code includes the function `fastFib2` that is just like `fastFib` except that it returns the type `FibPair2` instead of `FibPair`. The new type is defined as follows: ```typescript export type FibPair2 = [bigint, bigint]; ``` This type declaration says that a `FibPair2` is two integers, but it doesn't say which is the current Fibonacci number and which is the previous one. The comments in the code indicate that the previous number goes first. For example, the 3rd Fibonacci number would be represented by the pair `[1, 2]`. This is a nice example of how the type system, while useful, cannot find all bugs for us. In this case, it would correctly identify the error if we tried to return just 2 instead of `[1, 2]`, but it would not spot the error if we returned the two numbers in the wrong order, i.e., as `[2, 1]` rather than `[1, 2]`. It is important to understand which errors the type system does and does not catch. We need to be especially careful about the latter category (only). (a) Implement the body of `fastFib2`. Like `fastFib` it should use recursion, contain only `const` declarations, and not mutate anything. (b) Verify that the tests for `fastFib2` now pass when you run `npm run test`. --- \(^1\)For the record, "tuple" is actually pronounced "too-ple", but that was too hard to pun. 4. Rally the Loops (15 points) The following parts consist of a mix of written and coding work: parts (a, b) describe coding work and part (c) describes written work. The following Java function returns the smallest Fibonacci number that is greater than or equal to m: ```java public static int nextFib(int m) { int prevFib = 0; int curFib = 1; while (curFib < m) { int temp = prevFib; // change (prevFib, curFib) prevFib = curFib; // from (fib(n-1), fib(n)) to (fib(n), fib(n+1)) curFib = curFib + temp; } return curFib; } ``` The loop works its way up through the Fibonacci numbers, storing each one in turn in the variable curFib, until it gets to the first one that is greater than or equal to m. In order to calculate the next Fibonacci number, it needs to also keep track of the Fibonacci number before curFib, which is stored in the variable prevFib. (The property of this code that, at the top of the loop, curFib = fn and prevFib = fn−1 for some n is called a "loop invariant". We will have a lot more to say about those later in the course.) In this problem, you will write a recursive version of the function above in TypeScript. Unlike the loop above, our recursive function will not need to mutate any variables. The starter code includes a function called nextFib that handles the case m = 0 by returning 0. For m ≥ 1, it calls a function nextFibHelper, which you will implement recursively. (a) Implement nextFibHelper so that it simulates the loop above using recursion. In more detail, the function should call itself recursively on each subsequent Fibonacci number until it gets to the first Fibonacci number that is greater than or equal to m, which it then returns. Instead of storing the state in local variables, the state of the loop is now recorded in the function arguments: prevFib, curFib, and m. A call to nextFib(m) will invoke nextFibHelper(0, 1, m). Those arguments describe the state of the local variables the first time we get to the top of the loop. Your recursive calls should be made with arguments that go through increasingly larger Fibonacci numbers until you get to the first one that is greater than or equal to m, at which point the recursion should stop. (b) Verify that the tests for nextFib now pass when you run npm run test. (c) We can think of a call to nextFibHelper(prevFib, curFib, m) as asking, what would the loop above ultimately return if it entered the top of the loop with the three variables having the values of the given parameters? Explain in your own words why your recursive implementation answers this question. Relate the loop condition and loop body to their corresponding parts in your recursive implementation. 5. No Rest For the Query (15 points) The following parts describe coding work. So far, we have written functions that calculate Fibonacci numbers and related quantities, but users have no way of using them. In this problem, we will make `nextFib` available from a user interface. The provided starter code in `index.tsx` creates the Root in which we will render the UI, but the provided UI simply prints out one Fibonacci number. To make this useful, we need to get input from the user. For now, we will have the user pass their input in using query parameters. (a) Change the code to look for query parameters called "firstName", which can be any non-empty-string, and "age", which must be a non-negative integer. Have the code render an error message if the name parameter or the age parameter is missing or invalid. (See the section worksheet for how to do this.\(^2\)) (b) Change the code so that, if both parameters are provided and valid, it renders a message telling the user either that their age is a Fibonacci number (if it is one) or the number of years until their age will be a Fibonacci number (if it is not one). For example, if the user's first name is Jesse and their age is 21, it could render a message like this: Hi, Jesse! Your age (21) is a Fibonacci number! whereas if their age was 19, it could render a message like this: Hi, Jesse! Your age (19) will be a Fibonacci number in 2 years. (c) Start the server by running the command `npm run start`. Then, point your browser at `http://localhost:8080/?firstName=Jesse&age=21` to check that it works as intended. Try changing the age to a non-Fibonacci number (like 19) as well. Also be sure to try changing the first name! You could have accidentally written “Jesse” directly in the code. In that case, it would look correct if “Jesse” is the only name you tested. Validate that your error message appears when either parameter is missing also. 6. Once Upon a Prime (14 points) The following parts describe coding work. In `prime.ts` we have included the function `isPrime` which determines if a positive integer is prime, meaning it is only a product of 1 and itself. It is implemented recursively with a helper function `isPrimeHelper`. Read these over to make sure you understand how it works; there's nothing further you need to implement for these. We have also included the function, `isHighlyComposite` which determines if a positive integer is highly composite, meaning it has more divisors than all smaller non-negative integers. It is implemented by calling two helper functions `numDivisors` and `maxNumDivisors` which we will implement in this problem. (a) In this part you will implement `numDivisors` which returns the number of integers from 1 to the input integer, \(n\), which divide evenly into \(n\). It calls a helper function, `numDivisorsHelper`, with the following shape: \[ \text{const numDivisorsHelper} = (n: \text{bigint}, m: \text{bigint}): \text{bigint} \Rightarrow \{ \ldots \} \] It returns the number of numbers between 1 and \(m\) that divide evenly into \(n\). Look at how `numDivisors` calls this function, then complete the `numDivisors` functionality by implementing `numDivisorsHelper`. \(^2\)Technically, the solution described there, using `parseInt`, allows non-negative, fractional values by rounding down to the nearest integer. You could instead use `parseFloat` and then verify the result is an integer in the manner described in lecture. However, we will not require that for this assignment. (b) In this part you will implement `maxNumDivisors` which returns the maximum number of divisors of any integer input between 1 and `n`. This function has the following shape: ```javascript export const maxNumDivisors = (n: bigint): bigint => { ... } ``` Implement it by calling `only` `numDivisors` and recursively calling `maxNumDivisors`. (c) Check out how `isHighlyComposite` determines if an integer input is highly composite by calling the two functions you just implemented and make sure you understand how it works. Verify that the tests for `isHighlyComposite` and the helper functions now pass when you run `npm run test` to confirm that your new functions are working. ### 7. Partners in Prime (12 points) The following parts consist of a mix of written and coding work: part (a) describes coding work and part (b) describes written work. Now that we additionally can calculate if a number is prime and/or highly composite, we will make this functionality available from the user interface by add to the output the user sees when they input their name and age in the query parameters. (a) Add to the output the user sees when both query parameters are provided and valid, with a message(s) saying that their age is prime and/or highly composite when that is the case. For example, if the user’s first name is Jesse and their age is 23, it could render a message like ``` Hi, Jesse! Your age (23) will be a Fibonacci number in 11 years. Your age is also prime! ``` whereas if their age was 24, it could render a message like this: ``` Hi, Jesse! Your age (24) will be a Fibonacci number in 10 years. Your age is also highly composite! ``` If the age is neither prime nor highly composite, nothing additional should to be added to the message. If the age is both prime and highly composite, both messages should be added. You should do this by creating two helper functions at the top of `index.tsx` which call `isPrime` and `isHighlyComposite` respectively and return either a string message indicating the given age fits that case (being prime or highly composite) or the empty string otherwise. Then call those functions and include their output in the message for the user. (b) What are two different ways, other than defining a function, that we could have written the code to conditionally include these extra messages in the output? 8. There’s a Form Brewin’ (14 points) The following parts describe coding work. While query parameters work, they are not something that a typical Internet user would know how to use. In this problem, we will give the user a more natural way to enter this information. (a) Change the code in index.tsx so that, if the first name and the age parameters are not provided, rather than rendering an error message, it renders the following HTML: ```html <form action="/"> <p>Hi there! Please enter the following information:</p> <p>Your first name: <input type="text" name="firstName"></input></p> <p>Your age: <input type="number" name="age" min="0"></input></p> <input type="submit" value="Submit"></input> </form> ``` The `<input>` tags create UI components that allow the user to enter information. The first one with `type="text"` creates a standard text box that allows the user to enter any string. The second one with `type="number"` and `min="0"` allows the user to enter non-negative numbers. The final `<input>` tag with `type="submit"` creates a button labelled "Submit" that, when clicked, will redirect the page to a URL put together by adding query parameters to the URL in the `action="/"` attribute of the `<form>` tag containing the submit button. Specifically, it adds one query parameter for each of the (non-submit) `<input>` tags inside the `<form>` tag, with the parameter name coming from the `name=".."` attribute of the `<input>` tag and the parameter value coming from the value typed by the user into that input box. In this case, if the user types “Jesse” into the first input box and “21” into the second input box, then clicking the submit button will redirect the page to “/?firstName=Jesse&age=21”. (Note that the `type="number"` and `min="0"` attributes on the age `<input>` tag do not remove the need to check that the query parameters are valid when present. A user can still type in any query parameters they want into the URL bar of the browser. Generally, you should still include the error cases from problem 5a except in the new case where the form should appear instead.) Run the application and verify that navigating to `http://localhost:8080/` shows the form. Then, verify that you can fill out the form, click "Submit", and see the expected message from Problem 5. Pressing the back button should take you back to the form. (b) Change the HTML shown when the user provides first name and age query parameters so that, in addition to the message described in Problem 5 and 7, it also includes an `<a>` tag, labelled "Start Over", that navigates back to the form. Congratulations on completing your first web app of CSE 331! 9. Extra Credit: Like Watching Class Grow (0 points) The UI we created in the previous problem works, but it is pretty bare bones. For extra credit, you can improve the styling so that it looks more fanciful. To get credit, you must add your styling in a file, `index.css`, rather than directly in the code. You will need to create that file yourself. Once you have done so, you can define classes in the file and then assign classes to tags using a `className=".."` attribute in the code. (Make sure you “import './index.css’” in `index.tsx` so that the CSS is included in the page produced.) To get credit, you must change at least the following components of styling: background colors, foreground colors, fonts, borders, and margin or padding. Make sure the final result looks reasonable. (It must be readable as well as fanciful.) How to Turn In Assignments All work will be turned in via Gradescope. For each assignment, you will turn in your written work and code separately. In this assignment, the written work includes only your answer to problems 4(c) and 7(b), but later assignments will include a larger proportion of written work. You will turn in your written work to the "HW# Written" assignment on Gradescope. You may handwrite your work (on a tablet or paper) or type it, provided it is legible and dark enough to read. Please match each HW problem to the page with the work on Gradescope when you turn in. If you fail to have readable work or assign pages, you will receive a point deduction. You will turn in your code to the "HW# Code" assignment on Gradescope. You only need to submit the final version of the files you worked on in the assignment. We will identify a list of files which you should turn in at the top of each assignment. You should turn these files in directly, you should not put them in a folder and turn that folder in. On Gradescope, there is an autograder that will run when you turn in your code. This may take a few minutes, but you should always wait for it to complete to view the results, then fix any errors and resubmit. This means you should not wait until the last minute! Always make sure you leave enough time to fix possible issues before the deadline. The autograder will run checks on your code to validate that your submission was successful including that you turned in only the files we asked for (not too many/few, and not within a folder) and that we will be able to run your applications to grade them. It will also run the comfy-tslint linter to verify that your code follows our 331 code constructs. Then it will run any tests that we asked you to write and staff tests on your code and tell you if they failed. The linter and staff tests are worth points, and you should make sure both pass, meaning you get full points (we will also manually grade your code). Linter In this course we have a custom linter, comfy-tslint, which checks that your code follows our course specific coding conventions. As mentioned above, we run this linter on your code in the autograder when you turn in your assignment. The linter is not able to catch every coding convention mistake, so you should make sure you write code that looks similar to the examples we go over in class (note that we may manually grade your code and deduct for uncaught coding convention issues). We recommend that you download the VS Code extension so the linter warnings will appear as helpful popups while you’re coding. Additionally, for each assignment, you can manually run the linter with the command npm run lint. For example, your output will always have the first two lines listed in the image below, and if your code has any errors, those will be listed below. ```bash > cse331-hw-fib@0.0.1 lint > comfy-tslint --no-mutation src/*.ts,tsx src/fib.ts:7:32: any type is not allowed src/index.tsx:6:10: top-level variable declarations must have a type ``` You can always run this command prior to turning in your coding submission to make sure you’ll pass the linter ahead of time.
{"Source-Url": "https://courses.cs.washington.edu/courses/cse331/24sp/topics/hw-fib.pdf", "len_cl100k_base": 5232, "olmocr-version": "0.1.53", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 20952, "total-output-tokens": 5798, "length": "2e12", "weborganizer": {"__label__adult": 0.000789642333984375, "__label__art_design": 0.0007681846618652344, "__label__crime_law": 0.0005249977111816406, "__label__education_jobs": 0.02447509765625, "__label__entertainment": 0.00016701221466064453, "__label__fashion_beauty": 0.00037598609924316406, "__label__finance_business": 0.0003180503845214844, "__label__food_dining": 0.00095367431640625, "__label__games": 0.0013341903686523438, "__label__hardware": 0.0010585784912109375, "__label__health": 0.0004992485046386719, "__label__history": 0.0003809928894042969, "__label__home_hobbies": 0.0003046989440917969, "__label__industrial": 0.0006203651428222656, "__label__literature": 0.0007429122924804688, "__label__politics": 0.0003337860107421875, "__label__religion": 0.0008335113525390625, "__label__science_tech": 0.00365447998046875, "__label__social_life": 0.0004544258117675781, "__label__software": 0.006473541259765625, "__label__software_dev": 0.953125, "__label__sports_fitness": 0.0005354881286621094, "__label__transportation": 0.0009860992431640625, "__label__travel": 0.0003986358642578125}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 22152, 0.01223]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 22152, 0.57819]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 22152, 0.89788]], "google_gemma-3-12b-it_contains_pii": [[0, 2719, false], [2719, 5122, null], [5122, 6811, null], [6811, 9548, null], [9548, 13077, null], [13077, 15442, null], [15442, 18124, null], [18124, 18964, null], [18964, 22152, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2719, true], [2719, 5122, null], [5122, 6811, null], [6811, 9548, null], [9548, 13077, null], [13077, 15442, null], [15442, 18124, null], [18124, 18964, null], [18964, 22152, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 22152, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 22152, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 22152, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 22152, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 22152, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 22152, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 22152, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 22152, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 22152, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 22152, null]], "pdf_page_numbers": [[0, 2719, 1], [2719, 5122, 2], [5122, 6811, 3], [6811, 9548, 4], [9548, 13077, 5], [13077, 15442, 6], [15442, 18124, 7], [18124, 18964, 8], [18964, 22152, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 22152, 0.0]]}
olmocr_science_pdfs
2024-12-07
2024-12-07
f1554ab6fe5103a43639ed3df5e90583632d67c8
Abstract The SAS programming language has a rich “tool-box” of features that can offer a lot of power to the user. The use of macro variables and macro code is difficult to learn without some training. This workshop will introduce the user to a few of the very powerful techniques possible using macro variables and macro programming. The user will also see examples that are easy to understand. Some of the topics to be covered include: 1. What is a macro variable and what does it do? 2. Examples of some of the standard SAS macro variables 3. How the SAS macro processor handles macro variables 4. Passing information to other steps in a program using macro variables 5. What is a macro? 6. Creating and invoking macro code 7. How to "conditionally" run SAS steps based on the logic in your program 8. Changes and Enhancements to the macro language in Version 7 & 8 Introduction This paper corresponds to the hands-on workshop presented at SUGI. The SAS macro facility can be somewhat daunting due to its complexity and comprehensive nature. However considerable benefit can be gained by using some of the simple features of the facility along with an introductory understanding of macro structures and timing issues. This paper and the workshop will attempt to start that understanding. SAS Macro Overview The SAS Macro facility constructs source programs to be input to the SAS compiler just as pressing keys does when we write a program. Some functions of the SAS macro processor are to pass symbolic values between SAS statements and steps, to establish default symbolic values, to conditionally execute SAS steps, and to hopefully invoke very long, complex code in a quick, short way. It should be noted that the MACRO PROCESSOR is the SAS system module that processes macros and the MACRO LANGUAGE is how you communicate with the processor. Traditional SAS Programming Without macros, things that you cannot easily do are to substitute text in statements like TITLEs, to communicate across SAS steps, to establish default values, to conditionally execute SAS steps, and to hide complex code that can be invoked easily. The macro facility will allow us to do the above and more. Traditional Flow Without Macros Without macros, SAS programs are DATA and PROC steps. The program is scanned one statement at a time looking for the beginning of step (step boundary). When the beginning of step is found, all statements in the step are compiled one at a time until end of step is detected. When the end of step is found (the next step boundary), the previous step executes. SAS Step Boundaries The following keywords are step boundaries to the SAS system: - DATA ENDSAS - PROC LINES - CARDS LINES4 - CARDS4 PARMCARDS - DATALINES QUIT - DATALINES4 RUN RUN acts as an explicit step boundary in most PROCs. It is highly recommended that the RUN statement be coded, as there then no question to when compile finishes. The SAS Macro Language The Macro Language is a second SAS programming language for string manipulation. Characteristics of the language are: - strings are sequences of characters - all input to the macro language is a string - usually strings are SAS code, but they don’t need to be - the macro processor manipulates strings and may send them back for scanning. Macro Language Components The macro language has several kinds of components. Macro variables: - are used to store and manipulate character strings - follow SAS naming rules - are NOT the same as DATA step variables - are stored in memory in a macro symbol table. Macro statements: - begin with a % and a macro keyword and end with semicolon (;) - assign values, substitute values, and change macro variables - can branch or generate SAS statements conditionally. Macro Processor Flow Macro statements are given to the macro processor BEFORE the compiler where substitution may occur. - Macro statements start with %. - Macro variables are referred to with &. A Macro Problem Problem: You would like to have the Day of Week and current date appear in a title, but SAS titles are text, not variables. Solution: Use some system macro variables. PROC PRINT DATA=DEPTSALE; TITLE "Department Sales as of &SYSDAY &SYSDATE"; TITLE2 "Deliver to Michael O'Malley"; RUN; It should be noted that macro variables are NOT resolved within single quotes. Automatic Macro Variables A partial list of automatic macro variables and their usage are: - SYSBUFFR: text entered in response to %INPUT - SYSCMD: last non-SAS command entered - SYSDATE: current date in DATE6. or DATE7. format - SYSDAY: current day of the week - SYSDEVIC: current graphics device - SYSDSN: last dataset built (i.e., WORK.SOFTSALE) - SYSENV: SAS environment (FORE or BACK) - SYSFILRC: whether last FILENAME executed correctly - SYNSINDEX: number of macros started in job - SYSINFO: system information given by some PROCS - SYSJOBID: name of executing job or user - SYSLAST: last dataset built (i.e., WORK.SOFTSALE) - SYSLIBRC: return code from last LIBNAME statement - SYSLCCKRC: whether most recent lock was successful - SYSMENV: macro execution environment - SYSMSGR: message displayed with %DISPLAY - SYSPPARM: value passed from SYSPARM in JCL - SYSPROD: indicates whether a SAS product is licensed - SYSPRC: all macro parameters passed - SYSTIME: starting time of job - SYSVER: SAS version Another example: FOOTNOTE "THIS REPORT WAS RUN ON &SYSDAY, &SYSDATE"; Resolves to: FOOTNOTE "THIS REPORT WAS RUN ON FRIDAY, 26MAR99"; Displaying Macro Variables The %PUT statement can display individual or all macro variables to the log at compile time. Macro variables are prefixed with & and the special variable _ALL_ can display all known macro variables. Any other text is displayed unchanged. Example: DATA NEWPAY; INFILE DD1; INPUT EMP$ RATE; RUN; %PUT ***** &SYSDATE *****; Partial SAS Log: ***** 26MAR99 ***** Displaying All Macro Variables %PUT _ALL_; Partial SAS Log: GLOBAL MBILLYR 99 GLOBAL SSODEV C AUTOMATIC AFPSID 0 AUTOMATIC AFDSNAME AUTOMATIC AFLIB AUTOMATIC AFSTR1 AUTOMATIC AFSTR2 AUTOMATIC APBPDV AUTOMATIC SYSHUFFR AUTOMATIC SYSCMD AUTOMATIC SYSDATE 26MAR99 AUTOMATIC SYSDAY Tuesday Partial SAS LOG Continued AUTOMATIC SYSDSN _NULL_ AUTOMATIC SYSENV FORE AUTOMATIC SYSERR 0 AUTOMATIC SYSPARM AUTOMATIC SYSRC 0 AUTOMATIC SYSSCP WIN AUTOMATIC SYSSCPL WIN_32S AUTOMATIC SYSSET 0011485002 AUTOMATIC SYSTIME 10:35 AUTOMATIC SYSVER 6.11 AUTOMATIC SYSVLONG 6.11.0040P030596 Another Macro Problem You reference a SAS datasetname several times in a SAS job. DATA PAYROLL; INPUT EMP$ RATE; DATALINES; TOM 10 JIM 10 ; PROC PRINT DATA=PAYROLL; TITLE "PRINT OF DATASET PAYROLL"; RUN; Question: How can you change the name quickly in one place only and have the datasetname appear in a title? Solution: Use a user defined macro variable. Characteristics: - You can define macro variables with %LET. - You refer to the variables later with &variable. - Macro will substitute value for all occurrences of &variable. Syntax: %LET variable=value; Example: %LET NAME=PAYROLL; DATA &NAME; INPUT EMP$ RATE; DATALINES; TOM 10 JIM 10 ; PROC PRINT DATA=&NAME; TITLE "PRINT OF DATASET &NAME"; RUN; The Generated SAS Code DATA PAYROLL; INPUT EMP$ RATE; DATALINES; TOM 10 JIM 10 ; PROC PRINT DATA=PAYROLL; TITLE "PRINT OF DATASET PAYROLL"; RUN; Note that because Macro variables are not resolved within single quotes, the double quote character is used and that leading and trailing spaces are discarded. To assign a new value, code another %LET statement. %LET NAME=NEWPAY; DATA &NAME; INPUT EMP$ RATE; DATALINES; TOM 10 JIM 10 ; PROC PRINT DATA=&NAME; TITLE "PRINT OF DATASET &NAME"; RUN; The Generated SAS Code DATA NEWPAY; INPUT EMP$ RATE; DATALINES; TOM 10 JIM 10 ; PROC PRINT DATA=NEWPAY; TITLE "PRINT OF DATASET NEWPAY"; RUN; When assigning special characters (especially semicolon) the %STR function allows values with ; etc. %LET NAME=NEWPAY; %LET CHART=%STR(PROC CHART;VBAR EMP;RUN;); DATA &NAME; INPUT EMP$ RATE; DATALINES; TOM 10 JIM 10 ; &CHART PROC PRINT DATA=&NAME; TITLE "PRINT OF DATASET &NAME"; RUN; The Generated SAS Code DATA NEWPAY; INPUT EMP$ RATE; DATALINES; TOM 10 JIM 10 ; PROC CHART;VBAR EMP;RUN; PROC PRINT DATA=NEWPAY; TITLE "PRINT OF DATASET NEWPAY"; RUN; Nesting of Macro Variables is allowed by having macro variables contain references to other macro variables. %LET NAME=NEWPAY; %LET CHART=%STR(PROC CHART DATA=&NAME;VBAR EMP;RUN;); DATA &NAME; INPUT EMP$ RATE; DATALINES; TOM 10 JIM 10 ; &CHART PROC PRINT DATA=&NAME; TITLE "PRINT OF DATASET &NAME"; RUN; The Generated SAS Code DATA NEWPAY; INPUT EMP$ RATE; DATALINES; TOM 10 JIM 10 ; PROC CHART DATA=NEWPAY;VBAR EMP;RUN; PROC PRINT DATA=NEWPAY; TITLE "PRINT OF DATASET NEWPAY"; RUN; Other Macro Debugging Options SAS gives several system options that control log output. - SYMBOLGEN/NOSYMBOLGEN controls display of variable resolution - MPRINT/NOMPRINT displays generated statements given to the compiler - MLOGIC/NOMLOGIC displays tracing information during macro execution. What is a Macro? More than just macro variables and text, a SAS macro contains stored text that can be inserted anywhere in a SAS program and expanded including: - constants such as literals, variables, names, and statements - assignments to macro variables - macro programming statements - macro language functions - invocations of other functions - nested macro definitions - LOGIC to conditionally generate SAS code. Defining and Using Macros %MACRO and %MEND define macros. %mroname will invoke it later. Example: Define a macro to run PROC CHART and later invoke %MACRO CHART; PROC CHART DATA=&NAME; VBAR EMP; RUN; %MEND; Invoking the Chart Macro %LET NAME=NEWPAY; DATA &NAME; INPUT EMP$ RATE; DATALINES; TOM 10 JIM 10 ; RUN; &MCHART PROC PRINT DATA=&NAME; TITLE "PRINT OF DATASET &NAME"; RUN; The Generated Code DATA NEWPAY; INPUT EMP$ RATE; DATALINES; TOM 10 JIM 10 ; PROC CHART DATA=NEWPAY;VBAR EMP;RUN; PROC PRINT DATA=NEWPAY; TITLE "PRINT OF DATASET NEWPAY"; RUN; Positional Macro Parameters Macro parameters are defined in order after the macro name. Keyword parameters can also be defined using = . Keywords can be specified in any order and they can also set default values. ```sas %MACRO CHART(NAME,BARVAR); PROC CHART DATA=&NAME; VBAR &BARVAR; RUN; %MEND; %CHART(PAYROLL,EMP) ``` Resolves to: ```sas PROC CHART DATA=PAYROLL; VBAR EMP; RUN; ``` Nested Macros can be utilized when one macros calls another. ```sas %MACRO CHART(NAME,BARVAR); PROC CHART DATA=&NAME; VBAR &BARVAR; RUN; %MEND; %MACRO PTCHART(NAME,BARVAR); %CHART(PAYROLL,EMP) PROC PRINT DATA=&NAME; TITLE "PRINT OF DATASET &NAME"; RUN; %MEND; %PTCHART(PAYROLL,EMP) ``` The Generated SAS Code ```sas PROC CHART DATA=PAYROLL; VBAR EMP; RUN; PROC PRINT DATA=PAYROLL; TITLE "PRINT OF DATASET PAYROLL"; RUN; ``` Conditional Macro Compilation One of the most useful features of a macro, is that the programmer can use %IF and other statements to conditionally pass code to the compiler. While the DATA step has IF statements, %IF is the only practical way to run a PROC some of the time. Example: Run PROC PRINT only if PRTCH=YES. ```sas %MACRO PTCHT(PRTCH,NAME,BARVAR); %IF &PRTCH=YES %THEN %DO; PROC PRINT DATA=&NAME; TITLE "PRINT OF DATASET &NAME"; END; PROC CHART DATA=&NAME; VBAR &BARVAR; RUN; %MEND; %PTCHT(YES,PAYROLL,EMP) ``` The Generated SAS Code ```sas PROC PRINT DATA=PAYROLL; TITLE "PRINT OF DATASET PAYROLL"; RUN; PROC CHART DATA=PAYROLL; VBAR EMP; RUN; ``` Interactive Macro Invocation %DO can also vary a value. Example: Run PROC PRINT &PRTNUM times. ```sas %MACRO PRMAC(PRTNUM,NAME); %DO I= 1 %TO &PRTNUM; PROC PRINT DATA=&NAME&I; TITLE "PRINT OF DATASET &NAME&I"; RUN; %END; %MEND; %PRMAC(4,PAYROLL) ``` The Generated SAS Code ```sas PROC PRINT DATA=PAYROLL1; TITLE "PRINT OF DATASET PAYROLL1"; RUN; PROC PRINT DATA=PAYROLL2; TITLE "PRINT OF DATASET PAYROLL2"; RUN; PROC PRINT DATA=PAYROLL3; TITLE "PRINT OF DATASET PAYROLL3"; RUN; PROC PRINT DATA=PAYROLL4; TITLE "PRINT OF DATASET PAYROLL4"; RUN; ``` SAS DATA Step Interfaces The SYMGET function and SYMPUT call routine can transfer values between macro variables and the SAS Program Data Vector when the DATA step executes. This allows SAS steps to communicate to each other through macro variables and allows us to combine the power of the macro language, the DATA step, and the SAS procs together in our programs. Because the statements transfer values at EXECUTION time, macro variables created with SYMPUT, can be referenced via & in the NEXT step or later. Example: Display the number of observations in a dataset in a title. ```sas %MACRO OBSCOUNT(NAME); DATA _NULL_; SET &NAME NOBS=OBSOUT; CALL SYMPUT('MOBSOUT',OBSOUT); STOP; RUN; %MEND; %OBSCOUNT(PAYROLL) ``` The Generated SAS Code ```sas DATA _NULL_; SET PAYROLL NOBS=OBSOUT; CALL SYMPUT('MOBSOUT',OBSOUT); STOP; RUN; ``` Hands-on Workshops A SAS Macro Application Problem: Each day you read a SAS dataset containing data from counties in Wisconsin. Anywhere between 1 and 72 counties might report that day. Do the following: 1. Create a separate dataset for each reporting county. 2. Produce a separate PROC PRINT for each reporting county. 3. In the TITLE print the county name. 4. Reset the page number to 1 at the beginning of each report. 5. In a footnote print the number of observations processed for each county. Question: How do you do it? Solution: A Data Step and a SAS Macro. The data step goes through the data and: - counts counties - counts observations per county, puts in macro variables - puts county names into macro variables - puts total counties reporting into a macro variable. The Data Step Code DATA _NULL_; SET COUNTYDT END=EOF; /* READ SAS DATASET */ BY COUNTYNM; /* SORT SEQ */ IF FIRST.COUNTYNM THEN; /* NEW COUNTY? */ NUMCTY=1; /* ADD 1 TO NUMCTY */ CTYOBS=0; /* OBS PER CTY TO 0 */ END; CTYOBS=1; /* ADD 1 OBS FOR CTY */ IF LAST.COUNTYNM THEN; /* LAST CTY, MK MACvar */ CALL SYMPUT('MOBS'||LEFT(PUT(NUMCTY,3.)),LEFT(CTYOBS)); CALL SYMPUT('MCTY'||LEFT(PUT(NUMCTY,3.)),COUNTYNM); END; IF EOF THEN CALL SYMPUT('MTOTCT',NUMCTY); /* tot no of cty's */ PUT *** MTOTCT=MTOTCT; /* DISPLAY #OF CTYS */ If you prefer, PROC SQL can be used to produce the same results. PROC SQL NOPRINT; SELECT LEFT(PUT(COUNT(DISTINCT COUNTYNM),3.)) INTO:MTOTCT FROM COUNTYDT; SELECT DISTINCT COUNTYNM || EACH CTY NAME INTO:CTYNAME||CTYNAME FROM COUNTYDT; SELECT COUNT(*) INTO:MOBS1-:MOBSMTOTCT FROM COUNTYDT GROUP BY COUNTYNM; PUT *** MTOTCT=MTOTCT; /* DISPLAY NO OF CTYS */ We can now write a macro to loop through the macro variables and produce the necessary proc steps. %MACRO COUNTYM; /* MACRO START */ %DO I=1 %TO MTOTCT; /* LOOP THRU ALL CTYS */ %PUT *** LOOP &I OF &MTOTCT; /* DISPLAY PROGRESS */ %PUT *** MTOTCT=MTOTCT; /* PROC PRINT DATA-COUNTYDT */ %PUT *** MTOTCT=MTOTCT; /* PROC PRINT */ WHERE COUNTYNM="&MTOTCT"; /* GENERATED WHERE */ OPTIONS PAGENO=1; /* RESET PAGENO */ TITLE "REPORT FOR COUNTY &MTOTCT"; /* TITLE & FOOTNOTES */ FOOTNOTE "TOTAL OBSERVATION COUNT WAS &MOBSMTOTCT"; RUN; %END; %MEND COUNTYM; /* END OF %DO */ %COUNTYM /* INVOKE MACRO */ The Generated Code *** MTOTCT=3 *** LOOP 1 OF 3 PROC PRINT DATA=COUNTYDT; WHERE COUNTYNM="ASHLAND"; OPTIONS PAGENO=1; TITLE "REPORT FOR COUNTY ASHLAND"; FOOTNOTE "TOTAL OBSERVATION COUNT WAS 3"; RUN; *** LOOP 2 OF 3 PROC PRINT DATA=COUNTYDT; WHERE COUNTYNM="BAYFIELD"; OPTIONS PAGENO=1; TITLE "REPORT FOR COUNTY BAYFIELD"; FOOTNOTE "TOTAL OBSERVATION COUNT WAS 2"; RUN; *** LOOP 3 OF 3 PROC PRINT DATA=COUNTYDT; WHERE COUNTYNM="WASHINGTON"; OPTIONS PAGENO=1; TITLE "REPORT FOR COUNTY WASHINGTON"; FOOTNOTE "TOTAL OBSERVATION COUNT WAS 1"; RUN; If a SAS user understands where all of the structures are stored in the above example, and when each activity occurs, a good understanding of macros exists. This type of application can be used as a template for lots of different SAS problems. Example: A very common problem is to run a proc against all members of a SAS library. The following program produces a SAS dataset containing an observation for each variable within each dataset in the library. A PROC PRINT can display it’s values. PROC CONTENTS DATA=WORK._ALL_ NOPRINT OUT=CONTOUT; PROC PRINT DATA=CONTOUT; VAR LIBNAME MEMNAME NAME; RUN; Could we write a SAS macro that will generate a separate PROC PRINT of all members in the library with an appropriate title, noting that we want to produce one print per member, not one per variable? Yes: DATA ONEMEM; SET CONTOUT END=EOF; BY MEMNAME; IF LAST.MEMNAME; KTR+1; CALL SYMPUT ('MMEM'||LEFT(PUT(KTR,5.)),MEMNAME); IF EOF; CALL SYMPUT ('MTOTOBS',LEFT(PUT(KTR,5.))); /* LAST MEMNAME */ RUN; %MFLATOUT=MPREFIX&MMEMNAME..DAT, /* FLATFILE OUT */ MPREFIX=&SYSPREF.., /* OUT PREF, OR DIR OUT */ %MEND PRTLOOP; %MDO I = 1 %TO MTOTOBS; %MACRO PRTLOOP; %PUT *** MTOTOBS=MTOTOBS; /* PROC PRINT DATA=&MEMNAME; */ TITLE "&MEMNAME"; RUN; %MEND; %MEND PRTLOOP; %MPTLOOP The SSCFLAT Macro A general purpose macro that: - converts any SAS ds to a comma delimited file for input to spreadsheets etc. - will run on all platforms - automatically reads dictionary tables to get ds definition - honors SAS formatting - can create a header line - is available for the asking - demonstrates many of the topics covered. SSCFLAT Macro Partial Source %MFLATOUT=MPREFIX&MEMNAME..DAT, /* FLATFILE OUT */ %MDO I=1 %TO MFLATOUT; /* INPUT SAS DS (REQUIRED */ %MEND PRTLOOP; /* OUT PREF, OR DIR OUT */ %MFLATOUT=MPPREFIX&MEMNAME..DAT, /* FLATFILE OUT */ MHHEADER=YES, /*FIELD NAMES IN FIRST REC*/ MLIST=YES, /*PRINT FLAT FILE IN LOG?*/ MTRIMNUM=YES, /*TRIM NUM TRAIL BLANKS? */ MTRACE=NO, /*DEBUGGING OPTION */ MISSING=",.", /*MISSING VALUE CHARACTER*/ MLRECL=6160, /*LARGEST RECORD LENGTH*/ MVSOPT=UNIT=3390, /*MVS UNIT OPTIONS*/ MSPACE=1, /*MVS SPACE IN CYLS*/ A SSCFLAT Macro Example Convert a SAS file to a CSV file. %INC 'insert file ref\sscflat.sas.'; %SSCFLAT (MSASDS=WORK.ADDRDATA, mprefix=c:\temp) *invoke macro; Creates a file called c:\temp\addrdata.dat that is now available for download and/or import to spreadsheets, etc. Anyone interested in the above macro, or with any questions or comments can contact us as shown below. Conclusion The SAS macro facility gives the SAS programmer the ability to introduce logic in the generation of dynamic SAS programs by utilizing this second programming language. The price for this feature is a more complex program with more detail to timing and structures required. Contact Information Your comments and questions are valued and encouraged. Contact the author at: Steven First Systems Seminar Consultants 2997 Yarmouth Greenway Drive Madison, WI 53716 608 278-9964 x 302 voice 608 278-0065 fax sfirst@sys-seminar.com www.sys-seminar.com
{"Source-Url": "https://support.sas.com/resources/papers/proceedings/proceedings/sugi26/p153-26.pdf", "len_cl100k_base": 5183, "olmocr-version": "0.1.53", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 18018, "total-output-tokens": 5907, "length": "2e12", "weborganizer": {"__label__adult": 0.0001888275146484375, "__label__art_design": 0.0002791881561279297, "__label__crime_law": 0.00018906593322753904, "__label__education_jobs": 0.0024662017822265625, "__label__entertainment": 6.282329559326172e-05, "__label__fashion_beauty": 8.398294448852539e-05, "__label__finance_business": 0.0004210472106933594, "__label__food_dining": 0.00020802021026611328, "__label__games": 0.00030732154846191406, "__label__hardware": 0.0006284713745117188, "__label__health": 0.0001760721206665039, "__label__history": 0.00011980533599853516, "__label__home_hobbies": 8.857250213623047e-05, "__label__industrial": 0.0003693103790283203, "__label__literature": 0.00011479854583740234, "__label__politics": 0.00011879205703735352, "__label__religion": 0.00024235248565673828, "__label__science_tech": 0.007965087890625, "__label__social_life": 0.00010079145431518556, "__label__software": 0.04620361328125, "__label__software_dev": 0.93896484375, "__label__sports_fitness": 0.00014901161193847656, "__label__transportation": 0.00022983551025390625, "__label__travel": 0.00014519691467285156}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 19009, 0.02503]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 19009, 0.45729]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 19009, 0.72279]], "google_gemma-3-12b-it_contains_pii": [[0, 3955, false], [3955, 7271, null], [7271, 10143, null], [10143, 13015, null], [13015, 17698, null], [17698, 19009, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3955, true], [3955, 7271, null], [7271, 10143, null], [10143, 13015, null], [13015, 17698, null], [17698, 19009, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 19009, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 19009, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 19009, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 19009, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 19009, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 19009, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 19009, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 19009, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 19009, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 19009, null]], "pdf_page_numbers": [[0, 3955, 1], [3955, 7271, 2], [7271, 10143, 3], [10143, 13015, 4], [13015, 17698, 5], [17698, 19009, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 19009, 0.0]]}
olmocr_science_pdfs
2024-12-10
2024-12-10
e3fa1cb858fb3a99818e4e6e144f310e29a8213a
[REMOVED]
{"Source-Url": "https://portal.research.lu.se/ws/files/5489334/2837272.pdf", "len_cl100k_base": 5206, "olmocr-version": "0.1.50", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 16460, "total-output-tokens": 6831, "length": "2e12", "weborganizer": {"__label__adult": 0.0007476806640625, "__label__art_design": 0.0012493133544921875, "__label__crime_law": 0.0007867813110351562, "__label__education_jobs": 0.0011034011840820312, "__label__entertainment": 0.00016236305236816406, "__label__fashion_beauty": 0.0004215240478515625, "__label__finance_business": 0.0012035369873046875, "__label__food_dining": 0.000946044921875, "__label__games": 0.0008935928344726562, "__label__hardware": 0.006439208984375, "__label__health": 0.000782012939453125, "__label__history": 0.0005135536193847656, "__label__home_hobbies": 0.0003132820129394531, "__label__industrial": 0.041473388671875, "__label__literature": 0.00034332275390625, "__label__politics": 0.0005135536193847656, "__label__religion": 0.0012102127075195312, "__label__science_tech": 0.2366943359375, "__label__social_life": 0.00015044212341308594, "__label__software": 0.0540771484375, "__label__software_dev": 0.64599609375, "__label__sports_fitness": 0.0006399154663085938, "__label__transportation": 0.0029125213623046875, "__label__travel": 0.0003845691680908203}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 29431, 0.04667]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 29431, 0.34706]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 29431, 0.88719]], "google_gemma-3-12b-it_contains_pii": [[0, 1395, false], [1395, 6163, null], [6163, 11000, null], [11000, 16442, null], [16442, 20604, null], [20604, 23716, null], [23716, 29431, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1395, true], [1395, 6163, null], [6163, 11000, null], [11000, 16442, null], [16442, 20604, null], [20604, 23716, null], [23716, 29431, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 29431, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 29431, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 29431, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 29431, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 29431, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 29431, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 29431, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 29431, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 29431, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 29431, null]], "pdf_page_numbers": [[0, 1395, 1], [1395, 6163, 2], [6163, 11000, 3], [11000, 16442, 4], [16442, 20604, 5], [20604, 23716, 6], [23716, 29431, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 29431, 0.0]]}
olmocr_science_pdfs
2024-11-30
2024-11-30
44eb87e4a513b35d7074d20fdac66892e3b3f60a
The Affordance Template ROS Package for Robot Task Programming Stephen Hart\textsuperscript{1} and Paul Dinh\textsuperscript{2} and Kimberly Hambuchen\textsuperscript{3} Abstract—This paper introduces the Affordance Template ROS package for quickly programming, adjusting, and executing robot applications in the ROS RViz environment. This package extends the capabilities of RViz interactive markers [1] by allowing an operator to specify multiple end-effector waypoint locations and grasp poses in object-centric coordinate frames and to adjust these waypoints in order to meet the run-time demands of the task (specifically, object scale and location). The Affordance Template package stores task specifications in a robot-agnostic XML description format such that it is trivial to apply a template to a new robot. As such, the Affordance Template package provides a robot-generic ROS tool appropriate for building semi-autonomous, manipulation-based applications. Affordance Templates were developed by the NASA-JSC DARPA Robotics Challenge (DRC) team and have since successfully been deployed on multiple platforms including the NASA Valkyrie and Robonaut 2 humanoids, the University of Texas Dreamer robot and the Willow Garage PR2. In this paper, the specification and implementation of the affordance template package is introduced and demonstrated through examples for wheel (valve) turning, pick-and-place, and drill grasping, evincing its utility and flexibility for a wide variety of robot applications. I. INTRODUCTION Recent advances in human-robot interface design have led to a number of useful tools for interacting with complex systems, such as humanoid robots. Specifically, the abundance of RGBD and LIDAR devices have resulted in the development of 3D visualizations of robot environments that reflect the state of the robot in a virtual space with the aggregate data delivered by these devices. One such tool is RViz, which enables seamless use with the Robot Operating System (ROS) environment while providing extensible interfaces for both visualization and robot control. While RViz delivers a significant amount of off-the-shelf situational awareness to a human supervisor with a point-and-click interface for teleoperation [1], it does not inherently provide a standard tool for directing robots to accomplish more complex tasks that require extended sequences of commands. The Affordance Template framework, briefly introduced in [2], was developed to provide such task-level structure. This work was supported by the DARPA Robotics Challenge and the NASA Human Robotics Systems project. Special thanks to the UT Austin HCRL lab, Brown University’s RLAB, and David Lu!! for their support in this work. An affordance describes a place or object in the world that affords an action by a particular agent. If an area of the perceived environment affords “sitting,” it is not that there is a chair, but rather that it has a surface upon which that agent could sit, whether it be a chair, a stool, a rock, or the ground. The concept of affordances was initially introduced in the psychological literature by Gibson [3] as a means of describing cognitive structures that assign functional merit to the environment. It is therefore conceptually applicable for programming robots, embodied agents that must perform actions to achieve some discernible objective, where an operator (or a robot itself) can similarly assign such functionality to discernible areas in observed sensor data. An affordance template is a computational construct that exists in a graphical 3D immersive environment to provide human-adjustable robot task goals and parameters in object-centric coordinate frames. If a template is placed in such an environment alongside a robot avatar and its aggregate sensory data, a supervisor can move the template to an appropriate location—that which is hypothesized to afford the task behavior—and adjust the template goals and parameters as needed according to the perceived current run-time context. Template parameters capture the key degrees of freedom of the task in an efficient representation making them useful tools for shared autonomy between an operator and a robot and suitable for control over unreliable and/or unknown networks or in scenarios where degraded communications persist. The Affordance Template (AT) package is an attempt to standardize application programming for robots with one or more manipulator end-effectors. Unlike the de facto standard ROS-compatible packages for robot navigation [4], motion planning [5], computer vision (OpenCV), or 3D perception (PCL), affordance templates exist on-top of these tools, integrating such functionality as needed. While the current release incorporates only the MoveIt! package, ongoing work seeks to extend the framework to robot navigation, both wheeled and legged, and to integrate it with autonomous perception to alleviate run-time operator adjustments of RViz task parameters. These topics, and others, will be discussed in more detail in Section VI. In the remainder of the paper, the current release of the AT package is described along with some motivating examples showing its utility in various II. RELATED WORK J.J. Gibson initially proposed the “theory of affordances,” suggesting that organisms perceive their environment in terms of their ability to interact with it [3]. It is thus a natural area of study for embodied learning agents. Applying this theory to robotics, researchers have examined how a robot can learn affordances for pushing and grasping objects [6], tool use [7], and navigation [8]. More generally, various researchers have modeled affordances probabilistically in terms of likely effect of robot behavior [9], as planning operators that can be used in extended sequences of manipulation tasks [10], or in collections that can be acquired through intrinsically motivated reinforcement learning [11], [12]. This work focuses on computationally modeling affordances and is interesting from a theoretical perspective, but automatic recognition of a robot’s affordances remains an area of ongoing research. The affordance templates introduced in this paper follow a more pragmatic approach that takes inspiration from the theory, but provides a human-in-the-loop solution: allow an operator to assess a robot’s environment through its sensor data and assign affordances manually to bootstrap application and task programming. A number of large-scale projects have focused on building rich and general application tools and libraries so that developers do not always have to start from scratch to integrate functionality developed by the community. In particular, Matlab Robotics Toolkit [13], Microsoft Robotics Developer’s Studio [14], BRICS [15], ROS [16], YARP [17], and OPRoS [18] have supported a variety of cross-language and cross-platform tools that promote building libraries of functionality and the best practices of component-based software design. These projects often include GUI tools to manage and configure deployed components. ROSCo [19], in conjunction with SMACH [20] provide ROS-based utilities for developing and deploying ROS-based hierarchical applications, but are limited in their ability to modify task structure at run-time. Robot Task Commander (RTC), provides a similar IDE for application development for use with multiple middlewares, but development still requires a certain amount of expert, domain knowledge [21]. These utilities largely remain engineering tools, more useful for a priori application development, not flexible tools that allow non-experts to program or adjust applications on-line. Such an approach suggests a more shared level of programming where the robot can provide a level of expertise (either pre-programmed or acquired through experience) for decision-making or to handle more of the fine-details of a task, alleviating the load on the operator. Shared autonomy approaches to robotic operation have become favored methods owing to the desired semi-autonomous nature of many systems. Pitzer et al. describe a shared autonomy system in which a human operator assists a robot with manipulation tasks by perceiving and detecting objects in the robot’s environment [22]. Witzig et al. demonstrate a shared autonomy approach to grasp planning in which the human operator provides contextual information that the robot cannot perceive [23]. Shared autonomy grasping has been demonstrated with RViz interactive markers by Gossow et al. [1]; however, the most interaction the human has with the system is either adjusting single-grasp locations or confirming a location is acceptable. Both the MIT and IHMC DRC teams used similar methods to the AT framework. MIT developed the Object Template Description Format to direct their user interface [24]. This format provides a representation suitable for use by a human in the shared control of the ATLAS robot. The human operator uses this format to perform “affordance fitting” on their interface, which can also be done autonomously by the robot using its perceptual data. Interactivity is flexible for the operator, providing different levels of shared control. IHMC used a “coactive design” approach that integrates with their visualization tool [25]. This approach provides a similar user interface to ATs to allow for shared autonomy by combining human perception of visualized data and robot planning of mobility and grasping. However, neither of these methods provide a level of adjustment and interactivity that the AT framework can provide, which increases the flexibility of both human operation and robot task activity, nor are they provided as general purposes tool that are readily available for use with other robots (at this point). However, the MIT and IHMC approaches demonstrate a convergence of user interface methods for shared autonomy between human and robots that make the contribution of an open-source tool such as the Affordance Template ROS package timely. III. AFFORDANCE TEMPLATES This section describes the Affordance Template framework and details the components within. Figures 1—2 provide a motivating example for the framework in which a wheel-turning template (Figure 1) is registered to the NASA-JSC Valkyrie robot’s sensory data in order to have it turn a valve. In Figure 2(a), the NASA-JSC Valkyrie robot is shown standing in front of a valve. In (b), the RViz display window shows the robot avatar and the point cloud data received from Valkyrie’s head-mounted Ensenso sensor. From this view, an operator can clearly identify the valve in the robot’s workspace, and can manually register the wheel template to the location of the valve, as seen in (c), adjusting its size as necessary via a slider in a custom RViz panel (not shown). Additionally, the wheel template allows the operator to use RViz interactive markers to adjust the hand pre-grasp, grasp, and turn-goal waypoint locations (shown as different colored end-effector overlays, and defined in the coordinate frame of the wheel). When the goal locations are set, as in (d), the corresponding robot arm trajectories can be viewed in RViz to provide user feedback on what the robot’s movement will look like, if a path is found. These trajectories are computed using MoveIt! When the operator is satisfied with the displayed trajectories the RViz panel can be used to execute these trajectories—one or multiple waypoints at a time, forwards or backwards. Figure 4 shows Valkyrie using the template to turn a valve. A. Structure The structure of an affordance template is shown in Figure 4(a). Each affordance template, \( a \in A \), is a directed acyclic graph of display objects, \( O_{\text{obj}} \), and ordered sequences of end-effector waypoints, \( W_{ee} \), expressed in coordinate frames defined by the display objects. Each sequence of waypoints represents a set of end-effector configurations that, when followed, achieve the AT’s intended task. For each template there must be one object \( o_{\text{root}} \in O_{\text{obj}} \), designated the “root” object of the template, with a coordinate frame \( F_{\text{root}} \) expressed in the robot frame, and some set (possibly empty) of child objects arranged in a tree structure descending from that root object. As the root object is defined such that it has no incoming edges, each \( a \) forms a rooted tree. Every \( wp \in W_{ee} \) also has a single parent object in \( O_{\text{obj}} \) and corresponding Cartesian pose \( (obj_p_{wp}, obj_R_{wp}) \) expressed in the coordinate frame of this parent object. Each display object may also have a shape associated with it. In practice, this shape can be a primitive shape such as a box or cylinder, or a mesh shape in the form of an STL or Collada model. The relationship between display objects and waypoints in \( a \) thus described represents the core structure of the AT. The details about object scales, template location, and how the end-effector waypoints map to specific robot control groups must be determined upon instantiation of each template. Specifically, each end-effector waypoint, \( wp \), has an abstract ID associated with it (for convenience chosen to be in the set of natural numbers \( \mathbb{N} \)), that represents its corresponding robot end-effector, a sequence ID, and a grasp pose. For example, if a particular template is to be applied to a bi-manual system, such as Valkyrie, the waypoints in that template are assigned an end-effector ID of “0” or “1”, the former mapping to the robot’s left hand, the latter to its right. The grasp poses will similarly map to common configurations such as “hand closed” or “hand open.” In Figure 4(a) each waypoint is labeled as \( \text{wp}_<\text{ee_id}>;<\text{seq_id}> \), where \( <\text{ee_id}> \) is the end-effector ID, and \( <\text{seq_id}> \) is the ID of that waypoint in the ordered sequence for that end-effector. When enabling a robot to be used in the AT framework, a robot configuration file (as described below) needs to be constructed that defines the mappings between abstract IDs and the end-effector groups and grasp poses. ![Figure 4](image-url) Finally, a key advantage of the affordance template methodology is that parameters can be scaled at run time to allow the more intuitive ability of overalying objects onto (possibly variable) shapes in the robot’s environment. Scaled parameters include the sizes of display objects and the distance between these objects and their children. A template, such as the wheel template introduced in Figure 1, can be scaled and positioned by the operator to allow it to be used for a large class of turning tasks with minimal effort. The strategy for scaling is shown in Figure 4(b). As the operator adjusts the overall scale $s_{obj}$ of an object, the magnitude of the vector pointing to the coordinate frame of any waypoint expressed in the frame of that object, $^{obj}_{wpt}$, is scaled accordingly. This strategy is used to adjust the location of child display objects, as well as waypoint goals, when the parent object is scaled. B. Implementation Architecture The implementation of the AT package is structured as seen in Figure 5. An affordance template server ROS node loads the available templates and robot configurations stored in libraries on disk, and sends this information to a custom RViz panel over ZeroMQ (ZMQ) [26] using JSON data structure<sup>2</sup>. From the RViz panel, an operator can choose which template they want to use and for what robot. This information is sent back to the server accordingly, which then instantiates a new template as a Python class, running as a separate process within the ROS node. This instantiated class uses the mappings defined in the robot configuration file to display RViz interactive markers for the display objects and robot end-effectors at the locations and in the configurations defined by the template. This process is what allows the instantiation of the wheel-turning AT shown in Figure 1 to display the white wheel at the center and the displays of Valkyrie’s hands in the open and closed configurations at the specified waypoint locations (for grasping and turning the wheel). Once the template is instantiated in RViz, the operator can then interact with it, moving it to the desired location, scaling any display objects as necessary, and adjusting the locations of the end-effector waypoints. When configured satisfactorily, MoveIt! generated JointTrajectory messages are computed and sent to the robot in order to follow the waypoint trajectories at the operator’s discretion (from the panel to the server to the template). If the operator wishes to modify template or robot configuration parameters, updated information can be sent back to the server to be stored in the libraries for future use. The next sections discuss the structure of the robot configuration and AT files that are stored in the libraries. C. Affordance Template Description Format Affordance templates are stored in the AT library using a custom Affordance Template Description Format (ATDF) meant to provide a similar XML syntax as the Universal Robot Description Format (URDF), heavily used by the ROS community, and the Semantic Robot Description Format (SRDF), used by the MoveIt! package. The syntax should be familiar to ROS users and relatively easy to parse, both manually and programmatically. Every ATDF file starts with the name of the template and an image for display in the RViz panel: ```xml <affordance_template name="Wheel" image="wheel.png"/> ``` Next follows the description of display object and end-effector waypoints. Every object must have a unique name, geometry, origin, and controls element. If no parent element is provided (referring to the name of a different display object) element, the origin is taken to be with respect to the root AT coordinate frame as specified in the robot configuration file (defined below). If a parent is given, the origin will be in the coordinate frame of that object. The geometry element is identical to that in the URDF syntax and can encode primitive shapes such as cubes, spheres, and cylinders, or meshes. The controls element is a 6-DOF binary specification defining which dimensions the operator can adjust the object along in the RViz window. For example, if only translation controls are desired, the rpy values would be set to “0 0 0” and orientation controls would not be provided to the operator for the corresponding object in RViz. The following example shows the display object for the wheel template. It uses a Collada-format mesh (torus.dae) that is pitched 90 degrees, and allows full 6-DOF position/orientation controls. The scale factor is useful to appropriately scale the size of the IM controls, specifically for clutter reduction in the RViz window. ```xml <display_objects> <display_object name="wheel"> <geometry> <mesh> <filename="torus.dae"/> <scale="1.0 1.0 1.0"/> </mesh> </geometry> </display_object> </display_objects> ``` --- <sup>2</sup>The decision to use ZeroMQ as the transport layer between “robot-side” and “operator-side” was made to provide a simple, but robust protocol, more flexible than ROS service calls, appropriate for use with degraded or unreliable networks (such as seen during the DARPA Robotics Challenge), or with multi-master ROS environments. effector group hand offset map hand pose object map hand An YAML config file for Robonaut 2 is as follows: corresponding end-effector group names. For example, the between the abstract template end-effector labels and the such that hands are oriented appropriately), and mappings end-effectors with the abstract AT end-effector frames (i.e., first placed, transformation coordinates to align the robot's root offset from the robot's base frame to where any AT is for use with the AT package. This information includes the basic information about the robot that needs to be determined (generated through the MoveIt! "setup wizard"), and some parameters of that robot's configuration YAML (Section III- D. Robot Configuration File To instantiate an AT for a particular robot, a simple YAML configuration file is required to map the abstract declarations of the robot-generic template defined in the ATDF to the specific exigencies of each robot. This ensures that specific end-effectors (e.g. left or right hands) will be mapped to the appropriate template waypoints and that the template will exist in the appropriate robot base coordinate system. This configuration file provides the name of the robot, the name of the automatically generated MoveIt! configuration package /generated through the MoveIt! "setup wizard"), and some basic information about the robot that needs to be determined for use with the AT package. This information includes the root offset from the robot's base frame to where any AT is first placed, transformation coordinates to align the robot's end-effectors with the abstract AT end-effector frames (i.e., such that hands are oriented appropriately), and mappings between the abstract template end-effector labels and the corresponding end-effector group names. For example, the YAML config file for Robonaut 2 is as follows: robot_name: r2 moveit_config_package: r2_moveit_config frame_id: r2/root_base root_offset: [0.4,0,-0.2,3.14,0,0] end_effector_map: - name: left_hand id: 0 pose_offset: [0,0,1.57,0,0] - name: right_hand id: 1 pose_offset: [0,0,-1.57,0,0] end_effector_pose_map: - name: Left Hand Close group: left_hand id: 2 - name: Right Hand Close group: right_hand id: 1 In this example, end_effector_map is used to map the abstract end-effector labeled "0" in the ATDF will to the R2 MoveIt! group left_hand. Correspondingly, end-effector "1" will be mapped to right_hand. These group names must be defined in the generated SRDF file created by the MoveIt! setup process. Each group also has a pose_offset field necessary to re-orient the command and display of the end-effectors into the robot-agnostic AT frame convention. Similarly, end_effector_pose_map is used to map the abstract AT end-effector pose identifiers of the ATDF to poses stored in the SRDF. For example, the stored pose Right Hand Close for end-effector group right_hand is here mapped to the AT ID "2". Additional pose mappings are stored in this file as well, but omitted for reasons of space. When configuring a new robot for use with the AT package, the developer must determine the appropriate settings for these values. In the future, an automatic “wizard” tool could be useful, but has not been developed at this point. IV. RViz INTERFACE Two complimentary methods are provided to create, modify, or interact with ATs in order to execute task behavior on a robot: a custom RViz panel and context-menus available for each template after it has been instantiated. A. Affordance Template Panel Figure 6 shows the RViz Affordance Template panel. In the main RViz window, the Dreamer robot is shown with a pick-and-place AT. Basic information about AT server connectivity is shown in the right-side panel, along with which templates have been initiated. Multiple instances of any template can be instantiated at any given time. In this panel, the operator can also delete existing templates. A second hidden tab in the top section allows the operator to assign robots to the ATs, as well as to change and save parameters of that robot’s configuration YAML (Section III- [D]). The lower half of this panel shows the AT library. To instantiate a new template, the operator need only select an icon from this list and the corresponding template appears in the RViz window for the appropriate robot. Shown are templates for a door handle, the R2 ISS Taskboard (discussed in more detail in Section V-D) and pick-and-place. Fig. 6. Dreamer in RViz with a pick-and-place template, and the AT panel on the right. Other tabs in the bottom half of the panel are seen for scaling objects (as described in Section III-A) or managing the end-effector waypoint trajectory of the template. The operator has the option of commanding the robot to move through these trajectories any number of steps at a time in any direction, or for de-coupling the commands to the end-effectors (so that they can be run in conjunction or in isolation), if desired. For considerations of space, explicit images of these panels are omitted. B. Context Menus Right-clicking on display objects or waypoints in the main RViz window provides the operator a number of useful features, including the following. - **Hide/Show Controls:** To reduce clutter in the RViz environment, the operator has the option of not displaying the controls at all times. Exposure of the controls is used occasionally for placing the template in the appropriate location or for fine-tuning end-effector positions. - **Add/Delete/Move Waypoints:** The operator has options to add waypoints to the existing end-effector trajectory (either before or after existing goals), delete waypoints, or swap the sequence order of any pair of waypoints. - **Change Grasp Pose:** For waypoints, the operator has the option to alter which stored grasp pose is commanded at each waypoint. All poses available in the robot’s SRDF file are provided as options. - **Save Modifications:** The operator can save any changes to the template back to the AT library for future use. - **Change Trajectory:** This options lets the operator choose which of multiple trajectories associated with a template is displayed at any given time. V. EXAMPLES This section briefly explores a number of motivating examples demonstrating some key features of the AT package and how they apply to different robots and contexts. A. MoveIt! Integration Manual placement of an AT in a location does not explicitly determine if the corresponding waypoint trajectory is within the workspace of the robot, nor does it generate or show the path the robot would follow to achieve that trajectory. To these ends, the MoveIt! motion planning library was integrated into the AT package to provide both of these capabilities inherently. In general, any motion planning library could be used for these purposes, but MoveIt! provides an off-the-shelf solution that is widely used by the ROS community. Figure 7 shows the wheel-turning template instantiated for R2. The MoveIt!-generated path from the robot’s current location through the first two waypoints (for each arm’s sequence) is overlaid in purple. From the control panel, the operator can choose how many waypoint steps “ahead” in each sequence are planned, displayed, and executed at a time. Integrating MoveIt! quickly allows an operator to gain introspection on the achievability of the task at hand. B. Robot Generalization Because each template stores only abstract information about a task, a robot configuration YAML description (Section III-D) is required to instantiate the template for a given context. Figure 8 shows a drill AT instantiated for the R2, Valkyrie, and Dreamer systems. If the trajectory stored in the ATDF is suitable for a given robot “off-the-shelf,” no further programming is necessary, only than manual registration of the template onto the robot’s 3D data. If a robot-specific trajectory is needed, the operator is free to expose the individual waypoint controls, modify a stored trajectory as needed, and save the modified template for future use. C. Object Scaling With the scaling procedure discussed in Section III-A, the wheel template can be used in different run-time contexts. Figure 9 shows this template (instantiated for R2) in an array of sizes. The size of the template was adjusted using a slider in the “Object Scaling” tab in the bottom half of the RViz AT panel (Figure 6), which was generated automatically from the ATDF definition. D. Multi-Trajectory Storage Figure 10 shows three waypoint trajectories stored in the ISS Taskboard AT. The taskboard represents a set of canonical manipulation tasks (switches, buttons, handles, etc.) present on the ISS that is used for R2 development and practice as the robot’s operators learn how to control a humanoid robot in space. Each of the three trajectories shown in the figure displays stored waypoints for pushing a different button. As there are dozens of different tasks on the taskboard, it is natural to allow the single taskboard AT to store strategies for achieving these tasks, as opposed to storing many separate templates in the library. In this manner, an operator can choose from the AT context menu which task to perform at any given time. VI. ONGOING WORK The AT framework follows a supervisory control paradigm of Plan, Teach, Monitor, Intervene, and Learn (PTMIL) [27]. Currently, the framework supports only the TMI steps of this paradigm as it only allows the supervisor to place a template in an appropriate location, adjust certain parameters, and execute the resulting plan on the robot, intervening if necessary. Currently, the framework is being extended along multiple dimensions. - **Planning:** Integration of motion planning tools such as MoveIt! allows an extra level of verification, intelligence, and visualization for the supervisor concerning the robot’s expected motion for accomplishing the goal(s) of the AT. Additional uses of robot planning could also be used to eliminate the necessity for the supervisor to set all task parameters, as is currently necessary, or to chain ATs together to accomplish multiple extended behaviors (e.g. walk up to an object, pick it up, use it for some purpose). - **Learning:** Either in the absence of, or in conjunction with, more sophisticated planning techniques, ATs could monitor the parameter values over the course of multiple executions of a task and provide statistical feedback on whether those values are likely to lead to task success. The metric of success could be supervised (let the supervisor indicate task outcome after execution) or unsupervised depending on the task’s requirements. - **Perceptual Registration:** Rather than relying on the supervisor to register templates with sensor data (as in Figure 2), autonomous point cloud registration techniques such as ICP could be used. The robot could monitor its environment and provide guesses about likely affordances, initiating corresponding ATs with pre-adjusted parameter settings in RViz accordingly. - **Navigation & Mobility Tasks:** The AT package as described supports only manipulation-based tasks. Extending the AT package to allow locomotion-based templates (e.g. walking up stairs, driving through a cluttered environment) would be desirable to unify mobility and manipulation in the same application framework. Incorporation of the ROS Navigation Stack [4] is currently being investigated as it provides advanced mapping and mobility tools. Applying such templates to multi-legged locomotion is also desirable, though potentially more challenging. - **Force-Based Tasks:** Currently, existing ATs only allow the supervisor to set spatial parameters. However, force- or contact-based goals (e.g. apply a force along an axis of a certain magnitude, turn the wheel with a desired torque) could also be set in the framework. Such specifications will ultimately be necessary for guiding a robot to accomplish sophisticated manipulation tasks in real-world contexts. The visualization of these parameters in a 3D spatial environment is an interesting problem on its own terms, and currently various approaches are under investigation. Although some of these extensions individually may require significant research contributions, the AT framework provides an efficient representation for aggregating this functionality together in a unified structure. By keeping the supervisor “in the loop” and phasing in more autonomy as appropriate—whether in terms of planning, perception, or learning—the framework supports multiple levels of intervention that can ensure task success in multiple contexts. VII. CONCLUSION This paper introduces the Affordance Template ROS package for creating, executing, and supervising task-level applications on manipulation-based robotic systems. The package provides a robot-generic framework suitable for use in position-based tasks, though flexible enough to be modified easily to meet the demands of specific contexts. Although the package has clear limitations, it provides a core library in which further extensions can be made as described in Section VI. While the current implementation provides a set of tools that various members of the community are converging on, such as 3D tools for placing and adjusting robot end-effector goals amidst overlaid RGBD sensor data and a robot avatar, visualization of robot trajectories in anticipation of commanded movement, object-centric coordinate frame goal definitions (cf. [25], [24]), the AT package provides a common toolkit for robot application development will greatly progress robot task development in the community, while mitigating redundant development by various groups in the field. By choosing a ROS grounding for the package, it is also the hope that the package will be familiar and easy to use to prevent a steep learning curve for new users. REFERENCES
{"Source-Url": "https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/20150000509.pdf", "len_cl100k_base": 6827, "olmocr-version": "0.1.53", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 26373, "total-output-tokens": 9124, "length": "2e12", "weborganizer": {"__label__adult": 0.0004105567932128906, "__label__art_design": 0.0008039474487304688, "__label__crime_law": 0.0005793571472167969, "__label__education_jobs": 0.00139617919921875, "__label__entertainment": 9.54270362854004e-05, "__label__fashion_beauty": 0.0002338886260986328, "__label__finance_business": 0.000308990478515625, "__label__food_dining": 0.0003809928894042969, "__label__games": 0.0008835792541503906, "__label__hardware": 0.00244140625, "__label__health": 0.0009031295776367188, "__label__history": 0.00041365623474121094, "__label__home_hobbies": 0.00027179718017578125, "__label__industrial": 0.0013380050659179688, "__label__literature": 0.0002894401550292969, "__label__politics": 0.0003504753112792969, "__label__religion": 0.000507354736328125, "__label__science_tech": 0.29248046875, "__label__social_life": 0.0001366138458251953, "__label__software": 0.0190887451171875, "__label__software_dev": 0.67431640625, "__label__sports_fitness": 0.0004808902740478515, "__label__transportation": 0.0015764236450195312, "__label__travel": 0.00025010108947753906}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 38931, 0.01562]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 38931, 0.62411]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 38931, 0.86525]], "google_gemma-3-12b-it_contains_pii": [[0, 5217, false], [5217, 9212, null], [9212, 14203, null], [14203, 19456, null], [19456, 23708, null], [23708, 27382, null], [27382, 32006, null], [32006, 38931, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5217, true], [5217, 9212, null], [9212, 14203, null], [14203, 19456, null], [19456, 23708, null], [23708, 27382, null], [27382, 32006, null], [32006, 38931, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 38931, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 38931, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 38931, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 38931, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 38931, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 38931, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 38931, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 38931, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 38931, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 38931, null]], "pdf_page_numbers": [[0, 5217, 1], [5217, 9212, 2], [9212, 14203, 3], [14203, 19456, 4], [19456, 23708, 5], [23708, 27382, 6], [27382, 32006, 7], [32006, 38931, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 38931, 0.0]]}
olmocr_science_pdfs
2024-12-06
2024-12-06
c1dc6e6fa4916b18fe0f61a8e8f0c4b797a3600d
[REMOVED]
{"len_cl100k_base": 7345, "olmocr-version": "0.1.50", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 33229, "total-output-tokens": 11378, "length": "2e12", "weborganizer": {"__label__adult": 0.00048470497131347656, "__label__art_design": 0.0004687309265136719, "__label__crime_law": 0.0007867813110351562, "__label__education_jobs": 0.0012760162353515625, "__label__entertainment": 0.00011861324310302734, "__label__fashion_beauty": 0.0002810955047607422, "__label__finance_business": 0.0005846023559570312, "__label__food_dining": 0.000537872314453125, "__label__games": 0.0017538070678710938, "__label__hardware": 0.0013380050659179688, "__label__health": 0.0011606216430664062, "__label__history": 0.0005502700805664062, "__label__home_hobbies": 0.0001990795135498047, "__label__industrial": 0.0010576248168945312, "__label__literature": 0.0003781318664550781, "__label__politics": 0.0006375312805175781, "__label__religion": 0.0005865097045898438, "__label__science_tech": 0.212890625, "__label__social_life": 0.0001323223114013672, "__label__software": 0.00901031494140625, "__label__software_dev": 0.763671875, "__label__sports_fitness": 0.0006313323974609375, "__label__transportation": 0.001415252685546875, "__label__travel": 0.00032258033752441406}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 42514, 0.03211]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 42514, 0.47153]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 42514, 0.8793]], "google_gemma-3-12b-it_contains_pii": [[0, 4706, false], [4706, 11456, null], [11456, 17123, null], [17123, 23186, null], [23186, 27639, null], [27639, 31957, null], [31957, 37411, null], [37411, 42514, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4706, true], [4706, 11456, null], [11456, 17123, null], [17123, 23186, null], [23186, 27639, null], [27639, 31957, null], [31957, 37411, null], [37411, 42514, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 42514, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 42514, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 42514, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 42514, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 42514, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 42514, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 42514, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 42514, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 42514, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 42514, null]], "pdf_page_numbers": [[0, 4706, 1], [4706, 11456, 2], [11456, 17123, 3], [17123, 23186, 4], [23186, 27639, 5], [27639, 31957, 6], [31957, 37411, 7], [37411, 42514, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 42514, 0.0]]}
olmocr_science_pdfs
2024-12-01
2024-12-01
1b310a28bd80913d6b9037af5dcad939ab340908
BitstreamFormat Conversion Instructions <?xml version="1.0" encoding="utf-8"?> <html> Procedure to Upgrade a DSpace 1.5 archive to use the 1.6 BitstreamFormat+Renovation code. Planning You have to do a little planning before undertaking the conversion. Review the appropriate documentation (e.g. About Data Formats and BitstreamFormat Renovation) and be able to answer the questions below. Your most important decision is the choice of which external format registries to configure. This choice reflects the purpose of your DSpace archive, whether you are concerned with digital preservation or just storage and dissemination. Although the new DSpace architecture allows any number of registries to be configured, it really only makes sense to list one primary registry, and the Provisional registry for locally-added (and hopefully temporary) format identifiers not covered by the primary registry. First, decide how you want data formats to behave in your archive: - Is your DSpace mainly used to organize and disseminate assets, so the coarse-grained generic formats (almost like MIME-types) are satisfactory for your purposes? - If so, choose the backward-compatible DSpace status quo choice. - Do you plan to apply digital preservation techniques to the contents of your DSpace? Do you want Bitstreams identified with more fine-grained formats to facilitate preservation activities? - If so, you probably want the PRONOM registry, or GDFR when it is available. Here are all the planning questions, in detail: 1. Which external format registry is your primary registry? 2. *DSpace* - the backward-compatible status quo choice. 3. *PRONOM* - an actual external registry, on the path to later upgrade to GDFR 4. Do you also want to configure the Provisional registry? Should be "yes", but populate it sparingly, only for formats that really need special local entries. 5. Which format identification methods do you want to use? 6. *DSpace* (ONLY if using DSpace registry) 7. *Provisional* (ONLY if using Provisional registry) 8. *DROID* (ONLY recommended if using PRONOM registry) Outline of the Procedure Here are the minimal steps you will follow to convert your archive to the new BitstreamFormat model. We recommend keeping this list handy and checking off each step as you complete it: 1. Add DSpace Configuration entries for the format registries and format identifiers you have chosen. 2. Run the "cleanup -c" command to check for Bitstreams without readable asset files. 3. Run Phase 0: Upgrade15To16 -0 (Convert DB schema) 4. Populate the Provisional format registry: Upgrade15To16 -p <i>file</i> and edit results. 5. Run Phase 1: Upgrade15To16 -1 (convert to DSpace and Provisional registries where possible) 6. Run Phase 2: Upgrade15To16 -2 (automatic identification of remaining Bitstreams) 7. Generate detailed Report for records: Upgrade15To16 -r -v > report.out • Analyze report, summarize translations and check for anomalies. 8. Finish with Phase 3: Upgrade15To16 -3 (final database conversion) The entire process may take several hours, depending on your choice of format registry. We recommend converting a production DSpace system on separate test server first, working with a copy of your archive. It can share a read-only copy of the asset store with another system, since no Bitstreams are actually written or changed. Preparation The following instructions refer to two filesystem paths, so be sure you know the correct locations for these: 1. The install directory, ```bash $\{DSPACE_INSTALL\} ``` , which is typically under your source distribution where it builds the install hierarchy. It contains the ant script ```bash build.xml ``` 2. Your runtime (or home) directory, ```bash $\{DSPACE_HOME\} ``` , which is the value of * ```bash dspace.dir ``` * in the config file. Install Software Download Patch to DSpace 1.5 Source • Shutdown your DSpace archive, i.e. the Java Servlet container / webserver. • Update your install directory (i.e. ```bash $\{DSPACE_INSTALL\} ``` to the 1.6 prototype: Apply patches to the 1.5 source and rebuild or acquire a 1.6 binary distribution. • While in the install directory, run ant update to install new code. • Check that $\{DSPACE\_HOME\}$ has a config/formats subdirectory; if not, copy it over from the distribution hierarchy. You’ll probably need to do that. e.g. ``` cp -trp config/formats $\{DSPACE\_HOME\}\config ``` • Edit the DSpace Configuration as outlined below: **Configuration** Add these entries to your DSpace Configuration for the case you chose: ### If using "DSpace" Registry 1. a. i. Format Registry Configuration formatRegistry.DSpace.document = $\{dspace.dir\}/config/formats/dspace-formats.xml formatRegistry.DSpace.validate = true formatRegistry.DSpace.schema = $\{dspace.dir\}/config/formats/formats.xsd formatRegistry.DSpace.defaultSupportLevel = known formatRegistry.Provisional.validate = true formatRegistry.Provisional.schema = $\{dspace.dir\}/config/formats/formats.xsd formatRegistry.Provisional.document = $\{dspace.dir\}/config/formats/provisional-formats.xml 2. Set of registries (not a stack) plugin.named.org.dspace.content.format.FormatRegistry = org.dspace.content.format.DSpaceFormatRegistry = DSpace, org.dspace.content.format.ProvisionalFormatRegistry = Provisional 3. Format identifier stack - NOTE: TextSubtypeHelper must come last. plugin.sequence.org.dspace.content.format.FormatIdentifier = org.dspace.content.format.DSpaceFormatRegistry, org.dspace.content.format.TextHeuristicIdentifier, org.dspace.content.format.CSSIdentifier, org.dspace.content.format.ProvisionalFormatRegistry, org.dspace.content.format.TextSubtypeHelper 4. CSS SAC parser implementation formatIdentifier.CSSIdentifier.parser = org.w3c.flute.parser.Parser 5. Identifier(s) returned for CSS hits; first one is canonical. formatIdentifier.CSSIdentifier.identifiers = DSpace:CSS 6. Add this (set to a Provisional format) if your archive contains tar files. #formatIdentifier.TextHeuristicIdentifier.formats.tar = PRONOM:x-fmt/265 7. Subtypes of Text formats to be promoted if ID'd by filename extension formatIdentifier.TextSubtypeHelper.subtypes = DSpace:XML, DSpace:HTML, DSpace:CSS, DSpace:MARC, DSpace:Postscript, DSpace:Mathematica, DSpace:LateX, DSpace:TeX, DSpace:SGML, DSpace:RealAudio ### Configuration when using "PRONOM" Registry If you configure PRONOM as your primary format registry, you need the DROID identifier. We also recommend using the Text Heuristic, CSS, and TextSubtypeHelper identifiers to make up for shortcomings in DROID. 1. a. i. Format Registry Configuration formatRegistry.Provisional.validate = true formatRegistry.Provisional.schema = ${dspace.dir}/config/formats/formats.xsd formatRegistry.Provisional.document = ${dspace.dir}/config/formats/provisional-formats.xml 2. DROID's signature file - see http://droid.sourceforge.net/ formatIdentifier.DROID.signatureFile = ${dspace.dir}/config/formats/DROID_SignatureFile_V13.xml 3. PRONOM setup formatRegistry.PRONOM.contact = http://www.nationalarchives.gov.uk/ formatRegistry.PRONOM.dir = ${dspace.dir}/config/formats/PRONOM 4. Set of registries (not a stack) plugin.named.org.dspace.content.format.FormatRegistry = org.dspace.content.format.PRONOMFormatRegistry = PRONOM, org.dspace.content.format.ProvisionalFormatRegistry = Provisional 5. Format identifier stack - NOTE: TextSubtypeHelper must come last. plugin.sequence.org.dspace.content.format.FormatIdentifier = org.dspace.content.format.DROIDIdentifier, org.dspace.content.format.TextHeuristicIdentifier, org.dspace.content.format.CSSIdentifier, org.dspace.content.format.ProvisionalFormatRegistry, org.dspace.content.format.TextSubtypeHelper 6. CSS SAC parser implementation formatIdentifier.CSSIdentifier.parser = org.w3c.flute.parser.Parser 7. Identifier(s) returned for CSS hits; first one is canonical. formatIdentifier.CSSIdentifier.identifiers = PRONOM:x-fmt/224 8. Add this if your archive contains tar files. # formatIdentifier.TextHeuristicIdentifier.formats.tar = PRONOM:x-fmt/265 9. Subtypes of Text formats to be promoted if ID'd by filename extension formatIdentifier.TextSubtypeHelper.subtypes = PRONOM:x-fmt/224, PRONOM:x-fmt/91, PRONOM:x-fmt/406, PRONOM:x-fmt/407, PRONOM:x-fmt/408, PRONOM:fmt/122, PRONOM:fmt/123, PRONOM:fmt/124, PRONOM:fmt/14, PRONOM:fmt/15, PRONOM:fmt/16, PRONOM:fmt/17, PRONOM:fmt/18, PRONOM:fmt/19, PRONOM:fmt/20, PRONOM:fmt/95, PRONOM:fmt/96, PRONOM:fmt/144, PRONOM:fmt/145, PRONOM:fmt/146, PRONOM:fmt/157, PRONOM:fmt/146, PRONOM:fmt/147, PRONOM:fmt/158, PRONOM:fmt/148, PRONOM:fmt/101, PRONOM:x-fmt/183, PRONOM:x-fmt/160 Test Bitstreams and the Asset Store for Consistency Before executing the BitstreamFormat conversion, you must ensure the Bitstream information in the database and the asset store are in agreement. Otherwise, if the DB refers to a Bitstream with a missing asset file, the conversion process will fail and waste all the time spent on it so far. We intentionally designed the conversion to fail when an asset is missing or unreadable because this is an unacceptable flaw in the archive, anyway. If DSpace cannot access some Bitstreams, it cannot fulfill its primary mission. It is reasonable to force the administrator to fix such problems. We provide a testing and repair command, a variation on the "cleanup" script, to find all Bitstreams with missing asset files. It repairs them by marking the Bitstream deleted, and logging it. The DSpace administrator should check the log for failures and decide whether to fix or accept each one, since the next cleanup run will wipe out the "deleted" Bitstreams. Run the command: $[DSPACE_HOME]/bin/dsrun org.dspace.storage.bitstore.Cleanup -c If all goes well, it will display: ``` Checking for missing/unreadable files in asset store Found 0 missing/unreadable files in asset store. ``` The number in the second line will be nonzero if it finds any problems. See the server logs for ERROR records giving details about each Bitstream, e.g.: ``` (bitstream_id column value appears as id=209 } ``` ``` 2008-01-09 21:31:00,913 ERROR org.dspace.storage.bitstore.BitstreamStorageManager @ Bitstream id=209 has missing or unreadable asset file... marking it deleted. ``` Note that it takes approximately 30 minutes to run on a fairly slow server with about 160,000 Bitstreams. Runtime is a factor of the number of Bitstreams, not their overall size. You can also add the ``` -n ``` option to the ``` Cleanup ``` command to prevent it from marking broken Bitstreams as deleted. This means, if there are any problems, it will NOT fix them, so you must take care of them manually (or run it again). It may be helpful to use the ``` -n ``` option the first time you run this command, so you can check whether any of the Bitstreams reported belong to Items. ### Phase 0: Initial Database Conversion This phase modifies your database to the new 1.6 schema, while preserving old data to help in the conversion. **IMPORTANT:** Ensure there is no interactive access to the archive while you perform these steps, since any other DSpace process accessing Bitstreams may receive incorrect data. Also, another process making concurrent changes to the RDBMS may corrupt your data model. For the first phase you must ``` cd ``` to the directory containing your DSpace installation, i.e. from where you run ``` ant update ``` Ensure there is a file in the relative path ``` etc/database_schema_15-16.sql ``` --- **THERE IS NO WAY TO "UNDO" THIS STEP.** - BACK UP YOUR DATABASE. - BACK UP YOUR DATABASE. - BACK UP YOUR DATABASE. ``` cd ${DSPACE_INSTALL} ${DSPACE_HOME}/bin/dsrun org.dspace.administer.Upgrade15To16 -0 ``` **NOTE:** You can run the ``` org.dspace.administer.Upgrade15To16 ``` with various other options to try a "dry run" first, get verbose or debugging output, generate a report, etc. Run it with the ``` --help ``` option for details. At this point, all Bitstreams have an undefined format. The two conversion Phases will assign format values to them. **Populate the Provisional Registry** The purpose of the Provisional registry is to provide a separate place for file format entries added by the local DSpace administrator. It is named "Provisional" to remind you that its entries are supposed to be a temporary measure, until the format can be described in a shared external registry such as PRONOM or the GDFR, or even the DSpace built-in registry. The "Provisional" registry also gives you a separate, distinct, home for all of your local changes and extensions to the format technical metadata. Even for an archive configured with the old, simple "DSpace" format registry, it is helpful to have your local additions in a separate place so when the "DSpace" registry is modified in updates, the changes won't affect or collide with your Provisional registry. In the conversion process, you will generate a configuration file for the Provisional registry based on the formats used in your archive. The upgrade process will examine the old format registry and create Provisional entries for any formats it finds there which were not part of the original DSpace complement. You must still check and edit this list, to ensure the data is correct and no undesirable formats are included. For example, if you are using the PRONOM registry, then you should exclude any Provisional versions of formats already known to PRONOM. The content of the Provisional registry is dictated entirely by its configuration file. This has the same XML-based format as the DSpace registry's configuration file so you may consult that as an example, see ``` config/formats/dspace-formats.xml ``` under the runtime directory. To populate the Provisional registry: 1. Generate an automatic guess at the formats needed: ```bash ${DSPACE_HOME}/bin/dsrun org.dspace.administer.Upgrade15To16 -p new.xml ``` 2. _Edit configuration file_ `new.xml` , deleting the ``` &lt;entry&gt; ``` elements for any unwanted or unneeded formats. Be careful to preserve the XML format. 3. Move the new file into place: ```bash cp new.xml ${DSPACE_HOME}/config/formats/provisional-formats.xml ``` The next upgrade phase will automatically check the validity of your configuration file. It will stop if there is a problem. ### Phase 1: Converting Formats in DSpace and Provisional Registries This phase converts Bitstreams whose format has a direct analogue in either the DSpace (if configured) or Provisional registry. If those registries are not configured (or the Provisional registry is empty), it does nothing. You *can* run Phase 1 more than once; in fact, you *will* have to if you change the Provisional registry after the first run. It does no harm to run Phase 1 again, since it does nothing more if the registries have not changed. Run this command: ```bash ${DSPACE_HOME}/bin/dsrun org.dspace.administer.Upgrade15To16 -1 ``` Typical Phase 1 results (this example took about 4 minutes): ``` Phase One Summary: Bitstream Formats Converted: Out of 155185 upgradable bitstreams in archive, Total bitstreams touched = 155185 Had old "Unknown" format = 1021 .of Unknown, touched 33 with UserFormatDescription set. Translated to DSpace namespace = 0 Translated to Provisional namespace = 13 ``` At this point you may make changes to the contents of the Provisional registry, if, for example, fewer Bitstreams were converted than you expected. If you have no changes to make to the Provisional format registry you may proceed to Phase 2. ### Phase 2: Automatic Format Identification This phase assigns new BitstreamFormats to all Bitstreams not already converted, by automatically identifying their formats. It will not touch Bitstreams which have already been identified by conversion. - If you are keeping the old DSpace registry, this only includes Bitstreams such as license files that never had proper formats, so it will be fast. - If you are converting to the PRONOM registry, most Bitstreams will have to be identified in Phase Two. This may take several hours. *After running Phase 2 you will not be able to run Phase 1 again.* You may wish to test this Phase first by adding the `dry run` and `verbose` options dry run and verbose ```bash -n -v ``` to the command and watching the output for a while: ``` ${DSPACE_HOME}/bin/dsrun org.dspace.administer.Upgrade15To16 -2 -n -v ``` Be sure you'll get adequate results when you run Phase 2 for real, because it assigns some format to each as-yet unidentified Bitstream, which means it will ignore them on subsequent runs. Don't worry too much about getting everything perfect the first time, though. You can always re-identify the formats of specific Bitstreams and groups of them with the `BitstreamFormat Workbench` utility, even after the conversion is finished. To invoke Phase 2: ``` ${DSPACE_HOME}/bin/dsrun org.dspace.administer.Upgrade15To16 -2 ``` Typical phase 2 results: it takes about 60 minutes to process 64,000 Bitstreams on a fast server, (almost 5 hours for 155,00 Bitstreams on a slow server), and the summary looks like: ``` Phase Two Summary: Bitstream Formats Guessed: Total bitstreams touched = 64226 Automatically identified = 64082 Had old "Unknown" format = 106 Converted to new "Unknown" = 144 ``` You should only run Phase 2 once, since it does not leave any Bitstreams unidentified, and it will not touch a Bitstream which has already been identified. ### Reports and Verification You should produce a detailed report and save it just before finishing the conversion. You can generate a report of the state of the conversion, and optionally details about each Bitstream, at any time before Phase 3 has run. Invoke the command: ``` ${DSPACE_HOME}/bin/dsrun org.dspace.administer.Upgrade15To16 -r ``` This produces a simple summary report like: ``` SUMMARY Total upgradeable Bitstreams = 64269 SUMMARY Already converted to New BSF = 43 SUMMARY Not yet converted to New BSF = 64226 SUMMARY BS with UserFormatDescription = 29 ``` To add the details of how each Bitstream was converted from the old format to its new one, add the `verbose` option, for example: ``` ${DSPACE_HOME}/bin/dsrun org.dspace.administer.Upgrade15To16 -r -v ``` This adds a line for each Bitstream in the following format: - BITSTREAM, <BitstreamID>, <Name>, <Old BSF Name>, <New BSF>, <New Confidence>, <New Source>, <User Format Desc.> BITSTREAM, 5306, OR-083-78.pdf, Adobe PDF, (NONE), UNIDENTIFIED, "null", BITSTREAM, 53459, MIT-EL-88-003WP-19737424.pdf, Adobe PDF, (NONE), UNIDENTIFIED, "null", BITSTREAM, 163802, license.txt, License, 7-bit ASCII Text, HEURISTIC, "org.dspace.content.format.TextHeuristicIdentifier", We strongly recommend archiving a copy of the detailed report. Run the reporting command above with the output directed into a file. This gives you a record of the original old-style format of each Bitstream, and the vital information about the initial conversion. You can also analyze the report as shown in the next section to check the accuracy of the conversion. Analyzing Conversion Reports Here is how to analyze the report to verify the format conversions make sense. 1. Create a file with the report output, e.g. "report.out" 2. Use a simple Unix (Linux) text filter to summarize the conversions by reducing the report to unique combinations of old format, new format, and confidence, with the command: awk -F, '/^BITSTREAM/ {print $4,","$5,","$6}' < report.out | sort -u 3. Examine this output, which has the old format in the first column, then the name of the new format, and the confidence value. - Consider whether the conversion makes sense or not – e.g. Postscript to PostScript 2.0 is fine, but Adobe PDF to ASCII Text may be the sign of a problem. - If you find an anomaly or problem, use the following procedure to examine it further. For example, suppose you notice an anomaly and want to take a closer look at the affected Bitstreams – perhaps examine a Bitstream itself to see what format it really seems to be. The anomalous line from the summary report is: Adobe PDF, Windows Portable Executable, POSITIVE_SPECIFIC Use `awk` to pick out the relevant lines from the original report by matching the old BSF name in the fourth column and the new BSF name in the fifth column. It should be sufficient to match against a regular expression representing part of each name rather than match the whole thing, for example: To print only the bitstream DB ID number, modify the awk script: ```bash % awk -F, '$4 ~ /Adobe/ && $5 ~ /Executable/ {print $2}' < report.out 5153 ``` Now you can examine the Bitstream by visiting it through the DSpace web server, e.g. http://dspace.myuni.edu/dspace/retrieve/5153 If corrections are necessary, use the BitstreamFormat Workbench ```bash org.dspace.administer.Formats ``` ) to re-guess or manually set the format based on that Bitstream number. You can do this after Phase Three just as well as now, so it works even if you only discover the anomaly long after finishing this conversion. "Undo" and Starting Over If you discover you've made a terrible mistake and mis-identified a lot of Bitstreams, you can return to the state just before Phase One and re-do all the steps (populating the Provisional registry, etc.). Execute the following SQL statement in your database environment: ```sql UPDATE Bitstream SET bitstream_format_id = NULL; ``` Another way to return your system to that same state is to restore your database from the backup you made before Phase 0 (right?) and then re-run Phase 0 and the subsequent steps. Also see the last section about making repairs after finishing the conversion procedure. Phase 3: Database Cleanup ONLY begin this phase when you are satisfied with the results of Phase 2, and all of the Bitstreams in the archive have been converted. This phase removes the remaining DSpace 1.5 BitstreamFormat data structures from the RDBMS since they are no longer needed. This phase checks that all Bitstreams have been converted and will only run if they have been. ```bash ${DSPACE_HOME}/bin/dsrun org.dspace.administer.Upgrade15To16 -3 ``` Typical output: (after a couple seconds of runtime) Phase 3 finished, done with BitstreamFormat conversion. Maintaining and Repairing BitstreamFormats If a problem or mistake in the BitstreamFormat conversion only becomes apparent after you finish the conversion process (Phase 3) and thus cannot go back to it, you can still put it right. The BitstreamFormat Workbench tool, Troubleshooting: Adding Filename Extensions to a PRONOM Format PRONOM/DROID is currently missing (or has a bug preventing it from matching) some filename extensions, also known as external signatures. For example, though the PRONOM entry for an HTML format includes both the common three-letter (MS-DOS) extension and the conventional. Here is a temporary workaround procedure you can use until DROID is fixed, and for possible future cases where PRONOM/DROID lacks signatures: 1. Add an entry to the Provisional registry with the desired filename extension. 2. Find the BSF with the PRONOM identifier, and add the Provisional entry you just created as a synonym external identifier. 3. If the format is a subtype of "plain text" (i.e. if the PRONOM format is listed in TextSubtypeHelper), add the new Provisional identifier there too. Here are detailed instructions for an example that adds the .htm filename extension to PRONOM:fmt/96 Provisional Registry entry Create an entry for the Provisional registry like the one shown below: 1. name may be anything unique in the registry. 2. description should include an explanation of why it is there. 3. external-identifiers should include its identifier and the PRONOM synonym(s) 4. external-signatures includes all desired filename extensions Modify BitstreamFormat Registry 1. Go to the administrative GUI for the BitstreamFormat Registry. 2. Edit the BitstreamFormat entry for external identifier PROJONOM:fmt/96. 3. Add the external format entry Provisional:HTM to it. (Click Add New) Modify DSpace Configuration If the PRONOM format was a subtype of Text, for the purpose of TextSubtypeHelper, then you must add the Provisional external identifier to the subtype list too. Locate the configuration entry formatIdentifier.TextSubtypeHelper.subtypes, and add the external identifier Provisional:HTM to it. Testing Find a Bitstream with the .htm filename extension that was not identified correctly before, and retry identifying it, e.g. with the BitstreamFormat Workbench utility.
{"Source-Url": "https://wiki.lyrasis.org/download/temp/pdfexport-20200408-080420-0932-3377/DSPACE-BitstreamFormatConversionInstructions-080420-0932-3378.pdf?contentType=application/pdf", "len_cl100k_base": 6070, "olmocr-version": "0.1.53", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 25338, "total-output-tokens": 7041, "length": "2e12", "weborganizer": {"__label__adult": 0.0002727508544921875, "__label__art_design": 0.0011930465698242188, "__label__crime_law": 0.0004062652587890625, "__label__education_jobs": 0.003253936767578125, "__label__entertainment": 0.00017774105072021484, "__label__fashion_beauty": 0.00017583370208740234, "__label__finance_business": 0.0009245872497558594, "__label__food_dining": 0.00022733211517333984, "__label__games": 0.00067901611328125, "__label__hardware": 0.0015392303466796875, "__label__health": 0.00020229816436767575, "__label__history": 0.0006313323974609375, "__label__home_hobbies": 0.0002562999725341797, "__label__industrial": 0.0006723403930664062, "__label__literature": 0.0006170272827148438, "__label__politics": 0.0004291534423828125, "__label__religion": 0.0006122589111328125, "__label__science_tech": 0.09661865234375, "__label__social_life": 0.0002338886260986328, "__label__software": 0.2037353515625, "__label__software_dev": 0.6865234375, "__label__sports_fitness": 0.00018739700317382812, "__label__transportation": 0.0002378225326538086, "__label__travel": 0.00022935867309570312}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 24967, 0.02118]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 24967, 0.29107]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 24967, 0.79236]], "google_gemma-3-12b-it_contains_pii": [[0, 2767, false], [2767, 4295, null], [4295, 6781, null], [6781, 10027, null], [10027, 11710, null], [11710, 14024, null], [14024, 16476, null], [16476, 18574, null], [18574, 20839, null], [20839, 22923, null], [22923, 24222, null], [24222, 24967, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2767, true], [2767, 4295, null], [4295, 6781, null], [6781, 10027, null], [10027, 11710, null], [11710, 14024, null], [14024, 16476, null], [16476, 18574, null], [18574, 20839, null], [20839, 22923, null], [22923, 24222, null], [24222, 24967, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 24967, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 24967, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 24967, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 24967, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 24967, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 24967, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 24967, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 24967, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 24967, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 24967, null]], "pdf_page_numbers": [[0, 2767, 1], [2767, 4295, 2], [4295, 6781, 3], [6781, 10027, 4], [10027, 11710, 5], [11710, 14024, 6], [14024, 16476, 7], [16476, 18574, 8], [18574, 20839, 9], [20839, 22923, 10], [22923, 24222, 11], [24222, 24967, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 24967, 0.0]]}
olmocr_science_pdfs
2024-12-07
2024-12-07
aded6b43e1c46a0e070391a710ed72334538b8d8
Formally verified optimizing compilation in ACG-based flight control software Ricardo Bedin França, Sandrine Blazy, Denis Favre-Felix, Xavier Leroy, Marc Pantel, Jean Souyris To cite this version: Ricardo Bedin França, Sandrine Blazy, Denis Favre-Felix, Xavier Leroy, Marc Pantel, et al.. Formally verified optimizing compilation in ACG-based flight control software. ERTS2 2012: Embedded Real Time Software and Systems, AAAF, SEE, Feb 2012, Toulouse, France. hal-00653367 HAL Id: hal-00653367 https://inria.hal.science/hal-00653367 Submitted on 19 Dec 2011 HAL is a multi-disciplinary open access archive for the deposit and dissemination of scientific research documents, whether they are published or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers. L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés. Formally verified optimizing compilation in ACG-based flight control software Ricardo Bedin França*†, Sandrine Blazy‡, Denis Favre-Felix*, Xavier Leroy§, Marc Pantel† and Jean Souyris* *AIRBUS Operations SAS 316 Route de Bayonne, Toulouse, France {ricardo.bedin-franca,denis.favre-felix,jean.souyris}@airbus.com †Institut de Recherche en Informatique de Toulouse 2 Rue Charles Camichel, Toulouse, France {ricardo.bedinfranca,marc.pantel}@enseeiht.fr ‡IRISA - Université de Rennes 1 Campus de Beaulieu, Rennes, France sandrine.blazy@irisa.fr §INRIA Rocquencourt Domaine de Voluceau, Le Chesnay, France xavier.leroy@inria.fr Abstract—This work presents an evaluation of the CompCert formally specified and verified optimizing compiler for the development of DO-178 level A flight control software. First, some fundamental characteristics of flight control software are presented and the case study program is described. Then, the use of CompCert is justified: its main point is to allow optimized code generation by relying on the formal proof of correctness and additional compilation information instead of the current un-optimized generation required to produce predictable assembly code patterns. The evaluation of its performance (measured using WCET and code size) is presented and the results are compared to those obtained with the currently used compiler. Keywords—Safety critical systems, Optimized code generation, Toolset performance evaluation I. INTRODUCTION Flight Control Software (FCS) development is a very challenging task: not only it has the typical constraints of other software projects, such as budget, delivery schedule and available hardware, but also those that apply to hard real-time, safety-critical software. There are specific regulations for the avionics domain - in particular, the DO-178/ED12 [1] that enforce rigorous development of embedded software in avionics systems. In this context, it is not trivial to develop software that can perform optimally while complying with all requirements. This paper focuses on the compilation, which is a very important step in the generation of good performance critical software: compilers are very complex tools that carry out the delicate task of generating low-level code that behaves exactly as expected from the high-level source code. Thus, the compiler has clear influence over software performance and safety, but it is commonly developed by third parties (Commercial Off-The-Shelf “COTS” software) and are not necessarily oriented towards the needs of avionics software. We present experiments carried out by Airbus with the use of a formally-verified compiler, CompCert, in flight control software development. The goal of these experiments is to evaluate its performance in a realistic environment, with software modules similar to actual FCS ones and the same development and verification tools as real FCS. This paper extends the performance evaluation presented in [2], using a new version of CompCert that includes an annotation mechanism (for traceability and timing analysis purposes) and using more criteria to compare a CompCert-based development with the currently used approach. This paper compares Worst-Case Execution Times (WCET) taking into account the size and function of the modules. The paper is structured as follows: Section II presents the fundamentals of flight control software development and the method we use to assess software performance. Section III presents the CompCert compiler and its features that led to its choice for this work. Section IV presents the results of its performance evaluation and Section V draws conclusions and research perspectives. II. FLIGHT CONTROL SOFTWARE, COMPILERS AND PERFORMANCE A. An Overview of Flight Control Software While older airplanes had only mechanical, direct links between the pilots’ inputs and their actuators, modern aircraft rely on computers and electric connections to transmit these inputs. As Traverse and Briére [3] describe, digital, electrical flight control systems are used on all aircraft control surfaces since the development of the Airbus A320. Hardware and software used in flight control systems are subject to very strict requirements, just as any other component. Every kind of avionics software is subject to the DO-178 (currently, version B) regulations, and the DO-178B guidelines become more numerous and more stringent according to the criticality of a given software program. The correct operation of flight control software is essential to a safe flight, hence they belong to “software level A” and their planning, development, verification and project management must comply with very strict regulations. In addition, aircraft manufacturers usually have their own internal development constraints, ranging from additional safety considerations (e.g. dissymmetry and redundancy) to industrial ones, such as delivery delays. B. The Case Study In order to carry out a realistic study, we have chosen to use a case study that closely resembles actual flight control software: not only the source code is representative (in functionalities and size) of flight control laws, but the target computer is also representative of true flight control hardware, so as to illustrate typical constraints on hardware usage. The hardware and software used in this work are similar to those described in [4]: the relevant hardware in the scope of this work comprises the MPC755 microprocessor, and an external RAM memory. The MPC755 is a single-core microprocessor, which is much less complex than modern multi-core ones but does have pipelines, an internal cache and superscalar architecture, three elements that make its behavior less predictable. Naive timing analysis of this microprocessor could lead to the “timing anomalies” described by Lundqvist and Stenström [5]. It must be noted that the choices of hardware and software are led by a combination of factors – besides performance needs, there are other constraints, such as weight, size, power dissipation, cost and – most importantly in the scope of this paper – verifiability. Thus, choosing the MPC755 for this case study is consistent with flight control systems of modern aircraft. The development process described below also reflects the intent of developing deterministic and verifiable software. The development described in the next paragraphs follows the basic steps that are recommended by the DO-178B: specification, design, coding/integration and verification. One must take into account, though, that specification and design are treated together, due to the highly detailed software specification. 1) Specification and Design: The largest part of the software program – the “application” subset, which contains the implementation of the flight control laws – is specified as a set of sheets with the graphical formalism SCADe, each sheet being composed of interconnected basic operators (addition, filter, etc). There is no “main sheet”: they all belong to the same hierarchical level and they communicate via their input and output parameters. In order to simplify the specification and the code generation, all the symbols used in the sheets are custom-made by the developers. SCADe (V6) state machines are not used, mainly for determinism purposes – conditional statements are kept inside some library symbols. Figure 1 depicts instances of the custom-made symbols ABS, HW ACQDSI, BPO and AFDX_FSOUT. Each symbol has inputs and outputs, which are connected to their left and right sides, respectively. At the bottom of the HWACQDSI and AFDX_FSOUT symbols, there are some “hidden inputs”, which have the same semantics as a normal input but are used to underline symbol parameters (in our example, integer constants) that are not related to the data flow. The program also contains a manually-coded part that goes through distinct specification and design phases, but further details about this part are beyond the scope of this paper, as it makes no use of automatic code generation. 2) Coding: The specification is translated to source code by an automatic code generator (ACG). Automatic code generation, when applicable, has the advantages of being less error-prone and offering much smaller coding times than manual code generation. In order to lighten the burden of source code verification activities, the ACG is qualified as a development tool, according to the DO-178B standards for level A software. In this study, we use C as a source code language, as it is widely used in critical systems and there are many development and verification tools for C-coded critical systems. Each symbol is represented in C as a macro: a “symbol library” (a set of macros) is manually coded in order to implement each SCADe operator, and the ACG-generated code consists in a sequence of macro instantiations that respect the data flow specified in SCADe. A SCADe sheet is represented by a C function that contains a sequence of macro instantiations – all the data-flow constraints are taken into account by the ACG in order to make sequential C programs that are consistent with the parallel SCADe ones. It must be noted that all the sheets are activated periodically, but their activation period may vary. Thus, the execution cycle is divided into several sequential “tasks” and each sheet may be activated in one or more tasks during a cycle. The C code is finally compiled with a COTS compiler\(^1\) and linked to produce an executable file. It must be noted that the compiler – like the vast majority of compilers industrially used – is seen as a “black box” by the development and verification teams. In this case, the object code must be verified thoroughly, and the safest solution to carry out a complete verification taking into account the use of a COTS compiler and the high reactivity of the ACG process is to forbid compiler optimizations in order to force the generation of constant code patterns for each symbol. As our ACG-generated code is a (potentially long) sequence of a limited number of symbols and the symbol library code changes much less often than the application in actual flight control programs, it is less onerous to carry out thorough verification activities over each possible code pattern for this symbols than verifying all code “sheets” in each compilation. 3) Verification: Every development phase must be verified and this verification must meet the DO-178B requirements. As this paper focuses on the compilation, we shall describe the main activities that verify software coding and integration: - **Source Code Verification**: The source code must be traceable and compliant to the design (in our case, the SCADe specification). Also, it must respect the software resource and time constraints. - **Object Code Verification**: Object code also must be traceable and compliant to the SCADe specification and the integration of software modules, as well as their integration with the target computer, must be verified. The DO-178B demands requirement-based verification: a program must be verified with respect to its high-level and low-level requirements. In this paper, we suppose that low-level verification is carried out at symbol level (e.g. tests and/or formal proofs of symbol outputs), hence the compiler must not optimize away the symbol outputs, even if they are, indeed, intermediate results of a function. Usually, these verification activities (especially object code verification) involve testing. For level A software, the whole code must be tested with Multiple Condition/Decision Coverage (MC/DC) and traceability between source code and object code is necessary to validate code coverage: - If coverage is measured over the source code, traceability is necessary to ensure that there is no added, unverified functionality in the object code. Typical cases of “added, unverified” functionalities could be found in compilers that add array bound checks or that have a complex management for switch statements. - The DO-178B report for clarification [6] states that if coverage is measured over the object code, traceability is necessary to ensure that the measured coverage is equivalent to MC/DC, as the object code (such as Assembly language) may not contain the multiple conditions found in the source code. Traceability analysis is much less complicated if the object code presents no optimization and no untraceable code added by the compiler. Once again, it is useful to hinder compiler optimizations in order to simplify the verification activities. C. Estimating Software Performance Besides being a DO-178B requirement, Worst-Case Execution Time (WCET) analysis is a safe and reliable timing verification in the avionics software context. Hardware and software complexity make the search for an exact WCET nearly impossible; usually one computes time values which are as close as possible to the actual WCET, but always higher than it. In our case study, the main purpose of WCET analysis is to make sure that no application task oversteps its allowed execution time. As mentioned by Souyris et al [4], it was once possible to compute the WCET of avionics software by measurement and analysis, but such method is not feasible in state-of-the-art programs. The current approach at Airbus relies on AbsInt\(^2\)’s automated tool a^3 [7] to compute the WCET via static code analysis of the executable file. In order to obtain accurate results, the tool requires a precise model of the microprocessor and other relevant components; this model was designed in close cooperation between Airbus and AbsInt. Sometimes it is important or even essential to give a^3 extra information about loop counts or register value bounds to refine its analysis. As described in [4], annotations are necessary when memory access address ranges cannot be computed precisely because of limitations in a^3 value analysis (e.g. floating-point). The imprecisions that arise from such limitations degrade WCET analysis and can go as far as stopping a^3 from completing WCET computation. Such a situation is depicted in Algorithm 1: as a^3 is not yet able to carry out the floating-point comparison, it cannot evaluate the range of addresses that may be accessed in line 6. In this case, a^3 has to continue its computation assuming that the access might occur in any memory address, and the great deal of complexity that is added incurs a strongly overestimated – if not unbounded – WCET. For instance, if it is known that variable i is always within the bounds of the array, this information should be provided to a^3 as an annotation. In our case, annotations are needed only in a few symbols, so as to compute some addresses more precisely – with a^3, ### Algorithm 1 Example of a code that needs annotations 1: register double x; // Assume that x fits 2: // inside the array bounds 3: register int i; 4: extern double lookup_table[]; 5: i = (int)x; 6: register double y = lookup_table[i]; This kind of annotation can be assigned only to microprocessor registers, which are depicted in the Assembly code. Let us assume that Algorithm 1 is part of the C macro of a symbol and that its corresponding (non-optimized) Assembly code is depicted by Algorithm 2. One can notice that the C variable \( i \) is stored in \( r31 \), since it is loaded with the resulting value of the floating-point to integer conversion. Thus, if we know that \( i \) is always between, say, 0 and 9, the annotation should be: ``` instruction "Checkpoint" + 0x14 bytes is entered with r31 = from 0 to 9; ``` In order to keep the fast pace of the ACG-based approach (and avoid potential human mistakes), an automatic annotation generator was devised to avoid manual activities and keep the efficiency of the development process. Each symbol that needs annotations will need them repeatedly for all of its instances, but it is not difficult to annotate automatically the correct Assembly lines with a non-optimized compilation that always generates similar code patterns for all instances of the symbol. Whenever the macro containing Algorithm 1 is instantiated, an annotation would be needed at the of the symbol. Whenever the macro containing Algorithm 1 is instantiated, an annotation would be needed at the offset 0x14 from the tag "Checkpoint". Thus, one has to track the possible code patterns for the symbols that need annotations (to make sure that subtle variations in the code patterns do not change the offset of the instruction that needs an annotation) and find the right offsets to assign those value ranges. This annotation strategy is simple and effective, but would not work if the compiler could optimize the code. ### Algorithm 2 Example of a loop that needs annotations ``` // inside the array bounds Example of a loop that needs annotations Algorithm 2 Example of a loop that needs annotations Checkpoint: 00 fctiwz f0,f31 04 stfd f0,8(r1) 08 lwz r31,12(r1) \( \triangleright \) a3 cannot infer this value 0c addis r11,r0,lookup_table@ha 10 addi r11,r11,lookup_table@1 14 rlwinm r10,r31,3,0,28 \( \triangleright \) we should help a3 here 18 lfdx f30,r11,r10 ``` Annotations are also used in the manually-coded subsets in order to specify – for instance – the behavior of other hardware components, but those are created manually and are not in the scope of this paper. ### III. CompCert: Towards a trusted compiler One can figure out that, in extremely critical systems, traditional COTS compilers must be used with great caution with respect to code optimization. However, there are recent advances in the compilation field: in the scope of this work, a most promising development is the CompCert\(^3\) compiler. Besides working in a more realistic environment (a large C subset as input language, MPC755 as one of the possible target processors) than other experimental compilers, its development is taking into account the needs of critical systems and its own code is available for study if its end users need to know its internal details in order to devise verification strategies for their software. As described in [8], CompCert is a multiple-pass, moderately-optimizing compiler that is mostly programmed and proved correct using the Coq proof assistant. Its optimizations are not very aggressive, though: as the compiler’s main purpose is to be “trustworthy”, it carries out basic optimizations such as constant propagation, common subexpression elimination and register allocation by graph coloring, but no loop optimizations, for instance. As no code optimizations are enabled in the currently used compiler, using a few essential optimization options could already give good performance benefits. The semantic preservation proof of CompCert guarantees that the generated code behaves as prescribed by the semantics of the source program. The observed behaviors in CompCert include termination, divergence and “going wrong”. To strengthen the preservation theorem, behaviors also include a trace of the input-output operations performed during the execution of the program. Input-output operations include system calls (if an operating system is used) as well as memory accesses to global variables declared “volatile” (corresponding in particular to memory-mapped hardware devices). The formal verification of CompCert proves, in effect, that the source program and the generated machine code perform the same input-output operations, in the same order, and with the same arguments and results. A. CompCert annotation mechanism To strengthen the guarantees implied by CompCert’s formal verification, we have introduced a generic program annotation mechanism enabling programmers to mark source program points and keep track of the values of local variables at these points. Syntactically, annotations are presented as calls to a compiler built-in function, taking a string literal and zero, one or several program variables as arguments: ``` __builtin_annot("x is %1 and y is %2", x, y); ``` The formal semantics of this statement is that of a pro forma “print” statement: when executed, an observable event is added to the trace of I/O operations; this event records \(^3\) [http://compcert.inria.fr](http://compcert.inria.fr) the text of the annotation and the values of the argument variables (here, \(x\) and \(y\)). In the generated machine code, however, annotations produce no instructions, just an assembler comment or debugging information consisting of the text of the annotation where the escapes \#1, \#2 are replaced by the actual locations (in registers or memory) where the argument variables \(x\), \(y\) were placed by the compiler. For example, we obtain ```plaintext # annotation: \(x\) is \#r7 and \(y\) is \#mem(word,\#r1+16) ``` if \(x\) was allocated to register \#r7 and \(y\) was allocated to a stack location at offset 16 from the stack pointer \#r1. Despite executing no instructions, this special comment is still treated, from the standpoint of formal semantics, as a pro forma “print”, generating an observable event. The semantic preservation proof of CompCert therefore guarantees that annotations are executed in the same order and with the same argument values both in the source C program and in the generated assembly code. A typical use of annotations is to track pieces of code such as library symbols. We can put annotations at the beginning and the end of every symbol, recording the values of the arguments and result variables of the symbol. The semantic preservation proof therefore guarantees that symbols are entered and finished in the same order and with the same arguments and results, both in the source and generated codes. This ensures in particular that the compiler did not reorder or otherwise alter the sequence of symbol invocations present in the source program – a guarantee that cannot be obtained by observing systems calls and volatile memory accesses only. This possibility of finer-grained semantic preservation is most welcome, since some of our verification activities may be carried out at symbol level and semantic preservation needs to be ensured at this level to be useful in our context. In particular, we consider using per-symbol annotations in order to generalize the results of symbol-based tests: the test results for a given symbol remain valid for all possible code patterns generated when instantiating this symbol. This approach is currently under discussion and such discussions are not in the scope of this paper. Another use of annotations is to communicate additional information to verification tools that operate at the machine code level, such as the WCET analyzer of the a\(^3\) tool suite. Continuing the example of section II-C, we insert a source-level annotation as shown below. During compilation, this source-level annotation is turned into a special comment in the generated assembly file, where the placeholder \%1 is replaced by the machine register containing variable \(i\). Algorithm 4 below shows the assembly code generated by CompCert for two successive instantiations of the symbol containing Algorithm 3. The two instantiations generate significantly different assembly code fragments, since the second instantiation reuses some of the intermediate results computed by the first instantiation (common subexpression elimination). Nonetheless, the two special comments corresponding to the source-level annotation are correctly placed and correctly reveal the location of variable \(i\), namely register \#r3. From these special comments and their locations in the assembly listing, an automatic tool can easily extract the information that at points 20 and 40 from the beginning of the current function, register \#r3 (holding the array index) is in the range \([0, 9]\), and communicate this information to the WCET analyzer. Some aspects of this annotation mechanism are still under discussion with the CompCert and a\(^3\) developers, but an experimental annotation generator has already been developed and the ease of its development is a testimony to the usefulness of the CompCert annotation mechanism: readily-available, formally-verified variable information simplify the task of automating annotation generation for a\(^3\). One should remember that, in comparison, the annotation generator for the “default” compiler code must be reconfigured for each symbol library change: a new analysis must be carried out in the range \([0, 9]\), and communicate this information to the WCET analyzer. Algorithm 3 Adding a source-level annotation to Algorithm 1 ``` register double x; register int i; extern double lookup_table[]; i = (int)x; __builtin_annot("a3: entered with %1 = from 0 to 9", i); register double y = lookup_table[i]; ``` ``` Algorithm 4 Generated assembly code for two instantiations 10 fctiwz f13, f1 14 sfdru f13, -8(r1) 18 lwz r3, 4(r1) 1c addi r1, r1, r8 20 # annotation: a3: entered with r3 = from 0 to 9 20 rwinm r4, r3, 3, 0, 28 24 addis r12, r4, (lookup_table)@ha 28 lfd f1, (lookup_table)@l(r12) ... 40 # annotation: a3: entered with r3 = from 0 to 9 40 rwinm r6, r3, 3, 0, 28 44 addis r12, r6, (lookup_table)@ha 48 lfd f2, (lookup_table)@l(r12) ``` IV. PERFORMANCE EVALUATION OF COMPCERT The evaluation environment is essentially the same as in our previous work [2] and is depicted in Figure 2. CompCert is used only to generate Assembly code from the ACG-coded files, as these files are by far the most voluminous part of the program. Compilation of other software subsets, assembling and linking were done with the compiler, assembler and linker that are used in actual FCS. Figure 2. The development chain of the analyzed program In order to ensure greater realism in the experiments, about 3600 files that are functionally equivalent to a whole flight control program were compiled with CompCert 1.9. These files represent about 3600 SCADE sheets – when compiled with the default compiler, they correspond to 3.96 MB of Assembly code. The symbol library that was used comprises 145 symbols whose sizes vary from less than 10 to more than 100 lines of code. CompCert’s source-level annotation mechanism was used to track symbols’ inputs and outputs, and also to generate additional information for some variables that need range annotations. As explained in section III-A, this information is available in the generated assembly files, which are examined by the annotation generator to produce an annotation file in the suitable format for a\(^3\). \(a^3\) was used to compute WCET at two different levels: the most important benchmark is at task level, as it is the measure used for timing analysis in actual programs. While a traditional WCET analysis consists in verifying that each task is performed within its allocated time, we opted to compare the average WCET of all tasks in order to have a synthesis of the results for every task. In addition, we analyze individually the WCET of all SCADE sheets: we do not seek interprocedural optimizations or a register allocation that goes beyond one single module, hence individual WCET computations are meaningful in this context and are useful to find out which kind of algorithms get the most of CompCert’s optimizations. The baseline for the benchmark is the WCET of an executable file generated with the default compiler and the compilation options used in a real flight control program. Some analyzed sheets instantiate symbols that need range annotations; CompCert’s annotation mechanism was used together with a simple annotation generation script to assign variable ranges for \(a^3\) when needed. Figure 3 depicts the flow of annotation data, from the C macros (where the necessary extra information is specified by the user) to the execution of \(a^3\). In addition to WCET computations, code size measures were carried out as an auxiliary performance indicator – smaller code size often means better-performing code. The results of the WCET analysis are quite encouraging, as the average WCET improvement per task was 10.6%, which is a significant improvement by flight control software standards. As already pointed out in [2], this is mainly due to a better register allocation that saves many loads and stores that had to be performed to keep symbol inputs and outputs on stack. Figure 4 depicts the WCET computed for all sheets, ordering them according to the WCET obtained when they were compiled with the default compiler. The WCET improvement may change from one region of the graph to another (modules with a very low or very high WCET do not always have a visible improvement, whereas CompCert clearly improved the WCET of those in the middle part of the curves) and even inside a region – the WCET curve for CompCert-compiled modules is not smooth. In order to refine the general results obtained by the analysis of this large number of files, special attention was dedicated to files that had extreme values of WCET and code size. The 10% longest and shortest files (in WCET or code size) had results that differed from the average and had specific statistics in order to underline those differences. In addition, some “unexpected” results (e.g. the default compiler performing better than CompCert) were analyzed individually. The WCET of all analyzed modules was computed for the executable files generated by both compilers, in order to compare them when compiling modules of various WCET and code size value ranges – using the benchmark WCETs and code sizes to classify the modules into categories. The main conclusions from these experiments are: - In the analyzed program, even if a module is small, there is usually some possibility of optimization but results may vary according to the symbols that are instantiated in a given module. Some symbols have their code vastly improved by CompCert, whereas – in some very exceptional cases – the WCET of a module rises due to the overhead caused by longer function prologues and epilogues. In fact, modules that present very small code size are not quite a reliable source of WCET analysis because even their address in memory becomes a significant factor in WCET analysis. - Sheets that are not among the fastest or slowest have a slightly better WCET improvement than the overall results. This shows that the optimizations work best when there is enough code to enable their full use, but the code is still compact enough to avoid register spilling. - A sheet can have a large WCET for two main reasons: either it may have many instructions to execute or it may contain interactions with hardware devices that are time-consuming. In the former case, CompCert usually performs better, except when dealing with spilled variables – the gains become less significant because spilled variables resemble variables compiled with the default compiler. CompCert optimizations can do little or nothing to improve the WCET of a sheet if its symbols spend most of their computation time doing hardware acquisitions and emissions. In our case study, it is more common to have interactions with hardware than register spilling, hence the WCET gain over “long” sheets (larger code size) is more pronounced than the gain over “slow” ones (higher WCET). - Even with its optimizations turned off, the default compiler sometimes succeeds in selecting more efficient combinations of PowerPC instructions than CompCert. An example is address computations for volatile memory accesses, which CompCert compiles rather naively. We plan to improve the instruction selection phase of CompCert to reduce these inefficiencies. Table I summarizes the WCET analysis results. <table> <thead> <tr> <th></th> <th>WCET (CompCert)</th> <th>Size (CompCert)</th> </tr> </thead> <tbody> <tr> <td>All application tasks</td> <td>-10.6%</td> <td>-13.8%</td> </tr> <tr> <td>Small code size sheets</td> <td>-2.0%</td> <td>-14.6%</td> </tr> <tr> <td>Small WCET</td> <td>-10.6%</td> <td>-12.9%</td> </tr> <tr> <td>Average WCET</td> <td>-12.6%</td> <td>-14.3%</td> </tr> <tr> <td>Average code size</td> <td>-10.7%</td> <td>-13.6%</td> </tr> <tr> <td>Large code size</td> <td>-7.7%</td> <td>-14.2%</td> </tr> <tr> <td>Large WCET</td> <td>-3.8%</td> <td>-12.4%</td> </tr> </tbody> </table> **Table I** **CODE SIZE AND WCET COMPARISON** **A. Verification considerations** Since the main reason to avoid most optimizing compilers is the ensuing difficulty to verify traceability and compliance of the object code, the performance evaluation was followed by a study of possible verification strategies that could use CompCert’s semantic preservation in order to meet the DO-178B requirements without losing the performance gains obtained with its optimizations. This study is currently under way but it is already clear that the “traditional” analysis mentioned in [6] to verify traceability between source code and object code is still feasible with CompCert, as its optimizations remove computational instructions but do not change significantly the code structure (branches, etc). Also, its semantic preservation theorem could be used as a strong argument for traceability and compliance between source code and object code. **V. CONCLUSIONS AND FUTURE WORK** This paper presented an evaluation of the CompCert compiler, based on the characteristics of Airbus flight control software: ACG-based code, modules with different characteristics. Even if we focused on its WCET analysis to assess its performance, CompCert’s formal proofs are already seen as a key to bring more confidence in the compilation process, helping to make safe use of code optimizations. Moreover, CompCert’s optimizations apply to the vast majority of the modules that are representative of FCS. The main ongoing work in our CompCert study is the development of a new verification strategy that must be at least as safe as the current one. It is a complex subject on its own but some conclusions drawn from it (e.g. the need for semantic preservation at symbol level) are already being taken into account – as it is likely that we will need semantic preservation at symbol input level, the performance measures were taken using library symbols endowed with CompCert’s annotations to preserve the semantics of their inputs and outputs. An important discussion point is the DO-178 interpretation of a tool like CompCert. The performance evaluation shall not stop at the current state. As the symbol library was coded bearing in mind the current compilation strategy, an interesting work will be recoding it in order to favor optimizing compilation, with fewer intermediate variables and use of Small Data Areas. It is likely that the obtained WCET will be lower and every percent counts if one intends to improve performance. Another direction for future work is to further improve WCET by deploying additional optimizations in CompCert and proving that they preserve semantics. The WCC project of Falk et al [9] provides many examples of profitable WCET-aware optimizations, often guided by the results of WCET analysis. Proving directly the correctness of these optimizations appears difficult. However, equivalent semantic preservation guarantees can be achieved at lower proof costs by verified translation validation, whereas each run of a non-verified optimization is verified a posteriori by a validator that is proved correct once and for all. For example, Tristan and Leroy [10] show a verified validator for trace scheduling (instruction scheduling over extended basic blocks) that could probably be adapted to handle WCC’s superblock optimizations. Rival has experimented the translation validation approach on a wider scope in [11] but, currently, the qualification and industrialization of such a tool seems more complex. **References**
{"Source-Url": "https://inria.hal.science/hal-00653367/file/erts2012.pdf", "len_cl100k_base": 7700, "olmocr-version": "0.1.53", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 27268, "total-output-tokens": 8918, "length": "2e12", "weborganizer": {"__label__adult": 0.0004780292510986328, "__label__art_design": 0.00024211406707763672, "__label__crime_law": 0.0004105567932128906, "__label__education_jobs": 0.0003440380096435547, "__label__entertainment": 5.882978439331055e-05, "__label__fashion_beauty": 0.00019240379333496096, "__label__finance_business": 0.00021457672119140625, "__label__food_dining": 0.0004572868347167969, "__label__games": 0.0008263587951660156, "__label__hardware": 0.0028438568115234375, "__label__health": 0.0005440711975097656, "__label__history": 0.0002524852752685547, "__label__home_hobbies": 0.00011771917343139648, "__label__industrial": 0.0006265640258789062, "__label__literature": 0.0002002716064453125, "__label__politics": 0.0002605915069580078, "__label__religion": 0.0005192756652832031, "__label__science_tech": 0.02435302734375, "__label__social_life": 7.265806198120117e-05, "__label__software": 0.005092620849609375, "__label__software_dev": 0.95947265625, "__label__sports_fitness": 0.0004274845123291016, "__label__transportation": 0.00168609619140625, "__label__travel": 0.00027179718017578125}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 38993, 0.04268]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 38993, 0.53392]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 38993, 0.91474]], "google_gemma-3-12b-it_contains_pii": [[0, 1103, false], [1103, 5520, null], [5520, 10338, null], [10338, 15873, null], [15873, 21404, null], [21404, 26525, null], [26525, 29950, null], [29950, 34739, null], [34739, 38993, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1103, true], [1103, 5520, null], [5520, 10338, null], [10338, 15873, null], [15873, 21404, null], [21404, 26525, null], [26525, 29950, null], [29950, 34739, null], [34739, 38993, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 38993, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 38993, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 38993, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 38993, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 38993, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 38993, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 38993, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 38993, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 38993, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 38993, null]], "pdf_page_numbers": [[0, 1103, 1], [1103, 5520, 2], [5520, 10338, 3], [10338, 15873, 4], [15873, 21404, 5], [21404, 26525, 6], [26525, 29950, 7], [29950, 34739, 8], [34739, 38993, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 38993, 0.04891]]}
olmocr_science_pdfs
2024-12-07
2024-12-07
217f458b7dba640311b97fb29804e1e6ebe1b7bf
Isolating malicious code in Android malware in the wild Valérie Viet Triem Tong, Cédric Herzog, Tomás Concepción Miranda, Pierre Graux, Jean-François Lalande, Pierre Wilke To cite this version: Valérie Viet Triem Tong, Cédric Herzog, Tomás Concepción Miranda, Pierre Graux, Jean-François Lalande, et al.. Isolating malicious code in Android malware in the wild. MALCON 2019 - 14th International Conference on Malicious and Unwanted Software, Oct 2019, Nantucket, United States. hal-02288116 HAL Id: hal-02288116 https://hal-centralesupelec.archives-ouvertes.fr/hal-02288116 Submitted on 13 Sep 2019 HAL is a multi-disciplinary open access archive for the deposit and dissemination of scientific research documents, whether they are published or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers. L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés. Isolating malicious code in Android malware in the wild Valérie Viet Triem Tong, Cédric Herzog, Tomás Concepción Miranda, Pierre Graux, Jean-François Lalande, Pierre Wilke CentraleSupélec, Inria, Univ Rennes, CNRS, IRISA, Rennes, France firstname.lastname@inria.fr Abstract A malicious Android application often consists of a benign part which is the body of the application, and a malicious part that is added later, by repackaging. Fast and efficient analysis of Android malware depends on the analyst’s ability to quickly locate malicious code and have a clear representation of it. To do this, the analysis tools must allow the suspicious code to be quickly located and isolated from the rest of the application. In this article, we propose in a first part to synthesize recent works from the literature and to refresh older research works in order to highlight the discriminating characteristics of malicious code. Then, we propose a heuristic to reveal the suspicious methods of an Android application by static analysis. Finally, we discuss an algorithm to recover the malicious graft. This graft should contain the methods considered suspicious as well as the code calling these suspicious methods. 1. Introduction The code of an Android application consists of multiple packages, classes, Java or native methods. When such an application is malicious, statically understanding the attack requires to first accurately locate the malicious methods. Few applications contain only code produced by the attacker. Other malware are formed from healthy applications to which malicious code has been added: malware authors can simply decompress a benign application, then add their malicious code to it before finally repackaging it; these repackaged applications have been named piggy-backed apps by Li et al. [12]. In the Android context, a classic assumption is that most malware are repackaged applications. Malicious code localization can first be done manually. For example, the first datasets of malware were manually reversed: one of the pioneering projects is the Android malware Genome Project [19] presented in 2012. This dataset initially contained 1,200 malware samples, covering most of the existing Android malware families, collected between August 2010 and October 2011. This dataset was mainly maintained thanks to student efforts in charge of the reverse and classification of the malware. However, when handling larger-scale malware datasets, the manual reverse engineering does not scale anymore. Thus, we need an automatic method to locate suspicious code. Our long term goal is to explore different methods to quickly locate malicious code. More precisely, we would like to distinguish the code that implements the malicious intent from the benign code that supports the application. To achieve this goal, we have first compiled and completed various investigations on malware and goodware to highlight the features specific to Android malware. Our experiments were conducted over one malware dataset and one goodware dataset, each containing 5000 unique applications published between 2015 and 2018. These datasets (named GM19) have been carefully constructed to avoid statistical biases. Secondly we propose a heuristic resulting from this study. This heuristic guides a static analysis by highlighting in the application control flow graph the methods considered suspicious because they are more used by malware than by goodware. Finally, we identify the malicious graft (the malicious code written by the attacker) in an application by identifying the code handling data acquired by these methods considered suspicious. 2. Android applications background An Android application is an archive (an .apk file) that usually includes a collection of resources and the code of the application compiled in the DEX file format. In this article, all the classes.dex are decompiled into Jimple and we compute the interprocedural control flow graph with implicit flows from this representation. A control flow graph is an oriented graph where nodes are Jimple statements and an oriented edge from a node A to a node B indicates that statement B can be executed immediately after the statement A. Such a graph can be easily recovered for each method in the bytecode using Soot [3]. The inter-procedural con- Table 1. Average usage of packages and methods for GOOD and MAL datasets <table> <thead> <tr> <th>Apps type</th> <th>Average number of packages</th> <th>Average number of methods</th> <th>Average number of invoke statements</th> </tr> </thead> <tbody> <tr> <td></td> <td>Declared</td> <td>Dead</td> <td>Declared</td> </tr> <tr> <td>GOOD</td> <td>121</td> <td>69%</td> <td>16,059</td> </tr> <tr> <td>MAL</td> <td>199</td> <td>52%</td> <td>12,539</td> </tr> <tr> <td>Average</td> <td>160</td> <td>59%</td> <td>14,300</td> </tr> </tbody> </table> Table 2. Evaluation of some obfuscation techniques used by goodware and malware <table> <thead> <tr> <th>Obfuscation techniques</th> <th>Dataset nature</th> <th>Ratio of obfuscated applications</th> </tr> </thead> <tbody> <tr> <td>Identifier Renaming (*)</td> <td>Google Play</td> <td>43%</td> </tr> <tr> <td></td> <td>Third-party apps</td> <td>73%</td> </tr> <tr> <td></td> <td>Malware</td> <td>63.5%</td> </tr> <tr> <td>String Encryption (*)</td> <td>Google Play</td> <td>0%</td> </tr> <tr> <td></td> <td>Third-party apps</td> <td>0.1%</td> </tr> <tr> <td></td> <td>Malware</td> <td>5.3%</td> </tr> <tr> <td>Java Reflection (*)</td> <td>Google Play</td> <td>48.3%</td> </tr> <tr> <td></td> <td>Third-party apps</td> <td>49.7%</td> </tr> <tr> <td></td> <td>Malware</td> <td>51%</td> </tr> <tr> <td>Native method usage (**)</td> <td>GOOD</td> <td>25.8%</td> </tr> <tr> <td></td> <td>MAL</td> <td>62.5%</td> </tr> <tr> <td>Packer usage (**)</td> <td>GOOD</td> <td>0.06%</td> </tr> <tr> <td></td> <td>MAL</td> <td>10.88%</td> </tr> </tbody> </table> (*) Experiments conducted in [5] (**) Our own findings One of the major challenges of automatic malware analysis is to differentiate between malicious and benign code. In general, malicious code is code whose result will cause damage to whoever executes it. This code is very similar to benign code and we think that the only characteristics that can differentiate malicious code from benign code are: 1. The result of the execution of malicious code goes against the user. It can attempt to contact a remote control server, encrypt user data, access sensitive data (geolocation, contacts, IMEI, etc.), make calls or send messages to premium rate numbers, take control of the device. For all this, malicious code can use some libraries (crypto, TelephonyManager, . . .) more often than benign code would. 2. The attacker’s gain increases as long as his code is not analyzable and detectable by common anti-virus software. Therefore, the attacker tries to protect his code against (a) static analysis and (b) dynamic analysis. To do this, he obfuscates his code, and delays the execution of its payload to trigger the attack only on a real device when not under analysis. 3. On Android, some malware are distributed directly as entire applications. Many other malware are distributed by hiding in popular third-party applications, encouraging users to install it. These fake applications are referred to as piggybacked applications and are simply repackagings of benign applications where some malicious code has been grafted. We believe that characteristics (1) refer to the content of the code while characteristic (2) refers to the form (is it obfuscated or not) (a) and structure (is the payload accessible --- directly from an entry point) (b) of the malicious code and (3) impacts the internal structure of the whole application code. We now detail how these features can be exploited (or have been exploited) in Android malware analysis. **Content of the malicious code (1)** In 2013, Aafer et al. described malware through their usage of API functions, packages, and parameter level information [1]. Relying on this description, they proposed a detection method that distinguishes malware from benign applications. In particular, their work has highlighted a list of APIs that reveal the presence of potentially malicious code. This seminal study was very important and has been used by many approaches: mostly as a basis [7, 16–18], fewer for comparison [6]. This work was conducted in 2013 and we conducted a similar study on malware from 2019 in order to update these results. We have listed all the API methods invoked by the samples of MAL and GOOD datasets. Among these methods, it appears that at least 30 methods are invoked by samples in the MAL dataset and are never invoked by samples in the GOOD dataset, see Figure 1. We also computed the top 30 methods with the highest difference between malware and benign apps. Our results are presented in Figure 2. Comparing to the methods highlighted by Aafer et al. in 2013, we notice that the preferred method for malware is still `getSubscriberId` in the `TelephonyManager` API. But the rest of the top 30 has changed: nowadays malware get more information about the device they are running on (about the network, the wifi), rather than manipulating services, SMS messages, and timers. We can note the usage of `getPackageManager`, which allows to make administrative tasks with the OS, and of `getApplicationInfo`, which allows to check if an application is debuggable. These operations can obviously be used by malware, for example to become persistent or to disable some applications that would analyze them. **Form of the malicious code (2a)** The malware developer implements malicious code protections to prevent analysis and therefore detection. These protections are of two types, depending on whether they are protective against static analysis or dynamic analysis. Common obfuscation techniques that protect the code against static analysis are variable renaming, string encryption, reflection, packing (encryption of all or part of the bytecode) and usage of native code. Bacci et al. [4] proposed to automatically identify whether a sample under analysis has been modified by means of obfuscation techniques including disassembling followed by reassembling, repackaging, renaming packages, using call indirections, inserting junk code, renaming identifiers, encoding data, reordering code. Dong et al. [5] investigated how obfuscation techniques are really used by malware in the wild. They have evaluated how three obfuscation techniques (identifier renaming, string encryption, and Java reflection) are really used by Android applications of three typical datasets (Google Play, third-party markets, and malware). Their study has revealed that the percentage of malware using identifier renaming is 63.5%, which is more than for applications available on Google Play (43%), but slightly less than for third-party apps (73%). String encryption is not used by benign applications and only by 5.3% of malware. The proportions of reflection deployment in benign apps and malware are similar (around 50%). To complete this study, we have explored how native code obfuscation is used by malware and goodware. To detect if an application resorts to native code obfuscation we have checked the presence of methods declared as native in the DEX file of APKs from GOOD and MAL dataset. According to our investigation, we have found that malware use way more native methods than goodware (62.5% vs. 25.8%). This can be explained by the necessity of malware to obfuscate their code and, thus, to use native code. We have also quantified the usage of known packers by running APKiD [13] over the GOOD and MAL datasets. We have observed that malware use more packers than goodware (10.88% vs. 0.06%). This can also explain the higher usage of native methods in DEX files: packers rely on native methods to load the packaged code. The results from Dong et al. and our own findings are gathered in Table 2. **Structure of the malicious code (2b)** The protection of malware against dynamic analysis is of a different nature. A code is protected against dynamic analysis when it is not executed immediately after the application is launched. From the malware code point of view, this means that the pay- Top 30 of the highest difference in methods invoked in MAL and GOOD Figure 2. TOP 30 of the highest difference in methods invoked in MAL and GOOD Load can only be reached from an application entry point by passing through one or more conditional statements which are triggering conditions. These conditions ensure that code is only executed when the environment context appears to be suitable for malicious code, outside an analysis platform. These conditions are various: they can delay the execution in time, check the presence of emulators, check that user actions are performed. Leslous et al. [10] explored execution paths towards any piece of code considered as suspicious in Android applications. First, their study revealed that the malicious payload is regularly hidden behind implicit control flow calls (i.e., flows occurring when the Android framework calls a method implemented in the application space) making usual static analyzers believe that the malicious code is unreachable. Their study has also revealed an average of 12.34 conditions per execution path leading to suspicious code locations. These conditions are a mix of necessary checks for the app to work, and of triggering conditions that protect the malicious behavior in order to run only under certain circumstances. Internal structure of application hosting malicious code As mentioned above, malicious code is often hosted by a benign application and the resulting application is called a piggybacked application. These applications have been investigated by Li et al. [11] and they have built a large dataset of piggybacked and benign applications pairs. This dataset was obtained by searching for pairs of applications with highly similar code. To know the similarity between two applications, each method of each application is abstracted by a string encoding the different types of statements of the method. Then the similarity between these two applications is reduced to the similarity between two sets of strings. On this dataset, Li et al. described how piggybacked applications differ from benign ones: what actions are performed, what payloads are inserted, and so on. Among several insights, they claimed that piggybacking is done with little sophistication, in many cases automatically, and often via library code. Our conclusions To conclude, we believe that the studies mentioned above provided a good indication of the characteristics of Android applications hosting malicious code. First, these applications use more libraries than others (result of Aafer et al. in 2013, updated here). Then, malicious code can be protected against security analysis. The protection methods that differentiate them from goodware are mainly string encryption and native code based obfuscation. Lastly, the malicious code may have been added in an initially healthy application, so it forms an independent part grafted to the original code. In the remainder of this article, we use the first two conclusions to decide whether an Android application is suspicious or not (Section 4). We propose to evaluate the use of suspicious APIs by Android applications and assess their potential threat levels. This type of study helps us distinguish malware from goodware but is not enough to quickly locate the malicious part in all the code of an application since it does not allow us to find all the parts of the code written by the attacker, nor to highlight the structure of the malicious code. For this reason we propose in Section 5 to isolate the malicious graft from the healthy code using the data dependency graph. 4. Highlighting suspicious methods Section 3 quantifies method invocations in MAL and GOOD datasets, allowing us to highlight which classes and methods are statistically more used by malware than by goodware. Now, we propose to build a heuristic that can be used by static analysis to study the profile of an application according to its use of APIs preferred by malware rather than by goodware. A heuristic file lists methods that should be preferred by a malware than by a goodware. Here, our heuristics files are filled using the study presented in the previous section. Our problem is therefore to select enough methods not to wrongly classify too much goodware and not to wrongly dismiss too much malware, i.e. to be neither too selective nor too little selective. To tune this heuristic we separate MAL in two subsets: a training set of 4,000 samples and a test set of 1,000 samples. Then, we build a heuristic parametrized by a distance $d$ and a threshold $t$. A distance $d$ means that the methods listed in the heuristic have been chosen because in the previous study, these methods were invoked more than $d\%$ by malware than by goodware. Choosing a distance of 0% means we add in our heuristic a method present as much in the GOOD dataset than in the MAL dataset. $H_0$ is therefore very non-discriminating. On the contrary, a distance of 100% means we add in our heuristic methods exclusively present in the MAL dataset. We have computed 11 heuristics with a distance $d$ going from $H_0$ to $H_{100}$ by steps of 5%. We measured the accuracy and relevance of these heuristics on the remaining test set of 1,000 samples in MAL and a similar test set issued from GOOD. We count the number of invocation methods listed in the heuristics for each heuristic $H_0$ to $H_{100}$. We define a detection threshold $t$: an application is considered as malicious if it uses more than $t$ methods occurring in a heuristic $H_d$. We evaluate the impact in term of true positive rate (TPR) and false positive rate (FPR) of a threshold value from 0 to 10000 in Figure 3. Finally, from this results, we draw the ROC curves, as shown in Figure 4, for all heuristics. By maximizing the true positive rate while minimizing the false positive rate (point closest to the upper left of the ROC curve), we found that the best parameters are when using a distance of 35% and a threshold of 900 suspicious invokes, making $H_{35}$ with the threshold of $t = 900$ invocations of suspicious methods above which the application is considered malicious. 5. Isolation of suspicious code We conclude this article by focusing on the control flow graph and the data dependency graph of an application. In the control flow graph, we can highlight methods that seem suspicious because one or more of their instructions invoke a suspicious API function according to the previously described heuristics. This methodology leads to the identification of methods in the bytecode. The highlighted code can be grouped or scattered in the graph. This first step can be used to decide whether or not an application is malicious as we have proposed in the previous section. This method does not allow to understand the structure of the malicious code because it only reports a set of methods without any link between them. We now propose to try to separate malicious code from healthy code by assuming that the malicious code contains the suspicious methods and that the malicious code manipulates data contaminated by instructions considered suspicious. Figure 4. Comparaison of ROC curves Suspicious instructions and suspicious methods An instruction is suspicious if it is an invoke of an external suspicious Android API or when it depends on data generated by other suspicious instructions. A method is considered suspicious if it contains at least one suspicious instruction. The set of suspicious methods is recursively computed from the data dependency graph of the application. This data dependency graph is computed using Soot [3] and Grodd-Droid [10]. It represents the data dependency between a bytecode instruction \( i \) and the set of previous instructions that modify the registers impacting \( i \). Figure 5 depicts the control flow graph of a sample of Airpush issued from the AMD dataset. This sample has 830 methods, among them 23 (2.8%) invoke an external suspicious Android API (3 invoke a telephony API, 3 invoke a system API and 17 invoke a network API). The suspicious methods are colored in black in Figure 5. The computation of methods depending on at least a suspicious instruction leads to the identification of 330 (39.8%) suspicious methods in the following packages: - com.flurry*: 20 methods over 44 - com.bugsense*: 27/60 - com.mobclix.android*: 101/378 - com.ZGisNcvn*: 177/310 - com.boa.whis*: 5/8 Here again, the precision depends above all on the heuristics chosen: if the heuristic is too broad, then the error is further amplified by the search for methods manipulating data that are incorrectly labeled. In a random sample from MAL having 6127 methods, we found a graph composed of 11 connected components for a total of 2289 methods with the heuristic \( H_5 \), 2248 methods (loss of 41 methods) with the heuristic \( H_{35} \), and a total of 1876 (loss of an entire package) with the heuristic \( H_{50} \). The different grafts for \( H_{35} \) are depicted in gray in Figure 6. For each of these heuristics, we found the following number of components depicted here by their size: - \( H_5 \) : 49 components (1, 1, 1, 1, 1, 1, 1, 6, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2214) - \( H_{35} \) : 6 components (1, 1, 1, 10, 1, 2372) - \( H_{50} \) : 2 components (1, 2355) Malicious connected component and grafting point When an attacker grafts malicious code to an application, he ensures that the execution of malicious code is possible through the execution of the original application. To do this, he can either add a new entry point to the application, this is what we have called a "coarse" graft, or he can modify one (or more) methods of the application so as to modify at least one normal execution path to drift it to the malicious code, this is what we have called a "fine" graft. The malicious code can be gathered in a newly added library. From the graph point of view, a grafting point corresponds to an articulation point (i.e. a method whose removal would increase the number of connected components) that maximizes the number of suspicious methods contained in a single component. To highlight this suspicious graft, we highlight connected components of the control flow graph containing only suspicious methods obtained in the previous step: these nodes are suspicious either because they invoke a suspicious API or because they manipulate data acquired from suspicious APIs. 2SHA256: 84cde6a088b3303dfe4d7bc25443a82094d89441b6f39 6d2e8c2b70e0963fc 3SHA256: d0faeddd5a230685ac027f7e1136015dc5ffa5ef7ba12344b75 7cd90b57141e25 Figure 5. Method in the CFG depending on a suspicious instruction in AirPush Figure 6. Estimation of a malicious graft with $H_{35}$ 6. Conclusion In this article we have addressed the difficult problem of accurately locating malicious code in the entire code of an Android application. First, we conducted a broad study of the different characteristics that can lead to identify this malicious code. We have updated the list of classes and packages preferably used by malware rather than goodware. This first part was done by randomly selecting goodware and malware sets in the wild with a uniform distribution of numbers of samples between 2015 and 2018 and a distribution of the size of the goodware similar to the distribution of size of malware. This choice of input datasets allows us to limit the bias that datasets representing only certain families can bring. We deduced a heuristic that can be used to detect whether an application is a malware or not. This heuristic relies on the classes and methods used by the application. We have shown that, using this heuristic in conjunction with the data dependency graph allows to locate malicious code grafts. Hash values and heuristic files used here are available on demand. References
{"Source-Url": "https://hal-centralesupelec.archives-ouvertes.fr/hal-02288116/file/camera-malcon19.pdf", "len_cl100k_base": 5643, "olmocr-version": "0.1.50", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 30409, "total-output-tokens": 7522, "length": "2e12", "weborganizer": {"__label__adult": 0.0009832382202148438, "__label__art_design": 0.0005860328674316406, "__label__crime_law": 0.01080322265625, "__label__education_jobs": 0.0009412765502929688, "__label__entertainment": 0.00023114681243896484, "__label__fashion_beauty": 0.0003635883331298828, "__label__finance_business": 0.00030231475830078125, "__label__food_dining": 0.0005574226379394531, "__label__games": 0.0030517578125, "__label__hardware": 0.0035686492919921875, "__label__health": 0.0010995864868164062, "__label__history": 0.00046539306640625, "__label__home_hobbies": 0.00017845630645751953, "__label__industrial": 0.0007615089416503906, "__label__literature": 0.00077056884765625, "__label__politics": 0.0006608963012695312, "__label__religion": 0.0007801055908203125, "__label__science_tech": 0.1253662109375, "__label__social_life": 0.00021398067474365232, "__label__software": 0.08544921875, "__label__software_dev": 0.76171875, "__label__sports_fitness": 0.0004703998565673828, "__label__transportation": 0.0004329681396484375, "__label__travel": 0.00021755695343017575}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 29945, 0.06257]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 29945, 0.49325]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 29945, 0.87999]], "google_gemma-3-12b-it_contains_pii": [[0, 1145, false], [1145, 5478, null], [5478, 9091, null], [9091, 13746, null], [13746, 16058, null], [16058, 20330, null], [20330, 24392, null], [24392, 24526, null], [24526, 29945, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1145, true], [1145, 5478, null], [5478, 9091, null], [9091, 13746, null], [13746, 16058, null], [16058, 20330, null], [20330, 24392, null], [24392, 24526, null], [24526, 29945, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 29945, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 29945, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 29945, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 29945, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 29945, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 29945, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 29945, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 29945, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 29945, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 29945, null]], "pdf_page_numbers": [[0, 1145, 1], [1145, 5478, 2], [5478, 9091, 3], [9091, 13746, 4], [13746, 16058, 5], [16058, 20330, 6], [20330, 24392, 7], [24392, 24526, 8], [24526, 29945, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 29945, 0.17647]]}
olmocr_science_pdfs
2024-11-30
2024-11-30
b6ead78f6e33768cf18cda7d42e53f4182b00904
Graphs and BFS We will devote two lectures of the Algorithms and Data Structures thread to an introduction to graph algorithms. As with many other topics we could spend the entire course on this area. 9.1 Directed and Undirected Graphs A graph is a mathematical structure consisting of a set of vertices and a set of edges connecting the vertices. Formally, we view the edges as pairs of vertices; an edge \((v, w)\) connects vertex \(v\) with vertex \(w\). Formally: - \(V\) is a set, and - \(E \subseteq V \times V\). We write \(G = (V, E)\) to denote that \(G\) is a graph with vertex set \(V\) and edge set \(E\). A graph \(G = (V, E)\) is undirected if for all vertices \(v, w \in V\), we have \((v, w) \in E\) if and only if \((w, v) \in E\); that is, if all edges go both ways. This definition makes it clear that undirected graphs are just special directed graphs. When studying undirected graphs we often represent a complementary pair of directed edges \((u, v)\) and \((v, u)\) as just one ‘undirected’ edge using some special notation. In this introduction we will not go to this extent but state in each case if a graph is directed or undirected. A useful convention is that in drawing diagrams of directed graphs we indicate the direction of an edge with an arrow. In the case of undirected graphs we do not draw pairs of directed edges (one from \(u \to v\) and one from \(v \to u\)) but just one edge without an arrow\(^1\). If we want to emphasise that the edges have a direction, we say that a graph is directed. Note that in principle \(V\) and hence \(E\) can be infinite sets. Such graphs are very useful in many areas (including computing) but for this introduction we will assume always that \(V\) is finite. Since \(E \subseteq V \times V\) is follows that \(E\) is also finite. **Example 9.1.** Figure 9.2 shows a drawing of the (directed) graph \(G = (V, E)\) with vertex and edge sets given by: \[ V = \{0, 1, 2, 3, 4, 5, 6\} \\ E = \{(0, 2), (0, 4), (0, 5), (1, 0), (2, 1), (2, 5), (3, 1), (3, 6), (4, 0), (4, 5), (6, 3), (6, 5)\} \] We state here a definition that will be needed subsequently. **Definition 9.3.** Let \(v \in V\) be a vertex in a directed graph \(G = (V, E)\). - The in-degree \(\text{in}(v)\) of \(v\) is the number of incoming edges to \(v\), i.e., the number of edges of form \((u, v)\). The set of in-edges to \(u\) is written as \(\text{In}(u)\). - The out-degree \(\text{out}(v)\) of \(v\) is the number of outgoing edges from \(v\), i.e., the number of edges of form \((v, u)\). The set of out-edges from \(v\) is written as \(\text{Out}(v)\). \(^1\)Do not confuse a diagram representing a graph with the graph itself. The graph is the abstract mathematical structure and can be represented by many different diagrams. --- **Example 9.4.** Airline route maps. Vertices represent airports, and there is an edge from vertex \(A\) to vertex \(B\) if there is a direct flight from the airport represented by \(A\) to the airport represented by \(B\). **Example 9.5.** Electrical Circuits. Vertices represent diodes, transistors, capacitors, switches, etc., and edges represent wires connecting them. **Example 9.6.** Computer Networks. Vertices represent computers and edges represent network connections (e.g., cables) between them. **Example 9.7.** The World Wide Web. Vertices represent webpages, and edges represent hyperlinks. **Example 9.8.** Flowcharts. A flowchart illustrates the flow of control in a procedure. Essentially, a flowchart consists of boxes (vertices) containing statements of the procedure and arrows (directed edges) connecting the boxes to describe the flow of control. **Example 9.9.** Molecules. Vertices are atoms, edges are bonds between them. The graphs in Examples 9.4, 9.7 and 9.8 are directed. The graphs in Examples 9.5, 9.6 and 9.9 are undirected. 9.2 Data structures for graphs Let \(G = (V, E)\) be a graph with \(n\) vertices. We assume that the vertices of \(G\) are numbered \(0, \ldots, n - 1\) in some arbitrary manner. --- Figure 9.2. A directed graph The adjacency matrix data structure The adjacency matrix of $G$ is the $n \times n$ matrix $A = (a_{ij})_{0 \leq i, j \leq n-1}$ with $$a_{ij} = \begin{cases} 1, & \text{if there is an edge from vertex number } i \\ 0, & \text{otherwise.} \end{cases}$$ For example, the adjacency matrix for the graph in Figure 9.2 is $$ \begin{pmatrix} 0 & 0 & 1 & 0 & 1 & 1 & 0 \\ 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 & 0 & 1 & 0 \\ 1 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 1 & 0 & 0 \end{pmatrix} $$ Note that the adjacency matrix depends on the particular numbering of the vertices. The adjacency matrix data structure stores the adjacency matrix of the graph as a 2-dimensional Boolean array, where TRUE represents 1 (i.e., there is an edge) and FALSE represents 0 (i.e., there is no edge). It is worth noting here that for some applications it is preferable to use actual numbers rather than Boolean values. The main advantage of the adjacency matrix representation is that for all vertices $v$ and $w$ we can check in constant time whether or not there is an edge from vertex $v$ to vertex $w$. However we pay a price for this fast access. Let $m$ be the number of edges of the graph. Note that $m$ can be at most $n^2$. If $m$ is close to $n^2$, we call the graph dense, and if $m$ is much smaller than $n^2$ we call it sparse. Storing a graph with $n$ vertices and $m$ edges will usually require space at least $\Omega(n + m)$. However, the adjacency matrix uses space $\Theta(n^2)$, and this is much more than $\Theta(n + m)$ for sparse graphs (when a large fraction of entries in the adjacency matrix consists of zero). Moreover, many algorithms have to inspect all edges of the graph at least once, and to do this for a graph given in adjacency matrix representation, such an algorithm will have to inspect every matrix entry at least once to make sure that it has seen all edges. Thus it will require time $\Omega(n^2)$; we will see some important algorithms that run in time $\Theta(n + m)$ with an appropriate data structure. The adjacency list data structure The adjacency list representation of a graph $G$ with $n$ vertices consists of an array vertices with $n$ entries, one for each vertex. The entry for vertex $v$ is a list of all vertices $w$ such there is an edge from $v$ to $w$. We make no assumptions on the order in which the vertices adjacent to a vertex $v$ appear in the adjacency list, and our algorithms should work for any order. Figure 9.10 shows an adjacency list representation of the graph in Figure 9.2. For sparse graphs an adjacency list is more space efficient than an adjacency matrix. For a graph with $n$ vertices and $m$ edges it requires space $\Theta(n + m)$, which might be much less than $\Theta(n^2)$. Moreover, if a graph is given in adjacency list representation one can visit efficiently all neighbours of a vertex $v$: this just requires time $\Theta(1 + \text{out}(v))$ and not time $\Theta(n)$ as for the adjacency matrix representation$^2$. Therefore, visiting all edges of the graph only requires time $\Theta(n + m)$ and not time $\Theta(n^2)$ as for the adjacency matrix representation. On the other hand, finding out whether there is an edge from vertex $v$ to vertex $w$ requires (in the worst case) stepping through the whole adjacency list of $v$, which could have up to $n$ entries. Thus a simple adjacency test takes time $\Theta(n)$ in the worst case, compared to $\Theta(1)$ for adjacency matrices. Extensions We have only described the basic data structures representing graphs. Vertices are just represented by the numbers they get in some numbering, and edges by the numbers of their endpoints. Often, we want to store additional information. For example, in Example 9.4 we might want to store the names of the airports represented by the vertices, or in Example 9.7 the URLs of the webpages. To do this, we create separate vertex objects that store the number of a vertex and an object that contains the additional data we want to store at the vertex. In the adjacency list representation, we include the adjacency list of a vertex in the vertex object. Then the graph is represented by an array (possibly a dynamic array) of vertex objects. Similarly, we might want to store additional information on the edges of a graph; in Example 9.4 we may want to store flight numbers. We can do this by setting up separate edge objects which will store references to the two endpoints of an edge and the additional information. Then in the adjacency list representations, the lists would be lists of such edge objects. A frequent situation is that edges of a graph carry weights, which are real numbers providing information such as the cost of a flight in Example 9.4 or the capacity of a wire or network connection in Examples 9.5 and 9.6. Graphs whose edges carry weights are called weighted graphs. $^2$It might be tempting to replace $\Theta(1 + \text{out}(v))$ with $\Theta(\text{out}(v))$ but this is wrong if $\text{out}(v) = 0$. Figure 9.10. Adjacency list representation of the graph in Figure 9.2 9.3 Traversing Graphs Most algorithms for solving problems on graphs examine or process each vertex and each edge of the graph in some particular order. The skeleton of such an algorithm will be a traversal of the graph, that is, a strategy for visiting the vertices and edges in a suitable order. Breadth-first search (BFS) and depth-first search (DFS) are two traversals that are particularly useful. Both start at some vertex and then visit all vertices reachable from that vertex. If there are vertices that remain unvisited, that is, if there are vertices that are not reachable from that vertex, then the only way they can be listed is if the search chooses a new unvisited vertex and visits all vertices reachable from that vertex. This process would have to be repeated until all vertices are visited. We can present the general graph searching strategy as algorithms 9.11 and 9.12. In these algorithms we assume that we start with every vertex unmarked and we have some efficient way of marking it. Note that once a vertex is marked it stays as such. The schedule $S$ is some efficient data structure such that we can put vertices on it and take them off one at a time. For BFS we use a Queue while for DFS we use a Stack as our schedule $S$. As we will see, because recursive procedures use an implicit stack we will be able to re-express DFS rather neatly without an explicit schedule $S$ (all the same it is there but given to us by the underlying system for handling recursion). Algorithm search($G$) 1. initialise schedule $S$ 2. for all $v \in V$ do 3. if $v$ is not marked then 4. searchFromVertex($G, v$) Algorithm 9.11 Algorithm searchFromVertex($G, v$) 1. mark $v$ 2. put $v$ onto schedule $S$ 3. while schedule $S$ is not empty do 4. remove a vertex $v$ from $S$ 5. for all $w$ adjacent to $v$ do 6. if $w$ is not marked then 7. mark $w$ 8. put $w$ onto schedule $S$ Algorithm 9.12 In our presentation we think of vertices as being in one of two states: unmarked and marked. There is some advantage to thinking of them as being in one of three states which we represent by colours: - White: not yet seen. - Grey: put on schedule. - Black: taken off schedule. Each vertex starts off as white then becomes grey and finally black. We can think of these states as corresponding to “not yet investigated”, “under investigation”, “completed”. We will use the three colour scheme later on when studying an algorithm for topological sorting of graphs. Breadth-First Search A BFS starting at a vertex $v$ first visits $v$, then it visits all neighbours of $v$ (i.e., all vertices $w$ such that there is an edge from $v$ to $w$), then all neighbours of the neighbours that have not been visited before, then all neighbours of the neighbours of the neighbours that have not been visited before, etc. For example, one BFS of the graph in Figure 9.2 starting at vertex 0 would visit the vertices in the following order: 0, 2, 5, 4, 1 It first visits 0, then the neighbours 2, 5, 4 of 0. Next are the neighbours of 2, which are 1 and 5. Since 5 has been visited before, only 1 is added to the list. All neighbours of 5, 4, and 1 have already been visited, so we have found all vertices that are reachable from 0. Note that there are other orders in which a BFS starting at 0 could visit the vertices of the graph, because the neighbours of 0 might be visited in a different order. If the neighbour vertices are visited in numerical order, then the BFS from 0 would be 0, 2, 4, 5, 1. Vertices 3 and 6 are not reachable from 0, so to visit them we must to start another BFS, say at 3. The traversal heavily depends on the vertex we start at. If we start a BFS at vertex 6, for example, all vertices are reachable, and the vertices are visited in one sweep, for example: 6, 5, 3, 1, 0, 2, 4. Other possible orders are 6, 3, 5, 1, 0, 2, 4 and 6, 5, 3, 1, 0, 4, 2 and 6, 3, 5, 1, 0, 4, 2. In an undirected graph, however, the number of different BFS searches (or DFS searches) that need to be made to visit all vertices is independent of the choice of start vertices. During a BFS we have to store vertices that have been visited so far and also the vertices that have been completely processed (all their neighbours have been visited). We maintain a Boolean array visited with one entry for each vertex, which is set to TRUE when the vertex is visited. The vertices that have been visited, but have not been completely processed, are stored in a Queue. This guarantees that vertices are visited in the right order—vertices that are discovered first will be processed first. Algorithms 9.12 and 9.13 show a BFS implementation in pseudocode. The main algorithm bfs first initialises the visited array and the queue and then loops through all vertices, starting a bfsFromVertex for all vertices that have not been marked 'visited' in previous invocations of bfsFromVertex. The subroutine bfs- FromVertex visits all vertices reachable from the start vertex in the way described above. The inner loop in lines 5–8 can be implemented using an iterator over the adjacency list of the vertex $v$. **Algorithm** bfs($G$) 1. Initialise Boolean array $visited$ by setting all entries to FALSE 2. Initialise Queue $Q$ 3. for all $v \in V$ do 4. \[ \text{if } visited[v] = \text{FALSE} \] 5. \[ \text{bfsFromVertex($G, v$)} \] Algorithm 9.13 **Algorithm** bfsFromVertex($G, v$) 1. $visited[v] = \text{TRUE}$ 2. $Q$.enqueue($v$) 3. while not $Q$.isEmpty() do 4. \[ v \leftarrow Q$.dequeue() \] 5. for all $w$ adjacent to $v$ do 6. \[ \text{if } visited[w] = \text{FALSE} \] 7. \[ visited[w] = \text{TRUE} \] 8. \[ Q$.enqueue(w) \] Algorithm 9.14 To see the progress of $\text{bfs}(G)$ we can put a $\text{print}$ $v$ statement after each $visited[v] = \text{TRUE}$. In practice, BFS (or DFS) is often applied to applications such as all-pairs shortest paths for a graph. For applications like this, the “current vertex” obtained by BFS is used in the top-level algorithm for the particular application. ### Exercises 1. Give an adjacency matrix and an adjacency list representation for the graph displayed in Figure 9.15. Give orders in which a BFS starting at vertex $n$ may traverse the graph. ![Figure 9.15.](image-url)
{"Source-Url": "http://www.inf.ed.ac.uk/teaching/courses/inf2b/algnotes/note09.pdf", "len_cl100k_base": 4145, "olmocr-version": "0.1.50", "pdf-total-pages": 4, "total-fallback-pages": 0, "total-input-tokens": 16146, "total-output-tokens": 4504, "length": "2e12", "weborganizer": {"__label__adult": 0.0004532337188720703, "__label__art_design": 0.0006213188171386719, "__label__crime_law": 0.0006809234619140625, "__label__education_jobs": 0.004978179931640625, "__label__entertainment": 0.00015926361083984375, "__label__fashion_beauty": 0.00023448467254638672, "__label__finance_business": 0.00032806396484375, "__label__food_dining": 0.0007185935974121094, "__label__games": 0.0008935928344726562, "__label__hardware": 0.0016527175903320312, "__label__health": 0.00147247314453125, "__label__history": 0.0005884170532226562, "__label__home_hobbies": 0.0002732276916503906, "__label__industrial": 0.0010509490966796875, "__label__literature": 0.0005645751953125, "__label__politics": 0.0005540847778320312, "__label__religion": 0.0007848739624023438, "__label__science_tech": 0.36328125, "__label__social_life": 0.00023305416107177737, "__label__software": 0.0074310302734375, "__label__software_dev": 0.61083984375, "__label__sports_fitness": 0.0006055831909179688, "__label__transportation": 0.0013093948364257812, "__label__travel": 0.00035309791564941406}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 15456, 0.05011]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 15456, 0.607]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 15456, 0.91963]], "google_gemma-3-12b-it_contains_pii": [[0, 4076, false], [4076, 9217, null], [9217, 14046, null], [14046, 15456, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4076, true], [4076, 9217, null], [9217, 14046, null], [14046, 15456, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 15456, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 15456, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 15456, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 15456, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 15456, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 15456, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 15456, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 15456, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 15456, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, true], [5000, 15456, null]], "pdf_page_numbers": [[0, 4076, 1], [4076, 9217, 2], [9217, 14046, 3], [14046, 15456, 4]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 15456, 0.0]]}
olmocr_science_pdfs
2024-11-28
2024-11-28
7ca3aa491d3f2e8aadb18bda281280593f1ff390
[REMOVED]
{"Source-Url": "http://openaccess.city.ac.uk/2887/1/prima.pdf", "len_cl100k_base": 6276, "olmocr-version": "0.1.53", "pdf-total-pages": 13, "total-fallback-pages": 0, "total-input-tokens": 37237, "total-output-tokens": 8320, "length": "2e12", "weborganizer": {"__label__adult": 0.00042939186096191406, "__label__art_design": 0.000736236572265625, "__label__crime_law": 0.0006160736083984375, "__label__education_jobs": 0.0016527175903320312, "__label__entertainment": 0.00019180774688720703, "__label__fashion_beauty": 0.0002751350402832031, "__label__finance_business": 0.0007276535034179688, "__label__food_dining": 0.0005612373352050781, "__label__games": 0.0017557144165039062, "__label__hardware": 0.0011701583862304688, "__label__health": 0.0011243820190429688, "__label__history": 0.0006279945373535156, "__label__home_hobbies": 0.0001596212387084961, "__label__industrial": 0.0007762908935546875, "__label__literature": 0.0007581710815429688, "__label__politics": 0.0005817413330078125, "__label__religion": 0.0006194114685058594, "__label__science_tech": 0.39794921875, "__label__social_life": 0.0001634359359741211, "__label__software": 0.0107269287109375, "__label__software_dev": 0.57666015625, "__label__sports_fitness": 0.0004291534423828125, "__label__transportation": 0.0010013580322265625, "__label__travel": 0.00029540061950683594}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 31303, 0.04022]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 31303, 0.4014]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 31303, 0.89868]], "google_gemma-3-12b-it_contains_pii": [[0, 798, false], [798, 3787, null], [3787, 7383, null], [7383, 9400, null], [9400, 10674, null], [10674, 12914, null], [12914, 15018, null], [15018, 17035, null], [17035, 20140, null], [20140, 21712, null], [21712, 24274, null], [24274, 27896, null], [27896, 31303, null]], "google_gemma-3-12b-it_is_public_document": [[0, 798, true], [798, 3787, null], [3787, 7383, null], [7383, 9400, null], [9400, 10674, null], [10674, 12914, null], [12914, 15018, null], [15018, 17035, null], [17035, 20140, null], [20140, 21712, null], [21712, 24274, null], [24274, 27896, null], [27896, 31303, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 31303, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 31303, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 31303, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 31303, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 31303, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 31303, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 31303, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 31303, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 31303, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 31303, null]], "pdf_page_numbers": [[0, 798, 1], [798, 3787, 2], [3787, 7383, 3], [7383, 9400, 4], [9400, 10674, 5], [10674, 12914, 6], [12914, 15018, 7], [15018, 17035, 8], [17035, 20140, 9], [20140, 21712, 10], [21712, 24274, 11], [24274, 27896, 12], [27896, 31303, 13]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 31303, 0.0]]}
olmocr_science_pdfs
2024-12-08
2024-12-08
b824077d3f12b9451ee2cd8c821a5b30b6b41f1b
Protrack: A Student-Teacher Project Management Tool Dr. V. Vijayakumar\textsuperscript{a}, R. Pradeepkumar\textsuperscript{a}, S. Siddharthan\textsuperscript{a}, C. Harish Mohan\textsuperscript{a}, and V. Deepak Kumaran\textsuperscript{a} \textsuperscript{a}Department of CSE Sri Manakula Vinayagar Engineering College, India Article History: Received: 10 January 2021; Revised: 12 February 2021; Accepted: 27 March 2021; Published online: 28 April 2021 Abstract: The internet has become one of the most important necessities in the present world. Web technology is a collective name for technology primarily for the World Wide Web (WWW). The three core languages that form up the globe Wide Web are HTML, CSS and JavaScript. The present student management system helps in maintaining student records and the project management system is an industry-based software that is used to assign work to a group of people. The student management system only manages the student information and the project management system doesn't allow a person to monitor the team and give instructions based on it. ProTrack incorporates both project management and student management software and brings an industrial workspace to the students. Here students can form teams with peer students to work on their innovative projects. ProTrack provides an environment where students could work - teachers could support. Hence improves the ability of the students to work as a team under supervision. 1. INTRODUCTION 1.1 Web Technology The Internet has the distinctive ability to connect any user with another user, according to any quality possible relationships, goals, problems, identity or interests. Web technology is a collective name for technology primarily for the World Wide Web (WWW). It’s an information system where documents and other web resources are recognized by Uniform Resource Locators (URL). Web technology is the crucial and use of mechanisms that make it possible for different computers to communicate. We can also allot resources or the building blocks of an effective computer networking system. Some examples of web technologies together with markup languages such as HTML, CSS, XML, CGI, JavaScript and HTTP as well as Programming language, web servers, databases and business applications are also parts of web technologies. The amalgamation of Web technologies has an important place into the process of accomplishing companies. Its objectives to increase the competitiveness degree on the market by generating customers loyalty. Web technology has been used for various fields such as Real Time web analytics, Digital Advertising, E-Commerce, Publishing, Massively Multiplayer Online Games, Backend Services and Messaging, Project Management & Collaboration, Realtime Monitoring Services, Live Charting and Graphing, Group and Private Chat, etc. 1.2 Web Applications A web application is an application software that runs on a web server, and is accessed by the user through a web browser with an active internet connection. In order to create websites that look and performance a specific way, web developers utilize different languages. The three core languages that form up the globe Wide Web are HTML, CSS and JavaScript. The Net is an important platform, whether it's for developing or for consumer use when developing an internet site. HTML is the backbone of most web pages. Essentially, it's accustomed to create the structure of how a selected website would appear as if, from the headings, to the paragraphs, the body, links, and even images. To make a data-centric web application from the bottom-up, it is commanding to understand: - Front-end: For the look and feel of your web application. Front-end can include HTML, CSS, JavaScript, etc. - Back-end: Control how web applications work. Back-end can include Python, Java, NodeJS, etc. - DevOps: Deploying/hosting your web application. Some DevOps tools are GitHub, Jenkins, Docker. 1.3 Components of Web Application All web-based database applications have 3 primary components: A web browser, a web application server, and a database server. Web-based database applications rely on a database server, which provides the data for the application. The database server sometimes also provides business logic in the form of stored procedures. Depending on how the app logic is distributed among the client and server sides, there can be various types of web application architecture. A single page Web Application architecture will have client-side and a web server (server-side). Server-side is the systems that run on the server, server-side is about working behind the scenes to manage data. Nearly all business logic runs on the server side, and this includes rendering dynamic web pages, interacting with databases, identity authentication, and push notifications. Server-side refers to the location where processes run. Client-side involves interactivity and displaying data. this includes what the user sees, such as text, images, and the rest of the UI, along with any actions that an application performs within the user's browser. Client devices send requests to the servers for web pages or applications, and the servers serve up responses. When you visit websites on the internet, they are each hosted by a "server". A server is a computer located somewhere in the world that's connected to the internet, and that computer's job is to "serve" web pages to internet users that want to view them. A laptop computer shows web pages served by a "server" computer. 1.4 Web Technology Architecture ![Diagram of 3-tier Web Application] Figure 1. Architecture of 3-tier Web Application Server-side is the systems that run on the server, server-side is about working behind the scenes to manage data. Server-side refers to the location where processes run. Nearly all business logic runs on the server side, and this includes rendering dynamic web pages, interacting with databases, identity authentication, and push notifications. Client-side involves interactivity and displaying data. Every UI element in a web page is divided into reusable components that can be used in various parts of the application. 1.5 MERN Stack MERN stands behind the four key technologies MongoDB, Express, React, Node that make up the stack. The MERN stack is used to build web pages that fall into the premium category. Premier JavaScript web server MERN is one of the various MEAN Stack (MongoDB, Express, Angular, Node), in which the standard Angular.js frontend framework is replaced by ReactJS hosted by Facebook, Inc. MERN is also an open-stack of source technology and can classify as a full-stack. 1.6 NodeJS Node.js is an open-source, cross-platform, JavaScript runtime environment that executes JavaScript code outside a web browser, primarily used for non-blocking, event driven servers, due to its single-threaded nature. It used back-end API services, but was designed with real-time, push-based architectures in mind which is considered as an additional advantage. 1.7 MongoDB MongoDB is a cross-platform, document-oriented, open-source, NoSQL database program. MongoDB data are JSON-like documents. It stores data records as documents which are gathered together in collections. A database store can have one or more collections of documents. The main advantage of MongoDB is that the data fields can vary from document to document and data structure can be changed over time. It supports dynamic queries on documents including a document-based source language that's nearly as powerful as SQL. 1.8 React React also called ReactJS is an open-source, front end, JavaScript library for building user interfaces or UI components. It is maintained by Facebook and a community of individual developers and firms. ReactJS is employed as a base within the event of single page or mobile applications. However, ReactJS is simply concerned with state management and rendering that state to the DOM, so creating React applications usually requires the use of additional libraries for routing. React Router is an example of such a library. 1.9 Express Express or Express.js is a fast and minimalist web framework for Node.js designed for building single-page, multi-page, and hybrid web applications. It can manage a server and routes for a web application allowing setup middleware to respond to HTTP Requests. Express makes routing easy with the functionality to build robust API. Express is MVC like structure. Libraries like Mongoose for MongoDB needed for object-relational mapping. 2. RELATED WORK 2.1 College Activity Management System 2.1.1 Authors: M. Ashok Kumar, Ch. Mohan Srinivas, K. Vishnu Vardhan Reddy, K. Kiran Kumar The College activity management system is used to maintain college events. The base idea of this project is to develop an android based Mobile application for development of institution and educational system. The aim is to give output for reaching the student data framework and UI is to reduce the present paper records. Staff can exchange investment and results, they also can establish notices through a safe, online interface using an android gadget. There are different modules for different users such students, teachers, HOD, placement officers. The system uses MySQL as its database for simplicity and flexibility. This module stores every single data of students, faculty and models their data on specified operations. These operations can be storing student attendance, result data or can be authentication Credentials. The staff module uses mobile phones to take attendance, upload results and notifications. ![Figure 2. College Activity Management System Architecture](image) The entered admin details are encrypted and sent to the server for verification. Only after successful authentication the actions are performed. If the username and Password match then he/she can enter into the attendance page. The proposed framework gives the better approach for registering and showing a task with a responsive and alluring UI. 2.2 The Design of Embedded Web System based on REST Architecture 2.2.1 Authors: Yunwei Zhao, Xin Wan As there is a rapid development of network technology, embedded web system development the integration of web technology with embedded systems makes it more intelligent. The traditional development mode of embedded web systems has a high coupling degree between the front-end and back-end. The development mode of embedded web systems has a high degree of coupling between the front-end and back-end. There are some problems such as high memory consumption, long development cycle, high costs for maintenance and poor expansion performance. To solve these kinds of problems the paper proposes an integration of a web system with an embedded system that has a system design scheme based on REST architecture. The REST API is an API interface based on REST architecture. Compared with the front and rear end coupling development scheme, The REST API maintains the adaptability of the interface. The front and rear end separation architecture using REST API has the advantages of low coupling, low complexity and high expansibility. According to the principles of REST, different business types and data can be abstracted as resources and represented by URI. Users can retrieve resources by URL. The URL is mainly composed of the network protocol (HTTP, HTTPS), server address, URI and parameter list. This kind of development reduces the resource cost and improves the response speed. 2.3 Splay: A Lightweight Video Streaming Application 2.3.1 Authors: Nilesh S Inkane, Siddhi A Kotak, Amitkumar S. Manekar Splay is a video streaming web application which uses YouTube as a server and storage and the app itself inhabits our own desired server. It is developed to figure on any device and any platform provided, the device incorporates a browser. It uses React.js for developing the UI which is the front end and achieving a single page application model for the more native-like experience. The front end works without reloading the web page and renders components instead of HTML pages for each request sent. This avoids sending multiple HTTP requests to the server and saves a lot of time and makes the app faster Node.js and MongoDB are the ones powering the back end of the application. Splay considered MongoDB as the database for the video streaming application. MongoDB uses collections and documents instead of rows and tables. Splay uses the Mongoose - a node package instead of the default available MongoDB drivers. Every route in the application which node serves is made a middleware for security of the routes. The advantages of Splay are many be a strong and reliable resolution for small-scale and large-scale establishments and organizations for video streaming, performs as a better solution to the content management problem of institutions desiring their own video streaming application. 2.4 Student Information Management System 2.4.1 Authors: Dipin Budhrani, Vivek Mulchandani, Yugchhaya Galphat The motive of the Student Information Management system is to provide an integrated information technology environment for students, HOD, faculty, staff and administration. The system is equipped with a logging system to track all users-access and make sure conformity to data access guidelines and is anticipated to increase the efficiency of the institution's record management, thereby decreasing the work hours needed to access and deliver student records to users. It is mainly useful for educational installation to manage student data which also facilitates all individual associated information for easier navigation on a daily basis. It presents facilities for entering student tests and other assessment scores, tracking student attendance and managing many other data needs in an institution. ![Student Information Management System Architecture](image1) **Fig. 4. Student Information Management System Architecture** The study’s integrated institution administration application would be used to reduce time spent on administrative tasks, as to concentrate on other skilful practical activities other than book worming. It can acquire, process and generate reports at any given point of time accurately. All these problems are solved using a student information management system which provides the online interface for students, faculty etc., Increasing the efficiency of college record management, Decreasing the time required to access and deliver student records which make the system more secure. **2.5 Analysis of REST API Implementation** **2.5.1 Authors:** Chaitanya Mukund Kulkarni, Prof. M. S. Takalikar RESTful web services deliver an architectural style for developing the web services and way of devouring those APIs for clients. The APIs, developed using http protocol may not be following all the REST constraints. The motivation of this paper is to construct the method for API validation which checks if the implementation is developed as per the demand of the specification document of the respective API. To deliver a way for analysing the implementation of REST services, this paper provides a method for analysis with the help of OpenAPI Specification document 2.0. Our main aim will be to provide a way to compare the implementation and its documentation and give the detailed report on the REST API implementation. ![REST API Architecture](image2) **Figure 5. REST API Architecture** Our main objective will be to provide a way to compare the implementation and its documentation and give the detailed report on the REST API implementation. This report will also have the details about gaps between the implementation and the documentation. We visualize that knowing and analysing these data in detail will allow deriving fitting approaches for resolving the identified loss, helping to improve the state of the art with purposeful solutions. 2.6 Modern Web-Development using ReactJS 2.6.1 Author: Sanchit Aggarwal ReactJS could be a component-based library that is deployed for the event of interactive user interfaces. Currently, it’s the foremost fashionable front-end JS library. It incorporates the read (V) layer within the MVC (Model read Controller) pattern. It’s supported by Facebook, Instagram and a community of individual developers and organisations. React primarily allows the event of huge and sophisticated web-based applications which might amend its information while not consequent page refreshes. It targets to produce higher user experiences and with blazing quick and strong internet apps development. ReactJS could be a JavaScript library that is deployed to develop reusable computer programme (UI) parts. React primarily allows the event of huge and sophisticated web-based applications which might amend its information while not consequent page refreshes. React abstracts the Document Object Model (DOM), so giving an easy, acting and strong application development expertise. ![Figure 6. ReactJS Architecture](image) React principally renders on the server-side victimization NodeJS. React implements simplex information flow so simplifying the boilerplate and therefore proves to be a lot easier than ancient information binding. 2.7 A Review on Various Aspects of MongoDB Databases 2.7.1 Author: Anjali Chauhan MongoDB is an open-source document database that provides high convenience and automatic scaling. A record in it is a document, which is a data structure composed of field and value pairs. Its documents are similar to JSON objects. It is most popular among the NoSQL databases. For building data warehouses, it is a perfect tool mainly because of its ability to fully utilize so-called “sharding-nothing cluster architecture.” It is an open-source database, which makes it ideal for building high-performance data warehouses. This paper provides a review of various aspects of MongoDB and some key issues are framed. In future, research can be made on any of these issues. New, updated versions are published practically every day, so one has to approach the project for which MongoDB is considered with a sense of adventure. The next-generation NoSQL databases are mostly non-relational, distributed and horizontally scalable and are able to meet most of the needs of the current-day applications. The main characteristics of these databases are schema-free, no join, easy replication support, simple API and eventually consistent. The result of this study opens new avenues for future research of the performance of data access when there are hotspots in data because it supposes all the data will be accessed in the same patterns. MongoDB is considered as most reliable database because of its: - **High Performance** - MongoDB provides high performance data perseverance. In particular, it supports embedded data models, reduces Input and Output activity on database systems, indexes support faster queries and can include keys from embedded documents and arrays. - **Rich Query Language** - MongoDB supports a rich query language that supports create, read, update and delete (CRUD), write operations as well as Data aggregation, Text Search. - **High Availability** – MongoDB replica set provides automatic failover and data redundancy. A replica set is a group of MongoDB servers that maintain the same data set, providing redundancy and increasing data availability. - **Horizontal Scalability** – MongoDB provides horizontal scalability as part of its core functionality. Sharding distributes data across a cluster of machines. ### 3. EXISTING SYSTEM The existing system such as Basecamp, Asana, Zoho Projects are some software used in the well reputed firms which has almost everything that an employee needs to complete his work in time and also helps to keep it in an organised manner and also notify his team about it. Many project managers have started utilizing various software project management tools to manage and support their product activities. These tools are mainly utilized in planning, monitoring and controlling projects. The most important 17 criteria are Task Scheduling, Collaboration, Time Tracking, Project analysis/reporting, Communication Tools, Access Control, etc. They are completely personalized so they can fit the needs of teams of different magnitudes and with different goals. Most growing companies benefit from moving their project management system to the cloud which reduces the risk of data loss. It helps the employer to keep a record of all the work done by an employee and whether it is done in time. Some other systems such as DyKnow, Socrative, Hero are software used in educational institutes to monitor the progress of the students. Student management system is an environment where all the processes of the student in the institution are handled. It is done through the automated computerized method. Normally this system is done using papers, files and binders. This system saves the time of the student and of the institution. It includes processes like registration of the student’s details, assigning the department based on their course and maintenance of the record. This system reduces the cost and workforce required for this job. As the system is online the information is present worldwide to everyone. This makes the system easy to handle and feasible for finding the omission with updating at the same time. As the system used in the institute is outdated as it needs papers, files, which will need the human workforce to maintain them. To get registered within the institute, a student during this system one should come to the university. As the number of the scholars increases within the institute, manually managing the strength becomes a busy job for the administrator. This computerized system stores all the info within the database which makes it easy to fetch and update whenever needed. #### 3.1 Issues in the system **3.1.1. Both systems serve different environment** The existing system one is a software which totally serves the work environment and has no use for students in educational standards and the other system is totally based on the educational institute. One is not related to the other and it cannot be used by the irrespective group which makes the software monochromes. As a result of this the students have no experience about the work environment that they have to face in their upcoming future. **3.1.2. Project management system doesn't support the student environment** The project management system is used in industries to assign work to their workers, this cannot be used in a student environment since the students may need guidance and constant monitoring. The software does not provide an environment where a person could learn and improve it, just a software where a person could assign a task and others could be able to complete it. **3.1.3. Student management system doesn't have work environment** The student management system is a system which has the total record of the students under an institution from their personal records to their scores in the last evaluation. But still, it does not provide the student an experience in the work environment which they need in their foreseeable future. 4. PROPOSED SYSTEM The proposed system ProTrack - consists of the combination of both the existing systems which are student management system and project management system. ProTrack is a hybrid of both existing systems which has both merits and avoided all possible demerits. The software proposed provides a sophisticated environment for the students to form a team and develop projects under the guidance of their teacher. Unlike both its parents, the proposed system is not monochromes since it helps the students to work on a project as a team as they would do in an industrial environment. It also allows the teacher to keep track of their student’s work and guide them accordingly so that if there is any difficulty or any other kind of disturbance that could be taken care of immediately. Since ProTrack is a web-based application, it can be accessed from any device. Students can log in to ProTrack with the credentials provided by the institution and add projects that they need to work on. For the added project, ProTrack automatically assigns a teacher as a project guide. If the student who created the project also known as the Project Lead needs a team, he/she can raise a request to the guide to form a team with the peer students. ProTrack features both project management and task management. The project lead can break down the projects into multiple modules and assign tasks to team members. The tasks can be prioritised as its importance to the project and a deadline can also be assigned so that the work can continue without any due as per schedule. As all these processes can be monitored by respective project guides, they are also provided with a login and can monitor all the teams that are assigned to them to be taken care of. The project guides can accordingly give commands which may be a guideline for the team. ProTrack provides a common platform where students can organize their projects also where teachers simultaneously monitor and support students. ProTrack gives students an experience of the work environment in which they are about to work in their near future. This gives students a chance to improve leadership qualities, ability to work under pressure, time management, team work, ability to follow orders, etc. 5. SYSTEM ARCHITECTURE ProTrack is a web application based on a three-tier architecture. The three tiers: the presentation tier, the logic tier and the data tier. The presentation tier is the frontend with interactive UI elements built with ReactJS. This top-level tier will run on a web browser. The users - Students and Teachers can access ProTrack through this tier to display and collect data. ReactJS takes care of the user's data acquisition and state management. Also helps users with API calls to communicate with the logic tier. The logic tier, also known as the business tier is the heart of the application. It contains the functional business logic, set of business rules which drives the application's core capabilities. The logic tier is developed with Express.js on top of the NodeJS. Initially, the user is authenticated. If authentication succeeds, the authorized user's request is mapped to the respective processing unit based on the HTTP request's method and endpoint. All the information collected in the presentation tier is processed accordingly. If needed the logic tier communicates the data tier using Mongoose driver and continues request processing with any of the CRUD (Create, Read, Update, Delete) Operations. The data tier handles user’s data in NoSQL Database server - MongoDB. Here the data records of students, teachers and projects are stored as documents in a single database but as different collections of documents. These collections are accessible by the logic tier via Mongoose driver’s API calls. The database hosted in the MongoDB server will be managed by the Administrator. The primary benefit of three-tier architecture is its logical and physical separation of functionality. It offers high scalability to the application and gives more independence for developers to work on different tiers. 6.MODULES 6.1 Student module Students enter after entering into the landing page, they need to login with their ProTrack credentials and can access the student module i.e. a student home page. There they can create new projects and get information about the upcoming tasks and the recent project that the student is working on. When students select a project, it takes them to a page where there is an elaborate detail about the particular project from due date to the percentage of completion. They can also work on the modules, add modules, add tasks, delete them, edit them, etc. The key tasks of student modules are - Project Management - Task Management - Fix Room Figure 8. Student Dashboard 6.1.1 Project Management 1. Create & Manage Projects - Students can create a project and add team members. 2. Organize Project Modules - The Project can be divided into many small modules and weightage can be given to it as per its importance. 3. Project Status - The status of the project can be reported periodically to the respective teacher so that the progress can be noted. 6.1.2 Task Management 1. **Personal Tasks** - Students can create a task that he/she desire to do in a particular time period. 2. **Tasks under Project Modules** - Multiple tasks can be created in the project under each specific module. 3. **Assign tasks to team members** - Tasks can be assigned to the team members as per their skills. 6.1.3 Fix Room The FixRoom is a chat room which helps in the inter team communication inside the application so that the difficulties can be overcome. This provides an advantage by eliminating the need of external communication applications. This helps in conservation of time since every team member and the guide can see this whenever they are logged in, which increases the possibility of being noticed. 6.2 Teacher Module When a teacher tries to login using the login page with their ProTrack credentials they get access to the teacher module, where he or she initially enters into the landing page which is basically a page which explains the usages of the application. They can sort the teams under them by project name, event name, etc. When they get into a project, they can view the modules and tasks created by the students. The key tasks of teacher modules are 1. View student’s projects - When a teacher is assigned to a specific team, he/she can view the projects that have been performed by the team. 2. Monitor student’s day-to-day work - They can monitor a particular student’s day to day work so that the contribution of a student in a project will be known. 3. Verify student’s project status - They can know about the status of the project that has been done by the students and work contribution done by every student 4. Interact with project team members - When a student need guidance or to guide them with a more efficient solution, the teacher can interact with the student through the Team Discussion feature When an admin tries to login using the login page with their ProTrack credentials they get access to the admin module, where he or she initially enters into the landing page which is basically a page which explains about the usages of the application. The admin is the authority for the student and teacher information storing, editing, deleting. They can also add, edit, delete events. The key tasks of teacher modules are 1. Add & maintain students profile - the admin can add a student to the stack of student records and maintain it for further updates. 2. Add & maintain teacher’s profile - the admin can add a teacher as soon as he/she enrolled for the job and maintain till further updates. 3. Manage ongoing competitions - when a contest is announced the admin will be in charge for notifying as well as setting parameters such giving due dates etc. 7. FUTURE SCOPE 1. Event Announcement Panel - This feature helps the students to know about the upcoming events and also the changes and updates about the existing events. 2. Organize Webinars & Team Meet (using Third Party Service) - We have planned to introduce a new feature that allows either the teacher or the team leader of a particular project to schedule a meeting using a third-party application and notify the members about it through mail. 3. Allow teachers to assign tasks to team members - We have planned to provide the teacher with some additional permission which allows them to assign tasks to a team member directly. 4. Due Notifications - This feature will notify the team members about the due date of their project periodically. 8. CONCLUSION Web based applications are used in most places in our day-to-day life. These are easy to operate and can be accessed from any part of the world. Even though there are web-based student management systems and project management systems at present there is no application where these two systems co-exist to provide students a work-based environment so that a student could form a team and work on a project of his/her desire under the guidelines of a teacher. ProTrack can be a solution for this issue since this is a hybrid of both the above-mentioned systems, it provides an environment a student could develop a project just as a work environment. REFERENCES
{"Source-Url": "https://turcomat.org/index.php/turkbilmat/article/download/4972/4170/9251", "len_cl100k_base": 6348, "olmocr-version": "0.1.50", "pdf-total-pages": 14, "total-fallback-pages": 0, "total-input-tokens": 34943, "total-output-tokens": 8172, "length": "2e12", "weborganizer": {"__label__adult": 0.0004668235778808594, "__label__art_design": 0.001071929931640625, "__label__crime_law": 0.0003464221954345703, "__label__education_jobs": 0.0382080078125, "__label__entertainment": 0.00017893314361572266, "__label__fashion_beauty": 0.00026607513427734375, "__label__finance_business": 0.0005807876586914062, "__label__food_dining": 0.0005407333374023438, "__label__games": 0.000797271728515625, "__label__hardware": 0.0017061233520507812, "__label__health": 0.000530242919921875, "__label__history": 0.0005083084106445312, "__label__home_hobbies": 0.00022101402282714844, "__label__industrial": 0.000568389892578125, "__label__literature": 0.0005812644958496094, "__label__politics": 0.00020182132720947263, "__label__religion": 0.0006227493286132812, "__label__science_tech": 0.03717041015625, "__label__social_life": 0.00032591819763183594, "__label__software": 0.0289459228515625, "__label__software_dev": 0.884765625, "__label__sports_fitness": 0.0002925395965576172, "__label__transportation": 0.000732421875, "__label__travel": 0.0003216266632080078}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 36384, 0.03548]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 36384, 0.39266]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 36384, 0.91776]], "google_gemma-3-12b-it_contains_pii": [[0, 4323, false], [4323, 7587, null], [7587, 10580, null], [10580, 13534, null], [13534, 15847, null], [15847, 18720, null], [18720, 23010, null], [23010, 26682, null], [26682, 28501, null], [28501, 28840, null], [28840, 30378, null], [30378, 30937, null], [30937, 31994, null], [31994, 36384, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4323, true], [4323, 7587, null], [7587, 10580, null], [10580, 13534, null], [13534, 15847, null], [15847, 18720, null], [18720, 23010, null], [23010, 26682, null], [26682, 28501, null], [28501, 28840, null], [28840, 30378, null], [30378, 30937, null], [30937, 31994, null], [31994, 36384, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 36384, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 36384, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 36384, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 36384, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 36384, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 36384, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 36384, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 36384, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 36384, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 36384, null]], "pdf_page_numbers": [[0, 4323, 1], [4323, 7587, 2], [7587, 10580, 3], [10580, 13534, 4], [13534, 15847, 5], [15847, 18720, 6], [18720, 23010, 7], [23010, 26682, 8], [26682, 28501, 9], [28501, 28840, 10], [28840, 30378, 11], [30378, 30937, 12], [30937, 31994, 13], [31994, 36384, 14]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 36384, 0.0]]}
olmocr_science_pdfs
2024-11-28
2024-11-28
63218ca9b6bb9e59d7888314757950bc4ddacb4b
From a Monolithic Big Data System to a Microservices Event-Driven Architecture Nunes Laigner, Rodrigo; Kalinowski, Marcos; Diniz, Pedro; Barros, Leonardo; Cassino, Carlos; Lemos, Melissa; Arruda, Darlan; Lifschitz, Sérgio; Zhou, Yongluan Published in: Proceedings of 46th Euromicro Conference on Software Engineering and Advanced Applications Publication date: 2020 Citation for published version (APA): From a Monolithic Big Data System to a Microservices Event-Driven Architecture Rodrigo Laigner Department of Computer Science (DIKU) University of Copenhagen, Denmark rnl@di.ku.dk Marcos Kalinowski, Pedro Diniz Informatics Department PUC-Rio, Brazil {kalinowski, pfonseca}@inf.puc-rio.br Leonardo Barros, Carlos Cassino, Melissa Lemos Tecgraf/PUC-Rio, Brazil {lbarrros, cassino, melissa}@tecgraf.puc-rio.br Darlan Arruda Department of Computer Science Western University, Canada darruda3@uwo.ca Sérgio Lifschitz Informatics Department PUC-Rio, Brazil sergio@inf.puc-rio.br Yongluan Zhou Department of Computer Science (DIKU) University of Copenhagen, Denmark zhou@di.ku.dk Abstract—[Context] Data-intensive systems, a.k.a. big data systems (BDS), are software systems that handle a large volume of data in the presence of performance quality attributes, such as scalability and availability. Before the advent of big data management systems (e.g., Cassandra) and frameworks (e.g., Spark), organizations had to cope with large data volumes with custom-tailored solutions. In particular, a decade ago, Tecgraf/PUC-Rio developed a system to monitor truck fleet in real-time and proactively detect events from the positioning data received. Over the years, the system evolved into a complex and large obsolescent code base involving a costly maintenance process. [Goal] We report our experience on replacing a legacy BDS with a microservice-based event-driven system. [Method] We applied action research, investigating the reasons that motivate the adoption of a microservice-based event-driven architecture, intervening to define the new architecture, and documenting the challenges and lessons learned. [Results] We perceived that the resulting architecture enabled easier maintenance and fault-isolation. However, the myriad of technologies and the complex data flow were perceived as drawbacks. Based on the challenges faced, we highlight opportunities to improve the design of big data reactive systems. [Conclusions] We believe that our experience provides helpful takeaways for practitioners modernizing systems with data-intensive requirements. Index Terms—big data system, microservices, event-driven I. INTRODUCTION Data has been generated at an increasingly higher pace over the last years. Social media interactions, sensors, mobile phones, and business processes are examples of sources. Surveys indicate that 2.5 quintillion bytes of data are generated each day, which will lead to approximately 79.4 zettabytes of data by 2025 [1], [2]. This context made the case for the design of big data systems (BDS), which arose to handle the collection and manipulation of large volumes of data in modern business applications. Gorton and Klein [3] define BDS as “distributed systems that include redundant processing nodes, replicated storage, and frequently execute on a shared cloud infrastructure [...] employing a heterogeneous mix of SQL, NoSQL, and NewSQL technologies.” As a result, the development of BDS often imposes challenges to software engineers, as noted by Hummel et al. [4], which cataloged a set of challenges, such as steep learning curve and complex data processing. Besides, Laigner et al. [5] found that the major challenges on developing BDS are about software architecture design. Event-driven systems and microservices have emerged as compelling architectural paradigms to the development of data-driven software applications [6], [7]. Microservices are small scalable units where each represent a bounded business capability that are often autonomously deployed. In contrast to traditional monolithic systems, microservices do not share resources, communicating mainly via message-passing semantics [8]. In line with microservices, an event-driven architecture (EDA) is comprised by a set of high-cohesive components that asynchronously react to events to perform a specific task [9]. In this paper, we report the complete replacement process of a legacy BDS to a microservice-based event-driven architecture. The replacement comprised a 19-month long development period that took place at PUC-Rio’s Tecgraf Institute, which provides technical and scientific solutions for a wide range of strategic industrial partners. One of the solutions, developed for a customer in the Oil & Gas sector back in 2008, concerns a monolithic BDS that monitors moving objects (MOs) and proactively detects events that incur in risks to the operation, such as vehicle route deviations. Over the years, the system evolved into a complex and large obsolescent code base that involves a difficult maintenance process. In this context, in 2018, with the advent of a new industrial partner interested in the outcomes of the previous project that employed the legacy BDS, Tecgraf’s managers decided to take advantage of a new contract to accommodate a complete rewrite of the legacy BDS by adopting current big data technologies, such as Cassandra and Kafka. Furthermore, based on the lessons learned of the legacy BDS, Tecgraf’s managers decided that the new project must adopt a microservice-based EDA. Thus, we investigate the integration of microservices and EDA to support data-intensive requirements. The main contributions of this paper are: (i) an investigation on the motivation to adopt a microservice-based EDA; (ii) a 19-month experi- ence report on replacing a legacy BDS with a microservice-based EDA; (iii) a discussion of the obtained results in form of challenges and lessons learned. The remainder of this paper is organized as follows. Section II provides the background of this work. Next, the action research design is presented, describing the goal, research questions, and methodology. The results are presented in Section IV. Lastly, Section V presents the concluding remarks. II. BACKGROUND A. Big data systems Chen et al. [10] explain that traditional software development is characterized by “structured, batch-oriented, relational small data [volume],” and straightforward development lifecycle and architecture design. Besides, Gorton and Klein [3] argue that traditional business systems are “relatively well constrained in terms of data growth, analytics, and scale.” On the other side, Gorton and Klein [3] synthesize BDS based on four requirements: (i) write-heavy workload; (ii) variable request loads (adding new resources and release them as necessary); (iii) computation-intensive analytics (diverse query workloads and varying latency demands); and (iv) high availability. These requirements represent a significant shift from traditional business systems. B. Microservices Software systems have traditionally adopted a monolithic architectural style, on which modules and/or subsystems are integrated and cooperate in a centralized manner. According to Bucchiarone et al. [8], in such architecture, “the modularization abstractions rely on the sharing of resources of the same machine [...]”, and the components are therefore not independently executable.” However, concerns related to the complexity involved on scaling monolithic architectures [8] and aspects related to change, such as evolutionary maintenance [11], have shifted interests in industry towards the adoption of decoupled architectures. Built on SOA principles of loosened-coupled services, microservices have emerged as an “organic implementation approach to SOA[, encompassing] polyglot programming in multiple paradigms and languages, and design for failure; decentralization and automation” [12]. C. Event-driven architecture Systems that adopt an EDA, also known as reactive systems, are a current subject of interest in the development of data-driven software systems [6]. According to Richards [9], EDA is a pattern “made up of highly decoupled, single-purpose event processing components that asynchronously receive and process events”. Richards argues that “event processors are self-contained, independent, highly decoupled architecture components that perform a specific task in the application or system” [9]. Therefore, in EDA, each single-purpose service employs programming primitives for enabling reaction and response to a set of predefined events. To the best of our knowledge, literature does not clearly differentiates these from microservices. III. RESEARCH DESIGN Our study design follows the Action Research (AR) [13] methodology. The study context, goal and research questions, and methodology are presented hereafter. A. Context This study reports on the process of replacing a legacy big data system with a microservice-based EDA. The experience described herein occurred in the context of PUC-Rio’s Tecgraf Institute. Tecgraf is a mid-size non-profit research and development organization that conducts projects with industrial partners and government institutions. Our subject legacy system is a large-size BDS that had been under active development from 2008 to 2014. Figure 1 shows a high level view of the legacy system. MOs, such as vehicles, have tracking devices installed, so that positioning data (PD) are sent periodically. Every PD are sent to an information flow processing (IFP) engine [14], which analyzes them to uncover non-conformities, such as a vehicle route deviation. Then, the streams are enriched with domain data and presented to users. Over the years, the system has undergone a natural process of corrosion, on which the large source code became difficult to maintain due to the complexity of the system. Besides, the technology stack became obsolete, outpaced by current technologies, and the monolithic structure undermined the introduction of new technologies. Thus, in the advent of a new industrial partner with a closely related problem context, Tecgraf’s managers realized that the process of recruiting and training new developers that would be able to implement a new instance of the legacy BDS was not feasible. Also, with the myriad of big data technologies that emerged in the last decade, such as Cassandra and Kafka, and the mentioned drawbacks found in the legacy BDS, Tecgraf’s managers decided that the best approach would be designing a new architecture from scratch, based on microservices and event-driven principles. Besides, the new architecture should embrace widely adopted open-source technologies instead of relying on in-house solutions. B. Goal and Research Questions Developing a BDS poses several challenges to developers, such as steep learning curves, lack of modeling and debugging support, and data consistency [4]. Moreover, the recent trend towards adoption of microservices architectures has shown that without a careful design, drawbacks related to redundancy and data consistency may emerge [11]. Albeit there is substantial body of work reporting on microservices decomposition [8], [11], designing a microservice-based system without decomposing an existing monolithic system is not substantially covered in the literature [11]. Besides, to the best of our knowledge, there is no work that reports the challenges and lessons learned on replacing a legacy BDS with a new microservices EDA. Thus, our goal is to report the experience of replacing a legacy BDS with a microservices-based EDA without decomposing the existing system. To achieve our goal, we derived three Research Questions (RQs), which are detailed hereafter. RQ1. What are the reasons that motivate the adoption of a microservice-based EDA to replace a legacy big data system? This first research question intends to comprehend the reasons that motivate the adoption of architectural alternatives different from the one found in the legacy big data system, particularly regarding EDA and MS architectural style. While there are different works on the motivations for migrating to MS-based architectures, we wanted to understand the specific motivations of our context. RQ2. What are the benefits and limitations perceived on replacing a legacy big data system with a microservice-based EDA? The second research question explores the perceived benefits and limitations (post-development) related to the adoption of a new microservice-based EDA. We aim to uncover the technical decisions that the development team has taken that derived drawbacks and positive results. RQ3. What are the challenges faced and lessons learned while replacing a legacy big data system with a microservice-based EDA? The third research question concerns unveiling the challenges and lessons learned that were perceived throughout the development process. C. Method This section presents the research method employed to answer our research questions. The organization of the method follows the template of Santos and Travassos [13], which suggest one AR stage per section. Figure 2 depicts the AR process based on Davidson et al. [15]. The process starts with a diagnosis of the problem, followed by a plan to address the issue being investigated. Then, the plan is put into practice in the intervention phase. Lastly, an evaluation and analysis is carried out. Although the AR process allows for iterating through phases to achieve results incrementally, this study reports a full cycle of the methodology. 1) Diagnostic: Santos and Travassos [13] argue that this stage “consists of exploring the research field, stakeholders and their expectations”. Thus, as this phase naturally maps to answering RQ1, we have designed an exploratory survey to collect the expectation of Tecgraf’s main stakeholders involved in the project. In this survey, we aim to report on the drivers of the technical decision on moving towards a microservices EDA and obtain a view about the drawbacks found in the legacy BDS. Besides, the survey results allow to better understand the problem context and to cross-validate the findings of subsequent steps of the AR process. The target population of this study is composed by product managers, software architects, and developers of Tecgraf institute that have contributed to the decision about replacing the legacy BDS. The following questions compose our survey: (Q1) What are the drawbacks found in the legacy BDS that motivate the substitution? (Q2) What are the drivers for defining event-driven microservices as a target architecture? (Q3) What characteristics of the legacy BDS are important to remain in the target system? (Q4) What challenges would you expect to encounter in replacing a legacy BDS to a microservice-based EDA? (Q1)-(Q3) are defined with the goal to gather information on the legacy system and to extract requirements that must remain in the new architecture. (Q4) aims at gathering the perception of the stakeholders over the challenges incurred by the replacement process. Thus, we can cross-check if the expectations on challenges are met at the end. In addition, regarding the BDS, we conduct an analysis of the documentation, inspection of the source code and historical commits to uncover technical challenges faced by developers at the time. 2) Planning: This stage concerns the definition of actions to be taken onward. A component of this phase is conducting a literature survey for the purpose of examining the research theme [13]. Thus, we report our searching process on the aforementioned themes and the sequenced set of activities to carry out during intervention step. 3) Intervention: According to Santos and Travassos [13], this phase concerns the implementation of planned actions, which are depicted “in a chronological way, describing how the activities were performed during the research.” In this phase, data collection is a product of our experience playing the co-located role of software architects within Tecgraf/PUC-Rio. During this period, we have analyzed the results of several meetings, emails, interviews, and technical documents, such as use cases and user interface screen prototypes, in order to confirm our findings regarding the process of replacing a legacy BDS. The material collection was conducted between July 2018 and January 2020. Through intervention, we seek to unveil the challenges on adopting a microservice-based architecture from scratch (i.e., when no monolithic system is refactored) with event-driven requirements. The results of this AR step enables us to partially answer RQ2 and RQ3. 4) Evaluation and Reflection: This phase regards analyzing the effects of the actions taken. Although our study provides the point of view of two intereners playing a software architect role, it is worthwhile to enrich our understanding on the effects of the intervention by collecting the perceptions of other developers that also played a role in the project, i.e., contributed to the project code base. Therefore, in order to mitigate risks related to the report of outcomes of the intervention from a single point of view, we designed a survey to gather the perception of other developers about the new architecture. This also allowed us to cross validate our findings to reduce limitations of the study. Through evaluation, we are able to complement our answer to RQ2 and RQ3. IV. RESULTS This section provides detailed discussions on the AR methodology employed at Tecgraf to answer the RQs. A. Diagnostic The diagnosis phase “enables the identification of primary causes and circumstances faced by an organization” [13]. In this section, we analyze the project context by inquiring stakeholders’ expectations and understanding the legacy BDS. 1) Survey with stakeholders: We applied the survey to four Tecgraf stakeholders (SH1-4) that were closely involved in the arrangements of the project. Regarding the drawbacks of the legacy BDS, the respondents unanimously agreed on the complexity and obsolescence of the source code. For instance, SH1 argues that the “code was poorly structured and documented,” and “the technology was obsolete.” Next, SH1 asserts that a driver for microservices adoption is that “data could grow rapidly and the performance could be a bottleneck; [...] an architecture able to escalate easily was very attractive.” Besides, SH2 highlights that an EDA “facilitate the processing of events from different sources,” “[supporting] the communication and isolation among microservices.” Next, the respondents agreed that the core requirements to remain are georeferenced tracking of MOs, definition of route and activities for MOs, and proactive event generation based on trajectory data of MOs. Finally, they agreed that the lack of technical maturity could impose challenges. For instance, definition of API interfaces, microservices decomposition, database transaction issues, and high coupling among microservices were concerns raised. 2) Legacy big data system: In this step, we describe the process carried out to further understand the legacy BDS. We have acquired access to the legacy system’s wiki, a repository for sharing information about the project. We found that the core functional requirements of the legacy system were about efficient ingestion and fast retrieval of positioning data from MOs and detection of non-compliance patterns in the streams, such as speed limit overrun. In production settings, problems related to data consistency started to arise. For instance, thread blocking and data races have led to slowness in the processing of events. The process for understanding issues was complex, once traceability information was insufficient due to the large code base divided in several modules. We found that the system has started with 500 MOs sending PD every minute and has grown up to 10000 MOs sending PD every 15 seconds. We have also acquired access to the source code repository of the legacy BDS. Due to the large code base and minimal contact with developers of the legacy system, once they were not part of the organization anymore, the process lasted several weeks. In summary, we found that batches of streams were posted on queues placed in-memory, in a scheme similar to message queue systems. As multiple threads were employed to concurrently process the streams, this solution often led to data races and thread blocking. Misuse of Java concurrency primitives was the main reason for such issues. Lastly, we found that a custom-tailored IFP engine was engineered to monitor MOs (retrieved from in-memory queues) and detect events such as route deviations. Lastly, the legacy BDS LOC count for 400K, divided into application code and libraries. B. Planning The foundations that guide our planning stage were elucidated in the diagnosis stage. In this stage, we sought to gather knowledge on the research themes by searching the literature. We have submitted searches on Scopus digital library regarding microservices and event-driven architecture. In summary, although studies on microservices are prevalent [8], [16], we found that the problem of defining a microservice (MS) architecture for a new system still an ongoing problem in literature, with no clear guidelines [11]. Hence, we defined a sequence of phases to be followed in a defined timetable. We start with the conception, describing the requirements elicitation process. After, the architecture and design phase are conducted. Lastly, with the architectural blueprint of the system, we were ready to start the implementation phase. C. Intervention In this section we provide an in-depth discussion over the process conducted to replace the legacy BDS with a microservices EDA. As suggested by Santos and Travassos [13], the intervention is described in a chronological way. 1) Conception: The project has started with a researcher (the first author), a project manager (fourth author), a senior developer, and two requirements analysts. Soon, the requirements started to change. By working closely with the industry partner, the requirements team realized that their needs were different from the ones described in the contract. As we aimed a microservice-based architecture, this context has played a role on the process of defining our services. Although there are general guidelines on migration patterns and deducing microservices from a monolithic system [17] [18], by the time we were investigating approaches to support the process of defining our services, we have not found studies focused on how to define a microservices architecture from scratch, i.e., when no monolithic system is decomposed. Literature [17] [18] often cites Domain-Driven Design (DDD) [19] as a compelling technique to identify subdomains of the business, where industry practitioners advocate that each subdomain maps to a bounded context (a deployable unit). However, Evans [19] advocates first for a discovery process of the application domain, where its “understanding comes from diving in, implementing an initial design based on a probably naive model, and then transforming it again and again.” Hence, we followed the advice of starting with a naive model based on the business capabilities (BCs) [20] identified so far (1-month period). A BC, also referred as a bounded context [16], “is something that a business does in order to generate value,” often representing a delimited domain business model. We documented the conducted requirements gathering meetings and identified four major BCs of the domain, as shown in Figure 3. Our reasoning for defining the BCs is explained as follows. Analysts plan a patrol (trip) composed by a route to be followed and a set of inspections (stop points) to be performed along the work journey. The structure of patrol and verification trips are no different, however, a verification corresponds to an unforeseen inspection triggered by the reception of a denounce, while a patrol is previously defined and scheduled in advance. Also, distinct analyst teams handle patrols’ planning and verifications. Therefore, we defined both as distinct BCs. The Alerts BC is responsible for the ingestion, processing, and exposition of alerts coming from any source. For instance, instruments installed in oil pipelines periodically send alerts concerning suspicious activities, such as manual excavations. Besides, through the mobile app, in-field operators can communicate messages and alerts to analysts in real-time. The Tracking BC is responsible to ingest and process real-time PD of patrols and verifications. An in-field team is assigned to a patrol or a verification and tracking is automatically enabled by the the mobile app they carry in operation. In addition, vehicles assigned to a team also send tracking data. Lastly, the Tracking BC is responsible for storing and serving all trajectory data history of mobile devices and vehicles. 2) Architecture and design: This section discusses how the requirements elicited were translated to an architectural design, which is exhibited in Figure 4. **Defining a target stack.** The intervention process started at a slow pace due to frequent requirements changes. This context has made the case for focusing on the analysis of suitable technologies for the target architecture. Tecgraf has long-lasting expertise in developing distributed systems with Java. Besides, as the developers were proficient in the language, Java was a natural choice to be the main back-end programming language. As the project comprised the development of a web application with a distributed architectural style, in order to meet stakeholders expectations over embracing open-source technology, instead of writing custom-tailored infrastructure solutions (e.g., logging, data access, and dependence management) from scratch, a reasonable choice was relying on a well-adopted framework to support our development. Thus, we listed a set of capabilities that the framework must deliver: support for the development of REST APIs [21]; support for dependency injection [22]; support for hot reload; embedded support for database access; integrated support for message queuing systems; and support for reactive programming model. Although there are a number of feasible web framework options for Java platform, we decided to select Spring due to its rich ecosystem, composed by multiple integrations built by a supportive community. Besides, support for Spring in Question&Answers communities and extensive online documentation played a role in the decision. As scalability is a major driver of the target architecture, we opted to adopt the database per service pattern [23]. Besides, as the requirements were being progressively elicited, we aimed to get rid of schema changes for each new version. Then, we listed three important features for a default persistence technol- ogy for our services: (i) flexible-schema model, (ii) geospatial query support, (iii) high industrial adoption. Then, MongoDB was selected due to its support to geospatial indexes, replication, load balancing, file storage, and the representation of complex associations within a single record. **Defining services corresponding to business capabilities.** *Patrol Planning* and *Verifications*, as depicted by Figure 3, comprehend distinct BCs. This comprehension led to designing both as distinct microservices, as shown in Figure 4. In-field teams are either assigned to a planned patrol or a verification, and through the mobile app, they are able to retrieve data from the respective service in order to support daily operation. As a verification is spawned due to a denouncement (i.e., it is not planned daily), the mobile app is programmed to proactively request the existence of an assigned verification in a time interval. In case the team is assigned to a verification, the patrol is paused until the end of the verification operation. Next, we chose to define the *Tracking BC* as a microservice due to two reasons: (i) guarantee PD durability and (ii) enable retrieval of historical PD. As scalability of PD ingestion and retrieval is a central concern in the architecture, we listed essential quality attributes a data store must deliver in this case: (i) write-heavy workload support, (ii) availability, (iii) scalability, and (iv) consistency. Thus, we surveyed DBMS to compare additional quality attributes. The work of Lourenço et al. [24] gave us a starting point, as shown in Table II. Although not considered a database, but rather a pattern, we found worthwhile to also analyze CQRS [25] as a candidate solution. Given the superior write-performance, we selected Cassandra as our solution to intensive PD ingestion. From the point of view of event sourcing pattern [26], we modeled PD as an event, thus the state of a MO is represented as a sequence of state-changing events (i.e., a historical track). Following the advice of Balalaie et al. [17], which recommend “to start with a low number of services [...] and incrementally add more services” as the team understands requirements better, we realized that letting *Tracking MS* also deal with the reception of data from external sources (e.g., vehicle and mobile app) could compromise its performance on serving tracking historical data. Thus, in order to provide a singular interface for reception of PD, we defined a MS (*Signals*) that is responsible for abstracting the receiving of PD through a RESTful API by guaranteeing the conformance of the API defined and communicating it to interested services. This choice proved to be right due to scalability requirements entailed by the application, on which we could increase the number of *Signals* instances to cope with growing number of MOs sending PD without affecting serving historical data. Lastly, we defined a specific MS (*Alerts*) responsible for reception, processing, and serving alerts. In other words, alerts are events communicated to the system that should be stored consistently and informed to interested services. Thus, we applied the transactional outbox pattern [27], which advocates that a service that publishes a domain event [28] (in our case, an alert) must atomically update the database and publish an event. In the case of a growing number of different classes of events and interested services, it is important to have a unit of scalability which is represented by this MS. **Defining domain events.** Domain events [28] are often employed in EDA to communicate services about a change in the state of a domain object. A domain event, when received by a service, may trigger actions to be performed. A domain event is often published through a communication channel (a.k.a. topic) that is subscribed by interested parties, allowing a low coupled and non blocking message passing [29]. This approach is particularly important in data-intensive systems to avoid polling mechanisms, which may become a bottleneck with time. In our case, domain events were elicited along brainstorming reunions to evolve the domain knowledge, and, due to space constraints, we summarize the main ones in Table I. Based on the work of Brandolini [30], the columns are explained as follows: an Actor is the source object of an action; a Command represent an action triggered by an actor; and an Event is the consequence of an action. As mentioned earlier, a PD received by the system is a domain event that represents that the state of a MO (mobile app or vehicle) is updated. When a PD is received by *Signals*, it checks the conformance of the PD object and publishes it to a Kafka topic called *signals*. Although we do not adopt transactional outbox pattern [27] in *Signals*, we allow for faster communication of the new state to interested services (since we do not wait for a synchronous database operation) by relying on Kafka consistency guarantees, configuring a suitable trade-off when it comes to a (quasi) real-time system. On the other side, every alert processed by the MS *Alerts*, after stored in the database, is published in a topic called *alerts*. After analysis (by an analyst), an alert may result in the assignment of a verification to an in-field team. This assignment event is then delivered to the given in-field team through the mobile app. **Serving domain events to end-users.** A user interface application (UI-APP) was developed in Angular [31] to enable analysts to visualize domain events (e.g., alerts) in real-time. We chose not to include programming polling mechanisms in our UI-APP because we envisioned that real-time domain events retrieval from our microservices could experience high latency as the number of users and amount of data evolve. A technology that could intermediate domain events coming from Kafka topics to web browser clients was necessary. Thus, we found that *WebSocket* [32] make a suitable protocol to handle real-time event-driven communication in the front-end layer by avoiding polling the server for data. <table> <thead> <tr> <th>Actor</th> <th>Command</th> <th>Event</th> </tr> </thead> <tbody> <tr> <td>Mobile app</td> <td>Start patrol</td> <td>Patrol started</td> </tr> <tr> <td>Analyst</td> <td>Assign verification</td> <td>Verification assigned</td> </tr> <tr> <td>Mobile app</td> <td>Start verification</td> <td>Patrol paused</td> </tr> <tr> <td>Mobile app</td> <td>Finish verification</td> <td>Patrol resumed</td> </tr> <tr> <td>MO</td> <td>Update positioning</td> <td>MO state changed</td> </tr> <tr> <td>Processing</td> <td>Register route deviation</td> <td>Route deviation detected</td> </tr> </tbody> </table> **TABLE I** *DOMAIN EVENTS IDENTIFIED* ### Information flow processing Cugola and Margara [14] refer to systems that “require processing continuously flowing data from geographically distributed sources [...] to obtain timely responses to complex queries” as information flow processing (IFP) applications. At first we investigated Flink [33] as our IFP engine due to its ability to compute operations over stream data, like our real-time PD. However, as asserted by Orleans documentation [34], these systems present a “unified data-flow graph of operations that are applied in the same way to all stream items,” thus hindering applying filtering or aggregation operations over different data items in the same computation. For example, as part of the process of checking real-time trajectory data of MOs against their respective planned route, we found limited support to integrate an external call to Patrols MS API in order to retrieve the planned route. Thus, we built a tailored solution (Processing in Figure 4) that takes advantage of reactive primitives of Spring and in-memory data processing. Thereby, based on a 5-minute time-window, Processing retrieves PD associated with each in-field team (from signals topic) and triggers the route deviation detection computation. If a deviation is detected, a route deviation is registered and the respective event is triggered. The Alerts MS acknowledges the event as a new alert and publishes it in the alerts topic. This separation of concerns allow us to scale separated parts of the system independently. 3) Implementation: In total, an overall effort of more than 7500 hours were employed by the development team, resulting in a system of around 30,000 lines of Java code, 14,000 lines of TypeScript code, and 29 data tables and documents. In average, each MS has 2,500 lines of code. Due to the large number of microservices and supportive technologies, and the lack of knowledge on state-of-the-art DevOps tools, a great effort was put into deployment. For instance, Docker containers were used to package our services. Besides, several fixes that were not expected earlier were implemented only to adapt to Docker deployment. This context makes the case for introducing DevOps earlier in the development process. D. Evaluation and Reflection This section reports the results of survey conducted with developers and discusses challenges and lessons learned. Although the lessons learned are related to the specific action research project context described in this paper, we believe most of them are generalizable to other industrial settings. 1) Survey with developers: As mentioned in Section III-C4, we designed a survey to collect the point of view of three developers that collaborated in the development process. First, we have defined a set of challenges collected along the intervention. Then, we questioned the developers on their agreement and also inquired them about additional challenges. Their perceptions are summarized along the next section. Due to space constraints, survey details are found online [35]. 2) Challenges and lessons learned: - **Defining microservices.** Although Patrols and Verifications represent different domain concepts, which lead to different domain events, designing them as distinct microservices caused the problem of duplicate concepts [19], on which duplicate efforts on each requirement change (as a result of new knowledge acquired) was observed along the development life cycle. As a lesson learned, we suggest following the advice of Fowler [36], which advocates for the Monolithic-First approach, on which a project “shouldn’t start [...] with microservices, even if you’re sure your application will be big enough to make it worthwhile.” Waiting for requirements to mature is essential to define microservices properly. However, emerging research discusses model-driven development of microservice-based systems, which may help mitigate some of the impedance on microservices design [37]. - **Data modeling.** The fast-paced development process altogether with the adoption of novel technologies imposed a challenge on getting data modeling right. The distributed architecture forced us to adopt schema-less and denormalized data models, encapsulated through APIs, rather than normalized data models and data consistency guarantees usually found in monolithic systems, in line with Gorton and Klein’s discourse over BDS [3]. Furthermore, even though designing services communication based on domain events augments the expressiveness of the domain, from the point of view of developers, the myriad of services and technologies led to difficulties in troubleshooting problems. The complex data flow entailed by the application often led to misunderstandings and slowed the process of identifying the root cause of errors. - **Selecting an IFP engine.** Attempts to translate our IFP requirements to Flink were unsuccessful (see Section IV-C2). A second problem was relying on a short time window for implementing our IFP use cases. As the number of technologies employed were already large and the team had no previous experience with IFP engines, we realized that the learning curve could compromise subsequent sprints. As a lesson learned, we highlight that the selection of an IFP solution is an architectural decision. It means that the chosen IFP engine should be adherent to the architecture, and not the opposite. Furthermore, we consider Orleans streams [34] a promising candidate for expressing computations that span different items due to its flexible processing engine. Embracing failure. Some MS-oriented frameworks (e.g., Spring) fail to present extensive support for failure handling in workflows spanning multiple microservices. For instance, in the absence of distributed transactions, the developer should hard-code logic related to recovering from failures in such workflows. Furthermore, given the low granularity nature of MS instances and the difficulty on reasoning over each MS’ local state globally, we advocate for a programming model that specifies fault-tolerance properties that we can reason about on requests spanning multiple microservices. V. CONCLUDING REMARKS This study reports an industrial experience regarding the replacement of a legacy monolithic BDS to an event-driven microservice-based architecture. Microservices promise to automatically react to failure and changing workloads, provide independent deployment, and support for polyglot technologies [7] [12]. EDA commit to enable a reactive programming model among high-cohesive components that proactively react to incoming events by performing a computation or triggering it in another component [9]. However, the joint use of microservices and EDA has not been previously discussed in the context of BDS. Moreover, we present how microservices can be defined without refactoring a legacy monolithic system. From requirements elicitation, through architecture design, and implementation, we provided an example on how a system with data-intensive requirements can benefit from microservices and event-driven principles. The main takeaways from our experience are as follows. Defining microservices too early in the development process may yield into a wrong definition. Besides, in a fast-paced development scenario, waiting for requirements to mature is essential in getting microservices right. On one hand, microservices support for easier maintenance and fault-isolation were perceived as benefits to the architecture. However, the complex data flow entailed by the number of microservices, as well the myriad of technologies were perceived as drawbacks. REFERENCES
{"Source-Url": "https://static-curis.ku.dk/portal/files/245635593/SEAA_2020.pdf", "len_cl100k_base": 8165, "olmocr-version": "0.1.53", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 26701, "total-output-tokens": 10661, "length": "2e12", "weborganizer": {"__label__adult": 0.0003249645233154297, "__label__art_design": 0.000499725341796875, "__label__crime_law": 0.00024819374084472656, "__label__education_jobs": 0.0008935928344726562, "__label__entertainment": 6.121397018432617e-05, "__label__fashion_beauty": 0.00016200542449951172, "__label__finance_business": 0.0003082752227783203, "__label__food_dining": 0.0003006458282470703, "__label__games": 0.0004658699035644531, "__label__hardware": 0.0010623931884765625, "__label__health": 0.0004198551177978515, "__label__history": 0.0003387928009033203, "__label__home_hobbies": 8.112192153930664e-05, "__label__industrial": 0.00045609474182128906, "__label__literature": 0.00022852420806884768, "__label__politics": 0.00027060508728027344, "__label__religion": 0.0004227161407470703, "__label__science_tech": 0.02587890625, "__label__social_life": 7.37905502319336e-05, "__label__software": 0.00513458251953125, "__label__software_dev": 0.96142578125, "__label__sports_fitness": 0.00023984909057617188, "__label__transportation": 0.0005521774291992188, "__label__travel": 0.00020432472229003904}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 47561, 0.02222]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 47561, 0.25292]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 47561, 0.92334]], "google_gemma-3-12b-it_contains_pii": [[0, 741, false], [741, 6108, null], [6108, 11312, null], [11312, 16903, null], [16903, 23077, null], [23077, 27301, null], [27301, 33989, null], [33989, 39551, null], [39551, 47561, null]], "google_gemma-3-12b-it_is_public_document": [[0, 741, true], [741, 6108, null], [6108, 11312, null], [11312, 16903, null], [16903, 23077, null], [23077, 27301, null], [27301, 33989, null], [33989, 39551, null], [39551, 47561, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 47561, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 47561, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 47561, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 47561, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 47561, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 47561, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 47561, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 47561, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 47561, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 47561, null]], "pdf_page_numbers": [[0, 741, 1], [741, 6108, 2], [6108, 11312, 3], [11312, 16903, 4], [16903, 23077, 5], [23077, 27301, 6], [27301, 33989, 7], [33989, 39551, 8], [39551, 47561, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 47561, 0.04848]]}
olmocr_science_pdfs
2024-12-09
2024-12-09
2de0ef8f533de722f504ed5f696387df70ae801f
Improved SIRAP analysis for synchronization in hierarchical scheduled real-time systems Behnam, M.; Bril, R.J.; Nolte, T. Published in: Proceedings 14th IEEE Conference on Emerging Technologies &amp; Factory Automation (ETFA 2009, Palma de Mallorca, Spain, September 22-25, 2009) DOI: 10.1109/ETFA.2009.5347234 Published: 01/01/2009 Document Version Publisher’s PDF, also known as Version of Record (includes final page, issue and volume numbers) Please check the document version of this publication: - A submitted manuscript is the author's version of the article upon submission and before peer-review. There can be important differences between the submitted version and the official published version of record. People interested in the research are advised to contact the author for the final version of the publication, or visit the DOI to the publisher's website. - The final author version and the galley proof are versions of the publication after peer review. - The final published version features the final layout of the paper including the volume, issue and page numbers. Link to publication Citation for published version (APA): General rights Copyright and moral rights for the publications made accessible in the public portal are retained by the authors and/or other copyright owners and it is a condition of accessing publications that users recognise and abide by the legal requirements associated with these rights. - Users may download and print one copy of any publication from the public portal for the purpose of private study or research. - You may not further distribute the material or use it for any profit-making activity or commercial gain - You may freely distribute the URL identifying the publication in the public portal ? Take down policy If you believe that this document breaches copyright please contact us providing details, and we will remove access to the work immediately and investigate your claim. Improved SIRAP analysis for synchronization in hierarchical scheduled real-time systems Moris Behnam, Thomas Nolte Mälardalen Real-Time Research Centre P.O. Box 883, SE-721 23 Västerås, Sweden moris.behnam@mdh.se Reinder J. Bril Technische Universiteit Eindhoven (TU/e) Den Dolech 2, 5612 AZ Eindhoven The Netherlands Abstract We present our ongoing work on synchronization in hierarchical scheduled real-time systems, where tasks are scheduled using fixed-priority pre-emptive scheduling. In this paper, we show that the original local schedulability analysis of the synchronization protocol SIRAP [4] is very pessimistic when tasks of a subsystem access many global shared resources. The analysis therefore suggests that a subsystem requires more CPU resources than necessary. A new way to perform the schedulability analysis is presented which can make the SIRAP protocol more efficient in terms of calculated CPU resource needs. 1 Introduction The Hierarchical Scheduling Framework (HSF) has been introduced to support hierarchical CPU sharing among applications under different scheduling services [14]. The HSF can be generally represented as a tree of nodes, where each node represents an application with its own scheduler for scheduling internal workloads (e.g., tasks), and resources are allocated from a parent node to its children nodes. The HSF provides means for decomposing a complex system into well-defined parts called subsystems, which may share (so-called global) logical resources requiring mutual exclusive access. In essence, the HSF provides a mechanism for timing-predictable composition of course-grained subsystems. In the HSF a subsystem provides an introspective interface that specifies the timing properties of the subsystem precisely. This means that subsystems can be independently developed, analyzed and tested, and later assembled without introducing unwanted temporal interference. Temporal isolation between subsystems is provided through budgets which are allocated to subsystems. To ease the migration towards and integration of existing, legacy applications as subsystems into a HSF, fixed-priority pre-emptive scheduling (FPPS) must be supported for scheduling tasks of a subsystem, because FPPS is a de facto standard in industry today. Our current research efforts are directed towards the conception and realization of a two-level HSF that is based on (i) FPPS for both global scheduling of budgets (allocated to subsystems) and local scheduling of tasks (within a subsystem), (ii) the periodic resource model [14] for budgets, and (iii) the Stack Resource Protocol (SRP) [2] for both inter- and intra-subsystem resource sharing. The synchronization protocol for resource sharing, which is termed SIRAP [4], prevents depletion of a budget during global resource access through self-blocking of tasks, which may delay the access of a task to a global resource for at most one budget period. In this paper, we re-consider the local schedulability analysis of our HSF. We show that the original analysis is very pessimistic when tasks of a subsystem access many global resources. The analysis therefore suggests that a subsystem requires more CPU resources than necessary. A new way to perform schedulability analysis is presented which can make our HSF more efficient in terms of calculated resource needs. 2 Related work Over the years, there has been a growing attention to hierarchical scheduling of real-time systems. Deng and Liu [7] proposed a two-level HSF for open systems, where subsystems may be developed and validated independently. Kuo and Li [10] presented schedulability analysis techniques for such an HSF assuming FPPS for global scheduling. Mok et al. [13, 8] proposed the bounded-delay virtual processor model to achieve a clean separation in a multi-level HSF. In addition, Shin and Lee [14] introduced the periodic virtual processor model (to characterize the periodic CPU allocation behaviour), and many studies have been proposed on schedulability analysis with this model under FPPS [1, 11, 5] and under EDF scheduling [14, 16]. However, a common assumption shared by all above studies is that tasks are independent. *The work in this paper is supported by the Swedish Foundation for Strategic Research (SSF), via the research programme PROGRESS. Recently, three SRP-based synchronization protocols for inter-subsystem resource sharing have been presented, i.e., HSRP [6], BROE [9], and SIRAP [4]. Unlike SIRAP, HSRP does not support local schedulability analysis of subsystems, and the local schedulability analysis presented for BROE in [9] is incomplete. 3 System model and background This paper focuses on scheduling of a single node, where each node is modeled as a system $S$ consisting of one or more subsystems $S_s \in S$. The system is scheduled by a two-level HSF using FFPS at both levels. Subsystem model A subsystem $S_s$ consists of a set $T_s$ of $n_s$ tasks and a FFPS-based local scheduler. Once a subsystem is assigned the processor (CPU), its scheduler will select which of its tasks will be executed. Each subsystem $S_s$ is associated with a subsystem timing interface $S_j(P_s, Q_s, X_s)$, where $Q_s$ is the subsystem budget that the subsystem $S_s$ will receive every subsystem period $P_s$, and $X_s$ is the maximum time that a subsystem internal task may lock a shared resource. Let $R_s$ be the set of global shared resources accessed by $S_s$. Task model This paper considers the deadline-constrained sporadic hard real-time task model $\tau_i(T_i, C_i, D_i, \{c_{i,j}\})$, where $T_i$ is a minimum separation time between arrival of successive jobs of $\tau_i$, $C_i$ is their worst-case execution-time, and $D_i$ is an arrival-relative deadline $(0 < C_i \leq D_i \leq T_i)$ before which the execution of a job must be completed. Each task is allowed to access one or more shared logical resources, and $c_{i,j}$ is a critical section execution time that represents a worst-case execution-time requirement within a critical section of a global shared resource $R_j$ (for simplicity of the presentation, we assume that each task access a shared resource at most one time). It is assumed that all tasks belonging to the same subsystem are assigned unique static priorities and are sorted according to their priorities in the order of increasing priority. Without loss of generality, it is assumed that the priority of a task is equal to the task ID number after sorting, and the greater a task ID number is, the higher its priority is. The same assumption is made for the subsystems. The set of shared resources accessed by $\tau_i$ is denoted $\{R^i\}$. Let $hp(i)$ return the set of tasks with priorities higher than that of $\tau_i$, and $lp(i)$ return the set of tasks with priorities lower than that of task $\tau_i$. For each subsystem, we assume that the subsystem period is selected such that $2P_s \leq T_{sa}$, where $T_{sa}$ is the task with the shortest period. The motivation for this assumption is that higher $P_s$ will require more CPU resources [15]. Shared resources To access a resource $R_j$, a task must first lock the resource, and when the task no longer needs the resource it is unlocked. The time during which a task holds a lock is called a critical section. For each logical resource, at any time, only a single task may hold its lock. A resource that is used by tasks in more than one subsystem is denoted a global shared resource. To be able to use SRP in a HSF for synchronizing access to global shared resources, its associated terms resource, system and subsystem ceilings are extended as follows: Resource ceiling: Each global shared resource $R_j$ is associated with two types of resource ceilings; an internal resource ceiling ($rc_j$) for local scheduling and an external resource ceiling ($RX_j$) for global scheduling. They are defined as $rc_j = \max \{i | \tau_i \in T_s \text{ accesses } R_j \}$ and $RX_j = \max \{s | S_s \text{ accesses } R_j \}$. System/subsystem ceiling: The system/subsystem ceilings are dynamic parameters that change during execution. The system/subsystem ceiling is equal to the highest external/internal resource ceiling of a currently locked resource in the system/subsystem. Under SRP, a task $\tau_k$ can preempt the currently executing task $\tau_i$ (even inside a critical section) within the same subsystem, only if the priority of $\tau_k$ is greater than its corresponding subsystem ceiling. The same reasoning applies for subsystems from a global scheduling point of view. 4 SIRAP SIRAP prevents depletion of CPU capacity during global resource access through self-blocking of tasks. When a job wants to enter a critical section, it first checks the remaining budget. If there is sufficient remaining budget to complete the critical section, then the job is granted entrance. Otherwise the local scheduler delays the critical section entering of the job (i.e., the job blocks itself) until the next subsystem budget replenishment. In addition, it sets the subsystem ceiling equal to the internal resource ceiling of the resource that the self blocked job wanted to access, to prevent the execution of all tasks that have less priority than or equal to the ceiling of the resource until the job releases the resource. Local schedulability analysis The local schedulability analysis under FPS is as follows [14]: $$\forall \tau_i \ \exists t : 0 < t \leq D_i, \ \text{rbf}_{FP}(i, t) \leq \text{abf}_{s}(t),$$ \hspace{1cm} (1) where $\text{abf}_{s}(t)$ is the supply bound function based on the periodic resource model presented in [14] that computes the minimum possible CPU supply to $S_s$ for every interval length $t$, and $\text{rbf}_{FP}(i, t)$ denotes the request bound function of a task $\tau_i$. $\text{abf}_{s}(t)$ can be calculated as follows: $$\text{abf}_{s}(t) = \begin{cases} t - (k + 1)(P_s - Q_s) & \text{if } t \in V^{(k)} \\ (k - 1)Q_s & \text{otherwise}, \end{cases}$$ \hspace{1cm} (2) where $k = \max \left( \left\lfloor \frac{t - (P_s - Q_s)}{P_s} \right\rfloor, \frac{1}{2} \right)$ and $V^{(k)}$ denotes an interval $[(k + 1)P_s - 2Q_s, (k + 1)P_s - Q_s]$. Note that, for Eq. (1), $t$ can be selected within a finite set of scheduling points [12]. The request bound function \( r_b f_p(i, t) \) of a task \( \tau_i \) is given by [4]: \[ r_b f_p(i, t) = C_i + I_S(i) + I_H(i, t) + I_L(i), \] (3) where \( I_S(i) \) is the self blocking of task \( \tau_i \), \( I_H(i, t) \) is the interference from tasks with higher priority than \( \tau_i \), and \( I_L(i) \) is the interference from tasks with lower priority than \( \tau_i \), that access shared resources, i.e. \[ I_S(i) = \sum_{R_k \in \{R^C\}} X_{i,k}, \tag{4} \] \[ I_H(i, t) = \sum_{\tau_k \in h(i)} \left[ \frac{t}{T_h} \right] (C_h + \sum_{R_k \in \{R^C\}} X_{h,k}), \tag{5} \] \[ I_L(i) = \max_{\tau_l \in l(i)} \max_{R_k \in \{R^C\}} \left( c_{j,k} + X_{j,k} \right). \tag{6} \] The term \( X_{j,k} \) in these latter equations represents the self-blocking of task \( \tau_j \) due to access to resource \( R_k \), and is equal to the maximum amount of capability that the task (and tasks with a higher priority than \( R_k \)) may need during resource access. Its value can be determined by \[ X_{j,k} = c_{j,k} + \sum_{h=\lceil rc_k+1 \rceil}^{n_s} C_h. \tag{7} \] **Subsystem budget** In this paper, it is assumed that the subsystem period \( P_s \) of a subsystem \( S_s \) is given while the minimum subsystem budget \( Q_s \) should be computed. We use \( \text{calculateBudget}(S_s, P_s) \) to denote a function that calculates this minimum budget \( Q_s \) satisfying Eq. (1). This function is similar to the one presented in [14]. Finally, when a task experiences self-blocking during a subsystem budget period it is guaranteed access to the resource during the next period. To provide this guarantee, the subsystem budget \( Q_s \) should be \[ Q_s \geq X_s. \tag{8} \] ### 5 Upper bound analysis In this section we will show that the schedulability analysis associated with SIRAP is very pessimistic if many resources are accessed by tasks. We will show this by using the following example. **Example:** Consider a subsystem \( S_1 \) that has three tasks as shown in Table 1. Let the subsystem period be equal to \( P_s = 50 \). Using the original SIRAP analysis, we find a subsystem budget \( Q_s = 23.5 \). Task \( \tau_2 \) requires this budget in order to guarantee its schedulability (The set of points of time \( t \) used to determine schedulability of \( \tau_2 \) is \( \{100, 150\} \) and at time \( t = 150 \), \( r_b f_p(2, 150) = 47 \). To evaluate \( r_b f_p(i, t) \) for \( \tau_i \), the SIRAP analysis assumes that the maximum number of self blocking instances will occur for \( \tau_i \) and all its lower and higher priority tasks. Considering our example, \( r_b f_p(2, 150) \) contains a total of 9 self blocking occurrences; 6 self-blocking instances for task \( \tau_3 \) (see (5)), 2 for task \( \tau_2 \) (see (4)), and 1 for task \( \tau_1 \) (see (6)). Because \( r_b f_p(2, 150) = 47 \) and \( Q_s = 23.5 \), we know that \( \tau_2 \) needs at least two and at most three activations of the subsystem for its completion. Because no self-blocking instance can occur during a subsystem period in which a task completes its execution, the analysis should incorporate at most 2 self-blocking instances for \( \tau_2 \). This means that the SIRAP analysis adds 7 unnecessary self blocking occurrences when calculating \( r_b f_p(i, t) \) which makes the analysis pessimistic. If 2 self blocking occurrences are considered and the two largest self blocking values that may happen are selected (e.g., \( X_{3,2} = 2, X_{3,3} = 2 \)), then a subsystem budget of \( Q_s = 18.5 \) suffices. For this subsystem budget, we once again find at most 2 self-blocking instances. In other words, the required subsystem utilization can be decreased by 20% compared with the original SIRAP analysis. In the following section we present a method to incorporate an upper bound on the number of self-blocking occurrences in \( r_b f_p(i, t) \) based on the length \( t \) of the interval. ### 6 Improved SIRAP analysis The following conjecture presents an upper bound on the number of self blocking occurrences in an interval of length \( t \). **Conjecture 1** An upper bound on the number of self blocking occurrences \( z(t) \) in an interval of length \( t \) is given by \[ z(t) = \left\lfloor \frac{t}{P_s} \right\rfloor. \tag{9} \] After evaluating \( z(t) \), it is possible to calculate the self blocking \( I_S(i, t) \) on task \( \tau_i \) from all tasks, i.e., lower priority tasks, higher priority tasks and the task \( \tau_i \) itself. Let's define \( G_i(t) \) as a multi-set that includes the following elements: - \( \max(X_{i,k}) \) for all \( \tau_l \in l(i) \) and all \( R_k \in \{R^C\} \) for each \( \tau_l \), i.e., from lower priority tasks. - \( X_{i,k} \) for all \( R_k \in \{R^C\} \), i.e., from all resources that are accessed by \( \tau_i \). <table> <thead> <tr> <th>$t$</th> <th>$C_i$</th> <th>$T_i$</th> <th>$P_s$</th> <th>$c_{i,j}$</th> </tr> </thead> <tbody> <tr> <td>50</td> <td>6</td> <td>100</td> <td>$R_1, R_2, R_3$</td> <td>1.2.2</td> </tr> <tr> <td>20</td> <td>20</td> <td>150</td> <td>$R_1, R_3$</td> <td>2.1</td> </tr> <tr> <td>3</td> <td>3</td> <td>500</td> <td>$R_2$</td> <td>1</td> </tr> </tbody> </table> Table 1. Example task set parameters • \(\forall h, t \in X_{h,k} \times X_{h,k} \) for all tasks \(\tau_h \in \text{hp}(i)\) (higher priority tasks) and all \(R_h \in \{R^h\}\) for each \(\tau_h\), where \(\tau_h(t) = \left\lfloor \frac{j}{t_h} \right\rfloor\) is the maximum number of times that \(\tau_h\) activates within time \(t\). We mean by \(W_h(t) \times X_{h,k}\) the number of copies \(W_h(t)\) of \(X_{h,k}\) that will be inserted in \(G_i(t)\). Note that the multi-set \(G_i(t)\) includes all \(X_{h,k}\) that may contribute to the self-blocking, but only \(z(t)\) number of elements are required to be considered when evaluating the self-blocking effect, and to consider the worst case scenario, the value of these elements should be the highest in the multi-set. In order to find the \(z(t)\) highest values, we define a sequence \(G^\text{sort}(t)_i\) that contains all elements of \(G_i(t)\) in a non-increasing order, i.e., \(G^\text{sort}(t)_i = \text{sort}(G_i(t))\). Hence, the first element \(G^\text{sort}(t)_i[1]\) has the largest value. The self-blocking effect from all tasks on \(\tau_i\) can now be determined by \[I^*_Z(i,t) = \sum_{j=1}^{z(t)} G^\text{sort}(t)_i[j].\] Note that if \(z(t)\) is greater than the number of elements in the set \(G^\text{sort}(t)_i\), then we assume that the value of the extra elements are equal to zero. We now replace \(I^*_H(i,t)\) and \(I^*_L(i,t)\) by \(I^*_H(i,t)\) and \(I^*_L(i,t)\), respectively, i.e., terms without self-blocking: \[ I^*_H(i,t) = \sum_{\tau_h \in \text{hp}(i)} \left\lfloor \frac{t}{t_h} \right\rfloor C_b, \quad (11) \] \[ I^*_L(i,t) = \max_{\tau_l \in \text{hp}(i)} \left( \max_{R_h \mid R_h \sqsupseteq \tau_l} (c_{l,k}) \right). \quad (12) \] And finally \(\text{rbf}_{\text{FP}}(i,t)\) can be evaluated as \[ \text{rbf}_{\text{FP}}(i,t) = C_i + I^*_Z(i,t) + I^*_H(i,t) + I^*_L(i,t). \quad (13) \] Returning to our example, we find \(z(150) = 3\). Based on Eq (13), we find a minimum subsystem budget \(Q_s = 19.5\), which is better than the original SIRAP. The analysis is still pessimistic, however, because \(z(t)\) is an upper bound on the number of self blocking occurrences rather than an exact number and in addition, \(t\) is selected from the schedulability test points set of \(\tau_2\) rather than the Worst Case Response Time (WCRT) of the task. note that the WCRT of \(\tau_2\) is less than 150 which adds more pessimism on the results. 7 Summary In this paper, we have shown that the local schedulability analysis for the synchronization protocol SIRAP is pessimistic when many resources are accessed by the tasks of a subsystem. This pessimism is caused by the fact that the original analysis does not take into account that the maximum number of self blocking instances of tasks is bounded by the maximum number of subsystem period intervals in which these tasks execute. We presented a conjecture with an upper bound for the number of self blocking occurrences of tasks in an interval of length \(t\), and an improvement of the analysis of the SIRAP protocol based on that conjecture. Further improvements of the analysis, e.g., finding a tight upper bound on the number of self blocking occurrences, are a topic of future work. References
{"Source-Url": "https://pure.tue.nl/ws/files/3022343/Metis232887.pdf", "len_cl100k_base": 5399, "olmocr-version": "0.1.50", "pdf-total-pages": 5, "total-fallback-pages": 0, "total-input-tokens": 18793, "total-output-tokens": 6796, "length": "2e12", "weborganizer": {"__label__adult": 0.00029087066650390625, "__label__art_design": 0.00039315223693847656, "__label__crime_law": 0.00041413307189941406, "__label__education_jobs": 0.0011072158813476562, "__label__entertainment": 0.00010401010513305664, "__label__fashion_beauty": 0.00017952919006347656, "__label__finance_business": 0.000804901123046875, "__label__food_dining": 0.0003933906555175781, "__label__games": 0.0005598068237304688, "__label__hardware": 0.0045623779296875, "__label__health": 0.0008707046508789062, "__label__history": 0.00033855438232421875, "__label__home_hobbies": 0.0001672506332397461, "__label__industrial": 0.0017747879028320312, "__label__literature": 0.0002053976058959961, "__label__politics": 0.00035691261291503906, "__label__religion": 0.0005178451538085938, "__label__science_tech": 0.45556640625, "__label__social_life": 9.98377799987793e-05, "__label__software": 0.021514892578125, "__label__software_dev": 0.50830078125, "__label__sports_fitness": 0.0002524852752685547, "__label__transportation": 0.0010633468627929688, "__label__travel": 0.00022542476654052737}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 23554, 0.03285]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 23554, 0.59526]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 23554, 0.86422]], "google_gemma-3-12b-it_contains_pii": [[0, 2329, false], [2329, 6655, null], [6655, 12511, null], [12511, 17734, null], [17734, 23554, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2329, true], [2329, 6655, null], [6655, 12511, null], [12511, 17734, null], [17734, 23554, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 23554, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 23554, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 23554, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 23554, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 23554, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 23554, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 23554, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 23554, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 23554, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 23554, null]], "pdf_page_numbers": [[0, 2329, 1], [2329, 6655, 2], [6655, 12511, 3], [12511, 17734, 4], [17734, 23554, 5]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 23554, 0.03623]]}
olmocr_science_pdfs
2024-11-27
2024-11-27
1d1ff6282916c22a349cc1ec8be26f91d638bc92
consistency analysis in *bloom* a *CALM* and collected approach peter alvaro, neil conway, joseph m. hellerstein, william r. marczak uc berkeley the state of things - distributed programming increasingly common - hard\(^2\) - (parallelism + asynchrony + failure) \(\times\) (software engineering) choices ACID • general correctness via theoretical foundations - read/write: serializability - coordination/consensus loose consistency • app-specific correctness via design maxims - semantic assertions - custom compensation concerns: latency, availability concerns: hard to trust, test desire: best of both worlds - theoretical foundation for correctness under loose consistency - embodiment of theory in a programming framework progress • CALM consistency (maxims ⇒ theorems) • Bloom language (theorems ⇒ programming) outline - motivation: language-level consistency - foundation: CALM theorem - implementation: bloom prototype - discussion: tolerating inconsistency taint CALM monotonicity monotonic code - info accumulation - *the more you know, the more you know* non-monotonic code - belief revision - *new inputs can change your mind* - e.g. aggregation, negation, state update an aside • double-blind review an aside • double-blind review • pocket change intuition • counting requires waiting intuition • counting requires waiting • waiting requires counting CALM Theorem - CALM: consistency and logical monotonicity - monotonic code $\Rightarrow$ eventually consistent - non-monotonic $\Rightarrow$ coordinate only at non-monotonic points of order - conjectures at pods 2010 - (web-search for “the declarative imperative”) - results submitted to pods 2011 - Marczak, Alvaro, Hellerstein, Conway - Ameloot, Neven, Van den Bussche practical implications • compiler can identify non-monotonic “points of order” • inject coordination code • or mark uncoordinated results as “tainted” • compiler can help programmer think about coordination costs • easy to do this with the right language... outline • motivation: language-level consistency • foundation: CALM theorem • implementation: bloom prototype • discussion: tolerating inconsistency taint bloom disorderly programming • why is distributed programming hard? the von neumann legacy: obsession with order • state: ordered array • logic: ordered instructions, traversed by program counter • disorderly programming • state: unordered collections • logic: unordered set of declarative statements bud: bloom under development • based in 5 years experience with Overlog • culmination: API-compliant HDFS++ implementation [Eurosys10] • i got the itch to prototype a more usable language • dsl for distributed programming, embedded in ruby • interpreter: ~2300 lines of ruby • bloom features • fully declarative semantics (based on dedalus temporal logic) • disorderly programming with pragmatics of modern language (ruby) • domain-specific code analysis bloom operational model - really a metaphor for dedalus logic - each node runs independently - local clock, local data, local execution - timestepped execution loop at each node bloom statements <collection> <accumulator> <collection expression> bloom statements \[ \begin{array}{|c|c|c|} \hline \text{<collection>} & \text{<accumulator>} & \text{<collection expression>} \\ \hline \leq & \text{now} & \\ \leq+ & \text{next} & \\ \leq- & \text{del\_next} & \\ \leq\sim & \text{async} & \\ \hline \end{array} \] # bloom statements <table> <thead> <tr> <th>&lt;collection&gt;</th> <th>&lt;accumulator&gt;</th> <th>&lt;collection expression&gt;</th> </tr> </thead> <tbody> <tr> <td><strong>persistent</strong></td> <td>&lt;=</td> <td>now</td> </tr> <tr> <td><strong>transient</strong></td> <td>&lt;+</td> <td>next</td> </tr> <tr> <td><strong>networked transient</strong></td> <td>&lt;~</td> <td>del_next</td> </tr> <tr> <td><strong>scheduled transient</strong></td> <td></td> <td>async</td> </tr> <tr> <td><strong>transient</strong></td> <td></td> <td></td> </tr> </tbody> </table> bloom statements <table> <thead> <tr> <th>&lt;collection&gt;</th> <th>&lt;accumulator&gt;</th> <th>&lt;collection expression&gt;</th> </tr> </thead> <tbody> <tr> <td>persistent</td> <td>table</td> <td>&lt;= now</td> </tr> <tr> <td>transient</td> <td>scratch</td> <td>&lt;+ next</td> </tr> <tr> <td>networked transient</td> <td>channel</td> <td>&lt;= del_next</td> </tr> <tr> <td>scheduled transient</td> <td>periodic</td> <td>&lt;~ async</td> </tr> <tr> <td>transient</td> <td>interface</td> <td></td> </tr> <tr> <td>map, flat_map</td> <td>reduce, group</td> <td></td> </tr> <tr> <td>join, natjoin, outerjoin</td> <td></td> <td>empty? include?</td> </tr> </tbody> </table> toy example: delivery ```python # abstract interface module DeliveryProtocol def state super interface input, :pipe_in, ['dst', 'src', 'ident'], ['payload'] interface output, :pipe_sent, ['dst', 'src', 'ident'], ['payload'] end end ``` simple concrete implementation of the delivery protocol ```python module BestEffortDelivery include DeliveryProtocol def state channel :pipe_chan, ['@dst', 'src', 'ident'], ['payload'] end declare def snd pipe_chan =~ pipe_in end declare def done pipe_sent <= pipe_in end end ``` an alternative implementation: reliable delivery ```ruby module ReliableDelivery include BestEffortDelivery def state super table :pipe, ['dst', 'src', 'ident'], ['payload'] channel :ack, [@src, 'dst', 'ident'] periodic :tock, 10 end declare def remember_resend pipe <= pipe_in pipe_chan <= join([pipe, tock]).map{|p, t| p } end declare def rcv ack <= pipe_chan.map{|p| [p.src, p.dst, p.ident] } end declare def done apj = join [ack, pipe], [ack.ident, pipe.ident] pipe_sent <= apj.map{|a, p| p } pipe <= apj.map{|a, pl| p } end end ``` the payoff is in the paper - case study: 2 replicated shopping cart implementations 1. replicated key/value-store with “destructive” overwriting 2. “disorderly” version that accumulates/replicates user actions - demonstrates automatic consistency analysis - isolate points of order for coordination - highlights why the 2\textsuperscript{nd} implementation is preferable to 1\textsuperscript{st} - tolerating inconsistency (autoPat) - identify “tainted” data in a program - automatically generate scaffolding for compensation logic module DestructiveCart include CartProtocol include KVSProtocol declare def do_action kvget <= action_msg.map{|a| [a.reqid, a.key]} kvput <= action_msg.map do |a| if a.action == "A" unless kvget_response.map{|b| b.key}.include? a.session [a.server, a.client, a.session, a.reqid, [a.item]] end end end old_state = join [kvget_response, action_msg], [kvget_response.key, action_msg.session] kvput <= old_state.map do |b, a| if a.action == "A" [a.server, a.client, a.session, a.reqid, b.value.push(a.item)] elsif a.action == "D" [a.server, a.client, a.session, a.reqid, delete_one(b.value, a.item)] end end end declare def do_checkout kvget <= checkout_msg.map{|c| [c.reqid, c.session]} lookup = join [kvget_response, checkout_msg], [kvget_response.key, checkout_msg.session] response_msg =~ lookup.map do |r, c| [c.client, c.server, c.session, r.value] end end end • full source in paper including replicated KVS destructive cart module DisorderlyCart include CartProtocol include BestEffortDelivery def state table :cart_action, ['session', 'item', 'action', 'reqid'] table :action_cnt, ['session', 'item', 'action'], ['cnt'] scratch :status, ['server', 'client', 'session', 'item'], ['cnt'] end declare def do_action cart_action <= action_msg.map do |c| [c.session, c.item, c.action, c.reqid] end action_cnt <= cart_action.group( [cart_action.session, cart_action.item, cart_action.action], count(cart_action.reqid)) end declare def do_checkout del_items = action_cnt.map{|a| a.item if a.action == "Del"} status <= join([action_cnt, checkout_msg]).map do |a, cl| if a.action == "Add" and not del_items.include? a.item [a.client, a.server, a.session, a.item, a.cnt] end end status <= join([action_cnt, action_cnt, checkout_msg]).map do |a1, a2, cl| if a1.session == a2.session and a1.item == a2.item and a1.action == "Add" and a2.action == "Del" [a1.client, a1.server, a1.session, a1.item, a1.cnt - a2.cnt] end end response_msg <= status.group( [status.client, status.server, status.session], accum(status.cnt.times.map{status.item})) end end • full source in paper, including replication conclusion • CALM theorem • what is coordination for? non-monotonicity. • pinpoint non-monotonic points of order • coordination or taint tracking • Bloom • declarative, disorderly DSL for distributed programming • bud: organic Ruby embedding • CALM analysis of monotonicity • synthesize coordination/compensation • releasing to the dev community • friends-and-family next month • public beta, Fall 2011 more? http://bloom.cs.berkeley.edu thanks to: Microsoft Research Yahoo! Research IBM Research NSF AFOSR backup influence propagation...? - Technology Review TR10 2010: - “The question that we ask is simple: is the technology likely to change the world?” - Fortune Magazine 2010 Top in Tech: - “Some of our choices may surprise you.” - Twittersphere: - “Read this. Read this now.” relative to LP and active DB • “Unlike earlier efforts such as Prolog, active database languages, and our own Overlog language for distributed systems [16], Bloom is purely declarative: the syntax of a program contains the full specification of its semantics, and there is no need for the programmer to understand or reason about the behavior of the evaluation engine. Bloom is based on a formal temporal logic called Dedalus [3].” why ruby? • “Bud uses a Ruby-flavored syntax, but this is not fundamental; we have experimented with analogous Bloom embeddings in other languages including Python, Erlang and Scala, and they look similar in structure.” what about erlang? • “we did a simple Bloom prototype DSL in Erlang (which we cannot help but call “Bloomerlang”), and there is a natural correspondence between Bloom-style distributed rules and Erlang actors. However there is no requirement for Erlang programs to be written in the disorderly style of Bloom. It is not obvious that typical Erlang programs are significantly more amenable to a useful points-of-order analysis than programs written in any other functional language. For example, ordered lists are basic constructs in functional languages, and without program annotation or deeper analysis than we need to do in Bloom, any code that modifies lists would need be marked as a point of order, much like our destructive shopping cart” CALM analysis for traditional languages? • We believe that Bloom’s “disorderly by default” style encourages order-independent programming, and we know that its roots in database theory helped produce a simple but useful program analysis technique. While we would be happy to see the analysis “ported” to other distributed programming environments, it may be that design patterns using Bloom-esque disorderly programming are the natural way to achieve this. dependency graphs - Scratch collection - Persistent table - Dataflow source - Dataflow sink - A, B, C mutually recursive via a non-monotonic edge A appears in RHS, B in LHS of a rule $R$ $R$ is a temporal rule (uses $+$ or $-$) $R$ is non-monotonic (uses aggregation, negation, or deletion) $B$ is a channel dependency graphs BestEffortDelivery ReliableDelivery 2 cart implementations destructive disorderly example analysis in paper: replicated shopping carts - “destructive” cart implements a replicated key/value store - key: session id - value: array of the items in cart - add/delete “destructively” modify the value - “disorderly” cart uses accumulation and aggregation - adds/deletes received/replicated monotonically - checkout requires counting up the adds/deletes - hence coordinate only at checkout time Building on Quicksand - Campbell/Helland CIDR 2009 - goal: avoid coordination entirely - maxim: memories, guesses and apologies - can we use Bloom analysis to automate/prove correctness of this? - initial ideas so far from quicksand & maxims to code & proofs • “guesses”: easy to see in dependency graph • any collection downstream of an uncoordinated point of order • compiler rewrites schema to add “taint” attribute to these • and rewrites rules to carry taint bit along • “memories” at interfaces • compiler interposes table in front of any tainted output interface • “apologies” • need to determine when “memory” tuples were inconsistent • idea: wrap tainted code blocks with “background” coordination check • upon success, garbage-collect relevant “memories” • upon failure, invoke custom “apology” logic to achieve some invariant • ideally, prove that inconsistent tuples + apology logic = invariant satisfied the shift application logic system infrastructure theoretical foundation application logic system infrastructure quicksand ruby embedding - **class Bud** - “declare” methods for collections of Bloom statements - checked for legality, potentially optimized/rewritten - template methods for schemas and data - all the usual Ruby goodness applies - rich dynamic type system - OO inheritance, mixins (~multiple inheritance), encapsulation - functional programming comprehension syntax - libraries for everything under the sun a taste of ruby ```ruby module MixMeIn def mixi "who do we appreciate" end end class SuperDuper def doit "a super duper bean" end end class Submarine < SuperDuper include MixMeIn def doit "a yellow submarine" end def sing puts "we all live in " + doit end def chant(nums) out = nums.map { |n| n*2 } puts out.inspect + " " + mixi end end s = Submarine.new s.sing ; s.chant([1,2,3,4]) ``` example app: shopping cart • replicated for HA and low latency • clients associated with unique session IDs • add_item, deleted_item, checkout • **challenge:** guarantee *eventual consistency* of replicas • **maxim:** use commutative operations • c.f. Amazon Dynamo, Campbell/Helland “Building on Quicksand” • easier said than done! module CartClientProtocol def state interface input, :client_action, ['server', 'session', 'reqid'], ['item', 'action'] interface input, :client_checkout, ['server', 'session', 'reqid'] interface output, :client_response, ['client', 'server', 'session'], ['contents'] end end module CartProtocol def state channel :action_msg, ['@server', 'client', 'session', 'reqid'], ['item', 'action'] channel :checkout_msg, ['@server', 'client', 'session', 'reqid'] channel :response_msg, ['@client', 'server', 'session'], ['contents'] end end module CartClient include CartProtocol include CartClientProtocol declare def client action_msg =~ client_action.map do |a| [a.server, @local_addr, a.session, a.reqid, a.item, a.action] end checkout_msg =~ client_checkout.map do |a| [a.server, @local_addr, a.session, a.reqid] end client_response <= response_msg end end destructive cart • disconnected because we haven’t picked a kvs implementation yet destructive cart - basic KVS interposes a point of order into the dataflow abstract and concrete clients - note that concrete client is still underspecified: we haven’t supplied an implementation of the cart yet! module KVSProtocol def state super interface input, :kvput, ['client', 'key', 'reqid'], ['value'] interface input, :kvget, ['reqid'], ['key'] interface output, :kvget_response, ['reqid'], ['key', 'value'] end end module BasicKVS include KVSProtocol def state table :kvstate, ['key'], ['value'] end declare def do_put kvstate <+ kvput.map{|p| [p.key, p.value]} prev = join [kvstate, kvput], [kvstate.key, kvput.key] kvstate <- prev.map{|b, p| b} end declare def do_get getj = join [kvget, kvstate], [kvget.key, kvstate.key] kvget_response <= getj.map do |g, t| [g.reqid, t.key, t.value] end end end • no replication • deletion on each put • gets worse with replication! simple key/val store - any path through `kvput` crosses both a point of order and a temporal edge. - where’s the non-monotonicity? - state update in the KVS - easy syntactic check! ``` kvstate <- prev.map{lb, pl b} ``` module BasicKVS include KVSProtocol def state table : kvstate, ['key'], ['value'] end declare def do_put kvstate <+ kvput.map{|p| [p.key, p.value]} prev = join [kvstate, kvput], [kvstate.key, kvput.key] # dude, it's here! (<-) kvstate <- prev.map{|b, p| b} end declare def do_get getj = join [kvget, kvstate], [kvget.key, kvstate.key] kvget_response <= getj.map do |g, t| [g.reqid, t.key, t.value] end end end complete destructive cart - analysis: bad news - coordinate on each client action - add or delete - coordinate on each KVS replication - what if we skip coordination? - assert: actions are commutative - no way for compiler to check - and in fact it’s wrong! complete disorderly cart - client actions and cart replication all monotonic - point of order to handle checkout messages final analysis: destructive - point of order on each client request for cart update - this was visible even with the simplest KVS - only got worse with replication - what to do? 1. assert that operations commute, and leave as is - informal, bug-prone, subject to error creep over time - there’s already a bug: deletes may arrive before adds at some replicas 2. add a round of distributed coordination for each update - e.g. 2PC or Paxos - this makes people hate ACID 3. best solution: a better cart abstraction! - move that point of order to a lower-frequency operation simple disorderly skeleton Concrete implementation has points of order as abstraction. Client updates and replication of cart state can be coordination-free, some coordination may be necessary to handle checkout messages. ... and its composition with the client code - note points of order (circles) corresponding to aggregation module MulticastProtocol def state super table :members, ['peer'] interface input, :send_mcast, ['ident'], ['payload'] interface output, :mcast_done, ['ident'], ['payload'] end end module Multicast include MulticastProtocol include DeliveryProtocol include Anise annotator :declare declare def snd_mcast pipe_in <= join([send_mcast, members]).map do |s, m| [m.peer, @addy, s.ident, s.payload] end end end declare def done_mcast # override me mcast_done <= pipe_sent.map{|p| [p.ident, p.payload] } end end We take the abstract class Multicast... replication ... and extend the disorderly cart to use it (along with the concrete multicast implementation BestEffortDelivery) ```ruby module ReplicatedDisorderlyCart include DisorderlyCart include Multicast include BestEffortDelivery declare def replicate send_mcast <= action_msg.map do |a| [a.reqid, [a.session, a.reqid, a.item, a.action]] end cart_action <= mcast_done.map { |m| m.payload } cart_action <= pipe_chan.map { |c| c.payload } end end ``` final analysis: disorderly cart - concrete implementation has points of order as abstraction - client updates and replication of cart state can be coordination-free - some coordination may be necessary to handle checkout messages
{"Source-Url": "http://db.cs.berkeley.edu/jmh/talks/cidr2011.pdf", "len_cl100k_base": 5282, "olmocr-version": "0.1.53", "pdf-total-pages": 64, "total-fallback-pages": 0, "total-input-tokens": 97627, "total-output-tokens": 7495, "length": "2e12", "weborganizer": {"__label__adult": 0.0004048347473144531, "__label__art_design": 0.0002512931823730469, "__label__crime_law": 0.0002808570861816406, "__label__education_jobs": 0.0004041194915771485, "__label__entertainment": 5.036592483520508e-05, "__label__fashion_beauty": 0.00012564659118652344, "__label__finance_business": 0.00017821788787841797, "__label__food_dining": 0.0003781318664550781, "__label__games": 0.00042629241943359375, "__label__hardware": 0.0005459785461425781, "__label__health": 0.00040030479431152344, "__label__history": 0.00016701221466064453, "__label__home_hobbies": 7.915496826171875e-05, "__label__industrial": 0.00026488304138183594, "__label__literature": 0.00024700164794921875, "__label__politics": 0.0002913475036621094, "__label__religion": 0.00039124488830566406, "__label__science_tech": 0.0025634765625, "__label__social_life": 9.447336196899414e-05, "__label__software": 0.0030498504638671875, "__label__software_dev": 0.98876953125, "__label__sports_fitness": 0.00028705596923828125, "__label__transportation": 0.0004010200500488281, "__label__travel": 0.0001785755157470703}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 20133, 0.00316]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 20133, 0.14377]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 20133, 0.70992]], "google_gemma-3-12b-it_contains_pii": [[0, 148, false], [148, 303, null], [303, 604, null], [604, 748, null], [748, 844, null], [844, 1000, null], [1000, 1005, null], [1005, 1219, null], [1219, 1251, null], [1251, 1300, null], [1300, 1339, null], [1339, 1407, null], [1407, 1791, null], [1791, 2056, null], [2056, 2212, null], [2212, 2218, null], [2218, 2525, null], [2525, 2993, null], [2993, 3176, null], [3176, 3247, null], [3247, 3513, null], [3513, 3973, null], [3973, 4675, null], [4675, 4968, null], [4968, 5288, null], [5288, 5894, null], [5894, 6441, null], [6441, 7575, null], [7575, 8885, null], [8885, 9320, null], [9320, 9426, null], [9426, 9433, null], [9433, 9711, null], [9711, 10144, null], [10144, 10365, null], [10365, 11112, null], [11112, 11570, null], [11570, 11883, null], [11883, 11939, null], [11939, 11987, null], [11987, 12408, null], [12408, 12631, null], [12631, 13359, null], [13359, 13488, null], [13488, 13909, null], [13909, 14346, null], [14346, 14685, null], [14685, 15292, null], [15292, 15640, null], [15640, 15724, null], [15724, 15800, null], [15800, 15939, null], [15939, 16172, null], [16172, 16688, null], [16688, 16913, null], [16913, 17480, null], [17480, 17753, null], [17753, 17876, null], [17876, 18480, null], [18480, 18703, null], [18703, 18811, null], [18811, 19412, null], [19412, 19903, null], [19903, 20133, null]], "google_gemma-3-12b-it_is_public_document": [[0, 148, true], [148, 303, null], [303, 604, null], [604, 748, null], [748, 844, null], [844, 1000, null], [1000, 1005, null], [1005, 1219, null], [1219, 1251, null], [1251, 1300, null], [1300, 1339, null], [1339, 1407, null], [1407, 1791, null], [1791, 2056, null], [2056, 2212, null], [2212, 2218, null], [2218, 2525, null], [2525, 2993, null], [2993, 3176, null], [3176, 3247, null], [3247, 3513, null], [3513, 3973, null], [3973, 4675, null], [4675, 4968, null], [4968, 5288, null], [5288, 5894, null], [5894, 6441, null], [6441, 7575, null], [7575, 8885, null], [8885, 9320, null], [9320, 9426, null], [9426, 9433, null], [9433, 9711, null], [9711, 10144, null], [10144, 10365, null], [10365, 11112, null], [11112, 11570, null], [11570, 11883, null], [11883, 11939, null], [11939, 11987, null], [11987, 12408, null], [12408, 12631, null], [12631, 13359, null], [13359, 13488, null], [13488, 13909, null], [13909, 14346, null], [14346, 14685, null], [14685, 15292, null], [15292, 15640, null], [15640, 15724, null], [15724, 15800, null], [15800, 15939, null], [15939, 16172, null], [16172, 16688, null], [16688, 16913, null], [16913, 17480, null], [17480, 17753, null], [17753, 17876, null], [17876, 18480, null], [18480, 18703, null], [18703, 18811, null], [18811, 19412, null], [19412, 19903, null], [19903, 20133, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 20133, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 20133, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 20133, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 20133, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 20133, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 20133, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 20133, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 20133, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 20133, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 20133, null]], "pdf_page_numbers": [[0, 148, 1], [148, 303, 2], [303, 604, 3], [604, 748, 4], [748, 844, 5], [844, 1000, 6], [1000, 1005, 7], [1005, 1219, 8], [1219, 1251, 9], [1251, 1300, 10], [1300, 1339, 11], [1339, 1407, 12], [1407, 1791, 13], [1791, 2056, 14], [2056, 2212, 15], [2212, 2218, 16], [2218, 2525, 17], [2525, 2993, 18], [2993, 3176, 19], [3176, 3247, 20], [3247, 3513, 21], [3513, 3973, 22], [3973, 4675, 23], [4675, 4968, 24], [4968, 5288, 25], [5288, 5894, 26], [5894, 6441, 27], [6441, 7575, 28], [7575, 8885, 29], [8885, 9320, 30], [9320, 9426, 31], [9426, 9433, 32], [9433, 9711, 33], [9711, 10144, 34], [10144, 10365, 35], [10365, 11112, 36], [11112, 11570, 37], [11570, 11883, 38], [11883, 11939, 39], [11939, 11987, 40], [11987, 12408, 41], [12408, 12631, 42], [12631, 13359, 43], [13359, 13488, 44], [13488, 13909, 45], [13909, 14346, 46], [14346, 14685, 47], [14685, 15292, 48], [15292, 15640, 49], [15640, 15724, 50], [15724, 15800, 51], [15800, 15939, 52], [15939, 16172, 53], [16172, 16688, 54], [16688, 16913, 55], [16913, 17480, 56], [17480, 17753, 57], [17753, 17876, 58], [17876, 18480, 59], [18480, 18703, 60], [18703, 18811, 61], [18811, 19412, 62], [19412, 19903, 63], [19903, 20133, 64]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 20133, 0.02749]]}
olmocr_science_pdfs
2024-12-06
2024-12-06
c9e676cb159e1bede112ff254afc467b4e094df1
Map design report de Ronde, J.F.; Sloot, P.M.A. Citation for published version (APA): General rights It is not permitted to download or to forward/distribute the text or part of it without the consent of the author(s) and/or copyright holder(s), other than for strictly personal, individual use, unless the work is under an open content license (like Creative Commons). Disclaimer/Complaints regulations If you believe that digital publication of certain material infringes any of your rights or (privacy) interests, please let the Library know, stating your reasons. In case of a legitimate complaint, the Library will make the material inaccessible and/or remove it from the website. Please Ask the Library: https://uba.uva.nl/en/contact, or a letter to: Library of the University of Amsterdam, Secretariat, Singel 425, 1012 WP Amsterdam, The Netherlands. You will be contacted as soon as possible. UvA-DARE is a service provided by the library of the University of Amsterdam (http://dare.uva.nl) Commission of the European Communities **************** ESPRIT III PROJECT NB 6756 **************** CAMAS COMPUTER AIDED MIGRATION OF APPLICATIONS SYSTEM **************** CAMAS-TR-2.1.3.2 MAP Design Report **************** Date: September 1994 This design report has been submitted for evaluation to the CAMAS industrial partners of Workpackage 1: ESI and FEGS. Contents 1 Introduction 2 2 MAP embedded in the toolset 2 3 Cosmetics 3 3.1 Finite Element Mesh 4 3.2 Processor Topology 5 3.3 Units 6 4 Mapping 7 4.1 Fitness 7 4.2 The Genetic Algorithm 8 4.2.1 Reproduction 8 4.2.2 Crossover 9 4.2.3 Mutation and Inversion 9 4.3 Hill Climbing 9 4.4 Simulation Generation 10 5 Time Schedule 10 A Pseudo Genetic Algorithm for process-processor mapping 11 B On Input format 11 C MAP Preliminary Version 11 1 Introduction The purpose of MAP is to aid in modelling the behaviour of parallel (SPMD) applications for which the process graph can be specified statically and is undirected. One should think of for example finite element or finite difference applications. Many of such applications can be seen to have a direct correspondence to a regular domain decomposition. For example a grid (one or more dimensions). Modern massively parallel architectures often offer as physical or virtual topology such regular structures onto which the static process graph that emerges from a regular decomposition can be mapped easily. However for problems that do not have a regular communication pattern / process graph the optimal mapping may not be obvious in advance. For developing data parallel applications that contain irregular communication patterns it is useful to be able to experiment with various data mapping strategies and see what the effects are on the performance of the application. MAP will be utilized in combination with SAD and PARASOL to enable application developers to do qualitative analysis of application behaviour under different decomposition strategies. A near optimal process to processor graph mapping will be obtained by means of Genetic Algorithm (GA) optimization. Simple fitness functions will be used for this purpose. Modelling of the effects on performance of dynamic properties such as contention of message traffic in a processor network will be done by simulation (see SAD/PARASOL). The choice of using GA as optimization technique is based on the following. - Physical optimization technique such as Simulated Annealing and Genetic Algorithms have shown to be successful in finding near optimal solutions for discrete optimization problems that show NP completeness in their solution space, see for example [1] and [4]. - The parallelizability of Genetic Algorithms is much better (in general) than e.g. Simulated Annealing. - It is relatively simple to build genetic operators and add these modularly to a genetic algorithm kernel. - For example Fox et al. (see [3] and [2]) have shown that genetic algorithms can work well for the problem of mapping finite element meshes on hypercubic topologies. Basically these were the motivations to take GA as optimization strategy within the MAP tool. The next sections of the design report handles the following. In section 2 the way that MAP is supposed to be used within the CAMAS workbench is discussed. In chapter 3 the formats as chosen within the design for specifying a processor topology and a process graph are presented and clarified using a simple example. In chapter 4 the idea of mapping using a genetic algorithm of the example finite element mesh on the example processor topology is explained in some detail. Section 5 briefly addresses a time schedule for development of the specific work for the MAP subtask. In the appendix a pseudo genetic algorithm is presented as it is to be implemented within MAP. Furthermore briefly the interfacing of e.g. PAM-CRASH input files and DDT output to the MAP tool is discussed. Test results for a preliminary version of MAP are presented in appendix C. 2 MAP embedded in the toolset In figure 1 the synergy of the toolset is shown with emphasis on MAP. Within the Parasol I virtual machine one can specify a virtual or real processor topology. This topology can be represented in terms of a connectivity matrix. For each processor $A$ to every other processor $B$ a factor is given that corresponds to the route taken by a message sent from $A$ to $B$ and e.g. the relative throughput per link in this route. The route that is taken depends on the routing algorithm that has been build in by the manufacturer of the hardware platform under consideration. Below the routing problem is addressed when the formats for processor topology specification are presented. On the other hand one can supply a static process graph that is handcrafted or derived from a finite element mesh (elements + connectivities) or a "super element"-mesh, that is a set of sub-domains of a mesh that has been arrived at via a domain decomposition technique (for example by Recursive Spectral Bisection (RSB), Orthogonal Recursive Bisection (ORB) or scattered decomposition). Symbolically this is represented by a box DDT. We consider the following possibilities in studying mappings: - Mapping of a finite element mesh. - Mapping sub-domains that are generated by a decomposition module (for example from DDT) from a finite element mesh. - Mapping of a user defined connectivity graph which expresses the static process graph of an arbitrary problem that requires investigation. The mapping procedure is constructed as follows: Using a relatively cheap (meaning that it requires relatively little time to evaluate) fitness function a genetic optimization is done. Intermediate solutions can be picked out. From such a specific individual solution a SAD simulation program is generated. Dynamic behaviour such as network contention can then be investigated using the SAD/PARASOL simulation environment. The result of this can be fed back into the optimization procedure. 3 Cosmetics The following section is dedicated to the form in which MAP expects input and a more detailed view into the construction of MAP. 3.1 Finite Element Mesh A finite element mesh is characterized by its logical connectivity. Basically, the logical connectivity enumerates for every element in the mesh by which gridpoints it is constituted. The number of constituting gridpoints of a specific element depends on the shape of the element. Examples of possible element shapes are shown in figure 2. ![Element Shapes](image) **Figure 2: different element shapes** A logical connectivity that is to be read from file may appear in the following format: <table> <thead> <tr> <th>Element Number</th> <th>Element Type</th> <th>Gridpoints</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>type</td> <td>$a_{11}$ $a_{12}$ ... $a_{1m_1}$</td> </tr> <tr> <td>2</td> <td>type</td> <td>$a_{21}$ $a_{22}$ ... $a_{2m_2}$</td> </tr> <tr> <td>...</td> <td>...</td> <td>...</td> </tr> <tr> <td>N</td> <td>type</td> <td>$a_{N1}$ $a_{N2}$ ... $a_{Nm_N}$</td> </tr> </tbody> </table> For every element the type is given followed by the numbers of the gridpoints that constitute it. The number of gridpoints of an element depends on its “shape” property. So in the example logical connectivity table element 1 is formed by the gridpoints $a_{11}$,$a_{12}$...$a_{1m_1}$. Figure 3 shows an example mesh. The elements are numbered from 0 to 15. The gridpoints are numbered from 1 ... 25. Only the numbers for the gridpoints that lie on the boundaries of the mesh are displayed. ![Mesh Example](image) **Figure 3: mesh example** The logical connectivity for this mesh is given for the first few elements by: <table> <thead> <tr> <th>Element Number</th> <th>Element Type</th> </tr> </thead> <tbody> <tr> <td>1</td> <td></td> </tr> <tr> <td>2</td> <td></td> </tr> <tr> <td>...</td> <td></td> </tr> <tr> <td>N</td> <td></td> </tr> </tbody> </table> Element Number Element Type From this logical connectivity the element connectivity as it will be used in MAP can be derived. For this specific example this will become for the first few elements: Element <table> <thead> <tr> <th></th> <th>0</th> <th>1 2 4 5 1</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>0</td> <td>2 2 4 1 6 1</td> </tr> <tr> <td>2</td> <td>1 2 3 5 1 7 1</td> <td></td> </tr> </tbody> </table> e etc.... This means: Element 0 shares 2 gridpoints with element 1, 2 gridpoints with element 4 and 1 gridpoint with element 5 etc... If after mapping a finite element mesh to a processor network two connected elements reside on different processors, (in first approximation) a message that is proportional to the number of gridpoints they share has to be exchanged between those processes. Furthermore, with every element type a static workload must be associated. The determination of this (relative) workload is a task of the user of the MAP environment. A possible path in determining the work for a specific element type on a specific machine is by applying the performance estimation tools of the CAMAS Workbench. 3.2 Processor Topology A processor configuration for MAP will be characterized by a connectivity matrix. An element \( P_{pq} (p \neq q) \) denotes the relative (or absolute) time it takes for a unit sized message to travel from processor \( p \) to processor \( q \). Within the PARASOL I virtual machine model one will be allowed to specify a parallel machine by the processors that it is constituted from with the nearest neighbour links and their relative throughput. Figure 4 shows an example of a mesh of processors with different link types (a and b) as well as different processor types (X and Y). ![Figure 4: processor config example](image) In the following table the representation of such a mesh as how it could be initialized within the PARASOL I tool is given. <table> <thead> <tr> <th>processor</th> </tr> </thead> <tbody> <tr> <td>connected to other processors with link speeds.</td> </tr> </tbody> </table> This has to be read as processor zero has two directly neighbouring processors (1 and 3). Both processors are connected to processor 0 via links with relative throughput a. Unfortunately this information is not sufficient to find out what costs are associated with sending a message between processor 0 and 8 for example. The route that is taken by this message is dependent on the routing mechanism of the hardware (e.g. simple X-Y routing where the route between two processors is defined by alternating steps in X and Y direction via the links of the grid topology. We assume in our modelling that every processor pair is connected via a unique route when exchanging messages. It is not possible to incorporate dynamically changing routing schemes. What can be done is using different routing schemes and implementing these within PARASOL I. Given the processor mesh example in figure 4. So e.g. a message send from processor 0 to processor 8 migrates consecutively over links with speed of a, b, b and a. The processor connectivity matrix \( P_{pq}(p \neq q) \) is what is used by MAP. It has to be build within PARASOL I in which routing strategies can be embedded. ### 3.3 Units A finite element mesh may first be run through a preprocessing module that partitions the mesh in a set of \( M \) so called “units”. Examples of partitioning algorithms are RSB, ORB or scattered decomposition. Figure 5 shows the example mesh that is partitioned into 4 parts. A unit connectivity has the same format as a normal element connectivity. For every part (unit) the row of constituting elements is enumerated. Furthermore the “unit connectivity” is given. In case of the example mesh Unit <table> <thead> <tr> <th>0</th> <th>1</th> <th>3</th> <th>2</th> <th>1</th> <th>3</th> <th>4</th> </tr> </thead> <tbody> <tr> <td>5</td> <td>6</td> <td>7</td> <td>8</td> <td></td> <td></td> <td></td> </tr> <tr> <td>9</td> <td>10</td> <td>11</td> <td>12</td> <td></td> <td></td> <td></td> </tr> <tr> <td>13</td> <td>14</td> <td>15</td> <td>16</td> <td></td> <td></td> <td></td> </tr> </tbody> </table> Figure 5: a mesh partitioned into 4 units Meaning that unit 0 shares 3 gridpoints with unit 1, 1 gridpoint with unit 2 etc.... The Workload associated with a unit is the summation of the workloads of the individual elements that constitute the unit. 4 Mapping The search for a near optimal mapping of elements or units onto a processor configuration will be done by means of a genetic algorithm. The form of a chromosome on which genetic operators will act is encoded as a string of integers, where an integer refers to a processor and its position in the string represents the allocated data element. So for example for the finite element mesh that is mapped on the processor configuration (see figure 6) the corresponding chromosome is given by: \[ \begin{pmatrix} 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 0 & 1 & 2 & 3 & 4 & 5 & 6 \end{pmatrix} \] Figure 6: a map of a FE mesh on a processor grid-topology An initial population of chromosomes can be generated randomly. Work by Fox et al. (see [3]) has shown that this is a reasonable heuristic to initiate the genetic optimization from for the type of problems that we are addressing. 4.1 Fitness Two examples of costfunctions were given in technical report CAMAS-TR.2.1.3.1 : (units are equivalent with elements) \[ C = \max_{q \in Q} \sum_{u_i \in U_q} W_{ii} \] where \( Q \) is the set of processors and \( U_q \) is the set of units \( u_i \) residing on processor \( q \). This costfunction only takes workloads into account. Thus basically it represents a model of a fully connected machine with infinite communication bandwidth. A more realistic costfunction might be: \[ C = \max_{q \in Q} \left( \sum_{u_i \in U_q} W_{ii} + \max_{u_i \in U_q, u_j \in A(u_i)} P_{pq} W_{ij} \right) \] where $\mathcal{A}(u_i)$ is the set of neighbouring units for unit $u_i$. In this case the cost function takes into account the connectivities in the workload graph as well as the processor topology via the factor $P_{pq}$. This will force the maximum distance between the processors onto which connected units are mapped to be minimal while at the same time for optimizing the workload distribution. It should be noted that the multiprocessors in the above two models are assumed to consist of processors that have identical performance rate. That’s why the factor describing this rate $P_{pq}$ can be omitted in the cost functions above. Since many evaluations of the above cost functions are necessary within genetic algorithm optimization it is important to find a function of which the evaluation is not too expensive. Fox et al, see [2] have proposed an approximate function that has shown to achieve good results. In the genetic algorithm that is to be used by MAP a similar objective function is going to be used. At points where it becomes necessary to be more exact in the solution a more expensive function is taken. Finally the fitness of a specific mapping is defined as the reciprocal of the “cost functions” introduced above. 4.2 The Genetic Algorithm Generally a genetic algorithm consists of several operations that transform a population of chromosomes into a new one. The reproduction operation basically is the operation that is responsible for the tendency that consecutive populations that are generated evolve in the direction of higher average fitness. The other operations are introduced to create populations with high diversity. GA is a blind search technique. Very often the implementation of an efficient GA is confronted with the problem of premature convergence into local optima. On the other hand an implementation that is not specifically efficient may take very long times to reach a good suboptimal solution. Incorporating problem specific knowledge in the blind GA search to direct it to the fruitful regions in the search space is a possible technique to get more efficient GA’s. So called hybrid techniques can take into account domain specific knowledge in their search. The hybrid genetic algorithm for our purposes has to satisfy the following conditions: The likelihood of premature convergence has to be minimized, the search efficiency must be high while computational costs are kept as low as possible, and problem specific knowledge has to be utilized. For example work by Fox et al, see [2] has shown that such a hybrid genetic algorithm can provide good results. Several operators can be distinguished that are typical for the genetic algorithm kernel: - Reproduction - Crossover - Mutation and Inversion 4.2.1 Reproduction Reproduction of a population of size of $N$ individuals produces a new population of size $N$. The probability that an individual that appeared in the old population will be reproduced and put in the new one is higher when the fitness of the individual is higher. This can be done e.g. according to the so called biased “wheel of fortune” trick, see [1], or “ranking”, see [2]. Ranking will be adopted as reproduction scheme for the genetic algorithm within MAP. It has shown to be able to control premature convergence and to be computationally relatively cheap compared to other methods. 4.2.2 Crossover In “Crossover” the population that was generated by “Reproduction” is manipulated into a new population. Randomly two chromosomes are picked out of the population. Then two new chromosomes are generated using a crossover operation. Figure 7 gives some crossover operations that may be applied: one point crossover and two point crossover. A so called two-point ring-like crossover will be used within MAP instead of a more sophisticated crossover technique in order to avoid too much computational demand. ![Crossover Diagram] Figure 7: crossoverexample 4.2.3 Mutation and Inversion Mutation allows a small fraction of a chromosome to change spontaneously. These operations allow the genetic search to spontaneously direct the search to a region in the space of solutions that otherwise wouldn’t be reached. In the specific problem that is adressed within mapping of a task graph formation of clusters of “adjacent tasks” on the same processor is highy desirable. Mutation therefore is restricted to tasks/elements that reside on the boundaries of “clusters”. A task is said to be on a boundary when at least one of its nearest neighbour tasks is residing on another processor. Inversion within a chromosome is also allowed with some inversion probability. The chromosome is considered as a ring. A contiguous section of this ring gets inverted. In figure 8 this situation is depicted. 4.3 Hill Climbing A simple hill climbing technique to direct the blind GA search into the more profitable regions of the search space is added to genetic algorithm of MAP. In the hill climbing “boundary elements” are considered one at a time. A boundary element is transferred from the processor where it resides to a processor on which a neighbouring element resides if the fitness of the chromosome increases or stays the same. In this way locality within the task graph can be utilized to approach optimal solutions faster. 4.4 Simulation Generation From an individual that was generated by the genetic algorithm a simulation program for the Parasol II simulator can be generated. The results of such a simulation can again be fed back into the genetic algorithm as a “higher level” fitness function value. 5 Time Schedule The following time schedule for the progress of MAP in the CAMAS project is proposed: - Review 4: Deliverable: MAP Design Report (this report) - Review 4: Pseudo Code for MAP Genetic Algorithm Kernel (included in report) - Review 4: Interface for reading PAM grids and DDT output (logical connectivities) and transforming into format required by MAP. - Review 5: Deliverable: Report on Progress of MAP. - Review 5: Demonstration of Mapping example finite element grids to processor configuration (directly or partitioned by DDT). - Review 5: SAD level 3 simulation code generation from a proposed mapping - Review 6: Deliverable: final report on MAP - Review 6: Demonstration of MAP: - Mapping finite element grids (preprocessed or not) using genetic mapping module - choice of various fitness functions for mapping - generating from intermediate mapping solution a SAD level 3 simulation program - Simulation using PARASOL II (simulator) - Feedback of simulation result into mapping module - Evaluation example: direct mapping of a finite element grid versus mapping of same but now partitioned grid A Pseudo Genetic Algorithm for process-processor mapping Choose a Fitness Function Choose number of Chromosomes in a population Choose mating strategy ( one or two point crossover, mutation probability, ...) Read in Unit or Element information Read in processor topology information Create Initial Population While (No convergence) Reproduce : Calculate Total Fitness of Population For Number of Chromosomes Reproduce one of the Chromosomes using ranking EndFor Crossover: Generate (Number of Chromosomes/2) pairs randomly do crossover on every pair according to the chosen crossover strategy Mutation: For all Chromosomes in the population mutate a boundary - element in the chromosome with mutation probability Endfor Inversion apply inversion with small probability Apply hill-climbing for newly generated chromosomes If intermediate solution is requested Filter out momentarily “best” solution and feed it to the SAD program generator Endif If convergence criterium is satisfied set Convergence TRUE End While B On Input format Perl (Practical Extraction and Report Language) is very well suited for building reasonably fast an interface that can extract from for example a PAM-CRASH inputfile the logical connectivity and cast it into such a format that the MAP tool can handle it. The same goes for data that is generated by DDT. Therefore Perl is used for interfacing between real data files (such as for PAM-CRASH) and the MAP tool. C MAP Preliminary Version A preliminary version of MAP has been implemented. Results of a first test are presented here. The test took as input the logical connectivity of a mesh consisting of 640 quadrilateral finite elements. The mesh is the PAM-CRASH input mesh “box.inp” and has been provided by ESI. Furthermore a simple processor topology of 8 processors was taken as the processor graph. All processors have equal processor power. Figure 9 shows this processor mesh. Figure 9: a processor grid with 8 identical processors and 2 types of links, type a and type b It is assumed that the routing strategy is X-Y routing which has as a result the following processor connectivity matrix: \[ \begin{pmatrix} 0 & a & 2a & 3a & b & a+b & 2a+b & 3a+b \\ a & 0 & a & 2a & a+b & a & a+b & 2a+b \\ 2a & a & 0 & a & 2a+b & a+b & b & a+b \\ 3a & 2a & a & 0 & 3a+b & 2a+b & a+b & b \\ b & a+b & 2a+b & 3a+b & 0 & a & 2a & 3a \\ a+b & a & a+b & 2a+b & a & 0 & a & 2a \\ 2a+b & a+b & b & a+b & 2a & a & 0 & a \\ 3a+b & 2a+b & a+b & b & 3a & 2a & a & 0 \\ \end{pmatrix} \] The preliminary version of MAP consists of an interface that reads in the logical mesh connectivity, workload file per element type, a processor connectivity matrix and several operator rates for the genetic algorithm. The genetic algorithm that has been implemented is equivalent to the pseudo code given above, except that the “Hill-Climbing” is not included yet. Figure 10 shows an example of how the fitness function of this system evolves in the range of 1000 iterations, where the link speeds are taken \(a = 1\) and \(b = 2\). Such parameters will become available from within Parasol in the future. For now they are simply user defined. The population contains 100 chromosomes. The fitness function used is the reciprocal of the function: \[ C = \max_{\mathcal{Q}} \left( \sum_{u_i \in \mathcal{U}} W_{ii} + \max_{u_i \in \mathcal{U}, u_j \in A(u_i)} P_{pq} W_{ij} \right) \] that was introduced above. It is clear that the fitness evolves in the direction of higher fitness (due to the reproduction procedure). We are planning to optimize the algorithm where possible. The algorithm appears to work fine although for large problems it is likely to be very slow. At such a point it probably will not be feasible anymore to look at mapping of “individual” elements, but look at “units”. 12 Figure 10: Fitness Evolution - 1000 Iterations References
{"Source-Url": "https://pure.uva.nl/ws/files/1921247/25761_Sloot64mapdesign.pdf", "len_cl100k_base": 5928, "olmocr-version": "0.1.53", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 31928, "total-output-tokens": 6641, "length": "2e12", "weborganizer": {"__label__adult": 0.0003943443298339844, "__label__art_design": 0.0004978179931640625, "__label__crime_law": 0.0004646778106689453, "__label__education_jobs": 0.0008234977722167969, "__label__entertainment": 0.00010097026824951172, "__label__fashion_beauty": 0.00021970272064208984, "__label__finance_business": 0.00040841102600097656, "__label__food_dining": 0.0003936290740966797, "__label__games": 0.0006804466247558594, "__label__hardware": 0.0048980712890625, "__label__health": 0.0006999969482421875, "__label__history": 0.0005097389221191406, "__label__home_hobbies": 0.00014853477478027344, "__label__industrial": 0.0013637542724609375, "__label__literature": 0.00027441978454589844, "__label__politics": 0.0003726482391357422, "__label__religion": 0.0006856918334960938, "__label__science_tech": 0.337890625, "__label__social_life": 9.429454803466796e-05, "__label__software": 0.01140594482421875, "__label__software_dev": 0.63623046875, "__label__sports_fitness": 0.0004630088806152344, "__label__transportation": 0.0009794235229492188, "__label__travel": 0.00026345252990722656}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 25953, 0.04261]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 25953, 0.40913]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 25953, 0.89402]], "google_gemma-3-12b-it_contains_pii": [[0, 1165, false], [1165, 1501, null], [1501, 2091, null], [2091, 5752, null], [5752, 7418, null], [7418, 9145, null], [9145, 11003, null], [11003, 12860, null], [12860, 14574, null], [14574, 17949, null], [17949, 19887, null], [19887, 21303, null], [21303, 23363, null], [23363, 25258, null], [25258, 25953, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1165, true], [1165, 1501, null], [1501, 2091, null], [2091, 5752, null], [5752, 7418, null], [7418, 9145, null], [9145, 11003, null], [11003, 12860, null], [12860, 14574, null], [14574, 17949, null], [17949, 19887, null], [19887, 21303, null], [21303, 23363, null], [23363, 25258, null], [25258, 25953, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 25953, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 25953, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 25953, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 25953, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 25953, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 25953, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 25953, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 25953, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 25953, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 25953, null]], "pdf_page_numbers": [[0, 1165, 1], [1165, 1501, 2], [1501, 2091, 3], [2091, 5752, 4], [5752, 7418, 5], [7418, 9145, 6], [9145, 11003, 7], [11003, 12860, 8], [12860, 14574, 9], [14574, 17949, 10], [17949, 19887, 11], [19887, 21303, 12], [21303, 23363, 13], [23363, 25258, 14], [25258, 25953, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 25953, 0.09796]]}
olmocr_science_pdfs
2024-12-07
2024-12-07
cc020d35ba08f3acaa39cf6c2626b0414478784b
1 Introduction 1.1 Background In recent years, deep neural networks (DNNs) have achieved great improvements in the realm of artificial intelligence, demonstrating remarkable success in a wide range of difficult applications such as computer vision, speech recognition, natural language processing, etc. With their accuracy being closer or even better than a human’s, DNNs are deployed in a wide range of systems, from large data centers to mobile devices and robots. Many researchers nowadays, inspired by these impressive breakthroughs, view DNNs as solutions to their problems. Currently, many open-source frameworks have been released for DNN research, such as TensorFlow, Torch, Caffe, MxNet, CNTK, etc, each supported by an ambitious tech company or a strong academia leader. Among all these frameworks, TensorFlow, released by Google, is undoubtedly the most popular, as is shown in Figure 1. Most of these DNN frameworks have CPU/GPU backend support, but none of them support ASIC or FPGA. Due to their complex and deep topological structures, DNNs are known to be computationally-intensive and memory intensive. It is challenging to deploy DNNs in both large scale data centers and small mobile devices. Considering performance, flexibility, and energy efficiency, FPGA-based accelerator for DNNs is recognized as a promising solution. Unfortunately, programming FPGAs can be rather difficult, even with the support of High Level Synthesis (HLS) tools. Conventional FPGA design flow makes it difficult for DNN researchers to conveniently take advantage of FPGA computing power. They will have to be FPGA experts in order to implement an efficient DNN accelerator. 1.2 Scope of the project According to the analysis above, there is a strong demand for a easy-to-use framework that can automatically map CNN models onto FPGAs. To achieve this, we propose a CNN accelerator generation framework that takes high-level CNN model description as input, and execute the model inference on the FPGA-based accelerator generated by our framework. The focus of this project is to provide an easy-to-use framework, with reasonably good performance, for machine learning researchers, rather than to achieve the state-of-the-art performance for FPGA accelerators. We plan to make the following contributions: - We will build an end-to-end framework that automatically maps CNNs onto FPGAs for model inference. Our framework will support most sequential CNN models. This automated framework can significantly save FPGA design and implementation time. We will implement our own quantization tool to perform post-training quantization and to dump the quantized coefficients into C++ program. We will implement a model parser in python that analyzes a high-level CNN model and generates the execution schedule as well as the hardware configuration for each acceleration kernel. We will implement some OpenCL templates and use these templates to generate the kernel codes for each acceleration kernel. We will use SDAccel to compile our kernel codes into bitstream. We are well-aware that it is hard for pure HLS design to achieve the best performance. For large designs that use thousands of DSPs, HLS design typically require longer clock cycles than RTL design. One solution to this is to adopt an HLS-RTL hybrid approach, implementing the complex control logic with HLS while the computation engine in RTL. However, due to limited time for this project, we will use pure HLS implementations only, as interfacing the HLS kernel and RTL kernel require a lot of engineering effort. 2 Techniques - Automated Mapping Flow of CNN onto FPGA 2.1 Input - Tensorflow Tensorflow is an open-source library for dataflow programming. It is widely used for machine learning applications such as training and inferring neural networks. Neural networks are modeled by tensors and the operations performed on them. Because of its high popularity, we choose Tensorflow as the frontend of our framework. The input of our project is a Tensorflow program which specifies the neural network our accelerator targets. The user can specify any sequential neural networks (i.e. networks with a linear stack of layers) with the following layers: - Convolution layer: conv2d - Fully-connected layer: fc - Reshape layer: reshape - Activation layer: relu - Pooling layer: max_pooling2d A few limits exist regarding which kinds of combinations of the above layers can be accepted by our framework: 1. The first layer of the network must be a reshape layer which specifies the shape of the input feature maps (in the form of a Tensorflow \texttt{shape} object). 2. The activation layer is optional and, when in its presence, must follow either a convolution layer or a fully-connected layer. 3. The pooling layer is optional and, when in its presence, must follow either an activation layer, or a convolution/fully-connected layer. 4. Except for the first layer in the network, the reshape layer is optional and, when in its presence, must precede a convolution/fully-connected layer. 2.2 Output - OpenCL OpenCL is a framework for writing programs that can execute across heterogeneous platforms, including CPU, GPU, FPGAs, and other hardware accelerators. Xilinx SDAccel tool can generate the RTL design from OpenCL programs through HLS. We choose OpenCL as the backend of our framework because it allows easy generation of parametrizable OpenCL programs and converts the program into RTL design. The output of our framework is an OpenCL project that can be converted into RTL design using SDAccel 2017.2. The generated accelerator consists of the following kernels: - \texttt{load\_fmap}: refills the on-chip tile buffer from DRAM and feeds the data from tile buffer to \texttt{compute} kernel. - \texttt{load\_wts}: refills the on-chip weight buffer from DRAM and feeds the data from weight buffer to \texttt{compute} kernel. - \texttt{compute}: refills the on-chip weight buffer and computes the convolution results on the weights and input feature maps. - \texttt{acc\_relu}: performs the (optional) activation layer computation. - \texttt{pooling\_wb}: performs the (optional) pooling computation and writes back the output data to DRAM. Our framework also generates the host driver that calls a set of APIs to conveniently perform initialization, inference, and finalization on the accelerator. The APIs include: - \texttt{CnnAccelerator::initialize()} Initialize the accelerator with information from the command lines. - \texttt{CnnAccelerator::load\_wts()} Load the weights of a specific layer into the accelerator. - \texttt{CnnAccelerator::create\_buffer()} Create one buffer suitable for the input/output of the accelerator. - \texttt{CnnAccelerator::load\_wts()} Loads the weights of a specific layer into the accelerator. - \texttt{CnnAccelerator::run\_inference()} Perform the actual inference based on the input/output buffers and the loaded weights. The inference results are stored in the buffer that was provided to the accelerator. After \texttt{run\_inference()} the user can use the inference results however they like. 2.3 Our Framework Our proposed accelerator generation framework consists of four major components: the Tensorflow supporting framework, the model parser, the software flow, and the hardware flow. The user uses Tensorflow to describe the target CNN model, which will be quantized by the quantization tool\footnote{We thank Ritchie and Zhiru for letting us access their NN quantization library!}. The model parser takes the quantized CNN model and generates all kernel configurations and scheduling information. The software flow will take the scheduling information and generate the C++ driver program for the accelerator. On the hardware side, the hardware flow takes the kernel configuration and generates the OpenCL kernel codes by filling the kernel templates. The user can compile the driver program and the kernel codes into the host executable and bitstream, which are ready to be executed on the host CPU and the target FPGA device. 3 Implementation 3.1 Software Implementation 3.1.1 Model parser The model parser analyzes the quantized model from the quantization tool and generates kernel scheduling and configuration information for the software and hardware flow. The configuration for each layer of the CNN (such as the size of the feature maps, the input channel, the filter size, the number of filters, the stride and padding style, etc) will be extracted from the quantized model and delivered to the software flow for scheduling different types of kernels (corresponding to different types of layers). The same information is also delivered to the hardware flow to correctly configure the kernels so that their functionality matches the model specification. Finally, the model parser also passes the quantized weights to the software flow to correctly initialize the weight area of the DRAM. The model parser generates the configuration for each kernel from the specification of each layer. The concrete parameters such as the size of input feature maps, the size and number of filters, etc are determined from the model specification directly. For flexible parameters such as the tiling factors of input feature maps and how many weights should be stored on-chip, we reduce these factors into their influence on the operation intensity (defined as the number of operations performed inside the systolic array per byte loaded from the DRAM) of our accelerator. With some knowledge of the DRAM bandwidth and the amount of computation resources, we then quantitatively analyzes whether the operation intensity corresponds to a computation-bound or memory bandwidth-bound scenario using a roof line model. The desired flexible parameters are found through a exhaustive search in the design space and making ensure each computation kernel is computation-bound so that all computation resources are kept busy. Figure 4 shows the roofline model for a conv2d layer with a stride of 1 and 32 3-by-3 filters. Let’s assume that we have 256 DSPs in our design and that the DRAM bandwidth is 64 bytes per cycle. Under these assumptions, the minimum operational intensity required to reach the rooftop is only 8 operations per byte. If we unrealistically assume that all feature map data and weights data are stored in on-chip BRAMs (which means data reusage is maximized) the resulting operational intensity is 144 operations per byte, which is far more than we need. Therefore, we can reduce our on-chip storage, which will decrease the operational intensity. As long as the operational intensity is still higher than 8, i.e., we are still standing at the rooftop, the throughput is maximized since this layer can be considered as compute-bound. This is basically how we determine the tiling factor. Figure 4: Roofline model for a convolution layer with \textit{stride} = 1, 32 3 \times 3 filters, assuming we are using 256 DSPs, and that the DRAM bandwidth is 512 bits per cycle. Standing at the rooftop essentially means that all of the computation resources are always busy computing, i.e., our input kernel is always feeding data to our compute kernel, as is shown in Figure 5. The input kernel first fetches a tile of input feature map and some filters from DRAM, then starts feeding computation kernel... while fetching the next tile of feature map and next batch of filters. If reading next batch of data is finished before the computation for this batch of data is done, then our computation kernel will always have data to compute, meaning that we are at a efficient design point. ![Diagram](image) Figure 5: What happens at a lower level if we are standing at the rooftop. ### 3.1.2 Software flow The software flow is responsible for creating the correct driver program of our accelerator. The driver is provided to users as an API which takes a pointer to a vector of images and the size and number of the images, and returns inference results as a pointer to a vector. The software flow needs to take care of several tasks. First, the driver needs to copy the input feature maps into the DRAM local to the FPGA. It then sets the correct arguments for each kernel by consulting the kernel scheduling information (which kernel should be executed and in which order). After that, it generates the correct sequence of OpenCL commands and pushes that into the device command queue. In addition, the software flow is also responsible for setting up the quantized weights in the DRAM that is connected to the FPGA. Finally, after the successful execution of the command sequence, it copies the results back into the host memory. ### 3.1.3 Hardware flow The hardware flow is responsible for generating the HLS codes for acceleration kernels with pre-written OpenCL templates. The way it is done is very straightforward. It takes in the kernel configurations computed by the model parser and generate a header file that defines data types and constants that are referenced in the OpenCL templates. The kernel codes are then fed into the kernel compiler in SDAccel to generate the bitstream. Our OpenCL templates include input kernels that load input feature maps and weights data from DDR DRAM, a computation kernel that contains a systolic array and accelerates convolution, and other kernels that perform pooling and write back. We carefully implemented all the kernels so that they are highly-parametrized. We only need to change a few constants for different configurations. ### 3.2 Hardware implementation As is mentioned above, our hardware is generated with some pre-written templates. The general architecture of our hardware implementation is shown in Figure 6. Each kernel communicates with CPU via a AXIS4-Lite bus. The CPU will send the arguments for a certain layer, such as the size of the feature map, convolution stride, pooling stride, etc., to the acceleration kernels. And our acceleration kernels are connected using a OpenCL data structure called **pipe**, which is essentially a FIFO. The input kernel reads data from the DDR DRAM and the pooling kernel is in charge of writing data back to DRAM. According to Xilinx’s SDAccel optimization guide, a burst DDR transaction can be at most 4KB. Therefore, we allocate a 4KB buffer at the pooling kernel to buffer the output result. The pooling kernel will only perform write back when the output buffer is full or when there is no data left. In this way we make sure that writing to DDR does not become our performance bottleneck. 3.2.1 Input Kernel The input kernel is responsible for loading data from DRAM and storing them into the tile buffer BRAM. It also loads weights data from DRAM and sends it to the weights buffer in the compute kernel. It then feeds the feature map data to the inter-kernel FIFOs so that the computation kernel can compute the data correctly. The input kernel iteratively generates the DRAM address of each tile and reads it into the on-chip tile buffer. It then determines the tile buffer address of each piece of data to send by iterating over each pooling window and filter element. The input kernel also deals with the case where the filters are not completely stored on-chip so multiple iterations are needed to finish the computation. 3.2.2 Computation Kernel The key component in our computation kernel is a dot product unit as shown in Figure 7. We first pack some pixels in a filter and their corresponding pixels in the feature map into vectors and feed them into the dot product unit. The dot-product is deeply pipelined and can take in two vectors each cycle and produce one product each cycle once the pipeline is fully loaded. An array of such dot product units forms a systolic array, as is illustrated in Figure 8, and that stores a subset of filters on-chip. In each cycle, the systolic array consumes one feature map vector from the input kernel, and Each row of the systolic array compute the dot product of a feature map vector and \( N \) weights vector, one from each filter buffer, and produces \( N \) partial sums for the output pixel. The partial sums will be written to the output pipe and other kernels will accumulate the partial sum, performs pooling, and write back the results to DDR DRAM. 3.3 Communication Optimization Since our accelerators need to frequently communicate with off-chip DDR DRAM for inputs and outputs, the achieved effective DRAM bandwidth is also an important factor to be considered. Many studies have shown that increasing the DRAM burst width can raise up the effective DRAM bandwidth. To achieve this, we need to avoid discontinuous access to DRAM as much as possible. We therefore adopt a channel-major representation for each input feature map to achieve efficient data communication. Specifically, the feature map is first divided into several "blocks", which have the same number of channels (i.e. the tile depth) as the number of on-chip filters and the same width and height as the input feature maps. Each block is subsequently tiled with the width and height tiling factors. We store each block by the order of channel-column-row, in this way we guarantee continuous access to DRAM when fetching an input tile. Figure 9 demonstrates a comparison between the traditional row-major storage and our channel-major storage. As can be seen, even for a feature map with only 3 channels, channel-major storage results in a more continuous DRAM access. As the number of channels become larger, this effect will become even more obvious. Figure 9: Comparison between row-major DRAM access and channel-major DRAM access. 4 Evaluation We plan to evaluate our generation framework by implementing various pre-trained DNNs with it. To evaluate the productivity benefit of our framework, we will verify the RTL generated by the framework and compare the efforts to implement the target DNN with and without the DNN generator. We also qualitatively evaluate the performance of the generated accelerator. We evaluate our framework using MNIST dataset and a simple 2-conv 2-dense neural network. Figure 10 shows the configuration of the network in our evaluation. ![Figure 10: Configurations of our MNIST CNN.](image) 4.1 Accuracy Accuracy-wise, the baseline of our evaluation is the Tensorflow implementation and the alternative implementation is the accelerator generated by our framework. We train the baseline CNN using Tensorflow with 1000 train steps (each train step has a batch of 50 images). The final validation accuracy of the baseline is 96.92%. We then run inference on the generated accelerator in software emulation mode with 50 images from the first train batch. The generated accelerator achieves 94% accuracy on these 50 images, which is acceptable considering we are doing plain post-training quantization. We also noted that the error of the accelerator output relative to the Tensorflow output is generally small (error value ranges from 2.0 to 50.0 using 16-bit fixed-point representation). This demonstrates that the impact of post-training quantization on accuracy is small and can be used in the accelerator to improve the energy/area efficiency. 4.2 Productivity We demonstrate the productivity difference of developing a CNN accelerator with and without our framework. The baseline model is the development of a CNN accelerator corresponding to the model shown in Figure 10. We expect a small group of students (2 to 3) to be able to design, implement, verify the MNIST CNN accelerator with SDAccel in 3 to 5 days with close collaboration and intense development. Using our framework, however, requires only a running Tensorflow model which is usually less than 500 lines of Python code (including the model, training, validation, and other auxiliary functionality) and a few minutes to generates and compile the OpenCL program. The generated accelerator can be easily pushed through the FPGA flow with SDAccel. 5 Future Steps There are a number of things that we can think of to further improve our framework: - Run some experiments on real hardware and collect some feedback so that we know how to further optimize our hardware templates. - Experiment with more neural network configurations to verify the correctness of our generation framework. - Explore more advanced techniques to further improve the accelerator performance (e.g. can we pipeline the execution of different convolution layers? How to achieve higher performance when resources are abundant?). - Reduce HLS overhead on performance by replacing our current HLS compute kernel with an RTL kernel. 6 Project Management Since we are just a small team with only two students, we basically developed and debugged everything together. Peitian mainly contributes to the development of the load fmap kernel which has the most complex control logic, while Yanghui developed the rest of the kernels. The model parser is largely done by Peitian, which is a lot of work, while Yanghui also contributes to the part that quantizes the weights and output the weights into a c++ readable format. Yanghui also developed a reference model in c++ for testing the correctness of our kernels and he also verified the results produced by our accelerator against the intermediate results dumped out directly from TensorFlow. Our development for this project official starts on around November 15, when SDAccel is finally available on ece-linux server. Before then we just wrote some CNN models for MNIST dataset using TensorFlow. Our OpenCL kernels are finished during the thanksgiving holidays and the model parser are finished at the end of November. Overall, we deem our project as a success, considering the limited manpower of the team and tight schedule for both group members in November. This framework is literally built from scratch. The only thing that is not developed during this project is our makefile, which is taken from one of Yanghui’s previous project. 7 Conclusion We design and implement a truly end-to-end CNN accelerator generation framework. The framework uses Tensorflow as its frontend to specify the network configuration and outputs the generated accelerator in the form of OpenCL kernels. Our framework extracts the neural network configuration from a Tensorflow program and automatically chooses the optimal parameters for the accelerator hardware given the available resources of the FPGA board. The parameters will be filled into existing accelerator kernel templates to create an OpenCL project ready to be compiled by SDAccel. The generated project also includes a set of user-friendly APIs to initialize, run, and finalize the accelerator. We evaluate the accuracy and productivity of the generated accelerator. The generated accelerator achieves an acceptable accuracy of 94% on one training batch. Productivity-wise, our framework only requires a few hundreds of Python code to specify the model and less than ten minutes to generate and compile the OpenCL project. Our end-to-end framework significantly boosts the productivity of CNN accelerator development and has acceptable accuracy degradation (due to post-training quantization and overflow issues when executing fully-connected layer).
{"Source-Url": "https://www.csl.cornell.edu/courses/ece5775/pdf/proj/sample-report05.pdf", "len_cl100k_base": 4667, "olmocr-version": "0.1.48", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 19476, "total-output-tokens": 5112, "length": "2e12", "weborganizer": {"__label__adult": 0.0007452964782714844, "__label__art_design": 0.0008087158203125, "__label__crime_law": 0.0005435943603515625, "__label__education_jobs": 0.0007338523864746094, "__label__entertainment": 0.00015342235565185547, "__label__fashion_beauty": 0.0003902912139892578, "__label__finance_business": 0.0003750324249267578, "__label__food_dining": 0.0005917549133300781, "__label__games": 0.0010118484497070312, "__label__hardware": 0.0217742919921875, "__label__health": 0.001129150390625, "__label__history": 0.0004832744598388672, "__label__home_hobbies": 0.0002310276031494141, "__label__industrial": 0.0016956329345703125, "__label__literature": 0.00024211406707763672, "__label__politics": 0.00046706199645996094, "__label__religion": 0.00107574462890625, "__label__science_tech": 0.2471923828125, "__label__social_life": 0.00010818243026733398, "__label__software": 0.008270263671875, "__label__software_dev": 0.7099609375, "__label__sports_fitness": 0.0005726814270019531, "__label__transportation": 0.0011692047119140625, "__label__travel": 0.00033164024353027344}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 23224, 0.02851]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 23224, 0.43586]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 23224, 0.91048]], "google_gemma-3-12b-it_contains_pii": [[0, 2551, false], [2551, 4363, null], [4363, 7126, null], [7126, 8939, null], [8939, 11350, null], [11350, 14549, null], [14549, 16273, null], [16273, 17630, null], [17630, 19948, null], [19948, 23224, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2551, true], [2551, 4363, null], [4363, 7126, null], [7126, 8939, null], [8939, 11350, null], [11350, 14549, null], [14549, 16273, null], [16273, 17630, null], [17630, 19948, null], [19948, 23224, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 23224, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 23224, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 23224, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 23224, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 23224, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 23224, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 23224, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 23224, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 23224, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 23224, null]], "pdf_page_numbers": [[0, 2551, 1], [2551, 4363, 2], [4363, 7126, 3], [7126, 8939, 4], [8939, 11350, 5], [11350, 14549, 6], [14549, 16273, 7], [16273, 17630, 8], [17630, 19948, 9], [19948, 23224, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 23224, 0.0]]}
olmocr_science_pdfs
2024-11-24
2024-11-24
65d26bea28c128478d4a75bd641a65f51ee7da00
The following full text is a preprint version which may differ from the publisher's version. For additional information about this publication click this link. http://hdl.handle.net/2066/117003 Please be advised that this information was generated on 2017-11-26 and may be subject to change. Abstract—Learning techniques allow the automatic inference of the behaviour of a system as a finite state machine. We demonstrate that learning techniques can be used to extract such formal models from software on banking smartcards which – as most bank cards do – implement variants of the EMV protocol suite. Such automated reverse-engineering, which only observes the smartcard as a black box, takes little effort and is fast. The finite state machine models obtained provide a useful insight into decisions (or indeed mistakes) made in the design and implementation, and would be useful as part of security evaluations – not just for bank cards but for smartcard applications in general – as they can show unexpected additional functionality that is easily missed in conformance tests. I. INTRODUCTION Software for banking or credit cards will be developed using a very strict and regimented software engineering process. After all, this software is highly security-critical and patching is usually not an option. The software will be subjected to rigorous compliance tests and security certifications, possibly even costly Common Criteria certifications. Establishing security here is often more difficult than just establishing correctness, or compliance with a standard. In checking compliance (e.g. for interoperability) the emphasis tends to be on the presence of required functionality: if some functionality is missing, the implementation is incorrect and it will not work correctly in all circumstances. Security on the other hand is also concerned with the absence of unwanted functionality; if an implementation provides more functionality than what is required, then it may be considered compliant – after all, it does what it is supposed to do – but it might be insecure, as it does more than what it is supposed to do, and this additional functionality may be a source of insecurity. This makes it hard to test for security bugs, and to discover them in the field: unlike functional bugs, security bugs may never show up under normal circumstances. Testing of security applications using model-based testing techniques seems an interesting approach to test for security vulnerabilities [1]. As a generalisation of fuzzing, it does however require formal models that specify the intended behaviour of the system, and in practice these are often not available, because creating them is time-consuming, and possibly complex and error-prone. Constructing these models automatically would therefore be extremely useful. A potential approach is to use program analysis to construct models from source code. Of course, in many cases, access to source code is restricted. The method discussed in this paper constructs models just by observing the smartcard’s external behaviour. A widely used technique for creating a model from observations is regular inference, also known as automata learning [2]. The regular inference algorithm [3], [4] provides sequences of inputs to a System Under Test (SUT) and observes the responses to infer a Mealy machine, a special form of finite state machine, as explained in Section III. In addition to standard learning methods, abstraction techniques for data parameters [5], [6] can be used to learn a more detailed model of the system. We show that these techniques can provide useful formal models of bank cards quickly without much effort, which can be a useful addition to testing or security evaluations of these products. The technique is not just applicable to bank cards, but can be applied to any smartcard. II. BACKGROUND: SMARTCARDS AND EMV A. Smartcards All smartcards follow the ISO/IEC 7816 standard [7]. Here communication is in master-slave mode: the terminal sends a command to the card, and the card returns a response, after which the terminal can send another command, etc. Commands and responses are simply sequences of bytes with a fixed format and meaning, called APDUs (Application Protocol Data Units). The second byte in a command APDU is the instruction byte, and specifies the instruction that the smartcard is requested to perform. The last two bytes of a response APDU are the status word, which indicates if execution of the command went OK or if some error occurred. The ISO/IEC 7816 standard defines some standard instruction bytes and error codes. Standard instructions we used to infer the behaviour of bank cards include: - the SELECT instruction to select which of the possibly several applications on the smartcard the terminal wants to interact with; - the VERIFY instruction to provide a PIN code to the card for authentication of the cardholder; - the READ RECORD instruction to read some data from the simple file system that the card provides; - the GET DATA instruction to retrieve a specific data element from the card (for example the PIN try counter, which records how often the PIN can still be guessed); • the `INTERNAL AUTHENTICATE` instruction to authenticate the card; the terminal supplies a random number as argument to this command which the smartcard then encrypts or signs to prove knowledge of a secret key. For the purposes of this paper the difference between the ‘files’ retrieved using `READ RECORD` and the ‘data elements’ retrieved using `GET DATA` is not important. **B. EMV** Most smartcards issued by banks or credit cards companies adhere to the EMV (Europay-MasterCard-Visa) standard [8]. This standard is defined on top of ISO/IEC 7816. It uses some of standard instruction bytes (incl. those listed above), but also defines additional ones specific to EMV, including: - the `GENERATE AC` instruction to let the card generate a so-called Application Cryptogram (AC); - the `GET PROCESSING OPTIONS` instruction to initialise the transaction, provide the necessary information to the card and retrieve the capabilities of the card. A normal EMV session consists of the following steps: 1) *selection of the desired application on the smartcard using SELECT.* There may be several applications on a smartcard. Some bankcards will provide multiple EMV-applications for different uses, e.g. one to be used by ATMs and one to be used by a hand-held reader for internet banking. 2) *initialisation of the transaction using GET PROCESSING OPTIONS.* The terminal provides the card with data, specified in the response to the selection of the application. The card initialises the transaction and sends a response containing its capabilities. 3) optionally: *cardholder verification and/or card authentication.* Card authentication can, for example, be done using a challenge-response mechanism (called DDA in the EMV standard) by invoking the `INTERNAL AUTHENTICATE` instruction. Cardholder verification can be done offline by checking the PIN code using the `VERIFY` instruction; here the PIN can be sent to the smartcard either in plaintext or encrypted. Checking the PIN can also be done online, in which case the PIN is sent to the bank back-end to check it. 4) *the transaction.* For the actual transaction one or two cryptograms are requested using the `GENERATE AC` instruction, as discussed in more detail below. 5) *scripting.* After completing a transaction, the terminal may send additional Issuer-to-Card scripting commands, that allow the issuer to update cards in the field. The cryptograms generated for a transaction can have one of the following three types: - an Authorisation Request Cryptogram (ARQC), which is a request to perform a transaction online; - a Transaction Certificate (TC), which indicates acceptance of a transaction; - an Application Authentication Cryptogram (AAC), which indicates rejection of a transaction. All these cryptograms contain a MAC (Message Authentication Code), a hash over some data encrypted with a secret key. An EMV transaction involves at most two of these cryptograms. The types of these cryptograms depend on the transaction. EMV transactions can be offline or online. For an offline transaction, the terminal sends data about the transaction to the card, and the card returns a TC to approve the transaction. For an online transaction, the card first provides an ARQC that is sent back to the issuing bank. The bank’s response is sent to the card, which will then return a TC if the response is correct. Every transaction by the card is identified by a unique value of the Application Transaction Counter (ATC), that the card keeps track of. The terminal requests these cryptograms using the `GENERATE AC` command. The terminal will indicate which type of cryptogram it wants, but the card may return a different type than requested. For example, when the terminal requests a TC, the card may return an ARQC (namely in case the card wants the terminal to go online to get approval for the transaction from the bank) or it may decline the transaction by responding with an AAC. The EMV protocol as described above is also used for internet banking in the EMV-CAP protocol. Here bank customers use a handheld smartcard reader with a small display in which they insert their bank card. EMV-CAP is a proprietary standard of MasterCard. Unlike the EMV specs, the EMV-CAP specs are not public, but they have been largely reverse-engineered [9], [10]. In EMV-CAP the card is requested for an ARQC to authorise an transaction (e.g. an internet bank transfer). This is then followed by a request for an AAC, thus completing (or, more precisely, aborting) a regular EMV transaction so that the card is left in a ‘clean’ state. ### III. BACKGROUND: INFERENCE OF MEALY MACHINES #### A. Mealy Machines We use *Mealy machines* to model the behaviour of smartcards. A Mealy machine is a finite state machine where every transition involves an input and a resulting output. Formally, a *Mealy machine* is a tuple $\mathcal{M} = \langle I, O, Q, q^0, \delta, \lambda \rangle$, where $I$, $O$ and $Q$ are nonempty sets of input symbols, output symbols, and states, respectively; $q^0 \in Q$ is the initial state; $\delta : Q \times I \rightarrow Q$ is the *transition function*; and $\lambda : Q \times I \rightarrow O$ is the *output function*. Elements of $I^*$ and $O^*$ are input and output strings respectively. An intuitive interpretation of a Mealy machine is as follows. At any point in time, the machine is in some state $q \in Q$. It is possible to give inputs to the machine by supplying an input symbol $i \in I$. The machine then responds by producing an output symbol $\lambda(q, i)$ and transforming itself to the new state $\delta(q, i)$. Let a transition $q \xrightarrow{s/o} q'$ in $\mathcal{M}$ denote that $\delta(q, i) = q'$ and $\lambda(q, i) = o$. We extend the transition and output functions from input symbols to input strings in the standard way, by defining: \[ \begin{align*} \delta(q, \varepsilon) &= q \\ \delta(q, ui) &= \delta(\delta(q, u), i) \\ \lambda(q, \varepsilon) &= \varepsilon \\ \lambda(q, ui) &= \lambda(q, u)\lambda(\delta(q, u), i) \end{align*} \] The Mealy machines that we consider are complete and deterministic, meaning that for each state \( q \) and input \( i \) exactly one next state \( \delta(q, i) \) and output symbol \( \lambda(q, i) \) is possible. Given a Mealy machine \( M \) with input alphabet \( I \), output function \( \lambda \), and initial state \( q_0 \), we define \( \lambda_M(u) = \lambda(q_0, u) \), for \( u \in I^* \). Two Mealy machines \( M \) and \( M' \) with input alphabets \( I \) are equivalent if \( \lambda_M(u) = \lambda_{M'}(u) \) for all input strings \( u \in I^* \). ### B. Inference of Mealy Machines Angluin’s well-known L* algorithm [2] is an active learning algorithm to infer deterministic finite automata. Inspired by work of Angluin, Niese [3] developed an adaptation of the L* algorithm for active learning of deterministic Mealy machines. The algorithm assumes there is a Teacher, who knows a deterministic Mealy machine \( M = \langle I, O, Q, q_0, \delta, \lambda \rangle \), and a Learner, who initially has no knowledge about \( M \), except for its sets \( I \) and \( O \) of input and output symbols. Whenever the Teacher accepts an input symbol on \( M \), it maintains the current state of \( M \), which at the beginning equals the initial state \( q_0 \). The Learner can ask three types of queries to the Teacher, see Fig. 1[1]: - **An output query** \( i \in I \). Upon receiving output query \( i \), the Teacher picks a transition \( q \xrightarrow{i/o} q' \), where \( q \) is the current state, returns output \( o \in O \) as answer to the Learner, and updates its current state to \( q' \). - **A reset query**. Upon receiving a reset query the Teacher resets its current state to \( q_0 \). - **An equivalence query** \( \mathcal{H} \), where \( \mathcal{H} \) is a hypothesized Mealy machine. The Teacher will answer yes if \( \mathcal{H} \) is correct, that is, whether \( \mathcal{H} \) is equivalent to \( M \), or else supply a counterexample, which is a string \( u \in I^* \) such that \( u \) produces a different output string for both automata, i.e., \( \lambda_M(u) \neq \lambda_{\mathcal{H}}(u) \). The equivalence query cannot be really supported if the actual machine \( M \) can only be observed as a black box, as is the case in our work, as we analyse smartcards without access to the program code. In such cases, the equivalence query can only be approximated, namely by testing to see if a difference between the actual machine \( M \) and the hypothesis \( \mathcal{H} \) can be detected. (Note that this is a form of model-based testing.) As explained below, there are different strategies to test this. The typical behaviour of a Learner is to start by asking sequences of output queries (alternated with resets) until a “stable” hypothesis \( \mathcal{H} \) can be built from the answers. After that an equivalence query is made to find out whether \( \mathcal{H} \) is correct. If the answer is yes then the Learner has succeeded. Otherwise the returned counterexample is used to perform subsequent output queries until converging to a new hypothesized automaton, which is supplied in an equivalence query, etc. ![Learning framework](image1) **Fig. 1.** Learning framework ![Set-up](image2) **Fig. 2.** Set-up ### IV. Setup and Procedure We used authentic bank cards as SUT/Teacher. Access to the smartcards was realised via a standard smartcard reader and a testing harness discussed in Section IV-A. We connected the SUT to the LearnLib library [4], which served as Learner, see Fig. 2[3]. The LearnLib tool provides a Java implementation of the adapted L* algorithm. Because LearnLib views the SUT as a black box, equivalence queries can only be approximated. The tool provides several different realisations of equivalence queries. In our experiments we used a random test suite with 1000 test traces of length 10 to 50 as equivalence oracle. We verified our results with the W-Method by Chow [11] by checking if it will find at least one more state than the random test suite. For our tests we used a collection of MasterCard and Visa branded debit and credit cards from the Netherlands, Germany, Sweden and the UK. All the MasterCard credit cards contain a MasterCard application, whereas on the bank cards there is a Maestro application. Both these applications are used for payments in shops and to withdraw cash from ATMs. The Dutch bank cards also contain a SecureCode Aut application, which is used for online banking with a handheld EMV-CAP reader provided by the bank. The Visa branded debit card contains the Visa Debit application. #### A. Test harness As illustrated in Fig. 2[3] our test harness[4] translates the abstract command (from the input alphabet of our Mealy machine model) to a concrete command APDU, and translates a response APDU to a more abstract response (in the output alphabet of the Mealy machine model). It supports the commands listed in Section II-B. The test harness is just over 300 lines of Java code. Most of this code is generic code to set-up a connection to the smartcard reader. A regular smartcard reader was used, and communication was performed using the standard Java Smart Card I/O library. The code specific to EMV is just over 100 lines of code, and consists of 15 methods that define some command APDU to be sent to the card. The input alphabet corresponds to these 15 methods. For many parameters of these commands the test harness uses some fixed value, for instance for the random number sent as argument of INTERNAL AUTHENTICATE, the payload data for the cryptograms generated by the card, and the (correct) guess for the PIN code. One would not expect a different random number to affect the control flow of the application in any meaningful way, so by fixing values here we are unlikely to miss interesting behaviour. Note that we have two different payloads when requesting the cryptograms due to the difference between the first and second request for a cryptogram. As these payloads are different, both a correct and an incorrect payload is used when requesting cryptograms. Obviously, entering an incorrect PIN code would affect the control flow, but learning about the behaviour in response to incorrect PIN guesses is very destructive as it will quickly block the card. For several commands different variants are provided by the test harness: - For the commands GET DATA, READ RECORD and GET PROCESSING OPTIONS, both a variant with correct arguments and one with incorrect arguments is provided. E.g., for GET DATA we have variants requesting a data element that is present or one that is not. - For the GENERATE AC command 6 variants are provided, as there are 3 cryptogram types, each of which can be used with one of 2 sequences of arguments (one for the first and one for the second cryptogram). The test harness does not output the entire response of the smartcard to the learner. It only returns the 2 byte status word, but not any additional data returned by the card. For most commands, like GET PROCESSING OPTIONS, this additional data returned will always be the same, so there is not much interest in learning it. The only exception to this is the GENERATE AC command: here the test harness does return the type of cryptogram that was returned by the card (but not the cryptogram itself; as this is computed using a cryptographic function on the input and the card’s ATC, the response will never be the same and there is nothing we could hope to learn from it). A limitation of our test harness is that we do not know the bank’s secret cryptographic keys that are needed to complete one ‘correct’ path of the protocol, namely the path where the card produces an ARQC as first cryptogram and a TC as second. For this a correct reply to the first ARQC is needed, which requires knowledge of the cryptographic keys used by the bank’s back end. To be able to include the VERIFY command in the learning, the PIN code of the corresponding card has to be known. We did not try to learn the behaviour of the card in response to incorrect PIN codes, to avoid blocking the card. The cards we used are real bank cards for which we cannot reset the PIN. (With access to functionality to reset the PIN, which the issuing bank might have, one could also try to learn the behaviour in response to incorrect PINs.) The German card only supported encrypted PIN verification. Since the public key of MasterCard is needed for this, we were unfortunately not able to use VERIFY with this card. The Visa branded card can perform the GET DATA command to retrieve the current value of the ATC. This functionality is used for a so-called mapper component [5], [6] to be able to learn the transitions where a counter is increased. The mapper is integrated in the test harness of the SUT, and keeps track of the value of the counter. The GET DATA command only returns the current value of the ATC if the Visa Debit application is selected. Since the mapper depends on the value of the ATC, the Visa Debit application is automatically selected by the test harness before an output query is performed by LearnLib. The mapper retrieves the value of the ATC after each output query and adds the difference with the stored value of the ATC to the response, e.g. ‘+1’ on an edge indicates the ATC was increased by one in this transition. ### B. Trimming the inferred state diagrams The state diagrams returned by LearnLib as .dot file look quite unintelligible at first sight, because there are so many transitions: for each state, one for every possible command. However, many transitions from a given state are errors and simply return to the same or an error state (e.g. the ‘Selected’ or ‘Finished’ state). By simply collapsing all these transitions into one transition marked ‘Other’, and drawing multiple transitions between the same states with different labels as one transition with a set of labels, we obtain simple automata such as figures 3, 4, and 5. In these figures the responses are omitted for readability. We simply obtained these by manually editing the .dot files. This could easily be automated. At the same time we chose meaningful names for the different states. The transition labels for GENERATE AC commands indicate (i) if it is the 1st or 2nd request for a cryptogram in this session (i.e. whether the argument is for the first or second request), (ii) the type of cryptogram that was requested (ARQC, AAC, or TC), and (iii) the type of cryptogram that was returned. E.g. GENERATE AC 1st ARQC ARQC means the type requested was ARQC, the arguments supplied for the first request, and the type returned was an ARQC. We have combined arrows if different parameters yield the same response; e.g. GENERATE AC 2nd TC/AAC AAC means that requests for a TC or AAC, with the arguments for the second request, both result in an AAC. V. Results We learned models of EMV applications on bank cards issued by several Dutch banks (ABN-AMRO, ING, Rabobank) and one German bank (Volksbank), and on MasterCard credit cards issued by Dutch and Swedish banks (SEB, ABN-AMRO, ING) and of one UK Visa debit card (Barclays). The Dutch bank cards contain two EMV applications, one for internet banking (SecureCode Aut) and one for ATMs and Point-of-Sales (Maestro). All cards resulted in different models, with as only exception that the Maestro applications on all Dutch bank cards were identical, as were the SecureCode Aut applications. An educated guess would be that these implementations come from the same vendor. To learn the models LearnLib performed between 855 and 1695 membership queries for each card and produced models with 4 to 8 states. The total learning time depended on the algorithm and corresponding parameters used for equivalence approximation. The time needed to construct the final hypothesis was less than 20 minutes for every card. When analysing the state diagrams for the different categories, we made the following observations. The state diagrams for the ABN-AMRO and ING credit cards are very similar. There are only a few subtle differences, e.g. in the initial state different error codes are returned in response to some instructions. Also the handling of the INTERNAL AUTHENTICATE instruction differs: both cards respond with the error 6D00 (‘Instruction code not supported or invalid’), indicating that the instruction is not supported, but for the ING card this does not have any influence on the state, whereas the ABN-AMRO card is ‘reset’ to the ‘Selected’ state. Comparing the Maestro (Fig. 3) and the SecureCode Aut application (Fig. 4) on the Dutch bank cards, we can observe the following: 1) In both applications, if data that is not available is requested, either using the READ RECORD or the GET DATA instruction, the application returns to the ‘Selected’ state. This seems a bit strict, as the terminal has no way of knowing whether certain data that can be retrieved using GET DATA is available. Apparently, here the developers have chosen a ‘safe by default’ approach. Though this seems a sensible approach, one can imagine this can lead to compatibility problems with terminals that expect certain data to be present on the card while it is not, as the card will reset to a state that the terminal might not expect. 2) With the SecureCode Aut application it is possible, after successfully verifying the PIN code, to request a TC cryptogram using the GENERATE AC instruction. This is surprising, as this does not have any meaning in EMV-CAP: in an EMV-CAP session the terminal must always first ask for an ARQC (as explained at the end of Section II). One would expect that requesting a TC cryptogram type would result in an error (as e.g. happens when a second ARQC is requested) or in an AAC being returned to abort the session (as e.g. happens when any type of cryptogram is requested before PIN verification). Still, it does not seem that this spurious TC cryptogram can be exploited to cause a security vulnerability, at least insofar as we know the EMV-CAP protocol. 3) The error code that is given in response to the INTERNAL AUTHENTICATE instruction is different depending on the state in the SecureCode Aut application. In those states where it is possible in the Maestro application to perform this action, the error code is 6987 (‘Expected secure messaging data objects missing’), while in the other states, an error code 6985 (‘Usage conditions not satisfied’) is returned. Compared to the cards considered before, the Volksbank card handles things a bit differently (see Fig. 5): 1) Where the other cards return to the ‘Selected’ state when an error occurs, the Volksbank card goes into a ‘Finished’ state. From a ‘Finished’ state there is one transition using the SELECT command to get to the ‘Selected’ again, and one to get to the ‘GPO performed’ state using a valid GET PROCESSING OPTIONS command. 2) Data authentication using DDA is also handled differently with this card. First, the card forces DDA to be performed, i.e. if no INTERNAL AUTHENTICATE command is given, transactions cannot be performed: the GENERATE AC command will then always return an error. Also, it is possible to perform DDA even if the card is in a ‘Finished’ state. This suggests that the INTERNAL AUTHENTICATE command is handled separately from the other commands and keeps its own state to indicate whether it is already performed. Below we compare this with what the MasterCard’s specifications say. 3) If in the first GENERATE AC a TC is requested, the card indicates it wants to go online by returning an ARQC. However, after an ARQC is returned the first time, when requesting a TC in the second GENERATE AC, this is actually returned. This seems odd since one would expect this request to fail (i.e. Fig. 5. Automaton of Maestro application on Volksbank bank card Fig. 6. Automaton of Visa Debit application on Barclays card. Note that the INTERNAL AUTHENTICATE can be performed at any stage of the protocol. an AAC to be returned), as we did not provide a valid response from the bank. A. Difference with MasterCard’s specifications The Maestro and MasterCard-branded applications should all conform to MasterCard’s Paypass-M/Chip specification. This specification does specify a state diagram, which has only 5 states, whereas the models we obtained for Maestro cards have 6 or 7 states. In the state diagram specified by MasterCard the operation INTERNAL AUTHENTICATE has no effect on the state, meaning that this operation – i.e. performing DDA – is optional and can be done any number of times. In contrast, the model learned for the Dutch Maestro card says that this operation can be done at most once before cryptograms can be generated, and the model for the Volksbank Maestro card says that it must be done exactly once before cryptograms can be generated. Another difference between the state diagram of the Volksbank card and the one specified by MasterCard is the presence of the ‘Finished (no DDA)’ state, which seems to be a spurious dead-end in the behaviour of the Volksbank card, as it does not lead to a normal protocol run which ends where one or two cryptograms are generated. As these cards carry the Maestro or MasterCard logo, they must have undergone some certification. Assuming that their certification has not missed potential compatibility problems caused by these deviations from MasterCard’s specification, this does suggest that this process does not include checking --- 2This specification is for dual interface (contact and contactless) cards, rather than contact-only cards, but states that the state diagram for contact-only cards is the same, except that it has one transition less [12, p. 98]. for implementation of the exact state machine. B. Different choices in the Visa branded card In the models of the MasterCard applications there exists an ‘Initialisation’ state from which the applications can be selected on the smartcard. Since with the Visa branded card the test harness automatically selects the Visa Debit application, this initialisation state is not included in the learned models and the initial state is ‘Selected’. The Visa branded card is quite different from the others. For example, with the Visa card the commands GET DATA, READ RECORD and VERIFY are allowed in all states, even before the transaction is initialised with GET PROCESSING OPTIONS and after the actual transaction is started with a GENERATE AC command or even finished. These commands are thus apparently completely independent from the card. Also, DDA can be performed, by an INTERNAL AUTHENTICATE, completely independent of any other actions, again even during and after a transaction. In the model it can be seen from the additional information added by the mapper that only two transitions increase the ATC. This indicates that the ATC is increased when performing a successful GET PROCESSING OPTIONS command (i.e. 9000 is returned as the status word). VI. Related work Protocol fuzzing is an increasingly popular technique to test for security vulnerabilities. Simpler forms of protocol fuzzing consider only the format of messages, and then fuzz the different fields, often simply to try and crash an implementation. More advanced fuzzers, such as Snooze [13] and Peach[3] take a state-based approach and also use a state machine describing the protocol as basis for fuzzing. Models such as we obtain could be the basis for more thorough state-based fuzzing by such tools. Protocol-based testing has already been applied to security, including for smartcards, for instance using UMLSec models [14]. For EMV smartcards, there have been successful experiments with protocol fuzzing based on state models at a commercial test lab [15]; here models were constructed by hand. There is a growing interest in model inference, or more generally automated protocol reverse engineering, for security testing and analysis; see [16] for a survey and a proposed classification of approaches, and [17] for a discussion of future directions in combining model inference and model-based testing for security. In automated techniques for protocol reverse engineering one can distinguish approaches that try to infer either message formats (e.g. [18]) or protocol state machines (as we do, and [19]), or both (e.g. [20]). Another classification is that some approaches use ‘passive learning’, where the learner just observes traffic between other parties (e.g. [18], [19], [20]), and ‘active learning’, i.e. where the learner actively takes part in the traffic in order to learn (as we do). A fundamental limitation of passive learning is that the quality of the model depends on the traffic that is observed. It will typically not provide good insight into the possibility of unwanted behaviour. It is therefore natural to follow such passive learning by protocol fuzzing to actively look for any such behaviour. Indeed, fuzzing based on the inferred model is considered as final stage in [19], [20]. Active learning was also successfully used to infer models for the electronic passport [6], confirming that the right ‘files’ are accessible at different stages of the protocol. The models inferred in this paper are more complex than the one of the passport, and the models reveal interesting differences between various cards. Additionally, we could learn which command increased the ATC using a mapper component. VII. Conclusions We have demonstrated that after defining a simple test harness/mapper component, we can easily obtain useful state machine models for banking smartcards using learning and simple abstraction techniques [4], [5]. After some trimming, the models obtained are easy to understand for anyone familiar with the EMV standard, and clearly highlight some of the central decisions taken in an implementation. Differences in the models obtained for different cards may be inconsequential differences that exploit the implementation freedom allowed by the under-specification in the EMV specs, but can really affect the security conditions imposed (for example, the difference between figures 3 and 4 in requiring PIN code verification). To determine which is which, we have relied on ad-hoc manual work and human intelligence - the models obtained are easy to inspect visually. This step could even be automated if security conditions are expressed as temporal logic formulae. Differences in the state diagrams do not necessarily mean that implementations are not secure or that they cannot be regarded as compliant to the standard. The diagrams are a helpful aid in deciding whether this is the case. However, this decision then inevitably relies on an informal understanding of the standard and the essential security requirements. One would like to see more objective criteria for this, especially as security protocols are notoriously brittle and deciding what constitutes a secure refinement of the specification is not always easy. The complexity of the standards involved make such models very valuable. In fact, finite state machine models such as we obtain would be a useful addition to the official specifications. Despite the length of the EMV specs [8] (of over 700 pages), state diagrams describing the smartcard are conspicuously absent. A state diagram is specified in MasterCard’s specification [12], but most of the cards we analysed actually did not conform to it. The differences between e.g. figures 5 and 6 show the considerable leeway there is between different implementations of the same spec. One would expect (and hope?) that engineers developing, testing, or certifying EMV smartcards do have such state diagrams, either in the official documentation or just scribbled on a whiteboard. The models learnt did not reveal any security issues. Indeed, one would not expect to find any in smartcards such as we considered, which should have undergone rigorous security evaluations and tests. Still, we do notice some peculiarities (notably that the Volksbank card is still willing to return a TC even after failed issuer authentication). We believe that our approach would be useful as part of security evaluations, because it increases the rigour and confidence provided and it can save a lot of expensive and boring manual labour. Here it helps that LearnLib learns the behaviour blindly, in a completely haphazard way, without any of the preconceptions or expectations about what the ‘normal’ behaviour is that a human tester or code reviewer might have. The tool learns about all the possible behaviour. This is an advantage for security, as security bugs often occur under unusual conditions, when someone does something unexpected. Still, the hand-coded test harness we developed does make some assumptions about the functionality that the card provides. The test harness implements the basic operations for EMV, and LearnLib then only learns all the possible behaviours given these operations. A deliberately introduced backdoor would thus not be detected, but we conjecture that any mistake in the implementation of the internal state and the associated control flow in the smartcard code would. For future work, we want to try out our technique on more standard networking protocols such as SSH or TLS/SSL. This might be more fruitful in the sense that we can expect implementation bugs to be more common here, as these protocols are more complex and the code is less rigorously developed and tested than smartcard code. In the field of EMV, we plan to see if learning techniques can be used to assess EMV test suites provided by commercial testing companies; models learned from such test suites, using passive rather than active learning, could provide coverage criteria to assess their quality. ACKNOWLEDGEMENTS This work is supported by the Netherlands Organisation for Scientific Research (NWO) and by STW project 11763 Integrating Testing And Learning of Interface Automata (ITALIA). REFERENCES
{"Source-Url": "http://repository.ubn.ru.nl/bitstream/handle/2066/117003/117003.pdf?sequence=1", "len_cl100k_base": 7970, "olmocr-version": "0.1.53", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 29358, "total-output-tokens": 9738, "length": "2e12", "weborganizer": {"__label__adult": 0.0004351139068603515, "__label__art_design": 0.0005812644958496094, "__label__crime_law": 0.000743865966796875, "__label__education_jobs": 0.0041351318359375, "__label__entertainment": 0.0001245737075805664, "__label__fashion_beauty": 0.00022792816162109375, "__label__finance_business": 0.0010023117065429688, "__label__food_dining": 0.0003757476806640625, "__label__games": 0.0009446144104003906, "__label__hardware": 0.0026111602783203125, "__label__health": 0.0006084442138671875, "__label__history": 0.00031757354736328125, "__label__home_hobbies": 0.0001710653305053711, "__label__industrial": 0.0007524490356445312, "__label__literature": 0.00040793418884277344, "__label__politics": 0.00035500526428222656, "__label__religion": 0.00038242340087890625, "__label__science_tech": 0.181396484375, "__label__social_life": 0.00014126300811767578, "__label__software": 0.0182037353515625, "__label__software_dev": 0.78515625, "__label__sports_fitness": 0.0002522468566894531, "__label__transportation": 0.00069427490234375, "__label__travel": 0.0001811981201171875}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 40769, 0.01619]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 40769, 0.49135]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 40769, 0.91281]], "google_gemma-3-12b-it_contains_pii": [[0, 294, false], [294, 5205, null], [5205, 10950, null], [10950, 16757, null], [16757, 21004, null], [21004, 27148, null], [27148, 29089, null], [29089, 35422, null], [35422, 40769, null]], "google_gemma-3-12b-it_is_public_document": [[0, 294, true], [294, 5205, null], [5205, 10950, null], [10950, 16757, null], [16757, 21004, null], [21004, 27148, null], [27148, 29089, null], [29089, 35422, null], [35422, 40769, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 40769, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 40769, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 40769, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 40769, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 40769, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 40769, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 40769, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 40769, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 40769, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 40769, null]], "pdf_page_numbers": [[0, 294, 1], [294, 5205, 2], [5205, 10950, 3], [10950, 16757, 4], [16757, 21004, 5], [21004, 27148, 6], [27148, 29089, 7], [29089, 35422, 8], [35422, 40769, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 40769, 0.0]]}
olmocr_science_pdfs
2024-12-09
2024-12-09
0400d2e63b864a955331becd456b401ed2dfa091
Mining Developers’ Workflows from IDE Usage Ioannou, Constantina; Burattin, Andrea; Weber, Barbara Published in: Advanced Information Systems Engineering Workshops Link to article, DOI: 10.1007/978-3-319-92898-2_14 Publication date: 2018 Document Version Peer reviewed version Mining Developers’ Workflows from IDE Usage Constantina Ioannou, Andrea Burattin, and Barbara Weber Technical University of Denmark, Kgs. Lyngby, Denmark Abstract. An increased understanding of how developers’ approach the development of software and what individual challenges they face, has a substantial potential to better support the process of programming. In this paper, we adapt Rabbit Eclipse, an existing Eclipse plugin, to generate event logs from IDE usage enabling process mining of developers’ workflows. Moreover, we describe the results of an exploratory study in which the event logs of 6 developers using Eclipse together with Rabbit Eclipse were analyzed using process mining. Our results demonstrate the potential of process mining to better understand how developers’ approach a given programming task. Keywords: process mining, tracking IDE interactions, developers’ workflows, source code 1 Introduction Increasing the productivity of software development has traditionally been an important concern of the software engineering field. This includes software development processes (e.g., agile and lean development), development principles and practices (e.g., test-driven development, continuous integration), tools like integrated development environments (IDEs), but also human factors. Considering the tremendous productivity differences between developers of 10:1 [4], there is substantial potential to better support the process of programming by better understanding how developers’ approach the development of software and what individual challenges they face. The process of programming is highly iterative, interleaved and loosely ordered [7]. Developers need to understand the requirements presented to them and form an internal representation of the problem in working memory by extracting information from external sources [3]. Based on the requirements a solution design is developed [3]. This includes at the general level the decomposition of requirements into system structures, i.e., modules and, on a more detailed level, the selection or development of algorithms to implement different modules [18]. The solution design is then implemented using a specific development environment and a particular programming language [18, 21] and it is evaluated whether the developed solution is suitable to solve a problem [9, 21, 6]. Depending on the development process used, the development principles and practices, the used IDE and programming language as well as personal preferences, experience, and capabilities the process of programming varies. In this paper we show the potential of process mining to better understand how developers’ approach the creation of a solution for a given programming task using the IDE Eclipse. The contribution of this paper is twofold. First, the paper provides adaptations of an existing Eclipse plugin, i.e., Rabbit Eclipse, to produce event logs that can be used for process mining purposes. Second, it describes the results of an exploratory study in which the event logs of 6 development sessions were analyzed. The work does not only have potential to better understand the processes developers follow to create a solution to a given programming task using the IDE Eclipse. In the future we can use the developed plugin to compare how the usage of different development principles and practices impacts the way how developers solve a given problem and use conformance checking to identify deviations from best practices. Moreover, when integrated with eye tracking, we cannot only determine how developers interact with the IDE and the different source code artifacts, but additionally where they have their focus of attention. 2 Background and Related Work In Section 2.1 we discuss existing research on tracking IDE usage. In this paper we use the IDE Eclipse together with the Rabbit Eclipse plugin to collect the interactions of developers with the IDE (cf. Sect. 2.2) that are then used for process mining (cf. Sect. 2.3). 2.1 Tracking IDE Usage Research recording the interactions of a developer with the IDE including their analysis and visualization are related to our work. For example, [17] provides quantitative insights into how Java developers use the Eclipse IDE. Moreover, [16] developed DFlow for recording developers’ interactions within the IDE Pharao including their visualization and applied it to better understand how developers spend their time. Similarly, Fluorite [23] and Spyware [19] were implemented in order to collect usage data from the Eclipse IDE and to replay and backtrack developers strategies visualizing code histories. Unlike our research the focus is on a single development session, rather than abstract behavior derived from a set of sessions. Most closely related to our work is [1] in which frequent IDE usage patterns have been mined and filtered in order to form usage smells. More precisely, this approach identifies time-ordered sequences of developer actions that are exhibited by many developers in the field. However, the focus of [1] is on developers’ interactions with the IDE only. In contrast, our proposal considers the inter-relationships of interactions and source code artifacts, thus, emphasizing the way developers solve a programming task rather than how developers use the IDE. 2.2 Rabbit Eclipse Rabbit Eclipse is a statistical plugin, capable of recording developers’ interaction without interrupting their process, within the Eclipse IDE. Fig. 1 gives an overview of the instrumentation approach employed in this paper. When implementing a software within Eclipse, developers generate through their interactions with the IDE various low and high level events. Low level events are keyboard shortcuts and mouse clicks, whereas high level events are related to context menu or wizard interactions. Whenever an event is observed, Rabbit Eclipse is triggered to capture and analyze the interaction. These interactions are then stored in event logs and upon request of a developer the data collected by Rabbit Eclipse can be displayed graphically within Eclipse. The structure of event entries are presented in Fig. 2. For each type of event entry an event log is produced. At the top of the hierarchy are the classes DiscreteEvent and ContinuousEvent, which distinguish between the main types of interactions recorded, i.e. instant and continuous interactions. Command and Breakpoint events are listed as discrete interactions. On the other hand, interactions such as switching between files, views, perspectives, launching, Java elements and session inherit from ContinuousEvent, since the duration for such activities is relevant. 2.3 Process Mining Process mining is the bridge between model-based process analysis and data oriented analysis techniques such as machine learning and data mining [22]. In order to be amenable for process mining the event logs produced should conform to the minimum data model requirements [8]. These are: the case id, which determines the scope of the process, an activity which determines the level of detail for the steps and timestamp, which determines when the activity took place. Using process discovery a process model explaining the behavior of the recorded log can be derived. Moreover, using conformance checking deviations of the event log when compared to a reference behavior can be identified. Closely related to our work presented in this paper is the emerging area of software process mining. With the increasing availability of software execution data, the application of process mining techniques to analyze software execution data is becoming increasingly popular. The potential of software process mining was first demonstrated by [10, 20]. More specifically, source code repositories were mined to obtain insights into the software development processes development teams employed. Moreover, [2] suggests the usage of localized event logs where events refer to system parts to improve the quality of the discovered models. In addition, [11] proposes the discovery of flat behavioral models of software systems using the Inductive Miner [13]. In turn, [15] proposes an approach to discover a hierarchical process model for each component. An approach for discovering the software architectural model from execution data is described in [14]. Finally, [12] allows to reconstruct the most relevant statecharts and sequence diagram from an instrumented working system. The focus of all these works is software development processes or the understanding of the behavior of the software, while our focus is to use process mining to understand how a developer solves a programming task. 3 Extending Rabbit Eclipse for Process Mining Although Rabbit Eclipse provides broad and profound statistical results on developers’ interactions within the Eclipse IDE, the data provided are not sufficient to enable the mining of developers’ interactions as envisioned. In particular, as previously highlighted, timestamp and case id notions were not included in the Fig. 3. Timestamp modifications on three events collection. Therefore, we needed to expand some events in order to enable their usage in the context of process mining. Firstly, all the event logs were customized to include timestamp and case id by modifying classes DiscreteEvent and ContinuousEvent. Further, due to the nature of Rabbit Eclipse the collected interactions have no actual relation between them. To resolve this constraint focus was given to change the interpretation of FileEvent, JavaEvent, and CommandEvent (cf. Fig. 2) which seemed the most promising with respect to our goal. The rest of this section presents the adjustments introduced to enable the process mining investigations envisioned. 3.1 Adaptations to Enable Process Mining. To enable the extraction of a workflow from our data, using process mining techniques, timestamps and case id needed to be included in the recordings. As mentioned, the event logs for ContinuousEvents (both FileEvent and JavaEvent) contain durations, which means that entries referring to the same interaction were merged, whereas, concerning DiscreteEvents (i.e., Command-Events), event logs report the frequency of such interactions. We instrumented Rabbit Eclipse to allow the collection of all timestamps, as shown in Fig. 3. Specifically, for ContinuousEvents timestamps to indicate start and end time were introduces (i.e., each event represented as time interval) and for DiscreteEvents a single timestamp was added (i.e., each event as time instant). Additionally, Rabbit Eclipse does not have the notion of a case id. Therefore, we decided to artificially add one. Specifically, we assumed to have each developer referring to one different case id as approximation of a single development session. With these changes in place, we were able to associate Rabbit Eclipse recordings to user’s actions. Thus, we obtained a proper event log; we shifted the scope of Rabbit Eclipse from logging file changes (suitable for software process mining) to logging user’s interaction with the IDE (suitable for process mining). 3.2 Mapping Commands to Resources. By default, Rabbit Eclipse has no capability to establish links between the commands and the resource where these commands were performed. Therefore, we instrumented Rabbit Eclipse to be able to take this element into account together with timing information. The result is an augmented version of the CommandEvent, as depicted in Fig. 4. This augmentation needed to consider Fig. 4. Command modifications to track interactions different scenarios which are possible, including commands involving single or group of resources (such as renaming a folder or moving files). To better achieve our goal, we also implemented an interaction tracker, which listens for resource change events (see Fig. 5). Once the new tracker is triggered, it processes the event to identify and store affected commands. 3.3 Augmentation of Commands with Java Details. The version of the JavaEvent class available in the current version of Rabbit Eclipse was not able to provide information referring to the specific Java constructs being modified. This data, however, could contain very important in- formation for our analysis. To extract this information, we instrumented Rabbit Eclipse to inspect the Abstract Syntax Tree (AST) of each modified Java class. This enables the Rabbit Eclipse plugin to capture the modified methods and correspondingly update the commands. 4 Exploratory Study This section explains the exploratory study we conducted to evaluate the adapted version of the Rabbit Eclipse plugin. 4.1 Study Design and Execution Participants. Six participants were included in the case study. One participant is a software developer in a medium sized company, while the other five are newly graduated master students from Computer Science and related fields. All of them primarily develop in C, C++ and Java, mainly for embedded systems. Their age ranges from 25 to 29, and they have between 6 months to 2 years of experience using Eclipse. Task. Participants had to work on a fairly simple programming task that takes around 30min/1hour for completion. The task required the participants to first install our version of Rabbit Eclipse and then to implement an inheritance hierarchy of classes that derive from an abstract superclass using Java as a programming language. As depicted in Fig. 14, the task consists of five classes, a superclass called DessertItem and four derived classes, i.e., Cookie, Candy, IceCream and Sundae. Participants were provided with a description of the classes to be implemented including the class diagram (cf. Appendix. A) and a test file called DessertShop. To avoid inconsistent naming between participants, participants were encouraged to strictly follow the class and method naming as shown in the class diagram. While working on the task participants were not allowed to ask for help or explanation since this could affect their way of thinking. After the participants finished their implementation, they were requested to send the files collected from the tool. Thereafter, the required data set for process mining was retrieved. 4.2 Data Collection and Analysis Procedure Fig. 6 illustrates the data collection and analysis procedure we employed. Step 1: Collect Data. To collect data concerning a developer’s interactions with the IDE we asked participants to install our version of Rabbit Eclipse. During the implementation of the task all interactions of the participants with the IDE were then recorded using Rabbit Eclipse. Step 2: Prepare Data. Throughout the second step of the approach and after receiving the exported raw data sets from all participants, the data set requires refinement before it can be used for process mining. To begin with, any unrelated, captured interactions with projects in the developer’s current workspace were removed from the data set. Next, since process mining requires homogeneity among the data set, any inconsistencies in the data sets were detected and adjusted. An example of inconsistency is when a participant, instead of using correctly the requested naming Test.java, used test.java. In addition, the XML formatted event logs are converted to CSV format. Step 3: Combine Data. The refined data are combined into one file and are imported to Disco. Step 4: Mine Process. Disco was then used to analyze the data and settings were configured so that for all experiments the case id used was the developer’s id and the timestamp used was the start time of events. Further, specific settings defined for each experiment are displayed in Table 1. All participants were able to fulfill the task within the given time frame (i.e., all programming sessions lasted between 30 minutes and 1 hour). Most of the Table 1. Settings used for Disco to obtain the four results <table> <thead> <tr> <th>#</th> <th>Result’s Name</th> <th>Participants</th> <th>Event Log</th> <th>Activity</th> <th>Attribute</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>Most Common Commands</td> <td>5</td> <td>cmds</td> <td>command</td> <td>-</td> </tr> <tr> <td>2</td> <td>Developers’ Workflow</td> <td>5</td> <td>cmds</td> <td>file</td> <td>command</td> </tr> <tr> <td>3</td> <td>Classes Workflow</td> <td>5</td> <td>cmds</td> <td>command</td> <td>file</td> </tr> <tr> <td>4</td> <td>Source Code Workflow</td> <td>4</td> <td>javas</td> <td>method</td> <td>and</td> </tr> </tbody> </table> Fig. 7. Most common commands used participants used expected methodologies and commands, however, as indicated in Tab. 1 for all analyses one of the participants had to be excluded because of generating a considerable amount of noise events, as well as for the fourth analysis two participants were excluded due to failed recordings from the tool. 4.3 Results Most Common Commands. A statistical analysis of the entire sample using Disco showed that in total 323 commands were executed for all five participants (most common are shown in Fig. 7). When we observe the distribution of command interactions retrieved, we can see that only a small amount of the available Eclipse standard commands were executed. In fact, only 31 different commands occurred out of the 350 available. A possible explanation for that might stem from the simple nature of the given task. Moreover, our analysis showed that participants tend to use and repeat similar commands. Out of 31 different commands used, the most common are: Save, Undo and Paste which concurs with results of previous studies [17]. Developers’ Workflow. Fig. 8 displays the connection between file switching and command interactions. The file resources implemented throughout the task are indicated as nodes and the command interactions leading from one file to another as edges. The diagram shows that half of participants began their implementation by interacting with DessertItem.java which was the superclass and then moved to the implementation of subclasses, while the other half, begun interacting with subclasses (i.e. Candy.java, Sundae.java) and then moved to the superclass. These two approaches participants followed (cf. Fig, 9) are denoted in literature [5] as “top-down” versus “bottom-up” approach. When following a top-down approach a developer begins with the main problem and then subdi- vides it into sub problems. Whereas when employing a bottom-up approach the developer begins with sub-problems building up to the main problem. Classes Workflow. As observed in Fig. 8, class Candy.java has the highest amount of interactions, whereas, IceCream.java has the least. To explore further this aspect we applied process mining focusing on these two classes separately. In Fig. 10 and Fig. 11 the generated workflow diagrams are shown. In this case, command interactions appear as nodes and the switching between them is represented as edges. From Fig. 10 we can infer the absence of high interaction traffic and this is expected since IceCream.java was fairly simple to implement. On the other hand, Fig. 11 illustrates Cookie.java which is more demanding: this is reflected in a more complex routing of the interactions, including self loops and repetition. This suggests that there is a diversity in the approach used when dealing with classes of different difficulty level. Source Code Workflow. In Fig. 12 an attempt to process mine the source code interactions in Cookie.java is displayed. The method names of the class are indicated as nodes and the arrows indicate the flow participants followed. Participants followed two patterns (cf. Fig. 13), either they begun by building the body of the class and then implementing the methods in detail or the opposite. This was observed not only within the Cookie.java but also in the other implemented classes. Therefore this realization, implies that the workflow techniques mentioned (top down and bottom up) are applied not only for the class design but also for the methods, showing potential in performing process mining on source code development. 5 Summary and Conclusions In this paper we presented an extension of the Rabbit Eclipse plugin that is able to collect developers’ interactions with Eclipse that can be used for process mining. Moreover, we presented the results of an exploratory study where 6 developers developed a small piece of software using Eclipse together with Rabbit Eclipse. The analysis of the data using process mining allowed us to identify the most commonly used commands. Moreover, we could observe that the participating developers employed different object oriented programming techniques, i.e., top down and bottom up, to solve the programming task. In addition, we could identify differences in creating single classes. Our results demonstrate that it is possible to mine developers’ workflows from their interactions within an IDE. However, it has to be noted that the existing work is subject to several limitations such as the low number of subjects and the task difficulty. In the future we plan to extend our study with more subjects and more complex tasks. Another avenue of future research is the integration with eye tracking, thus allowing us to complement our results with data on where developers fo- cused their attention. In addition, future work will consider (retrospective think aloud) to obtain insights into the developer’s thinking process. References A Task Description The task is the implementation of inheritance hierarchy of classes that derive from an abstract superclass. Please follow the task carefully and develop the required units. It is crucial to follow the given naming for your variables, methods, and classes as shown in Fig. 14. The following classes are required: (a) DessertItem abstract superclass, (b) Candy, Cookie, IceCream classes which derive from DessertItem superclass and (c) Sundae class which derives from IceCream class. A Candy item has a weight and a price per pound which are used to determine its cost. The cost should be calculated as (cost) * (price per pound). A Cookie item has a number and a price per dozen which are used to determine its cost. The cost should be calculated as (cost) * (price per dozen). An IceCream item simply has a cost, and the cost of a Sundae is the cost of the IceCream plus the cost of the topping. The DessertShop class was given to developers and contained the main functions of the shop and the test for the classes.
{"Source-Url": "http://orbit.dtu.dk/ws/files/149069062/Article_Mining_Developer_s_Workflow_from_IDE_Usage.pdf", "len_cl100k_base": 4467, "olmocr-version": "0.1.53", "pdf-total-pages": 13, "total-fallback-pages": 0, "total-input-tokens": 30692, "total-output-tokens": 6018, "length": "2e12", "weborganizer": {"__label__adult": 0.0003249645233154297, "__label__art_design": 0.00021409988403320312, "__label__crime_law": 0.000274658203125, "__label__education_jobs": 0.000972747802734375, "__label__entertainment": 3.832578659057617e-05, "__label__fashion_beauty": 0.00011742115020751952, "__label__finance_business": 0.00017595291137695312, "__label__food_dining": 0.0002608299255371094, "__label__games": 0.0003540515899658203, "__label__hardware": 0.00043582916259765625, "__label__health": 0.0002944469451904297, "__label__history": 0.00012218952178955078, "__label__home_hobbies": 5.823373794555664e-05, "__label__industrial": 0.00023162364959716797, "__label__literature": 0.00015926361083984375, "__label__politics": 0.00018489360809326172, "__label__religion": 0.00031638145446777344, "__label__science_tech": 0.0024623870849609375, "__label__social_life": 8.207559585571289e-05, "__label__software": 0.0036716461181640625, "__label__software_dev": 0.98828125, "__label__sports_fitness": 0.0002532005310058594, "__label__transportation": 0.00032591819763183594, "__label__travel": 0.0001575946807861328}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 26198, 0.02773]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 26198, 0.54008]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 26198, 0.92069]], "google_gemma-3-12b-it_contains_pii": [[0, 602, false], [602, 3193, null], [3193, 5931, null], [5931, 8000, null], [8000, 9663, null], [9663, 12160, null], [12160, 13876, null], [13876, 16473, null], [16473, 18857, null], [18857, 19920, null], [19920, 21847, null], [21847, 25162, null], [25162, 26198, null]], "google_gemma-3-12b-it_is_public_document": [[0, 602, true], [602, 3193, null], [3193, 5931, null], [5931, 8000, null], [8000, 9663, null], [9663, 12160, null], [12160, 13876, null], [13876, 16473, null], [16473, 18857, null], [18857, 19920, null], [19920, 21847, null], [21847, 25162, null], [25162, 26198, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 26198, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 26198, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 26198, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 26198, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 26198, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 26198, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 26198, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 26198, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 26198, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 26198, null]], "pdf_page_numbers": [[0, 602, 1], [602, 3193, 2], [3193, 5931, 3], [5931, 8000, 4], [8000, 9663, 5], [9663, 12160, 6], [12160, 13876, 7], [13876, 16473, 8], [16473, 18857, 9], [18857, 19920, 10], [19920, 21847, 11], [21847, 25162, 12], [25162, 26198, 13]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 26198, 0.048]]}
olmocr_science_pdfs
2024-12-07
2024-12-07
9f4d82f905c32b16ea65678506bb0e8f20accd36
ABSTRACT We no longer live or work in a line printer - green bar paper environment. Indeed many of today's programmers do not even know what a line printer is or what green bar paper looks like. Our work environment expects reports which utilize various fonts, with control over point size and color, and the inclusion of graphic elements. In general we are expected to produce output that not only conveys the necessary information, but also looks attractive. In the line printer days little could be done with the style and appearance of reports, and consequently little was expected. Now a great deal of control is possible, and we are expected to take advantage of the tools available to us. We can no longer sit back and present a plain vanilla report. The Output Delivery System, ODS, gives us a great deal of the kind of control that we must have in order to produce the kinds of reports and tables that are expected of us. Although we will often include graphical elements in our tables, it turns out that a number of options, statements, and techniques that are associated with SAS/GRAPH can be utilized to our benefit even when we are NOT creating graphs. Learn how to take advantage of these graphical elements, even when you are not using SAS/GRAPH. KEY WORDS SAS/GRAPH, ODS, GOPTIONS, SYMBOL, AXIS, TITLE USING TITLE OPTIONS WITH ODS For destinations that support font and color attributes, the Output Delivery System, ODS, honors many of the SAS/GRAPH title and footnote options. A few of the traditional TITLE/FOOTNOTE statement options include: - **Color=** color designation - **BColor=** background color specification - **Height=** height of the text (usually specified in points) - **Justify=** text justification (left, center, right) - **Font=** font designation (can include hardware and software fonts) Most of these options can be abbreviated. For the options shown above you can use the upper case letters in the option name as an abbreviation. Colors can include most standard color names as well as any of the RGB or gray scale colors appropriate for the output destination. There also a few font modification options. These include: The Base SAS® TITLE statement documentation does not mention any of these options. They are listed in the SAS/GRAPH documentation, however a number of the SAS/GRAPH TITLE statement options are not supported outside of the graphics environment. The following example demonstrates some of these TITLE statement options titles associated with a RTF report. ```sas ods rtf file="&path\results\E1.rtf" style=rtf; title1 f='times new roman' h=15pt c=blue bc=yellow 'Using TITLE Options'; title2 f='Arial' h=13pt c=red j=l bold 'English Units'; ods rtf file="&path\results\E2.rtf" style=rtf bodytitle; ``` 1. You may use any font available to your system. Fonts consisting of more than one word must be enclosed in quotes. 2. The color is set to BLUE, and the font size is set to 15 points. This can be a fairly nominal size, as actual size can depend on the destination and how it is displayed. 3. The background color is set to yellow. 4. JUSTIFY=LEFT has been abbreviated. The options are applied to any text that follows the title option. The RTF style has been used with the RTF destination, and when using the RTF style in the RTF destination changing the background color (BC=) adds a box around the title. In RTF the titles and footnotes are by default added to the HEADER and FOOTERS of the document when the table is imported. Footers are at the bottom of the physical page, and not necessarily at the bottom of the table. The titles/footnotes can be made a part of the table itself through the use of the BODYTITLE option on the ODS RTF statement. For shorter tables this can move the footnote to the base of the table. There are quite a few other SAS/GRAPH TITLE statement options. Most of these are ignored outside of SAS/GRAPH. Depending on the destination and style, some SAS/GRAPH TITLE statement options are occasionally not ignored (when you think that they should be), in which case they tend to yield unanticipated results. SETTING AND CLEARING GRAPHICS OPTIONS AND SETTINGS Most procedures that have graphics capabilities, can also take advantage of many graphics options and settings. Not all of the graphics options will be utilized outside of the SAS/GRAPH environment, consequently you may need to do some experimenting to determine which graphics options are used for the procedure of interest. Graphics options are set through the use of the GOPTIONS statement. Like the OPTIONS statement, this global statement is used to set one or more graphics options. Because there are a great many aspects to the preparation and presentation of a high resolution graphic, there are necessarily a large number of graphics options. A few of the more commonly used options are shown here. <table> <thead> <tr> <th>Option</th> <th>Example Value</th> <th>What it does</th> </tr> </thead> <tbody> <tr> <td>htext=</td> <td>2.5</td> <td>Sets the size for text</td> </tr> <tr> <td>border</td> <td>noborder</td> <td>Determines if a border is to be placed around the graphic?</td> </tr> <tr> <td>device=</td> <td>emf</td> <td>Instruction set for the rendering of the graphic</td> </tr> <tr> <td>gsfname=</td> <td>fileref</td> <td>Location to write the file containing the graphic</td> </tr> </tbody> </table> Because these options and settings have a scope for the entire session, if you are in an interactive session and execute two or more programs that use or change some of these options, it is not uncommon to have the options from one program interfere with those of the next. We can mitigate this by setting or resetting the graphic options to their default values at the start of each program. This is done by using the RESET= graphics option. The RESET= graphics option can be used to reset a number of different groups of graphic settings. The following table shows some of these groups. <table> <thead> <tr> <th>RESET=</th> <th>What it does</th> </tr> </thead> <tbody> <tr> <td>all</td> <td>resets all graphics options and settings. Resets values from some other statements as well (see below).</td> </tr> <tr> <td>goptions</td> <td>only resets graphics options to their default values</td> </tr> <tr> <td>symbol</td> <td>clears all symbol statement definitions</td> </tr> <tr> <td>legend</td> <td>clears all legend statement definitions</td> </tr> <tr> <td>title</td> <td>clears all title definitions; same as title1;</td> </tr> <tr> <td>footnote</td> <td>clears all footnote definitions; same as footnote1;</td> </tr> </tbody> </table> The following rather typical set of GOPTION statements utilizes some of the options shown above with a PROC UNIVARIATE step. ``` filename outex3 "&path\results\E3_goptions.emf" goptions reset=all ftext='cambria' htext=1; GOPTIONS GSFNAME=outex3 GSFMODE=replace DEVICE=emf; *goptions device=win targetdevice=emf; 1. The RESET=all option clears all graphics options and sets them to their default values. 2. The FTEXT option is used to set the default font for graphics text. CAMBRIA, a font with serifs, is quite readable. Unless specified elsewhere, the HTEXT option sets the default height for all text to 1 unit. The default units are cells. Other choices include: IN, CM, PTS, PIXELS, PERCENT. 3. Graphics Stream File options, GSF, are used to route the graph to a file. GSFNAME points to the destination, fileref, of the graphic. 4. The DEVICE= option is used to structure the graph for the appropriate physical or virtual destination. EMF is a good device when the graphic is to be included in a word processing document. 5. The DEVICE= option is used to structure the graph for the appropriate physical or virtual destination. EMF is a good device when the graphic is to be included in a word processing document. 6. During program development you will want to see the graph displayed on the monitor (under windows this is DEVICE=WIN), however you may want to view it as it will ultimately be displayed on the final destination. The TARGETDEVICE option attempts to show you the graph on the display device (DEVICE=) using the constraints of the eventual final device (TARGETDEVICE). Since this is a production example, this development statement has been commented out. ``` **USING SAS/GRAph STATEMENTS WITH NON-SAS/GRAph PROCEDURES** In the previous example the UNIVARIATE procedure was used to generate a graph. Although UNIVARIATE is part of Base SAS, it can still take advantage of other aspects of SAS/GRAph. It turns out that there are a number of other procedures, which although not part of SAS/GRAph, are none-the-less able to take advantage of SAS/GRAph statements when generating high resolution graphs. A few of the more common procedures that I have found to be useful that also have high resolution graphics capabilities include: The following is a very brief introduction to some of the statements that can be used outside of SAS/GRAPH. Better and more complete introductions to SAS/GRAPH can be found in numerous papers, as well as in several books. Although outside the scope of this paper, ODS Stat Graphics can also be used to generate high resolution graphics. **Changing Plot Symbols with the SYMBOL Statement** The SYMBOL statement is used to control the appearance of items within the graphics area. As you would suspect, this includes plot symbols, but it also controls the appearance of lines, and how points are joined with these lines. All plot symbols and lines have attributes *e.g.* color, size, shape, thickness, and these attributes are declared on the SYMBOL statement. There can be up to 99 numbered SYMBOL statements. Attributes to be controlled are specified through the use of options. Options are specified through the use of their name and, in most cases, the names can be abbreviated. The following SYMBOL statement requests that the plot symbols (a dot) be blue, with a size (height) of .8 units. ``` symbol1 color = blue h = .8 v=dot; ``` Fortunately, since the SYMBOL statement is heavily used, it is usually fairly straightforward to apply. A quick study of the documentation will usually serve as a first pass instruction. Like so many things in SAS however, there are a few traps that you should be aware of when applying the SYMBOL statement in more complex situations. A few of the numerous SYMBOL statement options are shown in the following table. <table> <thead> <tr> <th>Option</th> <th>Option Abbreviation</th> <th>Example Value</th> <th>What it does</th> </tr> </thead> <tbody> <tr> <td>color=</td> <td>c=</td> <td>blue</td> <td>Sets the color of the symbol and/or line</td> </tr> <tr> <td>height=</td> <td>h=</td> <td>1.5</td> <td>Size of the symbol</td> </tr> <tr> <td>value=</td> <td>v=</td> <td>star</td> <td>Symbol to be used in the plot</td> </tr> <tr> <td>font=</td> <td>f=</td> <td>arial</td> <td>The plot symbol is selected from this font</td> </tr> <tr> <td>interpol=</td> <td>i=</td> <td>join</td> <td>How plot symbols are to be connected</td> </tr> <tr> <td>line=</td> <td>l=</td> <td>1</td> <td>Line numbers: 1, 2, and 33 are the most useful</td> </tr> <tr> <td>width=</td> <td>w=</td> <td>2.1</td> <td>Line width, the default is usually 1</td> </tr> </tbody> </table> **SYMBOL Definitions are Cumulative** Although SYMBOL statements, like TITLE and FOOTNOTE statements, are numbered, that is about the only similarity with regards to the way that the definitions are established. When a TITLE3 statement is specified, the definition for TITLE3 is completely replaced. Not only is a given TITLE statement the complete definition for that title, but that same TITLE3 statement automatically clears titles 4 through 10; SYMBOL statement definitions, on-the-other-hand, are cumulative. The following two SYMBOL statements could be rewritten as several statements. ```plaintext symbol1 color = blue v=none i=box10 bwidth=3; symbol2 color = red v=dot i=join line=2 h=1.2; ``` ```plaintext symbol2 v=dot i=join; symbol1 color = blue; symbol2 color = red; symbol1 v=none i=box10 bwidth=3; symbol2 line=2 h=1.2; ``` The graphics option RESET= can be used in the GOPTIONS statement to clear SYMBOL statement definitions. ``` goptions reset=symbol; ``` **SYMBOL Definition Selection is NOT User Directed** When symbols or lines are to be used in a graph, the procedure first checks to see if there are any user defined symbol definitions (of course, there are defaults for everything when SYMBOL statements have not been used). The procedure then selects the next symbol definition. This means that if SYMBOL2 was just used, the procedure will look for a SYMBOL3 definition. Unfortunately it is not possible to directly tie a given symbol statement to a given line or symbol. This means that you will need to have at least a basic understanding of symbol definition selection for the procedure that you are planning on using. The following example uses PROC REG to perform a regression analysis on HT and WT in the DEMOG data set. The PLOT statement can be used to create a plot of the results of the analysis. All graphics options are set to their defaults. Then selected options are changed as in the previous example. TITLE statement options are used to select bolded arial as the font for the first title. HT is used as the dependent variable. The CONF option is used to request the plotting of the confidence intervals and predicted values. Although the procedure selects colors and line types for the predicted value line and for the confidence intervals, the data are plotted using the plus ‘+’ symbol. In this case the predicted line is red, upper confidence bound is yellow and the lower limit is green. We can use the SYMBOL statement to gain control of the plot symbol and the color of the lines. For the data points the SYMBOL1 statement is used to select the plot symbol, color, and the symbol (V=). The color for the estimated line is specified. You will need to experiment to determine which SYMBOL statement will be used by which aspect of the graph. The confidence lines are colored green. The R= option causes this symbol definition to be reused a second time. Rather than use the R= option we could have specified a SYMBOL4 definition to be the same as the SYMBOL3 definition. The colors and plot symbols are shown in the legend at the bottom of the graph. You can take control of the legend though the use of the LEGEND statement. Although not supported by REG, for some procedures you can eliminate the legend altogether using the NOLEGEND option. Controlling Axes and Legends Control of any and all aspects of the horizontal and vertical axes can be obtained through the use of the AXIS statement. This global statement can be one of the most complex statements in SAS/GRAPH, if not within SAS itself, and it is clearly outside of the scope of this paper to do much more than partially describe this statement. Closely related to the AXIS statement in syntax is the LEGEND statement which is used to control the appearance of the graph’s legend. The following is a brief introduction to these two statements. Like the SYMBOL statement, you can have up to 99 numbered AXIS and LEGEND statements. Also like the SYMBOL statement, the axis and legend definitions are cumulative. Both axis and legend definitions can be cleared with the RESET= option. **AXIS Statement** The AXIS statement can be used to control the axis lines, tick marks, tick mark text, and axis labels. You can specify fonts and color for all text. For any of the lines you can control the styles (type of line), thickness, color, and length. The axis definition is built through a series of options. Some of these options will themselves have options, and the layers of options within options can often be three deep. To make things even more interesting some options will appear in multiple ways and their effect will depend on position and usage. Clearly just knowing how to apply the options and how to nest them can be complicated. Most of the options that can appear in several different aspects of the statement are text appearance options. Most are similar to those used as TITLE and FOOTNOTE statement options, and there is also some overlap with those used in the SYMBOL statement. Some of the more common text appearance options include: <table> <thead> <tr> <th>Option</th> <th>Option Abbreviation</th> <th>Example Value</th> <th>What it does</th> </tr> </thead> <tbody> <tr> <td>height=</td> <td>h=</td> <td>10pct</td> <td>size is set to 10 percent</td> </tr> <tr> <td>color=</td> <td>c=</td> <td>cxdedede</td> <td>color is set to a shade of gray</td> </tr> <tr> <td>font=</td> <td>f=</td> <td>Arial</td> <td>ARIAL is selected as the desired font</td> </tr> <tr> <td>'text string'</td> <td></td> <td>'Units are mg'</td> <td></td> </tr> </tbody> </table> The first layer of options control major aspects of the axis. These include such things as: - ORDER= range of values to be included - LABEL= axis label - VALUE= tick mark control - MAJOR= major tick marks (the ones with text) - MINOR= minor tick marks When building an AXIS statement parentheses are used to form groups of sub-options, and indenting to each level of option can be helpful in keeping track of which options go with what. This is a fairly typical AXIS statement. Notice that the values of options are in parentheses. This allows us to specify the sub-options. ``` axis1 order=(75 to 250 by 25) ❶ label=(h=1.5 ❷ c=blue ❸ 'Weight (LB)') ❹ value=(h=1.5) ❷ minor=(n=4) ❸ color=red; ❶ ``` 250 with major tick marks at an interval of 25. - ❶ ORDER= Restricts the axis range, data can be excluded. - Here the range of the axis is limited to values between 75 and 250 with major tick marks at an interval of 25. - ❷ H= The height of the text is set to 1.5 units (the default units are cells) - ❸ Color= The color for the label text is set to blue - ❹ 'text' The text for the label is specified overriding the variable’s label - ❺ MINOR= Specifies the number of minor tick marks. Eliminate all with MINOR=NONE. Since the Color= option is not within parentheses, RED will become the default color for all aspects of the axis. The following box plot uses the previous axis statement to control a few of the aspects of the vertical axis. For most procedures a given AXIS statement is associated with the vertical or horizontal axis through the use of options on the statement that defines the plot. In PROC BOXPLOT, which was used here, the defining statement is the PLOT statement and there is a both a VAXIS= and HAXIS= option to assign the axis statement. Since in this example the vertical axis is associated with the AXIS1 statement, the option would be \[ \text{VAXIS=} \text{AXIS1} \] The BOXPLOT step becomes: ```plaintext proc boxplot data=demog; plot wt*symp/ cframe = cxdedede boxstyle = schematicid cboxes = red cboxfill = cyan vaxis = axis1; id race; run; ``` **LEGEND Statement** The general syntax, statement structure, and even many of the options of the AXIS statement are shared with the LEGEND statement. In the discussion of the use of the SYMBOL statement with the regression plot earlier in this paper, the legend appears at the bottom of the graph. We can change its location as well as its appearance. 1. The legend can be INSIDE or OUTSIDE of the graphics area, and it can also be moved vertically and horizontally. 1. The VALUE= option controls the text associated with the four individual items in the legend. 2. Turn off the legend’s label. 3. Add a box around the legend. Other options allow you to change the width, color, and shadowing of the frame. For this graph, especially when displayed in black and white, the legend is fairly superfluous. Many procedures have an option (NOLEGEND) that can be used to prevent the display of the legend altogether. Unfortunately PROC REG does not support the NOLEGEND option. Consequently there is no way to prevent the legend from appearing when any of the PLOT statement options are used that cause multiple items to be displayed (such as CONF). The following example uses a LEGEND statement to minimize the impact of the legend. ``` legend2 label=none value= none shape=symbol(.001,.001) position=(inside bottom right); proc reg data=advrpt.demog; model ht = wt; plot ht*wt/conf legend=legend2; run; ``` 1. Allow at most 2 items for each row in the legend. 2. The LEGEND= option is used to identify the appropriate legend statement. The text for the individual values and the label is turned off. 3. The individual symbol elements cannot be turned off (SHAPE does not support NONE), therefore the values are made very small. 4. Move the legend to the lower right corner where it will be less noticeable. 5. The LEGEND2 definition is selected for use. USING ANNOTATE TO AUGMENT GRAPHS The annotate facility gives us the ability to customize the output generated by the procedure. Although designed to be used with the graphics procedures in SAS/GRAPH, it can be used with a number of other procedures that generate graphics output. The huge advantage to us is that the customization provided by annotate can be data dependent. This means that without recoding, our graphs can change as the data changes. The key to the process is the annotate data set. This data set contains the instructions that are to be passed to the annotate facility. Each observation in the data set is one instruction, and very often the instruction is fairly primitive e.g. pick up a pen. The instructions in the data set are passed to the procedure that is generating the graphic through the use of the ANNOTATE= option. You can tell if a procedure can take advantage of the annotate facility by whether or not it supports this option or its abbreviation ANNO=. The annotate facility interprets each observation in the annotate data set as an instruction, and it uses the values of specific variables to form the intent of the instruction. You do not get to choose the names of the variables, but you have a great deal to do with the values that the variables take on. In order for the instruction to provide a valid instruction to annotate, the variables and their values have to provide answers to three primary questions. <table> <thead> <tr> <th>Question to be answered</th> <th>Possible variables used to answer the question</th> </tr> </thead> <tbody> <tr> <td>WHAT is to be done?</td> <td>FUNCTION (this is the only variable for this question)</td> </tr> <tr> <td>WHERE is it to be done?</td> <td>X, Y, XSYS, YSYS</td> </tr> <tr> <td>HOW is it to be done?</td> <td>COLOR, SIZE, STYLE, POSITION</td> </tr> </tbody> </table> The value of the variable FUNCTION is always specified, and this value determines what other variables will be used by annotate when the instruction is executed. FUNCTION should be a character variable with a length of 8. There are over two dozen possible values for FUNCTION, a few of the commonly used ones are shown here. <table> <thead> <tr> <th>Value of FUNCTION</th> <th>What it does</th> </tr> </thead> <tbody> <tr> <td>label</td> <td>Adds a text label to the graphic</td> </tr> <tr> <td>move</td> <td>Moves the pointer to another position on the graphic without drawing</td> </tr> <tr> <td>draw</td> <td>Draw a line from the current position to a new position on the graphic</td> </tr> </tbody> </table> For annotate operations that are associated with a location on a graphic, separate variables are used to specify the location. In order to identify a location you will need to specify the coordinate system (e.g. XSYS, YSYS) and a location within that coordinate system (e.g. X, Y). In this example the Body Mass Index, BMI, is calculated and then added to the regression plot generated by REG using the annotate facility. 1. The annotate data set is named as are the variables that it will contain. 2. The annotate variables FUNCTION and COLOR are assigned a length. To avoid truncation; this is always a good idea. 3. The annotate variables that are constant for all the instructions (observations) are assigned values with the RETAIN. 4. Only create an annotate instruction, a label, for those observations with a BMI outside of the stated range. 5. The variables X and Y contain the coordinates of this data point on the graph. TEXT, the variable used to hold the annotate label, contains the value of the BMI. An introduction to the annotate facility can be found in *Annotate Simply the Basics* (1999). SUMMARY There are a number of ways to dress up your reports and graphs. Some of these techniques utilize options, statements, and approaches designed for SAS/GRAPH, but which are available even when not creating graphics. It pays to know how to take advantage of all tools available to us, and sometimes those tools come to us from unexpected sources. ABOUT THE AUTHOR Art Carpenter’s publications list includes four books, and numerous papers and posters presented at SUGI, SAS Global Forum, and other user group conferences. Art has been using SAS® since 1977 and has served in various leadership positions in local, regional, national, and international user groups. He is a SAS Certified Advanced Professional Programmer and through California Occidental Consultants he teaches SAS courses and provides contract SAS programming support nationwide. AUTHOR CONTACT Arthur L. Carpenter California Occidental Consultants 10606 Ketch Circle Anchorage, AK 99515 (907) 865-9167 art@caloxy.com www.caloxy.com REFERENCES http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=55127 http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=57320 http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=61686 TRADEMARK INFORMATION SAS, SAS Certified Professional, SAS Certified Advanced Programmer, and all other SAS Institute Inc. product or service names are registered trademarks of SAS Institute, Inc. in the USA and other countries. ® indicates USA registration.
{"Source-Url": "https://www.lexjansen.com/mwsug/2010/how/MWSUG-2010-140.pdf", "len_cl100k_base": 6114, "olmocr-version": "0.1.50", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 32599, "total-output-tokens": 6517, "length": "2e12", "weborganizer": {"__label__adult": 0.00030875205993652344, "__label__art_design": 0.0018777847290039065, "__label__crime_law": 0.0003230571746826172, "__label__education_jobs": 0.0044708251953125, "__label__entertainment": 0.00013136863708496094, "__label__fashion_beauty": 0.0001829862594604492, "__label__finance_business": 0.0018596649169921875, "__label__food_dining": 0.000278472900390625, "__label__games": 0.0004050731658935547, "__label__hardware": 0.0016326904296875, "__label__health": 0.0003862380981445313, "__label__history": 0.0003197193145751953, "__label__home_hobbies": 0.00019991397857666016, "__label__industrial": 0.0010557174682617188, "__label__literature": 0.0003418922424316406, "__label__politics": 0.0001798868179321289, "__label__religion": 0.000377655029296875, "__label__science_tech": 0.058197021484375, "__label__social_life": 0.00012540817260742188, "__label__software": 0.2310791015625, "__label__software_dev": 0.6953125, "__label__sports_fitness": 0.00017130374908447266, "__label__transportation": 0.0003964900970458984, "__label__travel": 0.00019252300262451172}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 26199, 0.02052]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 26199, 0.39621]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 26199, 0.8879]], "google_gemma-3-12b-it_contains_pii": [[0, 2173, false], [2173, 4117, null], [4117, 6346, null], [6346, 8608, null], [8608, 10087, null], [10087, 12972, null], [12972, 13675, null], [13675, 15241, null], [15241, 17898, null], [17898, 19274, null], [19274, 20666, null], [20666, 23531, null], [23531, 24359, null], [24359, 25368, null], [25368, 26199, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2173, true], [2173, 4117, null], [4117, 6346, null], [6346, 8608, null], [8608, 10087, null], [10087, 12972, null], [12972, 13675, null], [13675, 15241, null], [15241, 17898, null], [17898, 19274, null], [19274, 20666, null], [20666, 23531, null], [23531, 24359, null], [24359, 25368, null], [25368, 26199, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 26199, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 26199, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 26199, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 26199, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 26199, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 26199, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 26199, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 26199, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 26199, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 26199, null]], "pdf_page_numbers": [[0, 2173, 1], [2173, 4117, 2], [4117, 6346, 3], [6346, 8608, 4], [8608, 10087, 5], [10087, 12972, 6], [12972, 13675, 7], [13675, 15241, 8], [15241, 17898, 9], [17898, 19274, 10], [19274, 20666, 11], [20666, 23531, 12], [23531, 24359, 13], [24359, 25368, 14], [25368, 26199, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 26199, 0.15918]]}
olmocr_science_pdfs
2024-11-29
2024-11-29
67f32381e00c5941d257d3c189e230a03fbe1c10
[REMOVED]
{"Source-Url": "https://publik.tuwien.ac.at/files/publik_297954.pdf", "len_cl100k_base": 6465, "olmocr-version": "0.1.53", "pdf-total-pages": 16, "total-fallback-pages": 0, "total-input-tokens": 38985, "total-output-tokens": 9959, "length": "2e12", "weborganizer": {"__label__adult": 0.00042176246643066406, "__label__art_design": 0.0014352798461914062, "__label__crime_law": 0.0003960132598876953, "__label__education_jobs": 0.0029449462890625, "__label__entertainment": 0.0001392364501953125, "__label__fashion_beauty": 0.00025844573974609375, "__label__finance_business": 0.0025730133056640625, "__label__food_dining": 0.0004284381866455078, "__label__games": 0.0005965232849121094, "__label__hardware": 0.000751495361328125, "__label__health": 0.0005116462707519531, "__label__history": 0.0004901885986328125, "__label__home_hobbies": 0.00012743473052978516, "__label__industrial": 0.0007104873657226562, "__label__literature": 0.0006504058837890625, "__label__politics": 0.0004274845123291016, "__label__religion": 0.0005426406860351562, "__label__science_tech": 0.10711669921875, "__label__social_life": 0.00015366077423095703, "__label__software": 0.0188751220703125, "__label__software_dev": 0.859375, "__label__sports_fitness": 0.0002760887145996094, "__label__transportation": 0.0006704330444335938, "__label__travel": 0.00023043155670166016}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 39335, 0.02839]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 39335, 0.1141]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 39335, 0.85243]], "google_gemma-3-12b-it_contains_pii": [[0, 339, false], [339, 2651, null], [2651, 6020, null], [6020, 9157, null], [9157, 12382, null], [12382, 14280, null], [14280, 16283, null], [16283, 18601, null], [18601, 19640, null], [19640, 23776, null], [23776, 25255, null], [25255, 27436, null], [27436, 29472, null], [29472, 32506, null], [32506, 35878, null], [35878, 39335, null]], "google_gemma-3-12b-it_is_public_document": [[0, 339, true], [339, 2651, null], [2651, 6020, null], [6020, 9157, null], [9157, 12382, null], [12382, 14280, null], [14280, 16283, null], [16283, 18601, null], [18601, 19640, null], [19640, 23776, null], [23776, 25255, null], [25255, 27436, null], [27436, 29472, null], [29472, 32506, null], [32506, 35878, null], [35878, 39335, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 39335, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 39335, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 39335, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 39335, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 39335, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 39335, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 39335, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 39335, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 39335, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 39335, null]], "pdf_page_numbers": [[0, 339, 1], [339, 2651, 2], [2651, 6020, 3], [6020, 9157, 4], [9157, 12382, 5], [12382, 14280, 6], [14280, 16283, 7], [16283, 18601, 8], [18601, 19640, 9], [19640, 23776, 10], [23776, 25255, 11], [25255, 27436, 12], [27436, 29472, 13], [29472, 32506, 14], [32506, 35878, 15], [35878, 39335, 16]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 39335, 0.06704]]}
olmocr_science_pdfs
2024-12-09
2024-12-09
45de99f5434153de21febf28a49dd995141bd9c1
GMSim: A TOOL FOR COMPOSITIONAL GSMP MODELING Frode B. Nilsen Telenor RD P.O. Box 83 N-2007 Kjeller, NORWAY ABSTRACT The development of a discrete-event simulation tool, called GMSim, based on the generalized semi-Markov process (GSMP) formalism is described. The GSMP representation comprises both analysis and simulation in a unified framework. This paper focuses on the simulation aspect and how to deal with a combinatorially exploding state space. A compositional GSMP modeling methodology is proposed, which in turn is combined with an object-oriented programming approach. A key feature of the resulting tool is the close resemblance with the underlying mathematical structure. This facilitates coherent modeling and also an efficient implementation. The tool is completely generic and extendible by Tcl script programming. Application specific components are developed by C++ programming in combination with M4 macro processing. 1 INTRODUCTION The generalized semi-Markov process (GSMP) formalism gained interest about ten years ago as a convenient way to describe the dynamics found in stochastic discrete-event systems (Glynn 1989, Shedler 1993, Haas and Shedler 1987, Glynn 1996). Unlike most approaches, the GSMP formulation facilitates modeling and reasoning within a common framework. The description is at the same time both a precise mathematical setting for analysis and a discrete-event simulation algorithm. The GSMP framework does not aim at closed-form solutions. Quantitative results must be obtained by simulation but a flavor of qualitative theory can be established (Glynn 1989). The latter is the reason for applying the framework in the first place. The key point is that theoretically sound and computationally efficient methods for estimation and experimental design are readily available from the GSMP view (Glynn 1983, Glynn and Iglehart 1988). For simple systems GSMP modeling is straight-forward and the implementation of a corresponding simulation model follows almost immediately. However, as the number of events and components in the state description grows, combinatorial explosion quickly arises. Intractability follows from the fact that the state/event combinations to consider become too numerous to handle. The contribution of this paper is first the development of a compositional GSMP modeling technique. As always, decomposition is the solution to make complex models tractable. The second contribution is how this can be combined with an object-oriented programming approach for implementation of simulation models. The overall idea is illustrated in figure 1 and the resulting simulation tool is called GMSim (Nilsen 1998). In addition to the theoretical foundation, the paper discusses the implementation of GMSim and how the underlying mathematical structure is exposed to the programmer. To the knowledge of the author compositional GSMP modeling has not previously been addressed. Neither are we aware of any available simulation tool that directly reflects the GSMP view in an object-oriented environment. We conjecture that the preciseness of the GSMP foundation leads to a well-structured and hence efficient implementation of GMSim itself. The tool facilitates compositional development of simulation models but preserves a coherent view. Otherwise, the objectives of GMSim are execution speed and flexibility. Speed is gained by building binary code for the basic parts of a model. This is based on the C++ programming language (Strostrup 1991) augmented by a set of M4 macros (Seindal). The tool is completely generic and application specific components are incorporated by run-time linking. Flexibility is obtained by using the Tcl/Tk script environment (Ousterhout 1994) for simulation control. The tool can be extended in arbitrary ways by script programming. Scheduling in GMSim is based on two-level strategy where a pairing-heap (Fredman et al. 1986) is used for the global queue. GMSim is based on standard SW components and is released with the source code under the GNU General Public Licence terms. Hence, it is an open-ended tool suitable for research on simulation methodology. It has successfully been used (Nilsen 1997) for studying the performance of wormhole-switched (Ni and McKinley 1993) communication systems. Note that only a subset of the features in GMSim are discussed in this paper. The full documentation of the tool is available in (Nilsen 1998). 1.1 Organization The rest of this paper is organized as follows. A summary of the basic GSMP formalism is given in section 2. Section 3 describes the proposed technique to accomplish compositional GSMP modeling. Together these two sections provide the theoretical foundation for the GMSim development. Section 4 gives an overview of the GMSim tool and its features. This is followed by an illustrative M/M/1 queuing example in section 5. An outline of the the C++ programming interface is provided in section 6. Section 7 describes the scheduling algorithm used by GMSim before the paper is concluded in section 8. 2 THE BASIC GSMP FORMALISM A generalized semi-Markov process (GSMP) is based on the notion of a state, and makes a state transition when an event associated with the occupied state occurs. Several possible events compete with respect to triggering the next transition and each of these events has its own distribution for determining the next state. At each transition new events may be scheduled. For each of these events, a clock indicating the time until the event is scheduled to occur is set according to an independent mechanism. If a scheduled event does not trigger a transition but is associated with the next state, its clock continues to run. If such an event is not associated with the next state, it ceases to be scheduled and its clock reading abandoned. The standard definition of a GSMP (Glynn 1989, Glynn 1983, Glynn and Iglehart 1988) assumes that the set of scheduled events is uniquely determined by the current state. It is also assumed that there is a unique triggering event for each state transition. We use an extended definition where the set of scheduled events is explicitly given and where multiple triggering events are allowed. The former is based on (Haas and Shedler 1988) and the latter on (Shedler 1993). Formal definition of a GSMP is in terms of an embedded Markov chain \( X_k \) that describes a continuous-time process \( S(t) \in S \) at successive epochs of state transition. A one-dimensional illustration is provided in figure 2. Note that \( S \) signifies an application specific state space which is assumed to be finite or countable. A GSMP process is multi-dimensional in the general case, hence the vector notation. At entrance to a new state \( X_k \) at time \( T_k \) we associate a set of active (scheduled) events \( I_k \subseteq E \). Here \( E = \{ e_1, e_2, \ldots, e_m \} \) is taken to be a set of events defined specifically for the application. For each active event \( e_i \in I_k \) the product of an associated clock \( c_i \) and running speed \( r_i \) gives the time until the event is scheduled to occur. The scheduled events compete with respect to triggering the next transition at time \( T_{k+1} \). The winner(s) are the event(s) with the minimum remaining time. This is the set of triggering events denoted \( D^* \subseteq I_k \). The events \( e_j \in (E - I_k) \) are classified as inactive. The inter-event time \( W_k = T_{k+1} - T_k \) is called the sojourn time in state \( X_k \). The embedded state description arises from augmenting the natural state vector \( S(T_k) \) with event clocks \( C_k = (c_1, \ldots, c_m) \), hence \( X_k = (S(T_k), C_k) \). This approach is related to the supplementary variable technique (Cox and Miller 1965) often used to obtain Markov behavior in stochastic models. As always, Markov behavior simplifies analysis. A Markov-renewal condition (Cinlar 1975) is in turn imposed on the compound chain \( (X_k, W_k) \). In addition time-homogeneity (Cinlar 1975, Glynn 1989) is assumed. The details are beyond the scope of this paper but there are two major implications. First, a time-invariant Markov transition kernel is associated with the embedded chain. ![Figure 2: One-dimensional Illustration of a Generalized Semi-Markov Process.](image-url) Next, the sojourn times are conditionally independent given the embedded chain and with the distribution of \( W_k \) depending only on \( X_k \) and \( X_{k+1} \). This ensures semi-Markov behavior of the process \( S(t) \). Due to the inherent stochastic restrictions of the GSMP formulation, the embedded chain is completely characterized by a time-invariant single-step behavior. For a departing state \( x = (s, c) \) the probabilistic transition into the next state \( x' = (s', c') \) can be expressed (Haas and Shedler 1988) by the joint probability distribution function \[ P(x, A) = p(s'; s, D^*, c^*) \prod_{c_i \in \mathcal{O}} F(a_i; s', e_i, s, D^*) \prod_{c_i \in \mathcal{O}} I[0, a_i](c^*_i) \quad (1) \] Here \( A \) is a subspace for \( x' \) corresponding to the case that natural state \( s' \) is entered and the clock reading associated with active event \( e_i \) set to a value \( c'_i \in [0, a_i] \). The vector \( c^* \) in equation (1) refers to the updated clock readings just prior to the transition. Further, \( \mathcal{N} = \mathcal{N}(s'; s, D^*, c^*) \) is a set of new events becoming active due to the transition and \( \mathcal{O} = \mathcal{O}(s'; s, D^*, c^*) \) is the set of old events remaining active. For each old event \( e_i \in \mathcal{O} \) we set \( c'_i = c^*_i \) keeping the updated clock reading after the transition. New clock readings are generated for each event \( e_i \in \mathcal{N} \). A family of probability distribution functions \( F(: s', e_i, s, D^*) \) is defined so that \( F(a_i; s', e_i, s, D^*) \) is the conditional probability that event \( e_i \) is scheduled with a new clock value \( c'_i \in [0, a_i] \). Each remaining event \( e_i \in (\mathcal{E} - \mathcal{N} \cup \mathcal{O}) \) is cancelled by setting its clock and speed \( c'_i = r_i = 0 \). Finally, \( p(: s, D^*, c^*) \) is a family of probability density functions so that \( p(s'; s, D^*, c^*) \) denotes the probability that the next state is \( s' \). Note the product form of equation (1) suggesting that independence is at play. This contributes to the analyticity of a GSMP. ### 3 COMPOSITIONAL GSMP MODELING The basic GSMP formulation is tractable for simple applications. As the number of components in the state description and the number of events grow, combinatorial explosion quickly arises. This means that the number of state/event combinations to consider become too numerous to handle. As always, the solution is to decompose the problem. Our development of a compositional GSMP view is based on establishing a particular separability condition. It starts with regarding the state space \( S \) in terms of three components indexed by \( a, b \) and \( c \), hence \( S = S_a \times S_b \times S_c \) and we write the natural state vector as \( s = (s_a, s_b, s_c) \). Accordingly, we partition the set of events \( \mathcal{E} \) in three disjoint subsets \( \mathcal{E}_a \cup \mathcal{E}_b \cup \mathcal{E}_c \) and write \( c = (c_a, c_b, c_c) \) for the clock vector. The set of triggering events is decomposed in the same way \( D^* = D^*_a \cup D^*_b \cup D^*_c \) where \( D^*_j \subseteq \mathcal{E}_j \) for \( j = a, b, c \). For convenience we will use double-indexing to refer to two components simultaneously. E.g. \( c_{b,c} = (c_b, c_c) \) and \( \mathcal{E}_{b,c} = \mathcal{E}_b \cup \mathcal{E}_c \). In order to arrive at a separable process certain independence restrictions are imposed. Our interest is to obtain independence in the sense that components \( a \) and \( b \) are condition on \( a \) only, whereas component \( c \) is conditioned on both \( b \) and \( c \). This is illustrated in figure 3. The underlying idea is to support an object-oriented programming approach. Component \( a \) and \( c \) take the role of objects. The self-point communication suggests that each object have self-driving capabilities. Further, component \( a \) acts as a sending object whereas component \( c \) corresponds to a receiving object. Component \( b \) is used to capture one-way inter-object communication. It corresponds to the concept of an interface as introduced in section 4. The figure suggests that the interface is considered to be part of the receiving object. This explains why component \( c \) is conditioned on both \( b \) and \( c \). That component \( b \) is conditioned on \( a \) only, reflects the fact that an interface has no self-driving capabilities. Formalistically, the separability condition translates into the following requirements. The probability density functions \( p(:, s, D^*, c^*) \) are separable in the sense that \( p(s'; s, D^*, c^*) = p(s'_a; s_a, D^*_a, c^*_a) \cdot p(s'_b; s_b, D^*_b, c^*_b) \cdot p(s'_c; s_c, D^*_c, c^*_c) \). Further, new events are generated component-wise according to \( N = N_a(s'_a; s_a, D^*_a, c^*_a) \cup N_b(s'_b; s_b, D^*_b, c^*_b) \cup N_c(s'_c; s_c, D^*_c, c^*_c) \). Likewise, the decision about which old events to retain are made component-wise according to \( \mathcal{O} = \mathcal{O}_a(s'_a; s_a, D^*_a, c^*_a) \cup \mathcal{O}_b(s'_b; s_b, D^*_b, c^*_b) \cup \mathcal{O}_c(s'_c; s_c, D^*_c, c^*_c) \). Finally, new events are scheduled according to component-wise probability distribution functions \( F_a(:, s'_a, e_i, s_a, D^*_a) \), \( F_b(:, s'_b, e_i, s_b, D^*_b) \) and \( F_c(:, s'_c, e_i, s_c, D^*_c) \). The decomposition strategy just described can be applied repeatedly, of course. In sum, arbitrary complex models can be developed in a compositional setting. This provides the theoretical foundation for the object-oriented implementation of GMSim. 4 GMSim OVERVIEW The GMSim tool is structured as shown in figure 4 and consists of a number of packages to be loaded into a Tcl interpreter. The interpreter must exist in the realm of a running program. Each package comprises binary code which is dynamically linked\(^1\) with the executing program at load-time. One of the standard Tcl/Tk shells tclsh or wish are normally used to host the interpreter. The specific package named core must be loaded to set up the basic simulation environment. This results in an enriched set of commands and global variables that enable simulation. Names added to the interpreter have the format sim.xxx. The full set of commands is documented in (Nilsen 1998). The new script commands are used to build and manage simulation models. A model comprises items instantiated from various prototype classes. Since the class concept in GMSim builds directly on C++ classes, the full power of inheritance and polymorphism characteristic for object-oriented programming is available. An item that participate in the simulation is called an alive object. A simulation model can also comprise other kinds of objects like dead objects, configuration objects and statistics (Nilsen 1998). Due to space limitations these features of GMSim are not discussed in this paper. An alive object corresponds to a component in the compositional GSMP formulation discussed in section 3. The object must be instantiated from a class which has a piece of behavioral code written according to the compositional GSMP view. Connections between objects are formed by links and interfaces. This is illustrated in figure 6 for a particular example to be discussed later. Interactions takes place in terms of the connecting links. Objects possess one or more interfaces (shaded) and the links are typed according to the interfaces they conform to. Hence, only compatible objects can be linked. The GMSim core provides no classes. This is left to user-defined packages. Each package is expected to implement additional classes according to the compositional GSMP view. The recognized classes depend on which packages are loaded. Hence, the modeling capabilities of GMSim can be extended in arbitrary ways without recompiling the core. The operation of GMSim is illustrated in figure 5. It alternates between the binary domain and the script domain. The command loop is responsible for parsing script commands. Simulation proceeds by transferring control to the binary domain and the object dispatcher loop. In turn, the instantiated (alive) objects gain control according to their ordering in a scheduler queue. For each visited object a piece of behavioral code is executed before control is relinquished. Scheduling is discussed in more detail in section 7. The package system represents a way to extend the modeling capabilities of GMSim. The behavior of the tool itself can be extended by script programming. The idea is to permit the user to specify Tcl procedures that will be evaluated by GMSim at specific points during operation. This is illustrated in figure 5 and the procedures are called script hooks. Further discussion of the script hook facilities are beyond the scope of this paper. GMSim provides a graphical user interface if the hosting program supports Tk. Figure 7 shows the appearing screen for a particular simulation example. The main window shows a log of responses as script commands are evaluated. The log is an example of a report in GMSim. A Report, which is associated with an underlying text file and optionally a window, can be managed entirely from the script domain. A particular kind of report, called a dump report, can be requested for any alive object. This makes the object verbose about its inner workings. The verboseness features together with the facilities for simulation control are indispensable debugging aids. This is particularly important for complex models with many objects and involved interactions. Note however that the debugging features can be turned off to gain execution speed for batch runs. Note finally that GMSim includes a system where configuration parameters for objects can be set and read from the script domain. \(^1\)Dynamical linking is a feature of the Tcl interpreter. 5 EXAMPLE: M/M/1 QUEUE To get an idea of GMSim in action we consider a M/M/1 queuing (Kleinrock 1975) example. The queue model comprises three objects as depicted in figure 6. The ![Figure 6: The M/M/1 Queuing Model.](image) involved classes, links and interfaces are also shown. The leftmost object generates arrivals which are immediately fed to the intermediate queuing object. The rightmost object corresponds to the service facility. The source-code for the implementation of this example is available from the GMSim source distribution. Otherwise, the reader is referred to section 6 which describes the programming interface of GMSim. The script file used to build the model and launch a particular simulation is listed below. ```plaintext # Supress all command in log sim_log mask "" # script hook used by arrival statistics proc arrHook {who num} { if {$num > 0} { # write time and current count to report sim_rep write arep "[sim_curr time]: \" [sim_stats read $who]" } } # invoke hook at every arrival return [list [expr $num + 1] "" } # This example depends on mm1 package sim_pkg require mm1 # gstats is a standard package for statistics sim_pkg require gstats # class parameters sim_par set ExpArr "-#queue" 1 sim_par set ExpSrv "-#queue" 1 sim_par set Queue "-#srv" 1 # allocate space for 3 objects and 1 statistics sim_alloc 4 # create arrival, server and queue objects set arr [sim_new ExpArr] set srv [sim_new ExpSrv] set queue [sim_new Queue] # create count statistics set arrcnt [sim_new Count] # link objects sim_link set $arr queue $queue sim_link set $srv queue $queue # prepare for run, slow speed sim_speed slow sim_run setup # assign statistics and set hook sim_stats assign $arr -ArrCnt $arrcnt sim_hook add $arrcnt arrHook # open statistics report and dumps for objects sim_rep open arep -mode w sim_rep won arep -width 30 -height 20 sim_dump won "$arr $queue $srv" -width 40 -height 40 # perform 3 state transitions for {set i 0} {$i < 3} {incr i} { sim_run go > } We leave this without further comments but note that it involves two additional packages called mm1 and gstats. Dump reports for each of the three objects are also prepared. If this script file is sourced by GMSim the appearing windows will be as shown in figures 7 and 8. ![Figure 7: The Main and Command Windows for the M/M/1 Queuing Example](image) Except from menus and buttons, the main window displays the simulation log. The last (dimmed) line shows the response after the most recent simulation step. The three windows in figure 8 show the requested dump reports. The lower window in figure 7 is the command window. As commands are entered here they are passed to the interpreter. This makes GMSim ideal for interactive use. However, the tool can also be used in non-interactive (batch) mode. Then all windows are suppressed. 6 PROGRAMMING The following subsections give a flavor of how object-oriented programming according to the GSMP view takes place. Macro expansion and the concept of C++ hook functions are central to the discussion. Note that this is completely different from script hooks as discussed in section 4. See (Nilsen 1998) for a complete specification of the programming interface. 6.1 Macro Expansion Code development for GMSim depends on using a number of M4 macros in a C++ environment. The idea is to extend the concept of a class declaration by using block constructs like ``` sim_xxx(...) sim_use(...) { sim_yyy(...); ... sim_data: ... sim_hooks: ... sim_body: ...}; ``` where the names prefixed by `sim_` are M4 macros. As the macros are expanded code is automatically generated that takes care of all interactions with the GMSim core. Various kinds of blocks are recognized corresponding to the different kinds of prototype classes. In section 6.2 we discuss the most important case, alive classes, in more detail. Note that as the block-opening macro `sim_xxx` is expanded, the actual class inherits a common hierarchy of base classes pertinent to GMSim. This is invisible to the programmer. The `sim_use` macro is always used to specify inheritance. Anything between the delimiting `sim_data` and `sim_hooks` statements is expected to be ordinary C++ variable declarations pertinent to the class. The trailing part of the block, i.e. after the `sim_body` statement, is expected to be ordinary member function declarations. For each of the block constructs there is a set of member functions, referred to as hooks. The hook functions are called from within the core and represent a convenient way to let the user implement a particular behavior for a class. Each hook has a default implementation which is used unless overridden by the user. Overridden hooks should be declared between the `sim_hooks` and the `sim_body` statements. Note that there will be several hooks of the same type in a multi-level class hierarchy. All instances are called in response to a hook invocation. 6.2 Alive Classes An alive class is declared by the construct ``` sim_vaclass(name) sim_use(...) { sim_events(...); sim_links(...); sim_data: ... sim_hooks: <std. hooks> void nextState (void); Sim_UsrTime nextOccur (int ev); void verbose(ostream &os); sim_body: ...}; ``` Emerging links are specified by the `sim_links` macro. The type designation of a link must correspond to an interface declared elsewhere. In addition to specifying ordinary inheritance, the `sim_use` macro is used to declare that the class conforms to a particular interface. Only links with a conforming type can connect to an instantiated object. In accordance with the GSMP view a number of events can be defined for the class by the `sim_events` macro. The following event-set identifiers are also introduced in the scope of the class: `trigEvs`, `actEvs`, `oldEvs`, and `newEvs`. These sets are used to express the behavior at a state transition according to the GSMP formulation in section 2. A state description comprises ordinary C++ variables in the `sim_data` section. The `nextState` hook is responsible for maintaining the state. The hook is invoked at every state transition and is the most important hook as it implements the behavioral model for a class. This includes handling of the event sets `oldEvs` and `newEvs`. By default, the assignment `oldEvs = actEvs` is made just before visiting the object. Immediately after visit the `nextOccur` hook is called for each event in `newEvs`. This determines when the actual events is to be scheduled. Scheduled events may also be canceled at this point. The `verbose` hook can be used to extend the verboseness when dumps are prepared. It is a good habit... to always supply such a hook since it is often of great help in tracking programming errors. Otherwise, there is a number of standard hooks for each class (not shown) that can be used to set and check configuration parameters, and initialize and clean the object to a known state. 7 SCHEDULING Every alive object is responsible for proper scheduling of its own events. In fact, local scheduling is an intrinsic part of the GSMP formulation. The objects are in turn arranged by a global priority queue. Hence, GMSim employs a two-level scheduling strategy. This is efficient since the number of entries \( N \) in the global queue is reduced. There are several ways to implement the global scheduler queue (McCormac and Sargent 1981, Jones 1986, Chung et al. 1993). The methods can be classified depending on whether they use time-mapping (Kingston 1986, Brown 1988) or maintain a balanced tree structure (Kingston 1985, Sleator and Tarjan 1985). The former class employs the principle of hashing. It has the potential of performing a queuing operation \(^2\) in \( O(1) \) time, thus being independent of queue size \( N \). Unfortunately, this works well only if \( N \) and the scheduling distribution does not vary too much during the course of a simulation. The tree based methods are more robust to dynamic variations. The provision is that the tree is balanced so as to keep a queuing operations bounded by \( O(\log N) \). Since \( N \) can often be quite large in complex simulations, logarithmic behavior is essential. One way to achieve tree balancing is to impose a structural constraint and reorganize the tree accordingly at each access. A less strict approach is to use restructuring heuristic which do not guarantee that the tree is always balanced. However, amortized over a large number of accesses the tree will be sufficiently balanced for the \( O(\log N) \) bound to apply. In GMSim a tree based pairing heap (Fredman et al. 1986) algorithm is used to maintain the global queue. The algorithm employs a lazy restructuring heuristic for the heap-ordered tree rather than strict balancing. The algorithm is insensitive both to dynamic variations in \( N \) and also in the scheduling distribution. In the amortized sense a queuing operation will be bounded by \( O(\log N) \). A salient feature is that the administration cost associated with an entry depends mainly on its life-time in the queue and less on the number of entries \( N \) at any particular time. Hence, insertion is bounded by \( O(1) \) and the waste is kept at a minimum when an entry is exceptionally removed from the queue. We argue that this is a nice feature since exceptional removal will probably be a frequently occurring case when GSMP modeling is used. In sum, we argue that the paring heap strategy fits well with the compositional GSMP view and that it performs well under various operation conditions. 8 CONCLUDING REMARKS The contribution of this paper has been the development of a compositional GSMP view and how this can be combined with an object-oriented programming approach. The proposed methodology deals with combinatorial exploding state space which is otherwise characteristical for complex systems. We have restricted attention to the simulation aspect of the GSMP framework but it is important to keep in mind that the reason for applying the mathematical description in the first place is the flavor of qualitative theory that can be established. E.g. asynchronous sampling (Bratley et al. 1987, Fox and Glynn 1987), which is generally considered to be efficient, follows easily from the GSMP view (Glynn 1988). Since the systematic and well-structured GSMP formulation is directly reflected by GMSim, we argue that the tool is both consistent and efficient. Combined with the debugging features, the run-time linking property and the scripting facilities, we think that GMSim represents a versatile and convenient simulation tool. The fact that it is distributed with the source code also makes it suitable for research on simulation methodology. Even if we strongly believe that GMSim is efficient with respect to execution time, this remains to be properly documented. One direction for future research is to study the performance of GMSim compared to other tools. ACKNOWLEDGMENTS This work is mainly supported by grant no. 100722/410 from the Norwegian Research Council. Additional funds have been provided by Telenor RD. REFERENCES **AUTHOR BIOGRAPHIES** **FRODE B. NILSEN** is currently employed as a Research Scientist at Telenor RD (the dominant PNO in Norway) working on strategic development of the access network. Previously he was employed as a Research Assistant at the Dept. of Informatics, Univ. of Oslo. He received a M.S. and Ph.D. from the same place in 1993 and 1998, respectively. His research interests are network architectures, high-speed communication, data communications and methods for performance evaluation.
{"Source-Url": "http://www.informs-sim.org/wsc98papers/074.PDF", "len_cl100k_base": 6958, "olmocr-version": "0.1.50", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 27593, "total-output-tokens": 8619, "length": "2e12", "weborganizer": {"__label__adult": 0.0003998279571533203, "__label__art_design": 0.00036835670471191406, "__label__crime_law": 0.0004055500030517578, "__label__education_jobs": 0.0011606216430664062, "__label__entertainment": 0.00015652179718017578, "__label__fashion_beauty": 0.00019478797912597656, "__label__finance_business": 0.0005230903625488281, "__label__food_dining": 0.0004453659057617187, "__label__games": 0.000942230224609375, "__label__hardware": 0.0020503997802734375, "__label__health": 0.0008602142333984375, "__label__history": 0.00047469139099121094, "__label__home_hobbies": 0.0001468658447265625, "__label__industrial": 0.0010538101196289062, "__label__literature": 0.00031495094299316406, "__label__politics": 0.00046324729919433594, "__label__religion": 0.0005784034729003906, "__label__science_tech": 0.34033203125, "__label__social_life": 0.0001404285430908203, "__label__software": 0.0117340087890625, "__label__software_dev": 0.6357421875, "__label__sports_fitness": 0.0004730224609375, "__label__transportation": 0.0008139610290527344, "__label__travel": 0.00024890899658203125}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 32864, 0.0225]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 32864, 0.61582]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 32864, 0.89446]], "google_gemma-3-12b-it_contains_pii": [[0, 3305, false], [3305, 8334, null], [8334, 13981, null], [13981, 18238, null], [18238, 21470, null], [21470, 24927, null], [24927, 29819, null], [29819, 32864, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3305, true], [3305, 8334, null], [8334, 13981, null], [13981, 18238, null], [18238, 21470, null], [21470, 24927, null], [24927, 29819, null], [29819, 32864, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 32864, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 32864, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 32864, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 32864, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 32864, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 32864, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 32864, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 32864, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 32864, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 32864, null]], "pdf_page_numbers": [[0, 3305, 1], [3305, 8334, 2], [8334, 13981, 3], [13981, 18238, 4], [18238, 21470, 5], [21470, 24927, 6], [24927, 29819, 7], [29819, 32864, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 32864, 0.0]]}
olmocr_science_pdfs
2024-12-01
2024-12-01
bbb883272e2091ee2ec72120ef46f1810612db59
Class Responsibility Assignment (CRA) for Use Case Specification to Sequence Diagrams (UC2SD) Nurfauza Jali1,2, Des Greer1 and Philip Hanna1 1 School of Electronics, Electrical Engineering and Computer Science, Queens University Belfast, Belfast, Northern Ireland, United Kingdom 2 Faculty of Computer Science and Information Technology, Universiti Malaysia Sarawak, Kota Samarahan, Sarawak, Malaysia Abstract—Identifying responsibility for classes in object-oriented software design phase is a crucial task. This paper proposes an approach for producing high quality and robust behavioural diagrams (e.g. Sequence Diagrams) through Class Responsibility Assignment (CRA). GRASP or General Responsibility Assignment Software Pattern (or Principle) was used to direct the CRA process when deriving behavioural diagrams. A set of tools to support CRA was developed to provide designers and developers with a cognitive toolkit that can be used when analysing and designing object-oriented software. The tool developed is called Use Case Specification to Sequence Diagrams (UC2SD). UC2SD uses a new approach for developing Unified Modelling Language (UML) software designs from Natural Language, making use of a meta-domain oriented ontology, well established software design principles and Natural Language Processing (NLP) tools [6][7]. This tool then generates a well-formed UML sequence diagrams as output. Keywords—Class Responsibility Assignment; Software model; UML; Software Design Pattern; Responsibility Driven Design I. INTRODUCTION Finding class responsibilities in object-oriented analysis and design (OOAD) is not an easy task, although there is evidence that responsibility driven approach is effective [1][2][3][4]. Not only is this crucial during early analysis and design phases, but also during maintenance when new responsibilities have to be assigned to classes, or existing responsibilities have to be changed. All the current approaches are depend on human interpretation and decision making. This paper addresses the need to assist this decision making and describes an approach that can be used to support and improve the translation of natural language based software requirements to behavioural models that can in turn be translated to program code. A set of tools to support Class Responsibility Assignment (CRA) was developed to provide designers and developers with a cognitive toolkit that can be used when analysing and designing object-oriented software. This attempt is applied to a tool called Use Case Specification to Sequence Diagrams (UC2SD)[5]. UC2SD is a tool that uses a new approach for developing Unified Modelling Language (UML) software designs from Natural Language, making use of a meta-domain oriented ontology, well established software design principles and Natural Language Processing (NLP) tools [6][7]. This tool then generates a well-formed UML sequence diagrams as an output. The rest of the paper is organized as follows. In the next section, we provide background overview of related research. Section III presents the description technique of GRASP including responsibility description. We respectively present the developed tool and a demonstration of its efficacy in Section IV and provide some discussion and conclusions in section V. II. BACKGROUND AND RELATED WORK The most vital and important step in creating the object-oriented software design is assigning responsibilities to classes. The design problem relates with the difficulty in identifying the participating classes and instances, collaboration, responsibilities and their role. Thus, design patterns are useful because they could save time and effort in solving a problem that already been solved. Furthermore, when the patterns’ adoption increases among the designers, this in turns reduces their cognitive load when they encounter the similar design elements. In other word, pattern provides a blueprint that is very useful for the software designers. In OOAD, Class responsibility assignment (CRA) is known as a significant learning aid in helping to identify classes, responsibilities and roles. Bowman [8] and Larman [9] defines CRA as how the classes responsibilities can be identified through the form of class operations/methods and as well as the manipulated attributes belonging to and how object should interact by using those operations. Larman has stated that “the critical design tool for software development is a mind well educated in design principles. It is not the UML or any other technology." The designers must have knowledge and skills in understanding the design patterns by mapping the problem and provides guidelines for imaging and designing the solution. There has not been much work related to responsibilities of classes to improve the quality of software design. We are aware that there exist few well-reasoned and described design patterns or principles that assist us in understanding the essential object and class design [4]. There are Responsibility Driven Design (RDD)[10], Gang of Four (GoF) [11], and... GRASP\cite{9}. In this paper, we only focus on the GRASP pattern because it is the basis of RDD and more generic than GoF. Larman has introduced GRASP or also known as General Responsibility Assignment Software Patterns or Principles as a cognitive toolset, which consist of guidelines for assigning responsibility to classes and objects in object-oriented design. GRASP guidelines help software designers to balance the trade-offs and give advantages for writing class methods with behaviours that affect multiple classes. In solving the CRA problem, there were current works done by Bowman and Glavas by using the Genetic algorithm\cite{6}\cite{10} and Metaheuristic approach \cite{11}\cite{12}. Some of their approaches have been adapted and applied in this project in much more simplified manner. III. PROPOSED APPROACHES We have proposed architecture for a toolset, Use Case specification to Sequence Diagrams (UC2SD) that allows us to produce UML sequence diagrams from the text requirements provided by the stakeholder(s). This architecture will focus on the modelling aspects of the process, largely where the result is to generate diagrams and software code to represent the solution. Requirements analysis will then include an automated Natural Language Processing (NLP) \cite{10}\cite{11} process. In turn, the requirements analysis to design phase will involve the extraction of object model elements such as classes, attributes, methods and relationships derived from the NLP \cite{12}\cite{13}. The inclusion of knowledge in related to domain ontologies that will help to refine the object and properties candidates. In the software design and the implementation phases, these components will assist in building software models such as UML diagrams and software code. The data verification for each module will be evaluated by human experts. Data correction is a part of the verification process. Thus, we are aiming at design support rather than complete automation. In this paper, we will only discuss the Object Oriented Design Module with the UML Diagram Construction task (see Fig. 1). A detailed discussion on UC2SD architecture can be obtained in our previous publication \cite{5}. Participating actors/classes, messages/ methods and attributes are mapped respectively with nouns, verbs and adjectives and are then translated into UML sequence diagram constructs. In the beginning, a system sequence diagram (SSD) will be produced, followed by a detailed sequence diagram. Fig. 2 shows the process flow and how both the diagrams are generated. The output from the NLP processor will be used to generate sequence diagrams. Each sequence diagram will be visualized not just for main success scenarios but also for alternative and exception scenarios. Following the generation of a System Sequence Diagram (SSD), detailed sequence diagrams can follow. As illustrated in Fig. 3, we assume the stereotypes: boundary, controller and entity classes. Boundary classes are those that interact with system actors; Entity Classes are those that represent objects in the system. Controller classes are those that mediate between Boundary and Entity classes, handling calls and passing the responsibility of responding to these to entity objects. To move to detailed sequence diagrams, we must consider how objects collaborate with other objects to implement system operation. To achieve this we have applied the General Responsibility Assignment Software Principles (GRASP) \cite{19}, including Creator, Information Expert, Controller, Low Coupling and High Cohesion principles. Fig. 1. Architecture of Use Case specification to Sequence Diagrams (UC2SD) Fig. 2. Process flow of Use Case specification to Sequence Diagrams (UC2SD). Fig. 3. Use case realisation in Sequence Diagram There are used as follows: - Creator determines which object should be responsible for creating another specific object; - Information Expert determines which object should be responsible for a responsibility based on it having the necessary data to fulfill the responsibility; - Controller determines which object should be the first to receive a message from an external actor; - Low Coupling is used to choose between objects for responsibility assignment, based on the degree of interaction between objects; - High Cohesion is used to choose between objects for responsibility assignment, based on how internally related the assigned responsibility is in the case of each object. The goal of applying these principles is to identify class responsibility which in turn establishes its collaboration. **IV. DEMONSTRATION AND ANALYSIS** A Use Case specification to Sequence Diagrams (UC2SD) generator was designed and constructed in order to demonstrate the approach. The use case specification template has been formulated, which includes the most important components in order to build the sequence diagram. We used the processing resources that GATE [7][20] provides which are made available in the form of plug-ins. We also use ‘A Nearly-New IE’ (ANNIE) system [21] which supports a sentence splitter, tokeniser, morphological analyser, part of speech tagger, gazetter and orthomatcher. Aside from ANNIE, GATE makes it possible to use the Java Annotations Pattern Engine (JAPE) transducer [7] which provides a way to process text over specified annotations and to further identify patterns or entities in text. ANNIE relies on finite state algorithms and JAPE even supports an Ontology-API[22] which helps represent knowledge understanding in object relations. Input text is from the use case provided by the user, which needs to be tokenized and split into sentences. In every information retrieval process, this is a common procedure. Each token (i.e. number, word, punctuation) is then assigned with Part-of-Speech (POS) tags where the grammars are based on Penn Treebank Tagset which applies the Hepple's Brill-style tagger [23]. Hence, a word that is found to be a ‘stop word’ will be eliminated (i.e.: a, maybe, the, etc…). This process is assisted by a morphological analyser which involves lemmatization or word stemming. Next, the JAPE transducer will trigger the grammar rule to identify and annotate objects and messages from the given Syntactic Rules (SR), attached in the previous publication [5]. The JAPE syntaxes have been developed for all of the SRs. Thus, before the XML is produced, a frequency analysis step is carried out to produce frequency lists of overall word form. The selection of candidate classes are based upon the frequency of the nouns appearance, and the result will then be verified by the user. This so called object properties extraction are now used to construct a System Sequence Diagram (SSD). The SSD is a sequence diagram that shows the event interaction between external actors with the system object. Fig. 4 and 5 illustrates the Point of Sales (POS) system specification for process sale use case and SSD generated. This SSD describes: - each method is labelled above the arrow; - method parameters in brackets for each message; - the message represented as solid arrows and returns represented as a dotted line arrow. The SSD generation is a relatively straightforward task as it only involves the external actors, message flow and System object. However, more detailed system design can be derived with potential classes involving three common stereotypes (boundary, controller and entities). Thus, to construct a refined Sequence Diagram (rSD) as shown in Fig. 8, the classes selected from potential classes were finalised and responsibilities determined for objects within the system. To achieve this, we use the Point of Sales – Business Management Ontologies (POS-BMO) ontology [5][19] to map the extracted object properties extraction to appropriate objects. First the tool adds all the entity objects from preceding ontology analysis and then it transforms some individual messages on the GRASP rules. Finally, it divides the System class into a Boundary class; a Controller class and Entity classes adjust the messages accordingly. All of this is currently done against a representation of the sequence diagrams in XML, via the Document Object Model (DOM) API. In Creator, the pattern directs us to who should be responsible for creating a new instance of some class? According to Larman [6], using a Point of Sale system example, the Creator principle applied to ‘Process Sale’ use case is justified as follows: - **SystemRegister** is responsible for creating the **Sale** object because the **SystemRegister** is used by the **Cashier** to ring in a **New Sale**. - The **Sale** object is responsible for creating the **Payment** object, as **Payment** is only being made when a **Sale** is being made. Hence, the **SystemRegister** makes a **Sale** object which in turn makes a **Payment** object. ![Fig. 4. UC2SD Automation of System Sequence Diagram (SSD) production](image-url) The Information Expert principle guides us to assign responsibilities to objects where the object becomes an expert for service if it has the ability or information to fulfill the obligations of that service. According to Larman [6], the Information Expert principle applied to the Process Sale use case is described as follows: i. **SystemRegister** is the Information Expert for the following services: `makeNewSale`, `enterItem`, `endSale`, and `makePayment`, as it has the requisite information on hand to fulfill these obligations. ii. The **Sale** object is responsible for `getTotal`, `makePayment`, and `makeLineItem`. The picture should also include a call of `makeLineItem` to the `SalesLineItem` object. iii. The **Product** object is responsible for providing its own `price`, so it has a function called `getPrice` for this activity. The Controller pattern handles system operation messages between the actor and the first object in the domain layer. It is responsible for delegating tasks to other objects. In general, we are trying to put the methods in a class that has the most knowledge of how to implement the method. This class will serve as a Controller for other classes and in a way it minimizes the number of cross-dependencies between each class. We assumed that a Controller pattern can be identified with the controller stereotype class, detailed earlier. In one of the heuristic [23] we can identify a controller class for each use case. Again the use of the Controller principle applied to Process Sale use case is described as follows: - **SystemRegister** is the controller class who is responsible for delegating messages flow from Cashier as the actor class. - Before each message received by entity classes, **SystemRegister** will take control of the messages. The GRASP principles of High Cohesion and Low Coupling are not hard-and-fast rules, but rather goals to be achieved in so far as possible, given other constraints, and also given their potential to sometimes conflict with each other. Finding an optimal design under GRASP thus involves a search through the solution space for the best solution. Such a search is not too complex if these are the only “soft constraints” we wish to optimize for. But if we wish to allow additional soft constraints to be specified in the future, then the complexity can grow very quickly. Fortunately, there are some off-the-shelf open source tools handling such complex directed searches. The so called tool used is the Drools Planner [25][26]. With any such planner, the soft constraints need to be quantified so that competing solutions can be compared. This quantification is called a metric or a fitness function. Quantifying Coupling is straightforward. Quantifying Cohesion is not so easy, because it requires knowledge of the semantics of functions (whether two functions are “related” or “unrelated”). Our system will have to rely on an ontology to provide this semantic information. Fig. 6 and Fig. 7 show the metric evaluation for Coupling and Cohesion in both initial and refined sequence diagrams. The counts in the table on the metrics tab are combined into a scalar metrics value for Coupling, and likewise for Cohesion. Metrics for both the initial Sequence Diagram (iSD) and refined Sequence Diagram (rSD) are shown to how the refinement is chosen and how it will decrease Coupling and increase Cohesion. Below are the formula used to calculate the metric Coupling on both iSD and rSD: \[ \text{average of message flows} = \frac{\text{sum number of message flows}}{\text{number of classes}} \] \[ \text{average of class interactions} = \frac{\text{sum number of message class interaction}}{\text{number of classes}} \] The higher the average scores, the higher possibility the diagrams will be chosen. In some cases, iSD will produce higher scores than rSD which means the quality of the sequence diagram is better. To illustrate how the metrics measurement for iSD and rSD is being applied, referring to figures 6 and 7: i. If the design shown currently in the rSD tab produces worse or lower metrics count than the one in iSD, the tool will not accept the design currently as the rSD. It would either leave the design unchanged from iSD, or possibly produce some different design. ii. The idea of refinement is mainly to reduce the coupling but if it also increases Cohesion, then we can justify the increase in Coupling as a trade-off. The result of the metric Cohesion shows none of the classes has a different Cohesion score for the rSD than for the iSD. So the only metric that’s different at this stage is the Coupling, where iSD is better than the rSD. The quality of the sequence diagram is evaluated in terms of a set of measures: Completeness, Correctness, and BCE (the Boundary/Controller/Entity principle) Consistency[27]. To evaluate the quality of sequence diagrams produced by participants, we will make use of sequence diagrams given in textbooks or other resources. In the case of none of the resources being available, help from Object Oriented experts are needed. The completeness of a sequence diagram (SD\text{complete}) is calculated as the average of the completeness of the messages, interaction uses, and combined fragments contained in the sequence diagram. Fig. 6. Metric coupling in iSD and rSD Fig. 7. Metric Cohesion in iSD and rSD – Item Class Fig. 8. Refined Sequence Diagram The correctness of the sequence diagram (SD_correct) is evaluated as the average of the correctness of the messages, interaction uses, and combined fragments of the sequence diagram. The rationale is that the message is one of the most important elements of sequence diagrams and SD Completeness, and SD Correctness indicate the overall completeness and correctness of a sequence diagram, including the completeness and correctness of its interaction uses and combined fragments. Therefore, it is not necessary to report on the completeness and correctness of interaction uses and combined fragments separately. Meanwhile, the BCE measurement is evaluated through a number of messages passed through the class stereotypes. This interaction will not allow the Boundary classes to interact with the Entity classes. The Controller becomes the mediator to manage the interaction between the classes. V. DISCUSSION AND CONCLUSION Each of the GRASP patterns that have been applied to identify the class relationship and collaboration has their own generic task and uses. Creator, Controller, and the Information Expert can be evaluated by using the BCE measurement and rules applied. The SSD is generated before the iSD and rSD can be visualised where the classes are categorised into common stereotypes of BCE structures. Then, through coupling and cohesion class metric measurement, the interaction between classes was measured to improve the quality of the sequence diagram. By applying GRASP on CRA it was concluded that the solution need not always be the best but it will be optimal. Possibilities of deriving the best solution are still under study. In the object-oriented software system, every class should have set of responsibility, and it should be allocated optimally. We can find the optimal fitness function or metric calculation for each software component. In automatically producing behavioural models from text, we have to identify the proper object, classes, attributes relationships and so forth for building a System Sequence Diagram and Refined Sequence Diagram (rSD) by applying rules based on GRASP Principles. We have successfully developed a computerized support for CRA to provide a cognitive toolset to help designers and developers on the analysis and design of object-oriented software. ACKNOWLEDGMENT The authors gratefully acknowledge Ministry of Higher Education (MOHE) Malaysia, as part of the first author’s PhD studies scholarship. Furthermore, the authors also recognise the funding support for the conference provided by the School of Electronics, Electrical Engineering and Computer Science of Queen’s University Belfast. REFERENCES
{"Source-Url": "http://www.cs.qub.ac.uk/~Des.Greer/Mysec2014Jali.pdf", "len_cl100k_base": 4364, "olmocr-version": "0.1.50", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 19787, "total-output-tokens": 6209, "length": "2e12", "weborganizer": {"__label__adult": 0.00030803680419921875, "__label__art_design": 0.0003933906555175781, "__label__crime_law": 0.0002994537353515625, "__label__education_jobs": 0.00164794921875, "__label__entertainment": 4.9591064453125e-05, "__label__fashion_beauty": 0.00014495849609375, "__label__finance_business": 0.00020170211791992188, "__label__food_dining": 0.00025653839111328125, "__label__games": 0.0004048347473144531, "__label__hardware": 0.0004580020904541016, "__label__health": 0.0003514289855957031, "__label__history": 0.0001844167709350586, "__label__home_hobbies": 7.510185241699219e-05, "__label__industrial": 0.0003006458282470703, "__label__literature": 0.00024509429931640625, "__label__politics": 0.00021505355834960935, "__label__religion": 0.0003535747528076172, "__label__science_tech": 0.00801849365234375, "__label__social_life": 9.03010368347168e-05, "__label__software": 0.004497528076171875, "__label__software_dev": 0.98046875, "__label__sports_fitness": 0.0002472400665283203, "__label__transportation": 0.00039505958557128906, "__label__travel": 0.00017154216766357422}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 26394, 0.02342]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 26394, 0.7686]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 26394, 0.90163]], "google_gemma-3-12b-it_contains_pii": [[0, 5076, false], [5076, 8874, null], [8874, 14032, null], [14032, 19325, null], [19325, 19451, null], [19451, 26394, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5076, true], [5076, 8874, null], [8874, 14032, null], [14032, 19325, null], [19325, 19451, null], [19451, 26394, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 26394, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 26394, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 26394, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 26394, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 26394, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 26394, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 26394, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 26394, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 26394, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 26394, null]], "pdf_page_numbers": [[0, 5076, 1], [5076, 8874, 2], [8874, 14032, 3], [14032, 19325, 4], [19325, 19451, 5], [19451, 26394, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 26394, 0.0]]}
olmocr_science_pdfs
2024-11-29
2024-11-29
16d1bba6cd394f04cf501f8fda0d5a1094b634d3
Aligning an ISO/EIC 42010 System Architecture Model and Agile Practice Ronald Beckett *Swinburne University of Technology*, rcb@reinvent.net.au Rajyalakshmi Gaddipati *Charles Sturt University*, rgaddipati@studygroup.com Follow this and additional works at: [https://aisel.aisnet.org/acis2020](https://aisel.aisnet.org/acis2020) **Recommended Citation** [https://aisel.aisnet.org/acis2020/10](https://aisel.aisnet.org/acis2020/10) This material is brought to you by the Australasian (ACIS) at AIS Electronic Library (AISeL). It has been accepted for inclusion in ACIS 2020 Proceedings by an authorized administrator of AIS Electronic Library (AISeL). For more information, please contact elibrary@aisnet.org. Aligning an ISO/EIC 42010 System Architecture Model and Agile Practice Ronald C Beckett Swinburne University of Technology Melbourne, Australia Email: rcb@reinvent.net.au Rajyalakshmi Gaddipati Charles Sturt University Melbourne, Australia Email: rgaddipati@studygroup.com Abstract The ISO/EIC 42010 system architecture description standard evolved over a number of years with substantial practitioner inputs. It presents a high level, top-down view of requirements that may be interpreted as needed for different applications. Agile system development methods have proved effective in practice, but represent a bottom up view drawing on user stories. The question considered in this paper is how they might be harmonised. Experience from using these tools over several years in practical masters degree student projects has been used to explore this question. We suggest a logical compatibility lies in their core themes: stakeholder needs (who) frame architecture descriptions (what) and the associated rationale (why). A particular interpretation of ISO/EIC 42010 and a model outlining the evolution of architecture in an agile environment are presented. Several suggestions for future research are made. Keywords Agile, architecture description, user stories, models 1 Introduction As smart devices and processes become part of everyday life, new ways of working and doing business continue to evolve. There is pressure for enterprises to become more agile to cope with changing environments (e.g. Nijssen and Paauwe, 2012). Fast learning and an ability to rapidly reconfigure assets is observed in the responses. Systems engineering, computer science and information systems professionals need to work together in developing and sustaining such practices, and role flexibility and boundary spanning is needed (e.g. Sheard, 1996; Prifti et al, 2017). Tools that help reach common understandings and rapidly develop solutions to challenges are needed. For example, Ovaska et al (2003) described the role of system architecture in providing a coordinating mechanism to help understand a system’s functionality. Qumer and Henderson-Sellers (2008) provided an overview of the adoption of agile methods that may help rapidly develop software solutions. However some researchers suggest there are potential shortcomings with such top-down or bottom-up approaches. Thummadi and Lyytinen (2020) compared actual practices and outcomes in different development teams using traditional (requirements engineering /waterfall) and agile project management practices in a large company. They observed process and team knowledge and skill gaps, we wish explore further in this paper. Our research question is: how might architecture and agile perspectives be harmonized? In this paper, we draw on experience from two knowledge and skill development cases to compare similarities, differences and needs. Literature relating to architecture description frameworks and agile practices is first briefly reviewed, followed by a description of the research approach and findings. This leads to the presentation of system architecture description and agile architecture development models, and suggestions about how they can be harmonized. 2 Some Observations from the Literature From a study of goal congruence in a multi-site development environment, Ovaska et al (2003) noted the benefits of defining and describing the system architecture plus requirements for an associated development methodology. In broad terms, the latter involved coordination via a focus on the linkages between architecture functional components. In this way, all the component designers had a common understanding of interdependencies and had well-defined interfaces that supported development of their own components. Youngs et al (1999) described the need for and benefits from the use of an architecture description standard at IBM. An emphasis on a minimal set of shared concepts supported practical use and facilitated teaching a broad range of practitioners with different skills. Working in a similar style across the organization facilitated flexible work assignment and the documents produced could form part of the enterprise knowledge base. A little later, Maier et al (2001) outlined architectural description practices reflected in an IEEE standard, which was subsequently adopted as an ISO standard. A key idea of IEEE 1471 was the introduction of architecture viewpoints to codify best practices for the creation and use of architecture views within an architecture description. Emery and Hilliard (2009) provided background to the deployment of the ISO standard in a paper titled “Every architecture description needs a framework: Expressing architecture frameworks using ISO/IEC 42010”. The following briefly presents this framework and discusses some aspects of its application. Then a review of the application of architectures in agile development projects is presented, where some researchers have suggested there may be coordination issues. This is followed by a brief discussion of the utility “user stories” that are at the core of agile architecture development. 2.1 The ISO/EIC 42010 Architecture Description Framework The elements of this framework are shown in figure 1. The way we view the framework is as follows: 1. The rounded boxes at the top of the diagram (mission, environment, system, and architecture) represent context. The ISO 42010 statement relating to mission is: A system exists to fulfill one or more missions in its environment. A mission is a use or operation for which a system is intended by one or more stakeholders to meet some set of objectives. The operating environment may be considered from multiple perspectives: engineering and operational considerations combined with the digital and application environment as shown. In thinking about the systems element of the ISO 42010 framework it is first necessary to declare the boundaries – what functionality is required within the system to achieve the desired mission and what linkages with the broader ecosystem (e.g. internet connection) are needed to make it work. The architecture is intended to show high level functionality - Architecting is concerned with developing satisfactory and feasible system concepts, maintaining the integrity of those system concepts through development, certifying built systems for use, and assuring those system concepts through operational and evolutionary phases. Detailed systems engineering activities, such as detailed requirements definition and interface specification and the architecting of major subsystems are tasks that typically follow development of the system architecture. (ISO 32010). 2. The central shaded boxes show interactions framing the architectural description. The ISO 42010 standard indicates that: The principal class of users for this recommended practice comprises stakeholders in system development and evolution, including the following: o Those that use, own, and acquire the system (users, operators, and acquirers, or clients) o Those that develop, describe, and document architectures (architects) o Those that develop, deliver, and maintain the system (architects, designers, programmers, maintainers, testers, domain engineers, quality assurance staff, configuration management staff, suppliers, and project managers or developers) o Those who oversee and evaluate systems and their development (chief information officers, auditors, and independent assessors o A secondary class of users of this recommended practice comprises those involved in the enterprise-wide infrastructure activities that span multiple system developments, including methodologists, process and process-improvement engineers, researchers, producers of standards, tool builders, and trainers. ISO 42010 defines an architecture description as a collection of products to document an architecture. Multiple viewpoints are to be represented, and any inconsistency between viewpoints noted. It is suggested the rationale for the architectural concepts selected should be represented, along with evidence of the consideration of alternative architectural concepts plus the rationale for the choices made. If describing an adaptation of a pre-existing system the rationale for the legacy system architecture should be presented 3. The smaller lower boxes represent ways that multiple viewpoints may enrich the architectural description. These boxes will be discussed further later. Figure 1. Elements of the ISO/EIC Framework Table 1. An ISO 42010 element interaction matrix Mo and Beckett (2019) made the following comment on the interactions shown between the elements in figure 1. The standard states that “in the figure, boxes represent classes of things. Lines connecting boxes represent associations between things. An association has two roles (one in each direction).” Within the body of the standard there is reference to other interactions, e.g. “the rationale shall address the extent to which the stakeholders and concerns are covered by the viewpoints selected.” Mo and Beckett (2019) captured these ideas via an interaction matrix, shown as Table 1. The shaded ‘I’ cells represent the linkages shown in Figure 1. Mo and Beckett noted that whilst the diagonal (black X) cells were shown a null, there may be interactions within the cells, e.g. between stakeholders. 2.2 The Evolution of an Architecture Description in an Agile Project Gill (2015) contends that whilst agile development practices focus on developing and delivering working software systems in small iterations with minimal documentation, locally project focused agile practices overlook the need for holistic enterprise architecture. This is seen as a gap in practice. Paetsch et al (2003) suggested that requirements engineering and agile approaches may seem incompatible, with the former relying on a document-centric orientation towards coordination and the latter on a people-centric orientation (e.g. Eberlein and Leite, 2002). However potential synergies were seen in the areas of: customer involvement, interviews, prioritization, modeling, documentation, validation, configuration management, brainstorming, and handling non-functional requirements. Schön et al (2017) conducted a systematic literature review of agile requirements engineering and also suggested there was a need for more empirical studies. They noted that continuous communication and collaboration was the most common approach to user engagement and the most commonly utilized artifacts were user stories, prototypes, use cases, scenarios and story cards. The definition and delivery of non-functional requirements was seen as a particular challenge. Gayathri and Theetchenya (2016) also suggested that lack of attention to non-functional requirements at an early stage of development may compromise software projects. Costa et al (2014) observed that in relatively small agile projects where there is good customer involvement minimal formal modeling or documentation may be needed. That may not be the case in other projects where critical issues and architectural diagrams may have to be formally identified, e.g. in the management of multiple scrum teams. They suggested a practice where user stories relating to architecture interface, data and control elements might be linked to a use case. They suggested templates that could be used for this purpose. The concept was successfully trialed in a large industry project. 2.3 The Utility of User Stories Wautelet et al (2016) argued that user stories in isolation do not present a coherent representation of the intended system ‘to-be’ functions and proposed an approach to map user stories to a use case diagram. They proposed associating tags with stories to support their clustering in various ways. Liskin et al (2014) observed that sometimes user stories were too coarse, potentially leading to misunderstandings. This was seen as important to development practitioners, particularly where a large volume of work was associated with one story, making it difficult to fit into sprint schedules. Daly (2015) discussed a related practitioner approach using features of an agile project management tool (Jira) which supported the representation of a large issue as an ‘Epic’ that may have associated lower level user stories and sub-tasks. The idea of user stories may seem simple—who needs what and why, but creating appropriate detail and using them may not. Cohn (2004) suggests that the scope of a user story should allow delivery on it to be completed in one sprint. He suggests a user story should have three attributes: (a) a description used for planning and as a reminder, (b) conversations about the story helping to flesh out details, and (c) information that supports testing to determine when the story is complete. An initial goal-level story can be replaced with more detailed ones when that becomes necessary. He suggests: A team can very quickly write a few dozen user stories to give them an overall feel for the system. They can then plunge into the details on a few of the stories and can be coding much sooner than a team that feels compelled to complete an IEEE 830–style software requirements specification. In relation to such requirements specifications, Cohen comments: Unfortunately, it’s effectively impossible to write all of a system’s requirements this way. A powerful and important feedback loop occurs when users first see the software being built for them. When users see the software, they come up with new ideas and change their minds about old ideas. When changes are requested to the software contemplated in a requirements specification, we’ve become accustomed to calling it a “change of scope.” From this point of view, it might be argued that the architecture ‘evolves’ in an agile project. 3 Research Approach With the foregoing in mind our research question was: how might architecture-oriented and agile-oriented practices be harmonized? We drew on case studies representing the two viewpoints to compare similarities, difference and unmet needs. We utilized an action research strategy (Coghlan, 2003) in the case studies where we were directly engaged in delivering theory to inform practice and learning from that experience. In both cases the aim was, in a structured hands-on way to simulate a professional workplace, introducing Masters degree students to practices they were not necessarily familiar with. Learning was to be student team driven with academic facilitation, and at the end review and feedback was provided on what was delivered. Observations collected regarding the tools used were made via the formal assessments carried out and via student reflections required at the end of each course. We (the researchers) had a number of face-to-face meetings to discuss our respective observations, and used an on-line Slack project space to share information and record our discussions in the development of this paper. In one case study called Support Solutions Architecture (SSA) students taking a capstone Masters of Systems Engineering subject were observed. The bespoke industry subject was oriented towards innovative and economical long-term support arrangements for complex engineering assets. The primary business driver was a move towards private-public partnerships in establishing such arrangements (see Beckett, 2017). Both operational and business outcomes had to be considered from the viewpoints of a diverse range of stakeholders. The subject utilized a blended learning approach. It was run over 6 weeks in an intensive delivery mode. Over several years student cohorts of experienced engineering support practitioners from different companies tackled 15 projects. ISO/EIC 42010 was used as framework to capture and compare attributes of multiple case studies across a number of industry sectors using a pre-configured wiki tool. Consideration was then given to long-term changes in the operating environment, and student teams had to propose consequent adaptations to the as-is situation. The other was called Masters Project (MP) and was a capstone WIL subject in enterprise systems and in software engineering programs. Over several semesters, some 40 industry-initiated enterprise systems projects were tackled by teams of international students. This subject was organized as a series of sprints. Student teams were given client firm briefs and contacts and were asked to draw out and work with user stories. They had to deliver three reports and associated artifacts endorsed by the client over the subject duration. 4 Findings 4.1 The SSA Case This bespoke defence industry course built on experience with a similar course offered in another country. The blended learning format involved both initiating and final face-to-face week-long workshops and on-line interaction using university LMS tools in between. A trial version of the course was first delivered to a cohort of very experienced system support practitioners. Many members of this cohort had prior experience working with some form of enterprise architecture system. The first version of the SSA subject contained a lot of theoretical content it was not regarded as appropriate. A proposal for content and team-based activities built around ISO/EIC 42010 was accepted. Subsequent cohorts consisted of individuals nominated by their companies, and all were regarded as IT literate. The upper parts of the framework shown in figure 1 were tackled in chunks in the style of agile sprints to define an as-is situation. Outcomes were progressively documented in a multi-page wiki, and that content formed the basis of formal assessments with feedback. As we were dealing with economically viable, knowledge-based socio-technical systems, supplementary tools reflecting business model and knowledge architecture views were also introduced. This could be interpreted as models stimulating particular views. The students only had access to published case material, so the collection of user stories was not practical. As an alternative, the teams were prompted with a number of questions that could be interpreted as a viewpoint template: - What are the activities/physical processes at work? Who does what to make them happen? - What information is needed to undertake each physical process? - What kinds of technical data have to be managed in the data system? - What kinds of decisions have to be made, and how is this process supported? - What kind of data is needed to make decisions? - What kinds of background knowledge support the decision system? - What overarching architectural knowledge is needed to integrate the physical/data/decision systems and understand linkages between this and other functional systems? Many teams noted more interactions between elements of the framework than shown in figure 1, and when one team added these linkages from the point of view of architecture sub-components, the resultant diagram looked like a bowl of spaghetti (see figure 2). The team referred to this representation as ‘an ecosystem’ that included expectations of the broader community and the influence of competitors. The first learning here was that an interaction matrix (Table 1) view drew out additional discussion, particularly when sub-element aspects were considered. By way of example, there were interactions between the business model and stakeholders, rationale, viewpoints and views. In the first day of the final workshop, teams had to develop a presentation on their project ‘as-is’ situation and present it to the other teams, academics and an industry representative. This illustrated the extent to which individual teams may have adapted the ISO/EIC 42010 framework. A second learning was that, along the way, most teams had started to identify concerns to be addressed. This generally reflected a risk management perspective common in their home industry. A third learning was that reframing of explanation of the boxes shown in the lower part of figure 1 was needed as their utility was questioned. Treating them as a set representing operational views seemed to make more sense than considering them individually. A fourth learning related to team member interaction. Curiously, some teams thought they functioned better on-line than face to face. This may be the subject of a separate study. **Figure 2. Complex interactions between ISO 42010 elements.** The next step was to identify global challenges that might impact all or particular stakeholders (who), and for each team to develop a ‘to-be’ response to one of them in their project (what). Whilst many parts of an organization may be impacted, the task was to focus on one aspect of operations to propose an innovative change. A form of template was provided to facilitate consideration of views from the perspective of different stakeholders. The value proposition, what was required to deliver on this and who would be responsible for what taking potential risks into account were represented in this viewpoint template (why). At the end of this final workshop the cohort was invited to reflect what had been learned, what might be improved in delivering the subject, and present this to a panel of academic and industry representatives. A fifth learning was that the ISO 42010 framework had to be supplemented with complementary models and viewpoints at appropriate stages of case analysis to facilitate its use in the particular application. 4.2 The MP Case The MP subject was organized as face-to-face lectures with scheduled workshop time. But as with all university courses, students were expected to do additional work outside the classroom, and that meant both assigning tasks within the team and organizing meetings. Very few students had worked in self-managed teams before, and it took some time for students to adapt. The variety in team dynamics could be the subject of a separate paper. Teams were offered access to an online project management tool (Basecamp) and could also invite clients into this workspace, but usage was not consistent. This was later changed to a mandated requirement to use Microsoft Teams. Our first learning - make team interaction protocols clear and provide training as needed. The projects fell into two categories: (a) ‘research’ projects exploring the potential utility to a client business of new tools like block-chain, data analytics and cloud-based special purpose software, and (b) ‘requirements’ projects where the team had to develop software requirements and change management proposals for later implementation. In the first two weeks the teams had to develop a project plan, learning something about the client, the project requirements and identifying the types of activities to be considered in forthcoming sprints. The project clients were generally small firms that were not all familiar with the user story concept, so could be confused when students asked them for their user stories. In addition, clients would express their requirements in their own professional language, which had to be interpreted by the students. Our second learning was - appreciate the need for boundary-spanning activities. Client user stories were mostly pitched at a fairly high level, and the teams needed a finer level of detail to progress their sprints. This was addressed by going back to clients with specific questions or developing proposed user stories in conjunction with a Supervisor, and taking these back to clients for discussion. Our third learning was - understand granularity considerations when working with user stories. The collection of user stories had to be supplemented with additional views, e.g. use case diagrams and sequence diagrams. Our fourth learning - user stories need to be supplemented with some form of architecture description. Some matters of timing were problematic. Getting all team members synchronized, finding time windows to work with clients and get their signoff on proposals / work were frequently problems. Our fifth learning: both the scheduling of internal team activities and external interactions need to be considered in maintaining fast-paced iteration cycles. 5 Discussion Our literature survey described two potentially misaligned approaches to system definition: top-down requirements engineering and bottom-up agile development. The criticism of top-down approaches was that if taken to fine levels of detail the task can be burdensome and the result difficult to change. The criticism of bottom-up agile methods was that, whilst there is some flexibility offered, system elements may not link well in an overall structure. We drew on experience in two case scenarios – one top-down oriented and the other bottom-up oriented. Following the lead of the Thummadi and Lyytinen (2020), cases were compared in terms of development activities; understanding the project, identifying stakeholders, identifying customer requirements, organizing functional requirements, adding non-functional requirements, client feedback. From a top-down architecture perspective, this showed some consistency if the following adaptations to the ISO/EIC 42010 framework shown in figure 1 were made: - The combination of mission, system and environment may be viewed as a set framing operational context. We have added a link between environment and stakeholders reflecting a potential broader community or government interest in a particular system. - The core activities are slightly reframed reflecting the user story elements: stakeholders = who, architectural = what, rationale = why. Stakeholders are those with specific requirements or those who may be impacted by current issues. The architecture description should include structured collections of user stories. The rationale will include why a particular feature is needed and why a particular implementation choice (how) was made. Consistent with the literature (e.g. Capilla et al, 2016) we have viewed decision / rationale information as representing knowledge architecture. - Recognizing that concerns have multiple dimensions (e.g. Lago et al, 2010) these were clustered under the categories of potential risks and non-functional requirements. This is a topic for future research. • Views, viewpoints, viewpoint libraries and models have been clustered together to represent a set of operational views from an analyst perspective. One item in a viewpoint library could be a user story template. Following the lead of others, this will be a topic for future research. The outcome is shown in figure 3, which also notes parallels with stakeholder theory reflecting a business perspective (e.g. Lucke and Lechner, 2011). This could help the stakeholders align with associated change management activities. This will also be a topic of future research. Figure 3. An alternative representation of the ISO/EIC 42010 Architect Description Framework From a bottom-up Agile perspective, it is suggested user stories can be utilised at every stage of an agile project to identify and evolve an architecture as follows: • **Requirements Gathering:** Initially, Business defines strategies, policies and procedures. Business Client must provide the detailed user stories on the expected system functioning. These user stories must be reviewed and tested by the stakeholders, operational, strategic and tactical level of employees and employers. • **System Analysis:** In this phase, Business Analyst and Software Analyst must define the user stories together. The complex system can be broken down into simple components to understand the functional features. Then define the user stories for all the components and functional features. • **Architectural Design:** During this phase implement the design based on the above defined user stories. However, the design may not be compatible for all the user stories. Eliminate or redefine the user stories which fit into the proposed design. Redefinition or elimination stage needs approval from the business client. This phase must consider the Hardware and software used by the business client. Then write review and rewrite the user stories if required. • **Development and Testing:** This phase includes writing the code based on the defined User stories so far. Re-define the user stories if coding cannot be generated for the specific defined user story or a certain functional feature cannot be developed. This phase needs the A microscopic level of defining the user stories as they can be reflected in test cases, which are utilised as follows: - **Testing Activity 1**: Starts after the requirement gathering and before the design/development begins to design component test protocols. - **Testing Activity 2**: Starts after and during the design and development phase to ensure integration of components. The process requires continuous monitoring, reviewing, defining, and redefining the user stories as experience is gained from progressive testing and customer feedback. The proposed evolutionary process is summarised in figure 4 and may be viewed as an experiential learning cycle (e.g. Kolb, 2014). This supports development in two ways. Firstly, there is fast feedback from clients to verify (or otherwise) their requirements have been met. Secondly, as clients begin to appreciate what is practical, they may wish to modify the functional requirements of the system. An agile architecture-building practice could be aligned with ISO/EIC 42010 if that were to be the architecture design description vehicle to provide a bridge between different stages of agile development and help a business adapt to a dynamic IT environment. ![Figure 4. Agile architecture building cycle](image) We consider there is a logical compatibility between the two cases presented even though the details may be different. Both started by understanding something about the project and its context. Both drew out requirements, albeit in a different way, reflecting who needed what functionality and why. Both considered non-functional requirements/concerns, and both drew on some form of supplementary model. Schön et al (2017) had suggested there was a need for more empirical studies of ‘Agile Requirements Engineering’, and that in 93% of the studies they examined, the use of suitable artifacts was required. Drawing on our empirical studies, we further these suggestions in two ways: - By proposing two artifacts that may offer complementary views of complex systems and their evolution (figures 3 & 4), and - By proposing how they might be linked together to bridge stakeholder and system perspectives. In the SSA case, architecture elements of figure 3 were documented in an evolutionary way using a wiki tool. In some MP case projects, a storyboard having similar elements to figure 3 was used as a project starting point. The common theme was some form of architecture design to reflect client requirements. ### 6 Concluding Remarks In this paper we considered the utility of two tools in practice: an architecture description framework (ISO/EIC 42010) and an agile project management methodology, drawing on experiences of Masters degree students over multiple practice-oriented projects in two different cases. We started with a literature review of architecture description frameworks and agile practices. This indicated there might be some issues to be managed with each tool, and they might be incompatible. With the foregoing gap in mind our research question was: how might architecture-oriented and agile-oriented practices be harmonized? We observed that the architecture tool required the integration of multiple views of a system, identifying stakeholders (who), an architecture description (what) and the underlying rationale (what). This was seen as the same logical structure as the user stories used in agile practice. We make two contributions to theory and practice. A particular interpretation of the ISO/EIC framework presented in the paper (figure 3) reflects experience from the analysis of 15 large company systems engineering practical projects. An agile architecture evolution model presented in the paper (figure 4) reflects experience from 40 small company information systems practical projects. A limitation of the research may be that we drew on student projects. From this perspective, the utility of the tools developed (reflected in figures 3 & 4) remain to be tested in an industry setting. However, they did have a practical foundation. In the architecture case, the students were practitioners with more than 10 years experience who were sponsored by their employers to learn something to be applied in current workplace projects. In the agile case, candidate projects were negotiated with industry or government clients who were hoping to learn from the student projects. Three areas for further research have been suggested in relation to ISO/EIC 42010: one relating to the treatment of the concerns element, one relating to the treatment of the view / viewpoint / model element, and one relating to the application of stakeholder theory to architecture considerations. It was also suggested the agile architecture evolution model be further tested using the ISO/EIC 42010 framework as the architecture design vehicle at the architecture definition stage (see figure 4). 7 References Daly, L (2015) Break it down: decomposing user stories in Jira **Copyright © 2020 Ronald C Beckett and Rajyalakshmi Gaddipati. This is an open-access article licensed under a Creative Commons Attribution-NonCommercial 3.0 New Zealand, which permits non-commercial use, distribution, and reproduction in any medium, provided the original author and ACIS are credited.**
{"Source-Url": "https://aisel.aisnet.org/cgi/viewcontent.cgi?article=1010&context=acis2020", "len_cl100k_base": 6469, "olmocr-version": "0.1.53", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 37433, "total-output-tokens": 8943, "length": "2e12", "weborganizer": {"__label__adult": 0.0005064010620117188, "__label__art_design": 0.0024852752685546875, "__label__crime_law": 0.0004718303680419922, "__label__education_jobs": 0.01526641845703125, "__label__entertainment": 0.00014710426330566406, "__label__fashion_beauty": 0.0003159046173095703, "__label__finance_business": 0.0016574859619140625, "__label__food_dining": 0.0005025863647460938, "__label__games": 0.000850677490234375, "__label__hardware": 0.0010805130004882812, "__label__health": 0.0007290840148925781, "__label__history": 0.0008358955383300781, "__label__home_hobbies": 0.0001844167709350586, "__label__industrial": 0.0010614395141601562, "__label__literature": 0.000926494598388672, "__label__politics": 0.0004360675811767578, "__label__religion": 0.0007915496826171875, "__label__science_tech": 0.0899658203125, "__label__social_life": 0.0001971721649169922, "__label__software": 0.0096893310546875, "__label__software_dev": 0.8701171875, "__label__sports_fitness": 0.0003802776336669922, "__label__transportation": 0.0009975433349609375, "__label__travel": 0.00034928321838378906}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 40133, 0.03153]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 40133, 0.38527]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 40133, 0.93813]], "google_gemma-3-12b-it_contains_pii": [[0, 877, false], [877, 4852, null], [4852, 9410, null], [9410, 9807, null], [9807, 15090, null], [15090, 19433, null], [19433, 22282, null], [22282, 27210, null], [27210, 29404, null], [29404, 32214, null], [32214, 36737, null], [36737, 40133, null]], "google_gemma-3-12b-it_is_public_document": [[0, 877, true], [877, 4852, null], [4852, 9410, null], [9410, 9807, null], [9807, 15090, null], [15090, 19433, null], [19433, 22282, null], [22282, 27210, null], [27210, 29404, null], [29404, 32214, null], [32214, 36737, null], [36737, 40133, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 40133, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 40133, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 40133, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 40133, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 40133, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 40133, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 40133, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 40133, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 40133, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 40133, null]], "pdf_page_numbers": [[0, 877, 1], [877, 4852, 2], [4852, 9410, 3], [9410, 9807, 4], [9807, 15090, 5], [15090, 19433, 6], [19433, 22282, 7], [22282, 27210, 8], [27210, 29404, 9], [29404, 32214, 10], [32214, 36737, 11], [36737, 40133, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 40133, 0.0]]}
olmocr_science_pdfs
2024-12-07
2024-12-07
c5290da2da701110a8aa6e73a991da2f18d4022a
Midterm Review The purpose of software engineering Teamwork Processes and project planning Software Requirements The “Software Crisis” - Have been in “crisis” since the advent of “big” software (roughly 1965) - What we want for software development - Low risk, predictability - Lower costs and proportionate costs - Faster turnaround - What we have: - High risk, high failure rate - Poor delivered quality - Unpredictable schedule, cost, effort - Examples: Ariane 5, Therac 25, Mars Lander, DFW Airport, FAA ATC etc. - Characterized by lack of control Large System Context - Focus large, complex systems - Multi-person: many developers, many stakeholders - Multi-version: intentional and unintentional evolution - Quantitatively distinct from small developments - Complexity of software rises exponentially with size - Complexity of communication rises exponentially - Qualitatively distinct from small developments - Multi-person introduces need for organizational functions, policies, oversight, etc. - More stakeholders and more kinds of stakeholders Software is Pre-Industrial <table> <thead> <tr> <th>Pre-Industrial</th> <th>Post-Industrial</th> </tr> </thead> <tbody> <tr> <td>Craftsman builds product</td> <td></td> </tr> <tr> <td>- Builds one product at a time</td> <td></td> </tr> <tr> <td>- Each product is unique, parts are not interchangeable</td> <td></td> </tr> <tr> <td>- Quality depends on craftsman’s skill – product of training, experience</td> <td></td> </tr> <tr> <td>- Many opportunities for error</td> <td></td> </tr> <tr> <td>Focus on individual products</td> <td></td> </tr> <tr> <td>- Customization is easy</td> <td></td> </tr> <tr> <td>Scaling is difficult</td> <td></td> </tr> <tr> <td>- Parts are not interchangeable</td> <td></td> </tr> <tr> <td>- No economy of scale</td> <td></td> </tr> <tr> <td>- Control problems rise exponentially with product size!</td> <td></td> </tr> <tr> <td>Products produced by machines</td> <td></td> </tr> <tr> <td>- Quality depends on machines &amp; manufacturing process</td> <td></td> </tr> <tr> <td>- Production requires little training or experience</td> <td></td> </tr> <tr> <td>Focus on developing the means of production</td> <td></td> </tr> <tr> <td>- Craftsman builds means to build product (tools, factory)</td> <td></td> </tr> <tr> <td>- Customization is difficult</td> <td></td> </tr> <tr> <td>Easily scales</td> <td></td> </tr> <tr> <td>- Parts are interchangeable</td> <td></td> </tr> <tr> <td>- Products are alike</td> <td></td> </tr> <tr> <td>- Economies of scale apply</td> <td></td> </tr> </tbody> </table> Implications - Small system development is driven by technical issues (i.e., programming) - Large system development is dominated by organizational issues - Managing complexity, communication, coordination, etc. - Projects fail when these issues are inadequately addressed - Lesson #1: programming ≠ software engineering - Techniques that work for small systems fail utterly when scaled up - Programming alone won’t get you through real developments or even this course View of SE in this Course - The purpose of software engineering is to gain and maintain intellectual and managerial control over the products and processes of software development. - “Intellectual control” means that we are able to make rational choices based on an understanding of the downstream effects of those choices (e.g., on system properties). - Managerial control means we control development resources (budget, schedule, personnel). Meaning of “Control” - Both are necessary for success! - Intellectual control implies (as an ideal) - We understand what properties we want for the software (functional behavior and system qualities) - Can distinguish good choices from bad - We can reliably and predictably build a system with the desired qualities - Managerial control implies - We make accurate estimations - We deliver on schedule and within budget - Assertion: Managerial control is not really possible without intellectual control Course Approach - Will learn methods for acquiring and maintaining control of software projects - Managerial control (most of focus to date) - People management and team organization - Organizing people and tasks - Planning and guiding development - Intellectual control - Choosing appropriate order for decisions and ensuring feedback/correction - Establishing and communicating exactly what should be built Teamwork and Group Dynamics What is a Great Team? • Diverse Skills – People skills, communication and writing skills, design skills, implementation skills and knowledge • Coherence – Ability to build and maintain a shared vision – Shared expectations • Mutual Respect and Responsibility – You don’t have to like each other, but you need to trust and respect each other — and to earn your teammates trust and respect – This is an enduring part of professionalism in the real world Team Roles • Manager: responsible for schedule • System architect • Programmer • Quality control • Technical documentation • User documentation • User interface design/build • Configuration control (build-master) Lessons Learned: – Assigning people to roles ensure someone is personally responsible for each deliverable What do software developers do? • Most roles are not coding • So how do they spend their time? • IBM study (McCue, 1978): – 50% team interactions – 30% working alone – 20% not directly productive -Technical excellence is not enough "Egoless" design (Weinberg, *Psychology of Computer Programming*) - Investing ego in group - "Letting go" of ego investment in code, design, ideas - No winning or losing design debates (focus on improving the product) - Once contributed, ideas belong to the group - Criticism is aimed at concepts, not people - The best designers criticize their own designs! - Our own assumptions are the hardest to critique - Corollary: A conscientious critic is your best ally Being a Good Team Member - Attributes most valued by other team members - Dependability - When you say you’ll do something, you do it - Correctly - On time - Carrying your own weight (doing a fair share of the work) - People will overlook almost everything else if you do these The Software Lifecycle Introduction Need to Organize the Work - Nature of a software project - Software development produces a set of interlocking, interdependent work products - E.g. Requirements -> Design -> Code - Implies dependencies between tasks - Implies dependencies between people - Must organize the work such that: - Every task gets done - Tasks get done in the right order - Tasks are done by the right people - The product has the desired qualities - The end product is produced on time Usefulness of Life Cycle Models - Application of “divide-and-conquer” to software processes and products - Goal: identify distinct and relatively independent phases and products - Can then address each somewhat separately - Intended use - Provide guidance to developers in what to produce and when to produce it - Provide a basis for planning and assessing development progress - Never an accurate representation of what really goes on Common Models - Waterfall - Prototyping - Iterative - Spiral - Agile A “Waterfall” Model What are the issues: 1. As a guide to how software should be developed? 2. As a model of any real development? 1. As a guide: does not address some common development risks - What happens if requirements are wrong? - Is scheduling or budget is wrong? 2. As a model: unrealistic as a model of any real development - How do real developments differ? - Models are abstractions of reality Waterfall Model Variations There have been many variations attempting to address these issues Characteristic Model: Prototyping - Waterfall variation - First system versions are prototypes, either: - Interface - Functional - Attempts to address risk of building the wrong system Characteristic Processes: The Iterative Model - Process is a sequence of iterations, each producing an increment of the working software (sequence of waterfalls). Addresses - Risk that software cannot be completed – build incremental subsets - Risk of building the wrong system – stakeholder have opportunities to see the software - Also, feasibility, schedule, budget and others to some extent Characteristic Processes: The Spiral Model - Process viewed as repeating cycles of increasing scale - Identify risks and determine (next set of) requirements, build next version by extension, increasing scale each time Spiral Model - determine goals - Risk evaluation and Mitigation - plan next phase - development Spiral Model Goals - Response lack of risk analysis and risk mitigation in “waterfall” process - Make risk analysis standard part of process - Address risk issues early and often - Explicit risk analysis at each phase - Framework for explicit risk-mitigation strategies - E.g., prototyping - Explicit Go/No-Go decision points in process Characteristic Processes: Agile (scrum, RAD, XP) - Process viewed as nested sequence of short builds (sprints) - Even tighter timing loop - Addresses rapidly changing or emerging requirements - Code-driven, little planning or documentation How do we choose a development process? Goals vs. Risks • Balance goals and risks • Goal: proceed as rationally and systematically as possible from a statement of goals to a design that demonstrably meets those goals – Understand that any process description is an abstraction – Always must compensate for deviation from the ideal (e.g., by iteration) • Risk: Anything that might lead to a loss of control is a project risk – E.g., won’t meet the schedule, will overspend budget, will fail to deliver the proper functionality A Software Engineering Perspective • Choose processes, methods, notations, etc. to provide an appropriate level of control for the given product and context – Sufficient control to achieve results – No more than necessary to contain cost and effort Example • Project 1 assumptions 1. Deadline and resources (time, personnel) are fixed 2. Delivered functionality and quality can vary (though they affect the grade) 3. Risks: 1. Missing the deadline 2. Technology problems 3. Inadequate requirements • Process model – All of these risks can be addressed to some extent by building some version of the product, then improving on it as time allows (software & docs.) – Technology risk requires building/finding software and trying it (prototyping) – Most forms of incremental development will address these Project Planning and Management From Process to Plan - Process definition manifests itself in the project plan - Process definition is an abstraction - Many possible ways of implementing the same process - Project plan makes process concrete, it assigns - People to roles - Artifacts to deliverables and milestones - Activities to tasks over time - Looked at several techniques for documenting these Document Types and Purposes - Management documents - Basis for managerial control of resources - Calendar time, skilled man-hours budget - Other organizational resources - Project plan, WBS, Development schedule - Use: allows managers to track actual against expected consumption of resources - Development documents - Basis for product development (intellectual control) - ConOps, Requirements (SRS), Architecture, Detail design, etc. - Uses: - Making and recording development decisions - Allows developers to track decisions from stakeholder needs to implementation Work Breakdown Structure - This is a technique to analyze the content of work and cost by breaking it down into its component parts. It is produced by: - Identifying the key tasks - Breaking each task down into component parts - Continuing to breakdown until manageable work packages have been identified. These can then be allocated to the appropriate person - The WBS is used to allocate responsibilities Lessons Learned from Projects - The work breakdown defines the specific tasks team members must accomplish - Results of inadequate work breakdown and task definitions - If incomplete, some tasks may not be done - If imprecise, people do not know exactly what to do. May do too little or the wrong thing. - Without a complete set of tasks, schedules are unrealistic Milestone Planning - Milestone planning is used to show the major steps that are needed to reach the goal on time - Milestones typically mark completion of key deliverables or establishment of baselines - Often associated with management review points - Baseline: when a work product is put under configuration management and all changes are controlled - E.g., Requirements baseline, project plan complete, code ready to test Pert Chart - Network analysis or PERT is used to analyze the inter-relationships between the tasks identified by the work breakdown structure and to define the dependencies of each task - Helps identify where ordering of tasks may cause problems because of precedence or resource constraints - Where one person cannot do two tasks at the same time - Where adding a person can allow tasks to be done in parallel, shortening the project Gantt Charts - Method for visualizing a project schedule showing - The set of tasks - Start and completion times - Task dependencies - Responsibilities - PERT charts can be reformatted as Gantt charts Example Gantt Chart ![Gantt Chart Image] Product Development Cycle - Why do we document? - What needs to be communicated? - Who produces it? - Who uses it and for what? - What needs to be in it? - Usefulness for control? Development Documents Making and recording engineering decisions **Document Types and Purposes** - **Management documents** - Basis for project management (managerial control of resources) - Calendar time, skilled man-hours budget - Other organizational resources - Project plan, WBS, Development schedule - Use: allows managers to track actual against expected consumption of resources - **Development documents** - Basis for intellectual control - Used for making and communicating engineering decisions (requirements, design, implementation, verification, etc.) - Allows developers to track decisions from stakeholder needs to implementation - ConOps, SRS, Architecture, Detail design, etc. **Requirements** Problem Analysis Requirements Specification **What is a “software requirement?”** - A description of something the software must do or property it must have - The set of system requirements denote the problem to be solved and any constraints on the solution - Ideally, requirements specify precisely what the software must do without describing how to do it - Any system that meets requirements should be an acceptable implementation **Importance of Getting Requirements Right** 1. The majority of software errors are introduced early in software development 2. The later that software errors are detected, the more costly they are to correct ![Graph showing cost of errors detected by phase in development process] Requirements Phase Goals - What does “getting the requirements right” mean in the systems development context? - Only three goals 1. Understand precisely what is required of the software 2. Communicate that understanding to all of the parties involved in the development (stakeholders) 3. Control production to ensure the final system satisfies the requirements - Sounds easy but hard to do in practice, observed this and the resulting problems in projects - Understanding what makes these goals difficult to accomplish helps us understand how to mitigate the risks What makes requirements difficult? - Comprehension (understanding) - People don’t (really) know what they want (...until they see it) - Superficial grasp is insufficient to build correct software - Communication - People work best with regular structures, conceptual coherence, and visualization - Software’s conceptual structures are complex, arbitrary, and difficult to visualize - Control (predictability, manageability) - Difficult to predict which requirements will be hard to meet - Requirements change all the time - Together can make planning unreliable, cost and schedule unpredictable - Inseparable Concerns - Many requirements issues cannot be cleanly separated (i.e., decisions about one necessarily impact another) - Difficult to apply “divide and conquer” - Must make tradeoffs where requirements conflict Purposes and Stakeholders - Many potential stakeholders using requirements for different purposes - Customers: the requirements document what should be delivered - Managers: provides a basis for scheduling and a yardstick for measuring progress - Software Designers: provides the “design-to” specification - Coders: defines the range of acceptable implementations - Quality Assurance: basis for validation, test planning, and verification - Also: potentially Marketing, regulatory agencies, etc. Needs of Different Audiences - Customer/User - Focus on problem understanding - Use language of problem domain - Technical if problem space is technical - Development organization - Focus on system/software solutions - Use language of solution space (software) - Precise and detailed enough to write code, test cases, etc. Documentation Approaches - **ConOps**: informal requirements to describe the system's capabilities from the customer/user point of view - Answer the questions, “What is the system for?” and “How will the user use it?” - Tells a story: “What does this system do for me?” - Helps to use a standard template - **SRS**: formal, technical requirements for development team - Purpose is to answer specific technical questions about the requirements quickly and precisely - Answers, “What should the system output in this circumstance?” - Reference, not a narrative, does not “tell a story” - Precise, unambiguous, complete, and consistent as practical Informal Techniques - Most requirements specification methods are informal - Natural language specification - Use cases - Mock-ups (pictures) - Story boards - **Benefits** - Requires little technical expertise to read/write - Useful for communicating with a broad audience - Useful for capturing intent (e.g., how does the planned system address customer needs, business goals?) - **Drawbacks** - Inherently ambiguous, imprecise - Cannot effectively establish completeness, consistency - However, can add rigor with standards, templates, etc. Exemplified by discussion of use cases Scenario Analysis and Use Cases - Applying scenario analysis in the development process - **Requirements Elicitation** - Identify stakeholders who interact with the system - Collect “user stories” - how people would interact with the system to perform specific tasks - **Requirements Specification** - Record as use-cases with standard format - Use templates to standardize, drive elicitation - **Requirements verification and validation** - Review use-cases for consistency, completeness, user acceptance - Apply to support prototyping - Verify against code (e.g., use-case based testing) Use Cases <table> <thead> <tr> <th>Use Case: Manage Reports</th> </tr> </thead> <tbody> <tr> <td><strong>1. Description</strong></td> </tr> <tr> <td>This Use Case describes the operation for creating, saving, viewing, printing, editing, and deleting reports.</td> </tr> <tr> <td><strong>2. Access</strong></td> </tr> <tr> <td>Project Manager or any user with the required access level.</td> </tr> <tr> <td><strong>3. Negatives</strong></td> </tr> <tr> <td>Requires high-level security clearance.</td> </tr> <tr> <td><strong>4. Description</strong></td> </tr> <tr> <td>This Use Case describes the operation for creating, saving, viewing, printing, editing, and deleting reports.</td> </tr> <tr> <td><strong>5. Access</strong></td> </tr> <tr> <td>Project Manager or any user with the required access level.</td> </tr> <tr> <td><strong>6. Negatives</strong></td> </tr> <tr> <td>Requires high-level security clearance.</td> </tr> </tbody> </table> A systematic approach to use cases - Uses a standard template - Easier to check, read - Still informal Benefits and Drawbacks • Use cases can be an effective tool for: – Identifying key users and their tasks – Characterizing how the system should work from each user’s point of view – Communicating to non-technical stakeholders • Generally inadequate for detailed technical requirements – Difficult to find specific requirements – Inherently ambiguous and imprecise – Cannot establish completeness or consistency – Possible exception: applications doing simple user-centric tasks with little computation (e.g., your project) Technical Specification The SRS The role of rigorous specification Requirements Documentation • Is a detailed requirements specification necessary? • How do we know what “correct” means? – How do we decide exactly what capabilities the modules should provide? – How do we know which test cases to write and how to interpret the results? – How do we know when we are done implementing? – How do we know if we’ve built what the customer asked for (may be distinct from “want” or “need”)? – Etc... • Correctness is a relation between a spec and an implementation (M. Young) • Implication: until you have a spec, you have no standard for “correctness” Technical Requirements • Focus on developing a technical specification – Should be straightforward to determine acceptable inputs and outputs – Can systematically check completeness consistency • Provides – Detailed specification of precisely what to build – Design-to specification – Build-to specification for coders – Characterizes expected outputs for testers Desirable SRS Properties <table> <thead> <tr> <th>Semantic Properties*</th> <th>Packaging Properties+</th> </tr> </thead> <tbody> <tr> <td>Complete</td> <td>Modifier</td> </tr> <tr> <td>Consistent</td> <td>Readable</td> </tr> <tr> <td>Unambiguous</td> <td>Organized for reference and review</td> </tr> <tr> <td>Verifiable</td> <td>Reusable</td> </tr> </tbody> </table> * Properties of the specification’s semantics (what it says) independently of how it’s said + Properties arising from the way the specification is written (organization, formats, notations) The Formal Methods Dilemma - Standard approaches (e.g., prose specs) lack sufficient rigor to meet high-assurance goals - Formal requirements methods have desired technical virtues viewed as impractical for large, complex systems - Capability for unambiguous specification, precision, testability, and analyzability - Industry concern for practicality - Concern for difficulty to write/read, required expertise, ability to scale - Concern for real-world issues of fuzzy or changing requirements - Concern for fit with industrial development context - Adds up to perceived cost/schedule risk - Implication: Need for Practical Formal Methods The Good News - A little rigor in the right places can help a lot - Adding formality is not an all-or-none decision - Use it where it matters most to start (critical parts, potentially ambiguous parts) - Often easier, less time consuming than trying to say the same thing in prose - E.g. in describing conditions or cases - Use predicates (i.e., basic Boolean expressions) - Use tables where possible Graphic Notations for Simple Machines Tabular for Larger Machines <table> <thead> <tr> <th>Source Mode(s)</th> <th>Events</th> <th>Destination Mode</th> </tr> </thead> <tbody> <tr> <td>Off</td> <td>@ T(HeatSwitch = on) WHEN (NOT NeedHeat)</td> <td>Standby</td> </tr> <tr> <td>Off</td> <td>@ T(HeatSwitch = on) WHEN NeedHeat</td> <td>Ignition</td> </tr> <tr> <td>Standby</td> <td>@ T(HeatSwitch = off)</td> <td>Off</td> </tr> <tr> <td>Standby</td> <td>@ T(NeedHeat)</td> <td>Ignition</td> </tr> <tr> <td>Ignition</td> <td>@ T(Combustion = ignited)</td> <td>Running</td> </tr> <tr> <td>Ignition</td> <td>@ T(HeatSwitch = off) WHEN (Combustion = unplugged)</td> <td>Shutdown</td> </tr> <tr> <td>Running</td> <td>@ T(NeedHeat)</td> <td>Shutdown</td> </tr> <tr> <td>Running</td> <td>@ T(HeatSwitch = off)</td> <td>Shutdown</td> </tr> <tr> <td>Shutdown</td> <td>@ T(BlowerUpSpeed)</td> <td>Standby</td> </tr> <tr> <td>Fault/Shutdown</td> <td>@ T(Fault/Reset)</td> <td>Standby</td> </tr> </tbody> </table> Description: Allowed state transitions for the Home Heating System. State Charts for Concurrent and Hierarchical Machines Is a “Good” SRS Achievable? - A qualified “yes” - Mutual satisfaction of some goals is difficult - Want completeness but users don’t know what they want and requirements change. - Many audiences and purposes, only one possible organization and language - Want formality (precision, verifiability, analyzability) but need readability. - Tradeoffs and compromises are inevitable - Usefulness of establishing document purpose in advance. - Make them by choice not chance! - It isn’t easy - Effort, expertise, technique Tables Express Cases <table> <thead> <tr> <th>Modes for HeartCycle</th> <th>Conditions</th> </tr> </thead> <tbody> <tr> <td>Running</td> <td>HotAvail NOT HotAvail</td> </tr> <tr> <td>Off, Standby, Ignition, Shutdown, Fault/Shutdown</td> <td>TRUE</td> </tr> <tr> <td>WaterPump = on</td> <td>off</td> </tr> </tbody> </table> Description: WaterPump defines the rules for when the pump circulating heated water to the radiators should be turned on and when it should be turned off. Requirements Summary - Requirements characterize “correct” system behavior - Being in control of development requires: - Getting the right requirements - Communicating them to the stakeholders - Using them to guide development - Requirements activities must be incorporated in the project plan - Requirements baseline - Requirements change management Real meaning of “control” - What does “control” really mean? - Can we really get everything under control then run on autopilot? - Rather, does control mean a continuous feedback loop? 1. Define ideal 2. Make a step 3. Measure deviation from idea 4. Correct direction or redefine ideal and go back to 2 Questions?
{"Source-Url": "https://classes.cs.uoregon.edu/11F/cis422/slides/8-Midterm%20Review.pdf", "len_cl100k_base": 6012, "olmocr-version": "0.1.53", "pdf-total-pages": 18, "total-fallback-pages": 0, "total-input-tokens": 39604, "total-output-tokens": 6246, "length": "2e12", "weborganizer": {"__label__adult": 0.0004673004150390625, "__label__art_design": 0.00036525726318359375, "__label__crime_law": 0.0002906322479248047, "__label__education_jobs": 0.0034999847412109375, "__label__entertainment": 5.519390106201172e-05, "__label__fashion_beauty": 0.0001747608184814453, "__label__finance_business": 0.0006189346313476562, "__label__food_dining": 0.0003657341003417969, "__label__games": 0.0006504058837890625, "__label__hardware": 0.00044846534729003906, "__label__health": 0.00029540061950683594, "__label__history": 0.0002007484436035156, "__label__home_hobbies": 0.00011211633682250977, "__label__industrial": 0.0003261566162109375, "__label__literature": 0.00030612945556640625, "__label__politics": 0.00023567676544189453, "__label__religion": 0.00040030479431152344, "__label__science_tech": 0.0014581680297851562, "__label__social_life": 0.0001475811004638672, "__label__software": 0.00447845458984375, "__label__software_dev": 0.98388671875, "__label__sports_fitness": 0.0003757476806640625, "__label__transportation": 0.00042724609375, "__label__travel": 0.0002243518829345703}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 25272, 0.00272]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 25272, 0.56168]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 25272, 0.89088]], "google_gemma-3-12b-it_contains_pii": [[0, 2030, false], [2030, 3895, null], [3895, 4955, null], [4955, 6254, null], [6254, 7190, null], [7190, 8100, null], [8100, 8831, null], [8831, 10195, null], [10195, 11588, null], [11588, 12831, null], [12831, 13343, null], [13343, 14739, null], [14739, 17001, null], [17001, 19616, null], [19616, 21194, null], [21194, 22832, null], [22832, 24586, null], [24586, 25272, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2030, true], [2030, 3895, null], [3895, 4955, null], [4955, 6254, null], [6254, 7190, null], [7190, 8100, null], [8100, 8831, null], [8831, 10195, null], [10195, 11588, null], [11588, 12831, null], [12831, 13343, null], [13343, 14739, null], [14739, 17001, null], [17001, 19616, null], [19616, 21194, null], [21194, 22832, null], [22832, 24586, null], [24586, 25272, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 25272, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, true], [5000, 25272, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 25272, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 25272, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 25272, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 25272, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 25272, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 25272, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 25272, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 25272, null]], "pdf_page_numbers": [[0, 2030, 1], [2030, 3895, 2], [3895, 4955, 3], [4955, 6254, 4], [6254, 7190, 5], [7190, 8100, 6], [8100, 8831, 7], [8831, 10195, 8], [10195, 11588, 9], [11588, 12831, 10], [12831, 13343, 11], [13343, 14739, 12], [14739, 17001, 13], [17001, 19616, 14], [19616, 21194, 15], [21194, 22832, 16], [22832, 24586, 17], [24586, 25272, 18]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 25272, 0.11472]]}
olmocr_science_pdfs
2024-12-07
2024-12-07