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
254fd9876d00fd17e67205b4a327529c5bfd15c0
Cache Impact On Performance: \textit{An Example} Assuming the following execution and cache parameters: - Cache miss penalty = 50 cycles - Normal instruction execution CPI ignoring memory stalls = 2.0 cycles - Miss rate = 2% - Average memory references/instruction = 1.33 \[\text{CPU time} = IC \times [\text{CPI}_{\text{execution}} + \text{Memory accesses/instruction} \times \text{Miss rate} \times \text{Miss penalty}] \times \text{Clock cycle time}\] \[\text{CPU time with cache} = IC \times (2.0 + (1.33 \times 2\% \times 50)) \times \text{clock cycle time}\] \[= IC \times 3.33 \times \text{Clock cycle time}\] \[\rightarrow \text{Lower CPI}_{\text{execution}} \text{ increases the impact of cache miss clock cycles}\] \[\rightarrow \text{CPUs with higher clock rate, have more cycles per cache miss and more memory impact on CPI}\] Impact of Cache Organization: An Example Given: • A perfect CPI with cache = 2.0 Clock cycle = 2 ns • 1.3 memory references/instruction Cache size = 64 KB with • Cache miss penalty = 70 ns, no stall on a cache hit • One cache is direct mapped with miss rate = 1.4% • The other cache is two-way set-associative, where: – CPU time increases 1.1 times to account for the cache selection multiplexor – Miss rate = 1.0% Average memory access time = Hit time + Miss rate x Miss penalty Average memory access time \( t_{1\text{-way}} \) = \( 2.0 + (.014 \times 70) = 2.98 \) ns Average memory access time \( t_{2\text{-way}} \) = \( 2.0 \times 1.1 + (.010 \times 70) = 2.90 \) ns CPU time = IC x [CPI\(_{\text{execution}}\) + Memory accesses/instruction x Miss rate x Miss penalty ] x Clock cycle time CPU\(_{\text{time \ 1-way}}\) = IC x (2.0 x 2 + (1.3 x .014 x 70)) = 5.27 x IC CPU\(_{\text{time \ 2-way}}\) = IC x (2.0 x 2 x 1.10 + (1.3 x 0.01 x 70)) = 5.31 x IC → In this example, 1-way cache offers slightly better performance with less complex hardware. Types of Cache Misses: "The Three C’s" 1. **Compulsory:** On the first access to a block; the block must be brought into the cache; also called cold start misses, or first reference misses. 2. **Capacity:** Occur because blocks are being discarded from cache because cache cannot contain all blocks needed for program execution (program working set is much larger than cache capacity). 3. **Conflict:** In the case of set associative or direct mapped block placement strategies, conflict misses occur when several blocks are mapped to the same set or block frame; also called collision misses or interference misses. The 3 Cs of Cache: Absolute Miss Rates (SPEC92) The 3 Cs of Cache: Relative Miss Rates (SPEC92) Improving Cache Performance How? • Reduce Miss Rate • Reduce Cache Miss Penalty • Reduce Cache Hit Time Improving Cache Performance • **Miss Rate Reduction Techniques:** * Increased cache capacity * Higher associativity * Hardware prefetching of instructions and data * Compiler-controlled prefetching * Larger block size * Victim caches * Pseudo-associative Caches * Compiler optimizations • **Cache Miss Penalty Reduction Techniques:** * Giving priority to read misses over writes * Early restart and critical word first * Second-level cache (L2) * Sub-block placement * Non-blocking caches • **Cache Hit Time Reduction Techniques:** * Small and simple caches * Avoiding address translation during cache indexing * Pipelining writes for fast write hits Miss Rate Reduction Techniques: Larger Block Size - A larger block size improves cache performance by taking advantage of spatial locality. - For a fixed cache size, larger block sizes mean fewer cache block frames. • Performance keeps improving to a limit when the fewer number of cache block frames increases conflict misses and thus overall cache miss rate. Miss Rate Reduction Techniques: Higher Cache Associativity Example: Average Memory Access Time (A.M.A.T) vs. Miss Rate <table> <thead> <tr> <th>Cache Size (KB)</th> <th>1-way</th> <th>2-way</th> <th>4-way</th> <th>8-way</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>2.33</td> <td>2.15</td> <td>2.07</td> <td>2.01</td> </tr> <tr> <td>2</td> <td>1.98</td> <td>1.86</td> <td>1.76</td> <td>1.68</td> </tr> <tr> <td>4</td> <td>1.72</td> <td>1.67</td> <td>1.61</td> <td>1.53</td> </tr> <tr> <td>8</td> <td>1.46</td> <td>1.48</td> <td>1.47</td> <td>1.43</td> </tr> <tr> <td>16</td> <td>1.29</td> <td>1.32</td> <td>1.32</td> <td>1.32</td> </tr> <tr> <td>32</td> <td>1.20</td> <td>1.24</td> <td>1.25</td> <td>1.27</td> </tr> <tr> <td>64</td> <td>1.14</td> <td>1.20</td> <td>1.21</td> <td>1.23</td> </tr> <tr> <td>128</td> <td>1.10</td> <td>1.17</td> <td>1.18</td> <td>1.20</td> </tr> </tbody> </table> (Red means A.M.A.T. not improved by more associativity) Miss Rate Reduction Techniques: Victim Caches - Data discarded from cache is placed in an added small buffer (victim cache). - On a cache miss check victim cache for data before going to main memory. - Jouppi [1990]: A 4-entry victim cache removed 20% to 95% of conflicts for a 4 KB direct mapped data cache. - Used in Alpha, HP PA-RISC machines. Miss Rate Reduction Techniques: Pseudo-Associative Cache - Attempts to combine the fast hit time of Direct Mapped cache and have the lower conflict misses of 2-way set-associative cache. - Divide cache in two parts: On a cache miss, check other half of cache to see if data is there, if so have a pseudo-hit (slow hit) - Easiest way to implement is to invert the most significant bit of the index field to find other block in the “pseudo set”. Drawback: CPU pipelining is hard to implement effectively if L₁ cache hit takes 1 or 2 cycles. - Better used for caches not tied directly to CPU (L₂ cache). - Used in MIPS R1000 L₂ cache, also similar L₂ in UltraSPARC. **Miss Rate Reduction Techniques:** **Hardware Prefetching of Instructions And Data** - Prefetch instructions and data before they are needed by the CPU either into cache or into an external buffer. - **Example:** The Alpha APX 21064 fetches two blocks on a miss: The requested block into cache and the next consecutive block in an instruction stream buffer. - The same concept is applicable to data accesses using a data buffer. - Extended to use multiple data stream buffers prefetching at different addresses (four streams improve data hit rate by 43%). - It has been shown that, in some cases, eight stream buffers that can handle data or instructions can capture 50-70% of all misses. Miss Rate Reduction Techniques: Compiler Optimizations Compiler cache optimizations improve access locality characteristics of the generated code and include: - **Reorder procedures** in memory to reduce conflict misses. - **Merging Arrays**: Improve spatial locality by single array of compound elements vs. 2 arrays. - **Loop Interchange**: Change nesting of loops to access data in the order stored in memory. - **Loop Fusion**: Combine 2 or more independent loops that have the same looping and some variables overlap. - **Blocking**: Improve temporal locality by accessing “blocks” of data repeatedly vs. going down whole columns or rows. Miss Rate Reduction Techniques: Compiler-Based Cache Optimizations Merging Arrays Example /* Before: 2 sequential arrays */ int val[SIZE]; int key[SIZE]; /* After: 1 array of structures */ struct merge { int val; int key; }; struct merge merged_array[SIZE]; Merging the two arrays: – Reduces conflicts between val and key – Improve spatial locality Miss Rate Reduction Techniques: Compiler-Based Cache Optimizations Loop Interchange Example /* Before */ for (k = 0; k < 100; k = k+1) for (j = 0; j < 100; j = j+1) for (i = 0; i < 5000; i = i+1) x[i][j] = 2 * x[i][j]; /* After */ for (k = 0; k < 100; k = k+1) for (i = 0; i < 5000; i = i+1) for (j = 0; j < 100; j = j+1) x[i][j] = 2 * x[i][j]; Sequential accesses instead of striding through memory every 100 words in this case improves spatial locality. Miss Rate Reduction Techniques: Compiler-Based Cache Optimizations Loop Fusion Example /* Before */ for (i = 0; i < N; i = i+1) for (j = 0; j < N; j = j+1) a[i][j] = 1/b[i][j] * c[i][j]; for (i = 0; i < N; i = i+1) for (j = 0; j < N; j = j+1) d[i][j] = a[i][j] + c[i][j]; /* After */ for (i = 0; i < N; i = i+1) for (j = 0; j < N; j = j+1) { a[i][j] = 1/b[i][j] * c[i][j]; d[i][j] = a[i][j] + c[i][j]; } - Two misses per access to \(a\) & \(c\) versus one miss per access - Improves spatial locality Miss Rate Reduction Techniques: Compiler-Based Cache Optimizations Data Access Blocking Example /* Before */ for (i = 0; i < N; i = i+1) for (j = 0; j < N; j = j+1) {r = 0; for (k = 0; k < N; k = k+1) r = r + y[i][k]*z[k][j]; x[i][j] = r; } • Two Inner Loops: – Read all NxN elements of z[ ] – Read N elements of 1 row of y[ ] repeatedly – Write N elements of 1 row of x[ ] • Capacity Misses can be represented as a function of N & Cache Size: – 3 NxNx4 => no capacity misses; otherwise ... • Idea: compute BxB submatrix that fits in cache Miss Rate Reduction Techniques: Compiler-Based Cache Optimizations Blocking Example (continued) /* After */ for (jj = 0; jj < N; jj = jj+B) for (kk = 0; kk < N; kk = kk+B) for (i = 0; i < N; i = i+1) for (j = jj; j < min(jj+B-1,N); j = j+1) {r = 0; for (k = kk; k < min(kk+B-1,N); k = k+1) { r = r + y[i][k]*z[k][j]; } x[i][j] = x[i][j] + r; } • B is called the Blocking Factor • Capacity Misses from $2N^3 + N^2$ to $2N^3/B + N^2$ • May also affect conflict misses Compiler-Based Cache Optimizations <table> <thead> <tr> <th>Function</th> <th>Performance Improvement</th> </tr> </thead> <tbody> <tr> <td>vpenta (nasa7)</td> <td>2.5</td> </tr> <tr> <td>gmtty (nasa7)</td> <td>2.0</td> </tr> <tr> <td>tomcatv</td> <td>1.5</td> </tr> <tr> <td>btrix (nasa7)</td> <td>1.5</td> </tr> <tr> <td>mxm (nasa7)</td> <td>1.0</td> </tr> <tr> <td>spice</td> <td>1.0</td> </tr> <tr> <td>cholesky (nasa7)</td> <td>1.0</td> </tr> <tr> <td>compress</td> <td>1.0</td> </tr> </tbody> </table> Legend: - **merged arrays** - **loop interchange** - **loop fusion** - **blocking** Miss Penalty Reduction Techniques: Giving Priority To Read Misses Over Writes - Write-through cache with write buffers suffers from RAW conflicts with main memory reads on cache misses: - Write buffer holds updated data needed for the read. - One solution is to simply wait for the write buffer to empty, increasing read miss penalty (in old MIPS 1000 by 50%). - Check write buffer contents before a read; if no conflicts, let the memory access continue. - For write-back cache, on a read miss replacing dirty block: - Normally: Write dirty block to memory, and then do the read. - Instead copy the dirty block to a write buffer, then do the read, and then do the write. - CPU stalls less since it restarts soon after the read. Miss Penalty Reduction Techniques: Sub-Block Placement - Divide a cache block frame into a number of sub-blocks. - Include a valid bit per sub-block of cache block frame to indicate validity of sub-block. - Originally used to reduce tag storage (fewer block frames). - No need to load a full block on a miss just the needed sub-block. Miss Penalty Reduction Techniques: Early Restart and Critical Word First • Don’t wait for full block to be loaded before restarting CPU: – *Early restart:* As soon as the requested word of the block arrives, send it to the CPU and let the CPU continue execution. – *Critical Word First:* Request the missed word first from memory and send it to the CPU as soon as it arrives. • Let the CPU continue execution while filling the rest of the words in the block. • Also called *wrapped fetch* and *requested word first*. • Generally useful only for caches with large block sizes. • Programs with a high degree of spatial locality tend to require a number of sequential word, and may not benefit by early restart. Miss Penalty Reduction Techniques: Non-Blocking Caches *Non-blocking cache* or *lockup-free cache* allows data cache to continue to supply cache hits during the processing of a miss: - Requires an out-of-order execution CPU. - “hit under miss” reduces the effective miss penalty by working during misses vs. ignoring CPU requests. - “hit under multiple miss” or “miss under miss” may further lower the effective miss penalty by overlapping multiple misses. - Significantly increases the complexity of the cache controller as there can be multiple outstanding memory accesses. - Requires multiple memory banks to allow multiple memory access requests. - Example: Intel Pentium Pro/III allows up to 4 outstanding memory misses. Value of Hit Under Miss For SPEC Average Memory Access Time (A.M.A.T) Hit Under i Misses 0->1 1->2 2->64 Base EECC551 - Shaaban Cache Miss Penalty Reduction Techniques: Second-Level Cache (L₂) - By adding another cache level between the original cache and memory: 1. The first level of cache (L₁) can be small enough to be placed on-chip to match the CPU clock rate. 2. The second level of cache (L₂) is large enough to capture a large percentage of accesses. - When adding a second level of cache: Average memory access time = Hit time\textsubscript{L₁} + Miss rate\textsubscript{L₁} \times Miss penalty\textsubscript{L₁} where: Miss penalty\textsubscript{L₁} = Hit time\textsubscript{L₂} + Miss rate\textsubscript{L₂} \times Miss penalty\textsubscript{L₂} - Local miss rate: the number of misses in the cache divided by the total number of accesses to this cache (i.e. Miss rate\textsubscript{L₂} above). - Global miss rate: The number of misses in the cache divided by the total accesses by the CPU (i.e. the global miss rate for the second level cache is Miss rate\textsubscript{L₁} \times Miss rate\textsubscript{L₂} Example: Given 1000 memory references 40 misses occurred in L₁ and 20 misses in L₂ The miss rate for L₁ (local or global) = 40/1000 = 4% The global miss rate for L₂ = 20/1000 = 2% L₂ Performance Equations \[ \text{AMAT} = \text{Hit Time}_{L1} + \text{Miss Rate}_{L1} \times \text{Miss Penalty}_{L1} \] \[ \text{Miss Penalty}_{L1} = \begin{array}{c} \text{Hit Time}_{L2} + \\ \text{Miss Rate}_{L2} \times \text{Miss Penalty}_{L2} \end{array} \] \[ \text{AMAT} = \text{Hit Time}_{L1} + \text{Miss Rate}_{L1} \times \left(\text{Hit Time}_{L2} + \text{Miss Rate}_{L2} \times \text{Miss Penalty}_{L2}\right) \] Cache Miss Penalty Reduction Techniques: 3 Levels of Cache, L₁, L₂, L₃ - CPU - L₁ Cache: Hit Rate = H₁, Hit time = 1 cycle - L₂ Cache: Hit Rate = H₂, Hit time = T₂ cycles - L₃ Cache: Hit Rate = H₃, Hit time = T₃ cycles Main Memory Memory access penalty, M L3 Performance Equations $$AMAT = \text{Hit Time}_{L1} + \text{Miss Rate}_{L1} \times \text{Miss Penalty}_{L1}$$ $$\text{Miss Penalty}_{L1} = \text{Hit Time}_{L2} + \text{Miss Rate}_{L2} \times \text{Miss Penalty}_{L2}$$ $$\text{Miss Penalty}_{L2} = \text{Hit Time}_{L3} + \text{Miss Rate}_{L3} \times \text{Miss Penalty}_{L3}$$ $$AMAT = \text{Hit Time}_{L1} + \text{Miss Rate}_{L1} \times (\text{Hit Time}_{L2} + \text{Miss Rate}_{L2} \times (\text{Hit Time}_{L3} + \text{Miss Rate}_{L3} \times \text{Miss Penalty}_{L3}))$$ Hit Time Reduction Techniques: **Pipelined Writes** - Pipeline tag check and cache update as separate stages; current write tag check & previous write cache update - Only STORES in the pipeline; empty during a miss ``` Store r2, (r1) Check r1 Add -- Sub -- Store r4, (r3) M[r1]<- r2& check r3 ``` - Shaded is “Delayed Write Buffer”; which must be checked on reads; either complete write or read from buffer Hit Time Reduction Techniques: Avoiding Address Translation • Send virtual address to cache: Called *Virtually Addressed Cache* or just *Virtual Cache* vs. *Physical Cache* – Every time process is switched logically the cache must be flushed; otherwise it will return false hits • Cost is time to flush + “compulsory” misses from empty cache – Dealing with *aliases* (sometimes called *synonyms*); Two different virtual addresses map to same physical address – I/O must interact with cache, so need virtual address • Solution to aliases: – HW guarantees covers index field & direct mapped, they must be unique; this is called *page coloring* • Solution to cache flush: – Add *process identifier tag* that identifies a process as well as address within process: can’t get a hit if wrong process Hit Time Reduction Techniques: Virtually Addressed Caches Conventional Organization Virtually Addressed Cache Translate only on miss Synonym Problem Overlap $ access with VA translation: requires $ index to remain invariant across translation ## Cache Optimization Summary <table> <thead> <tr> <th>Technique</th> <th>MR</th> <th>MP</th> <th>HT</th> <th>Complexity</th> </tr> </thead> <tbody> <tr> <td>Larger Block Size</td> <td>+</td> <td>−</td> <td>−</td> <td>0</td> </tr> <tr> <td>Higher Associativity</td> <td>+</td> <td>−</td> <td>−</td> <td>1</td> </tr> <tr> <td>Victim Caches</td> <td>+</td> <td>−</td> <td>−</td> <td>2</td> </tr> <tr> <td>Pseudo-Associative Caches</td> <td>+</td> <td>+</td> <td>+</td> <td>2</td> </tr> <tr> <td>HW Prefetching of Instr/Data</td> <td>+</td> <td>−</td> <td>−</td> <td>2</td> </tr> <tr> <td>Compiler Controlled Prefetching</td> <td>+</td> <td>+</td> <td>+</td> <td>3</td> </tr> <tr> <td>Compiler Reduce Misses</td> <td>+</td> <td>+</td> <td>+</td> <td>0</td> </tr> <tr> <td>Priority to Read Misses</td> <td>+</td> <td>−</td> <td>−</td> <td>1</td> </tr> <tr> <td>Subblock Placement</td> <td>+</td> <td>+</td> <td>−</td> <td>1</td> </tr> <tr> <td>Early Restart &amp; Critical Word 1st</td> <td>+</td> <td>−</td> <td>−</td> <td>2</td> </tr> <tr> <td>Non-Blocking Caches</td> <td>+</td> <td>−</td> <td>−</td> <td>3</td> </tr> <tr> <td>Second Level Caches</td> <td>+</td> <td>+</td> <td>+</td> <td>2</td> </tr> <tr> <td>Small &amp; Simple Caches</td> <td>−</td> <td>+</td> <td>+</td> <td>0</td> </tr> <tr> <td>Avoiding Address Translation</td> <td>+</td> <td>−</td> <td>−</td> <td>2</td> </tr> <tr> <td>Pipelining Writes</td> <td>+</td> <td>+</td> <td>−</td> <td>1</td> </tr> </tbody> </table> **Miss rate** **Miss Penalty** **Hit time**
{"Source-Url": "http://meseec.ce.rit.edu:80/eecc551-winter2000/551-1-23-2001.pdf", "len_cl100k_base": 5487, "olmocr-version": "0.1.49", "pdf-total-pages": 32, "total-fallback-pages": 0, "total-input-tokens": 51086, "total-output-tokens": 6464, "length": "2e12", "weborganizer": {"__label__adult": 0.000560760498046875, "__label__art_design": 0.0005788803100585938, "__label__crime_law": 0.0007328987121582031, "__label__education_jobs": 0.0004227161407470703, "__label__entertainment": 0.00010251998901367188, "__label__fashion_beauty": 0.0002999305725097656, "__label__finance_business": 0.0003767013549804687, "__label__food_dining": 0.0006232261657714844, "__label__games": 0.0013885498046875, "__label__hardware": 0.0207061767578125, "__label__health": 0.0009174346923828124, "__label__history": 0.000461578369140625, "__label__home_hobbies": 0.00027680397033691406, "__label__industrial": 0.0018787384033203125, "__label__literature": 0.00023925304412841797, "__label__politics": 0.0004482269287109375, "__label__religion": 0.0008211135864257812, "__label__science_tech": 0.19921875, "__label__social_life": 6.973743438720703e-05, "__label__software": 0.0098419189453125, "__label__software_dev": 0.7578125, "__label__sports_fitness": 0.0007567405700683594, "__label__transportation": 0.00116729736328125, "__label__travel": 0.0003337860107421875}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 17891, 0.03249]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 17891, 0.56824]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 17891, 0.79177]], "google_gemma-3-12b-it_contains_pii": [[0, 846, false], [846, 1913, null], [1913, 2533, null], [2533, 2581, null], [2581, 2629, null], [2629, 2735, null], [2735, 3421, null], [3421, 3785, null], [3785, 4475, null], [4475, 4823, null], [4823, 5493, null], [5493, 6189, null], [6189, 6836, null], [6836, 7197, null], [7197, 7681, null], [7681, 8239, null], [8239, 8843, null], [8843, 9373, null], [9373, 9932, null], [9932, 10676, null], [10676, 11015, null], [11015, 11741, null], [11741, 12470, null], [12470, 12602, null], [12602, 13797, null], [13797, 14226, null], [14226, 14486, null], [14486, 15015, null], [15015, 15430, null], [15430, 16240, null], [16240, 16487, null], [16487, 17891, null]], "google_gemma-3-12b-it_is_public_document": [[0, 846, true], [846, 1913, null], [1913, 2533, null], [2533, 2581, null], [2581, 2629, null], [2629, 2735, null], [2735, 3421, null], [3421, 3785, null], [3785, 4475, null], [4475, 4823, null], [4823, 5493, null], [5493, 6189, null], [6189, 6836, null], [6836, 7197, null], [7197, 7681, null], [7681, 8239, null], [8239, 8843, null], [8843, 9373, null], [9373, 9932, null], [9932, 10676, null], [10676, 11015, null], [11015, 11741, null], [11741, 12470, null], [12470, 12602, null], [12602, 13797, null], [13797, 14226, null], [14226, 14486, null], [14486, 15015, null], [15015, 15430, null], [15430, 16240, null], [16240, 16487, null], [16487, 17891, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 17891, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 17891, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 17891, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 17891, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 17891, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 17891, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 17891, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 17891, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 17891, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 17891, null]], "pdf_page_numbers": [[0, 846, 1], [846, 1913, 2], [1913, 2533, 3], [2533, 2581, 4], [2581, 2629, 5], [2629, 2735, 6], [2735, 3421, 7], [3421, 3785, 8], [3785, 4475, 9], [4475, 4823, 10], [4823, 5493, 11], [5493, 6189, 12], [6189, 6836, 13], [6836, 7197, 14], [7197, 7681, 15], [7681, 8239, 16], [8239, 8843, 17], [8843, 9373, 18], [9373, 9932, 19], [9932, 10676, 20], [10676, 11015, 21], [11015, 11741, 22], [11741, 12470, 23], [12470, 12602, 24], [12602, 13797, 25], [13797, 14226, 26], [14226, 14486, 27], [14486, 15015, 28], [15015, 15430, 29], [15430, 16240, 30], [16240, 16487, 31], [16487, 17891, 32]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 17891, 0.11078]]}
olmocr_science_pdfs
2024-11-25
2024-11-25
490dcc1947013fae61733c2b720ffc7cb1b81d34
Towards Querying Implicit Knowledge in XML Documents Diego Mury Gomes de Lima\textsuperscript{1}, Carla Delgado\textsuperscript{1}, Leonardo Murta\textsuperscript{2}, Vanessa Braganholo\textsuperscript{2} \textsuperscript{1} PPGI/Federal University of Rio de Janeiro, Brazil dmlima@ufrj.br, carla@dcc.ufrj.br \textsuperscript{2} Fluminense Federal University, Brazil {leomurta, vanesssa}@ic.uff.br Abstract. The expressive growth in the volume of data stored as XML stimulates the improvement of methods for obtaining novel ways to explore this information. Methods for providing elaborated answers to increasingly more complex queries were recently investigated, but existing approaches mainly analyze information that is explicitly defined in the XML document. This work presents an approach that is capable of processing implicit knowledge through inference, guided by user defined rules. This can cause a significant increase in the query possibilities, allowing easy access to new information, serendipitous results and providing for more elaborate queries. Categories and Subject Descriptors: H. Information Systems [H.2 Database Management]: Systems—Rule-based databases Keywords: inference, prolog, query, XML 1. INTRODUCTION XML has quickly become a universal standard for information exchange over the Web. The rise of large data collections in this format puts in evidence the need of improving query methods, so that large portions of data can be efficiently managed [Kotsakis 2002]. Most of the XML query languages currently available, such as XPath [Clark and Derose 1999] and XQuery [Boag et al. 2010], gather the query answers by navigating from the root of the document to an internal element of interest, and applying filters to obtain the desired result. The query is usually processed over the explicit data, ignoring any implicit information that may be obtained from it. This implicit information, however, is crucial in many applications. Consider, for instance, provenance data collected from workflow executions [Freire et al. 2008; Mattoso et al. 2010]. In this scenario, there is a lot of implicit information that cannot be easily queried, such as "what were the activities that contributed to produce a given workflow output?". Stimulated by the expressive power of XML and by the large volume of information currently available in this format, the approach we propose in this work suggests an improvement in the XML query mechanisms. This is obtained through the use of inference machines in order to increase query possibilities, allowing for more elaborate results. As an example, an XML document that defines that John is the parent of Peter, and that Peter is the parent of Paul, does not have enough information to answer queries about grandparenthood. However, once an expert inserts a rule that specifies that grandparent is the parent’s parent, the system should be able to answer that John is Paul’s grandparent. To make inference possible, we need to translate XML data to some language that provides such capability. RuleML [Boley 2001], Datalog [Gallaire and Minker 1978], RIF [Kifer 2008] and Prolog Authors would like to thank CNPq and FAPERJ for partially supporting this research work. Copyright©2012 Permission to copy without fee all or part of the material printed in JIDM is granted provided that the copies are not made or distributed for commercial advantage, and that notice is given that copying is by permission of the Sociedade Brasileira de Computação. [Lloyd 1984] allow inference and are alternatives to solve this problem. Our choice was based on the features of these languages. Datalog, for instance, does not accept complex terms as predicate arguments and has restrictions on the use of negation and recursion. Thus, we decided not to use it. RuleML was also discarded, since it uses Datalog as basis for inferences. Rule Exchange Format (RIF) [Kifer 2008], on the other hand, is a W3C Recommendation to represent rules over the internet. It became a W3C recommendation in mid 2010. Since this is a very recent proposal, reasoners and other related technology are still under development. Consequently, we opted for using a Prolog inference machine to interpret implicit data and define new information over XML data. In the future, we may migrate to RIF. The remaining of this work is organized in three sections. Section 2 illustrates our proposed approach, which we call XMLInference, and describes our XML-to-Prolog translation method. Section 3 discusses related work. Finally, section 4 concludes the article. 2. XMLInference: A Query Method to Infer Data Our approach processes data contained in the XML structure with the goal of inferring new information. It enables more complex answers to be obtained from either explicit information or information deduced through inference rules (implicit information). For this to be possible, we build a knowledge base with facts (representing the XML data), rules (derived from the document’s schema), and manual rules (provided by an expert user). This extends the query possibilities, providing the means for inference of new information. Our method, called XMLInference, is divided in three stages: rules configuration, generation of facts, and query. Figure 1 illustrates each stage and its phases. During the rules configuration stage, the user informs to the system the schemas that validate the XML documents that will be queried. Such schemas are analyzed by a schema translator component that generates Prolog rules from the processed data. We call such rules "automatic rules". This component is also responsible for generating predicate definitions, which are Prolog predicate signatures. Using these definitions, an expert user can manually generate new rules. In the end of the first stage, the knowledge has Prolog rules that were automatically derived by our method, and manual rules that were added by the expert. Such knowledge base can be stored as a new project and can be loaded whenever needed. The second stage uses the XML translator to derive Prolog facts from the XML documents. After this stage, all information contained in the XML document and in the schemas is defined in Prolog as facts and rules, respectively, together with manual rules. Such information constitutes the knowledge base and are subject to inference. Finally, in the third stage, the user is able to perform queries that are processed by the Prolog inference machine. The results are presented to the user that may submit additional queries, since the environment is all set up. Towards Querying Implicit Knowledge in XML Documents Fig. 2. Example of XML document (left) and its Prolog translation (right) Sections 2.1, 2.2 and 2.3 explain the translation rules of stages 1 and 2 of Figure 1. For didactical reasons, the translation of XML documents is explained before the schema translation. This inversion was intentional: since facts are simpler than rules, we present them beforehand, so that the reader gets familiarized with the syntax. In practice, this process is transparent to the user. This way, Section 2.1 explains the translation of XML documents to Prolog facts (second stage). Sections 2.2 and 2.3 explain the translation of the XML schemas to automatic and manual rules, respectively. 2.1 XML to Prolog translation The translation process generates several facts for a single XML document. It transforms XML elements into predicates, and its content into constants. To relate distinct predicates, an identifier (Prolog constant) is added as a parameter. This allows to connect facts that represent parent/child relations in the XML document. The translation process is guided by five possible translation types, as follows. An example of the application of these translations is presented in Figure 2. Translation of the document root (Figure 2, line 1). The XML document root must be treated in a special way, because this is the only element in the document that does not have a parent. In the large majority of the cases, the root is a complex element (unless it is a rare case of a document that contains a single simple element). Thus, the result of the translation of complex roots is a fact with the element name and a single argument that is equal to an application generated id. The main purpose of this id is to establish a connection with the child elements of the root. Translation of complex elements (Figure 2, line 2). Complex elements have other elements as children. Thus, a new identifier is generated to relate the children with their parent. As the result of the translation, XMLInference generates a fact with the complex element name and two arguments: the parent’s id and the element’s id. Its children are translated accordingly to its type (simple, complex, etc). Translation of atomic elements, with no attributes (Figure 2, lines 3 and 5). Atomic elements with no attributes have its textual content as its single child in the XML tree. Thus, they are translated as a Prolog fact named after the element’s name. The arguments, in this case, are the parent’s id and the element content. Translation of atomic elements with attributes (Figure 2, lines 6 and 7). Attributes are considered children of the element that possesses them. We generate a new identifier for the element, so that its attribute child can reference it. XMLInference generates a fact that represents the element, plus a fact for each of its attributes. The former has the element name and three arguments: the parent’s id, the new element’s identifier, and its textual content. The remaining facts have the attribute name and two arguments: the parent’s id (that represents the element that contains the attribute), and the attribute value. Translation of mixed elements (Figure 2, line 4). Mixed elements are translated similarly to complex elements, except by the generation of “xml/mixedElement” facts to the element’s text children (once they do not have names). This naming scheme was adopted considering that the XML specification does not allow XML element names to contain the “/” character. Thus, no other translation can generate facts named “xml/mixedElement”. This way, our translation mechanism generates “xml/mixedElement” facts with two arguments: the parent’s id (the complex element) and its textual content. The other children are translated according to the appropriate translation rule. 2.2 Automatic Rules Prolog rules are needed to make inference possible. Such rules are categorized into two types: manual and automatic rules. Automatic rules are automatically obtained from the document’s XML Schema. They define the structure that must be followed by the facts in the knowledge base. Manual rules are inserted by an expert with the goal of increasing the inference power of our approach. In this section, we focus on automatic rules. Section 2.3 explains manual rules. Our translation method generates different Prolog rules for XML Schema that validates the XML documents loaded into our knowledge base. This translation considers all three XML Schema group delimiters: sequence, choice and all [Fallside and Ghemawat 2004]. These group delimiters define the structure of the XML documents. The next sections present the translation method that generates the automatic rules (stage 1 of our approach). 2.2.1 Complex Elements with Simple Children. The simplest cases of automatic rules are derived from complex elements that possess only simple elements as children. In this case, basic translation rules for each of the group delimiters sequence, choice, and all are used. Translation of sequence. Among the existing group delimiters, the most used is sequence [Lan-} der et al. 2009]. Its specification suggests that the complex element using it must follow the structure defined at the schema, respecting order and cardinality. The translation method that treats the schema produces a rule that respects the structure established by the analyzed sequence. Figure 3 (left side) shows part of an XML schema containing a sequence group delimiter. The head of the Prolog rule generated in this case refers to the complex element (“address” in Figure 3) and has the following arguments: a Prolog variable representing the rule’s identifier “ID”, responsible for relating the rule to the other terms defined in Prolog (facts and rules), and one variable to each of the complex element’s children (“STREET” and “HOUSE_NUMBER” in our example), in order to obtain the value of these attributes through the association of the identifier with the facts (or rules) referring to each of them. The tail of the rule possesses a fact referring to each child, with the same arguments of the rule’s identifier (establishing its relation with the head) and the corresponding variable. Figure 3 shows in the right-hand side the automatic rule obtained from the translation of the schema presented in the left-hand side of Figure 3. Translation of choice. The specification of the choice group delimiter allows a complex element to have as its child just one of the options defined in its structure. Thus, the translation method creates a rule for each option of choice, attending each of the possible valid structures. Figure 4 shows part of a schema with the occurrence of the choice group delimiter. The result of the translation is a set of Prolog rules referring to the possible options of the structure that the complex element might have, as illustrated in Figure 4, right-hand side. The head of rule is formed by the complex element “unit”, having as arguments a variable representing the rule’s identifier Towards Querying Implicit Knowledge in XML Documents ``` <xs:element name="unit" type="tUnit"/> <xs:complexType name="tUnit"> <xs:choice> <xs:element name="area" type="xs:string"/> <xs:element name="volume" type="xs:string"/> </xs:choice> </xs:complexType> ``` ```prolog unit(ID, area, AREA) :- area(ID, AREA). unit(ID, volume, VOLUME) :- volume(ID, VOLUME). ``` ![Fig. 4. Example of XML Schema with "choice" (left) and its Prolog translation (right)](image) ``` <xs:element name="contact" type="tContact"/> <xs:complexType name="tContact"> <xs:all> <xs:element name="phone" type="xs:string"/> <xs:element name="email" type="xs:string"/> </xs:all> </xs:complexType> ``` ```prolog contact(ID, phone, PHONE) :- phone(ID, PHONE). contact(ID, email, EMAIL) :- email(ID, EMAIL). ``` ![Fig. 5. Example of XML Schema with "all" (left) and its Prolog translation (right)](image) ``` <contact> <email>email@email.com</email> <phone>77777777</phone> </contact> ``` ![Fig. 6. Example of XML document according to the schema of Figure 5](image) “ID”, an option identifier (we use the element’s name), responsible for indicating which of the options was adopted, and a variable referring to the corresponding element. In Figure 4, “area” and “volume” are respectively the identifiers of the options, while “AREA” and “VOLUME” are the variables. The tail of the rule has the fact referring to the child corresponding to the rule with two arguments: the rule’s identifier (to establish the relation with the rule) and the appropriate variable. **Translation of all.** The group delimiter `all` allows the complex element to have any combination of the options defined in its structure (in any order), making the occurrence of several different elements possible. During the translation, the element that has the group delimiter turns out to be the rule’s head, which will be defined with the following parameters: a rule identifier “ID”, an identifier of the option and a variable that represents the child corresponding to the chosen option. Once more, the rule will relate the possible children through its ID. Figure 5 (left-hand side) shows part of a schema that has a complex element `all`, whereas Figure 5 (right-hand side) shows the result of the translation of this same part of schema using the proposed algorithm. The specification of the group delimiter `all` defines that it can only be used as the most external group of any complex type, and also that its children should all be elements. So there cannot be complex structures contained in or that contains the group delimiter `all`. Another restriction prevents the children elements of `all` to have cardinality greater then 1, limiting to 0 or 1 the values allowed for `minOccurs` and indicating that the value of `maxOccurs` should be 1. In the right-hand side of Figure 5, “phone” is the option identifier of the first generated rule that refers to the `phone` element. Notice that `phone` is a child of the complex element `all`. On the other hand, “PHONE” is a variable that represents the textual content of the `phone` element. It is important to note that the option identifier acts as metadata of `contact`, while the variables represent the values themselves. This enables queries such as: `contact(7, METADATA, DATA)`. Assuming the XML document presented at Figure 6 and assuming that “contact” was generated with ID=7, the aforementioned query would generate the following result: ``` METADATA = email, DATA = email@email.com; METADATA = phone, DATA = 77777777; ``` 2.2.2 Complex Elements with Complex Children. The translation method for complex elements with complex elements as children adopts the same principles of the previously mentioned basic translation rules, used to generate automatic rules. However, because children elements are complex, some additional care is needed to precisely map the valid structures of the XML document into rules. Translation of sequence with choice child. The translation of a group delimiter sequence, which owns a choice child, adopts rules defined as the union of the translation of both groups. The schema scrap presented in Figure 7 shows that the complex element “customer” has two children: the first may be “ssn” or “company_id” and the second is always “phone”. This results in a situation similar to the existence of two different sequences, one of them containing “ssn” and “phone” and the other containing “company_id” and “phone”. This way, the translation consists of two distinct rules, one for each situation. It is important to notice that the head of the rule also contains the choice to facilitate future queries. The right-hand side of Figure 7 shows the results of the translation of the schema shown in the left-hand side of Figure 7. Translation of choice with sequence child. A complex element delimited by choice may have sequence children. If this happens, our translation method adopts a Prolog constant \((s1, ..., sn)\) for each sequence child. These constants work as identifiers of the possible choices. This is necessary because the sequence group delimiter has no corresponding name that can be used to identify the Prolog rule. The remaining of the process is similar to the translation of choice with simple children elements. Figure 8 illustrates the translation process. There are also other possible combinations of group delimiters, and we treat them by applying the “neutral element property”, as explained next. The neutral element property. If a complex element has the same group delimiter as its parent (sequence with sequence child, or choice with choice parent), then we can treat it as a neutral element in our translation. To understand this concept, let \(C\) be the choice group delimiter, let \(S\) be the Towards Querying Implicit Knowledge in XML Documents Fig. 9. XML Schema with nested sequence group delimiters (left), simplified schema (right), and its Prolog translation \[ \text{customer}(\text{ID}, \text{NAME}, \text{SSN}, \text{PHONE}) \leftarrow \text{name}(\text{ID}, \text{NAME}), \text{ssn}(\text{ID}, \text{SSN}), \text{phone}(\text{ID}, \text{PHONE}). \] Fig. 10. XML Schema with nested choice group delimiters (left), simplified schema (right), and its Prolog translation \[ \text{unit}(\text{ID}, \text{area}, \text{AREA}) \leftarrow \text{area}(\text{ID}, \text{AREA}). \text{unit}(\text{ID}, \text{length}, \text{LENGTH}) \leftarrow \text{length}(\text{ID}, \text{LENGTH}). \text{unit}(\text{ID}, \text{mass}, \text{MASS}) \leftarrow \text{mass}(\text{ID}, \text{MASS}). \text{unit}(\text{ID}, \text{volume}, \text{VOLUME}) \leftarrow \text{volume}(\text{ID}, \text{VOLUME}). \] sequence group delimiter, and let X, Y, and Z be child elements of C or S. The sequence specification defines that its children must appear in the XML document in the same order they appear in the schema. Thus, a sequence that has a sequence child preserves this restriction. This allows the following transformation: \( S(X, S(Y, Z)) = S(X, Y, Z) \). We make this simplification in the schema before running our translation algorithm, as shown in Figure 9. The same reasoning applies to the choice group delimiter. The choice specification requires that the XML document contain only one of the elements defined inside it in the schema. In the case a choice has another choice as a child, it can be interpreted as a single choice that includes the child elements of both. Formally, we have \( C(X, C(Y, Z)) = C(X, Y, Z) \). Figure 10 illustrates such case. There is also a special treatment for optional elements and for elements with cardinality greater than one. We omit the translation details due to space restrictions. It is worth noting that we do not adopt any existing method to translate XML to Prolog [Coelho and Florido 2003; Seipel 2002; Wielemaker 2005] because these methods work at a coarse grain, mapping the whole XML into one Prolog fact. We need a fine-grained mapping, where elements become Prolog facts. This unleashes the Prolog inference machine to use features like backtracking when answering complex queries. Moreover, the main goal of automatic rules is to ease the process of writing manual rules. This occurs because automatic rules are adherent to the structure of the document, and try to simplify the usage of basic Prolog facts generated from the document. Thus, our approach can be adopted even if the document does not have an associated schema. However, in this situation, no automatic rule can be generated and probably more manual rules will have to be created. 2.3 Manual Rules Manual rules are elaborated rules that cannot be automatically obtained from the schema. The approach we propose allows the insertion of manual rules by an expert user during the rules configuration stage. The goal is to enable more complex inferences, thus achieving query results that cannot be obtained from the information contained in the document or in the XML schema. As an example, the schema defined in Figure 11 does not have any information regarding partnership. Nevertheless, it might be necessary to establish this relation among the registered people. Analyzing the definition of the predicates generated from the schema translation, an expert user (with domain knowledge and Prolog knowledge) can create rules that make it possible to infer such information. The semantics behind a set of XML tags (for example, the fact that two owners of the same business are partners) is not automatically captured by a translation schema, but it can be noticed by knowledge engineers (expert users). They can evaluate if this concept enriches the knowledge base and decide to include it in the form of a rule. It is worth mentioning that this only occurs at the configuration stage, and that these users might not be the ones that will use the query system later (the experts might be there during the environment setup only). Figure 11, right side, illustrates the manual rule that must be inserted by an expert user to implement the partnership relation among people. During the query stage, the user gets information about the partnership relation through the query term: “partner(X, Y)”. With XQuery, the same information would be obtained by means of a much more complex query, shown in Figure 12. The inference mechanism from Prolog allows the reuse of rules to elaborate more complex queries. Considering our example, Figure 13 shows four Prolog rules that make it possible to obtain query results with respect to partnerships originated from inheritance (heir partners). Notice that the rules “heirPartner” reuse previously defined rules “partner” and “heir”. This is not allowed in XQuery: XQuery users must define all the desired relations in each query. Towards Querying Implicit Knowledge in XML Documents heir(Heir, Predecessor) :- name(ID, Heir), parentName(ID, Predecessor). heir(Heir, Predecessor) :- name(ID, Heir), parentName(ID, Predecessor2), heir(Predecessor2, Predecessor). heirPartner(Name1, Name2) :- hairPartner2(Name1, Name2). heirPartner(Name1, Name2) :- hairPartner2(Name2, Name1). heirPartner2(Name1, Name2) :- heir(Name1, Predecessor1), partner(Predecessor1,Name2). heirPartner2(Name1, Name2) :- heir(Name1, Predecessor1), heir(Name2, Predecessor2), partner(Predecessor1, Predecessor2). Fig. 13. Example of heirPartner manual rule 3. RELATED WORK The integration of Logic Programming and the Database field has been studied with the intention to ease the representation and manipulation of data. [Niemi and Jarvelin 1991] proposed the adoption of Prolog to represent a relational database’s knowledge base. With the dissemination of the Internet and the emergence of large amounts of XML data, the interest in the integration of Logic Programming with the processing of XML data has grown [Boley 2000; Almendros-Jiménez et al. 2008; Bailey et al. 2005; Seipel 2002]. Similar to us, Almendros-Jiménez et al. (2008) propose a translation from XML documents into facts, and from schemas into Prolog rules. The goal of their work is to implement the XPath language in Logic Programming. Their method, tough, translates only the necessary path to answer a submitted query, whereas our work translates the whole document, allows the insertion of new rules and the use of Prolog queries. Seipel (2002) proposes a model to represent XML documents in Prolog called field-notation. The main goal of his work is to show that semi-structured data can be represented and queried using logic programming. His translation, however, differs from the one we propose here once Seipel uses association lists to represent data in Prolog. Thus, his method generates a list containing the entire XML document. Elements inside this list are nested and represented as attribute/value pairs. In his work, Boley (2000) establishes a strong relation between logic programming and XML. His goal is to investigate the use of XML in formal documents. Thus, he investigates XML to prolog translation, and also Prolog to XML translation. He represents Herbrand terms and Horn clauses in an XML language called XmlLog. He then investigates how to query the resulting XML document by using XQL. Once more, his translation differs from ours in the sense that it generates large Prolog facts, which overcomplicates the query process. Coelho and Florido (2003) make types’ inference in XML documents with the usage of logic programming. This approach aims at deducing the data type of elements contained in the structure and use a DTD to support the translation process. In our approach, we adopt the use of XML Schema. As we propose, Coelho and Florido use Prolog to make inferences over XML data, but their work is concerned with the inference of data types instead of content. Similar to the work of Boley (2000) and Seipel (2002), his translation method also generates large Prolog facts. 4. FINAL REMARKS This work proposes a query method for XML documents that is not restricted only to the documents’ explicit data. With the support of previously loaded XML Schemas, rules that should be followed by the instances (database facts) can also be queried and used for the inference of implicit information, enriching the queries’ results. Even though the initial information set is represented in XML documents, the users should make their queries in Prolog, once all data is translated to this language. This is done in order to make inference possible. In spite of the fact that many of the users interested in querying XML documents have a technological background and could possibly be familiarized with Prolog, this obstacle can be eased with the adoption of a graphical interface that generates the Prolog queries from the selection of high level options [Costa and Braganholo 2010]. A limitation of our approach resides in the fact that Prolog treats upper-case text as variables. Thus, our translation mechanism for choice and all group delimiters does not work when the XML element is written in uppercase. A possible solution to this limitation is to pre-process the document and its schema, translating all element names to lowercase. Another one is to use an escape character in Prolog. We are studying alternative solutions to this limitation. We are currently working on the experimental evaluation of our approach. It will be based on the XBench XML benchmark [Yao et al. 2004]. In this experiment, we plan to measure both expressiveness and query processing time. As future work, we intend to experiment with users with different backgrounds and expertise levels, to evaluate the usability of our approach from the user’s point of view. REFERENCES
{"Source-Url": "https://seer.ufmg.br/index.php/jidm/article/download/170/113", "len_cl100k_base": 6345, "olmocr-version": "0.1.53", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 27510, "total-output-tokens": 8037, "length": "2e12", "weborganizer": {"__label__adult": 0.0003871917724609375, "__label__art_design": 0.0006666183471679688, "__label__crime_law": 0.0005669593811035156, "__label__education_jobs": 0.0018739700317382812, "__label__entertainment": 0.0001531839370727539, "__label__fashion_beauty": 0.00023174285888671875, "__label__finance_business": 0.0005331039428710938, "__label__food_dining": 0.00042891502380371094, "__label__games": 0.0006604194641113281, "__label__hardware": 0.0007252693176269531, "__label__health": 0.0006737709045410156, "__label__history": 0.0004506111145019531, "__label__home_hobbies": 0.00012981891632080078, "__label__industrial": 0.0006618499755859375, "__label__literature": 0.0008645057678222656, "__label__politics": 0.00037550926208496094, "__label__religion": 0.0006513595581054688, "__label__science_tech": 0.1923828125, "__label__social_life": 0.00016164779663085938, "__label__software": 0.0295562744140625, "__label__software_dev": 0.76708984375, "__label__sports_fitness": 0.0002512931823730469, "__label__transportation": 0.0005326271057128906, "__label__travel": 0.00021326541900634768}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 32737, 0.02068]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 32737, 0.5486]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 32737, 0.88637]], "google_gemma-3-12b-it_contains_pii": [[0, 3521, false], [3521, 6605, null], [6605, 10164, null], [10164, 13680, null], [13680, 17260, null], [17260, 19495, null], [19495, 22300, null], [22300, 24490, null], [24490, 28351, null], [28351, 32737, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3521, true], [3521, 6605, null], [6605, 10164, null], [10164, 13680, null], [13680, 17260, null], [17260, 19495, null], [19495, 22300, null], [22300, 24490, null], [24490, 28351, null], [28351, 32737, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 32737, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 32737, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 32737, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 32737, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 32737, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 32737, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 32737, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 32737, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 32737, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 32737, null]], "pdf_page_numbers": [[0, 3521, 1], [3521, 6605, 2], [6605, 10164, 3], [10164, 13680, 4], [13680, 17260, 5], [17260, 19495, 6], [19495, 22300, 7], [22300, 24490, 8], [24490, 28351, 9], [28351, 32737, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 32737, 0.0]]}
olmocr_science_pdfs
2024-12-06
2024-12-06
67c5a90516dce6de700ab8d6b9cacaae685ea5cf
Logic Programming and Knowledge Representation in Computer Games Jozef Šiška, Michal Turček and Milutín Krištofič KAI FMFI UK, Mlynská dolina, 842 48 Bratislava siska@ii.fmph.uniba.sk Abstract. Certain kinds of computer games (especially role-playing and adventure games) offer an exact, coherent and relatively small and simple world description. This includes the background knowledge about the world in question, static description of the world state and description of actions and their consequences. Such system can be seen as a multi-agent system and presents a variety of knowledge representation problems. Logic Programming and specifically Answer Set Programming are formalisms for knowledge representation and reasoning based on classical logic. They allow a clean and declarative characterization of many KR based problems. In this article we present two applications of Logic Programming in the area of computer games: a simple interactive game and an ASP based world evaluation module for an existing game. We also present a framework for dynamic modularization of logic programs and describe the implementations. 1 Introduction The aim of this work is to present two applications of Logic Programming in the area of computer games. First is a simple interactive game used to test the ability of ASP to describe game world and to help development of such descriptions. The second is an ASP based world evaluation module for an existing game, that enhances a computer game scripting engine with the ability to declaratively describe the game world and quests. We also present a framework for dynamic modularization of logic programs, which splits the programs into modules and allows to dynamically specify when are they to be included. Finally we describe the implementations being developed. Logic Programming (LP) is one of the knowledge representation formalisms that are strongly bound to classical logic. It provides the ability do declaratively specify knowledge and problems. With the addition of negation as failure it is also able to do non-monotonic reasoning. Although logic programming is aimed... primarily at the representation of static knowledge, it had been used in many approaches to define dynamic domains such as planning and multi-agent systems. Several extensions to logic programming have been also proposed to allow a more simple description of such dynamic domains. Computer games have used the most recent advancements in computer graphics and physics simulations. However, the area of artificial intelligence in games (meaning planning and deciding for the computer controlled objects – items, computer opponents, . . . ) is not very advanced. Average game producers care about things that sell the games – nice graphics or realistic physics of the world. The AI part of the game started to get attention only recently. Although it is very easy to identify problems from the areas of multi-agent systems and knowledge representation in some kinds of computer games, theoretical knowledge from these areas is scarcely used. Every computer game takes place in a specific world. Some kinds of games, mainly role-playing (RPG) and adventure games are based primarily on player’s interaction with such a world. Creativity plays the main part in such interaction. The more ways to finish a task there are (and the more creative and full of fun), the better the game is. It is therefore a constant goal to make the game world as open and generic as possible. Most games are usually scripted using game engines, which provide communication with the player and a scripting interface. The more complex the quests are, the harder the creation of a game becomes. It is very common that a game does not consider a task finished even when it is from the player’s perspective. Such scripting glitches then negatively influence player’s experience and perception of the game. Declarative description of such world and tasks can therefore be much easier to create and maintain. The paper is organized as follows: in sections two and three we present the logic programming formalism and a basic description of computer games. Section four describes an ASP based game that allows to independently develop, test and evaluate declarative descriptions of game worlds. Section five describes the application of such declarative description in an existing game engine. Section six presents a dynamic modularization of logic programs that reduces the complexity of evaluated programs and shortly describes the implementations. The final section includes comparison to other work and possible future directions. 2 Logic Programming In this paper we will concentrate on a class of logic programs called Dynamic Logic Programs[8] which are a generalization of Logic Programs. First we recall some basic concepts and notation. Then we characterize some classes of logic program and recall the definition of the class of Dynamic Logic Programs. Let \( A \) be a set of propositional atoms (also called objective literals). For an atom \( A \), \( \text{not } A \) is called a default literal. We denote \( L = \{A, \text{not } A | A \in A\} \) the set of all literals. For a literal \( L \in L \), we use \( \text{not } L \) to denote its opposite counterpart. Thus \( \text{not } L = \text{not } A \) iff \( L = A \) and \( \text{not } L = A \) iff \( L = \text{not } A \). We call \( L \) and not \( L \) conflicting literals and denote it by \( L \succ \neg L \). For a set of literals \( M \subseteq \mathcal{L} \) we denote \( M^+ \) the set of all objective literals and \( M^- \) the set of all default literals from \( M \). A set of literals \( M \) is called consistent if it does not contain two conflicting literals, otherwise it is inconsistent. A generalized logic program \( P \) is a countable set of rules of the form \( L \leftarrow L_1, L_2, \ldots, L_n \), where \( L \) and each of \( L_i \) are literals. When all literals are objective, \( P \) is called a definite logic program. For a rule \( r \) of the form \( L \leftarrow L_1, L_2, \ldots, L_n \) we call \( L \) the head of \( r \) and denote by head\((r)\) we denote the set \( \{L_1, L_2, \ldots, L_n\} \) and call it the body of \( r \). If body\((r) = \emptyset \) then \( r \) is called a fact. Two rules \( r \) and \( r' \) are called conflicting (opposite) if head\((r)\) and head\((r')\) are conflicting and we denote this by \( r \succ r' \). An interpretation is any consistent set of literals \( I \). \( I \) is called a total interpretation if for each \( A \in \mathcal{A} \) either \( A \in I \) or \( \neg A \in I \). A literal \( L \) is satisfied in an interpretation \( I \) (\( I \models L \)) if \( L \in I \). A set of literals \( S \subseteq \mathcal{L} \) is satisfied in \( I \) (\( I \models S \)) if each literal \( L \in S \) is satisfied in \( I \). A rule \( r \) is satisfied in \( I \) (\( I \models r \)) if \( I \models \text{body}(r) \) implies \( I \models \text{head}(r) \). A total interpretation \( M \) is called a model of logic program \( P \) if for each rule \( r \) in \( P \) \( M \models r \). We also say that \( M \) models \( P \) and write \( M \models P \). For a generalized logic program \( P \) we denote \( \text{least}(P) \) the least model of the definite logic program \( P' \) obtained from \( P \) by changing each default literal \( \neg A \) into a new atom \( \neg A \). According to [4] we can define stable models of a generalized logic program as those models \( M \) for which \[ M = \text{least}(P \cup M^-). \] Dynamic Logic Programs as an extension of Logic Programs provide a way to express changing knowledge. Knowledge is structured into a sequence of logic programs. Conflicts between rules are resolved based on causal rejection of rules – for two conflicting rules, the more recent one overrules the older. Thus more recent programs contain more important rules which override older rules. A Dynamic Logic Program is a sequence of generalized logic programs \( \mathcal{P} = (P_1, P_2, \ldots, P_n) \). We use \( \rho(\mathcal{P}) \) to denote the multisets of all rules \( \rho(\mathcal{P}) = \bigcup_{1 \leq i \leq n} P_i \). A total interpretation \( M \) is a stable model of \( \mathcal{P} \) iff \[ M = \text{least}(\rho(\mathcal{P}) \setminus \text{Rej}(\mathcal{P}, M) \cup \text{Def}(\rho(\mathcal{P}), M)) \] where \[ \text{Rej}(\mathcal{P}, M) = \{ r \mid r \in P_i, \exists r' \in P_j : r \succ r', i \leq j, M \models \text{body}(r') \}\] \[ \text{Def}(\rho(\mathcal{P}), M) = \{ \neg A \mid A \in \mathcal{L}, \exists r \in \rho(\mathcal{P}) : M \models \text{body}(r), \text{head}(r) = A \}\] The set \( \text{Rej}(\mathcal{P}, M) \) contains all rejected rules from \( \mathcal{P} \) i.e. rules for which there is a conflicting rule satisfied in \( M \) in more important program. The set \( \text{Def}(M) \) contains default negations of all unsupported atoms. The previous definition defines the \textit{Refined Dynamic Stable Model semantics} (RDSM) [3]. All other semantics for DynLoP based on causal rejection of rules [2, 8, 6, 7, 10, 11] can be achieved by corresponding definitions of the sets $\text{Rej}(P, s, M_s)$ and $\text{Def}(\rho(P_s, M_s))$. A transformational semantics equivalent to the DSM semantics can be defined for DynLoP[8]. This semantics transforms the DynLoP into a generalized logic program with a set of models that corresponds to that of the DynLoP. This allows for direct implementation of the DSM semantics for DynLoP by using existing solutions for LP. 3 \hspace{1em} \textbf{Computer games} In this section we take a closer look on the world of a computer game. We describe the basic elements, how game engines usually handle them and compare them to the elements of a multi-agent system. Although all computer games take place in a certain game world, there are types of games which highly depend on a really open and \textit{intelligent} interaction of the player with such a world. These include mostly Role Playing Games (RPGs) and Adventure games. These are the games we are mostly interested in this paper. It is clear that such \textit{intelligent interaction} requires a good ability of the game engine to reason about the game world and thus an appropriate knowledge representation of the world. Therefore in this paper we provide an overview of a game (game engine) from the side of the game world representation and common tasks that are required to be done over it. In an RPG game, the player assumes the role of a fictional character, guiding it through the game world, solving quests and task and building a storytelling background for his character. An adventure game is very similar to an RPG game, but the action elements are more reduced and the game is more based on puzzle-solving and interaction with the surrounding world. One of the main distinction between RPG and adventure games is a very detailed system describing how the player’s character evolves and improves through the course of an RPG game. On the other hand in adventure games the abilities of a player character do not change that much and are not that important during the game. 3.1 \hspace{1em} \textbf{Game engines} Computer games are not written from scratch. Computer game engines are used, which contain various common parts used in multiple games and final games are built on top of them. Existing game engines vary in the level of generalization, from very specific with most of the game mechanics and other things hardcoded, to general engines resembling only an user interface. Engines also offer various levels of scripting support, ranging from very simple and limited to full featured, object oriented, event driven scripting languages. All are however procedural and usually every non-trivial event in a game requires a complex script. The quality and consistency of these scripts then forms a major factor of games’ quality and impression. There are two levels of game mechanics in an RPG game engine: one responsible for technical gameplay and a roleplaying part that creates an illusion of story and meaning in the game. The first one is very simple: moving around the world and performing few predefined actions or using dialogs, where user chooses one of the presented options. Game designers than use the scripting abilities of the game engine to give meaning to these simple actions and create the storytelling layer presenting the player with a story behind the game. The game engines always provide some kind of interface to the representation of the game world ranging from direct access to the whole knowledge about the world to specifically prepared and processed knowledge for a specific NPC. They also offer different kinds of possible actions to be accessible from the scripting interface. These include ability to directly change the world representation, limited ways of changing properties of game objects or selecting actions for computer controlled characters. 3.2 World of a computer game World of RPG and adventure games consist of objects, such as player character, non-player characters (NPCs), items or even abstract items (sounds, light). Objects can be passive or active. Active objects can execute actions and passive objects are only targeted by actions, thus changing their properties. A special active object in a game is the player object, which is controlled by the player. It represents usually the character or item the player controls, although there are games where player controls more characters. Or in the case of multiplayer games, more players can play the game at a time. Game objects have properties, which can be changed as a result of actions. Some properties and their changes are given by the basic mechanics of the game (position, motion, . . . ). Other properties are determined specially, by game scripts. This usually includes tracking the progress of the game or quest: specific properties are recorded on some items and they are checked later in the game. Because of the size, game world is generally divided into locations. Most objects are active only in one (or very few) location(s) and disregarded elsewhere. Only player objects and game-important objects persist between the locations. Information about quests that span over multiple locations is therefore usually recorded as properties of player object itself in some condensed form. A set of rules that describes the basic events, actions and interactions in the game world is often referred to as game rules or game mechanics. Specific games (including game story and quests) are usually scripted on top of these. Given the base mechanics of the game, the game world is exactly described. Such world is relatively small compared to real world applications and is scarcely ambiguous. \[\text{There are games which give an illusion of continuous world. This is however almost always achieved by switching the locations in background.}\] 4 An ASP based game Because the creation of the logic programs that describe game mechanics and quests is not an easy task, a project was started to allow easy, incremental way of creating and testing ASP-based representation of a computer game world – a small computer game using exclusively ASP and a simple interpreter and user interface[17]. ![Diagram of iterative game processing](image) **Fig. 1.** Iterative game processing In the most simple case the interpreter constructs a logic program (or a dynamic logic program) from the description of the current state of the game world, the players action and the game and evaluation rules. It then computes the answer sets of this program, selects one of them and extracts the new world state and the list of possible actions. The interpreter then presents these actions and the description of this world state to the player, who selects one of the actions. After this the whole process, as shown in fig 1, repeats itself. The state of the world is represented using fluents in a similar way as in action languages and planning. Actions are also used in almost the same way as in planning and one iteration of the game resembles very closely one step in the inference of the results of an action in planning problems. The evaluation of the world state is currently strictly reactive, meaning that effects of players actions including the actions of any active in-game objects are computed directly in one step. There are plans however to embed a simple planning framework in the respective ASP representation to allow simple planning. 5 Game world evaluation One of the common knowledge representation tasks in a computer game is the evaluation of the state the game world is in. The game engine has to decide if the player has achieved his goals (quests) or if some objectives were fulfilled that allow the game to advance. This may seem easy and trivial in most games, but there are games which depend on an open interactivity between the player and the world. In such games a multitude of possibilities that satisfy the objectives can arise and scripting them all can get very hard. Declarative logic programming can thus present a viable alternative to scripted evaluation. Declarative descriptions of a goal would be much more concise and easier to maintain. On the other hand, evaluation of the world state is relatively simple. The encoding of the relevant (static) knowledge about the world can be easily done through logic programs and posing queries to such knowledge base is easy. Because of this such an application presents a perfect opportunity for starting the use of LP in computer games, possibly extending it to more dynamic applications like planning the actions for computer controlled characters. Application of this kind has been proposed in [16] along with an experimental implementation in [18] and we will include only a short characterization here. The main goal is to enhance a scripting subsystem of a game engine allowing scripts to pose DynLoP-based queries of the world state and use them to decide fulfillment of objectives or quests. An overview of such system can be seen in fig. 2. Fig. 2. DynLoP based world state evaluation in a computer game Whenever a query from the scripting system is generated, a DynLoP program is assembled in the world state evaluation module from the game rules, quest description and the current game world data. This DynLoP program is then transformed into an LP program according to the transformational semantics and passed to the ASP solver. Models of this programs are read by the ASP-python interface module and the result of the query is passed back to the scripting system. Using the expressiveness of DynLoP queries can be easily represented by dynamic logic programs describing the knowledge about the world, game mechanics and quests in a hierarchic way. The semantics of DynLoP then can automatically resolve possible conflicts between specific quests, core game mechanics and background knowledge. This way, although the base game rules would state that dead people cannot talk, the game designer creating a specific quest concerning ghosts can easily and consistently override that for this single quest. Such quest description can be represented by a dynamic logic program $P = (P_0, P_1, P_2, \ldots, P_n, P_g, P_q)$ and a set of atoms $Q_a$. $P_0$ represents the initial configuration of the game (facts at the beginning). $P_1$ through $P_n$ represent the updates of facts (either as results of player actions or game created events). $P_g$ is a program containing all the rules describing the general game mechanics and $P_q$ represents the rules special for the evaluation of this quest (i.e. describing the quest). The set $Q_a$ contains the atoms we will be interested in when deciding the result of the query – whether they are modeled by some or all models of $P$. **Example 1.** Consider the following DynLoP $P = (P_0, P_1, P_g, P_q)$: $P_0 = \{ \ldots \text{alive}(\text{King}); \text{alive}(\text{General}); \text{speech}(\text{King}); \text{speech}(\text{General}); \ldots \}$ $P_1 = \{ \quad \text{killed}(\text{Player}, \text{King}); \}$ $P_g = \{ \ldots \text{not alive}(X) \leftarrow \text{killed}(Y, X); \quad \text{alive}(X) \leftarrow \text{ressurect}(Y, X); \ldots \}$ $P_q = \{ \quad \text{war} \leftarrow \text{alive}(\text{King}), \text{influenced}(\text{King}, X); \} \quad \text{influenced}(\text{King}, X) \leftarrow \text{alive}(X), \text{wants_war}(X); \quad \text{wants_war}(\text{General}); \}$ The program $P_0$ contains the initialization of the game. $P_1$ contains the description of the current state. $P_g$ are the common engine rules for the game mechanics. $P_q$ contains the description of a quest to prevent a kingdom to go into a war. Seeing that the game mechanics contains rules about the ability to speak, we can specify our quest more precisely by a small change: $P_q = \{ \ldots \text{influenced}(\text{King}, X) \leftarrow \text{alive}(X), \text{speech}(X), \text{wants_war}(X); \ldots \}$ which only states the obvious need to be able to communicate with someone to influence him. Now the quest can be solved by other means, such as $\text{castSpell}(\text{Player}, \text{General}, \text{Silence})$. 6 Modularization of logic programs and Implementation In this section we first describe a framework that splits logic programs into modules and allows them to be loaded only when they are needed. Then we present a short description of the implementation of presented applications. 6.1 Modularization Although game worlds are simpler and smaller than real world they are still relatively large. Computer game programmers came up with different techniques to overcome the difficulties of a large game world. Most simple and efficient of these has been introduced in section three: the world is divided into multiple parts: levels, modules, areas or locations and only one or some of these parts are active at a time. Many current games use this technique together with an on-demand, in-background loading of new parts to provide an illusion of a continuous game world. Modularization is also an interesting concept in logic programming. In the simplest way modules represented by different logic programs are just joined together to form one big logic program. Theoretical research has been done in different directions regarding modularization, whether to resolve conflicts between modules or to define certain interfaces for modules to improve communication between them. We describe here a simple framework that allows to split logic programs into different modules and to declaratively specify when are they to be loaded. There are two main approaches that are considered: an iterative approach and a simple two-level approach. Both approaches are based on the introduction of a special predicate, say \texttt{load\_module/1}, whose presence in a stable model of program states that a specific module should be loaded. \begin{figure} \centering \includegraphics[width=\textwidth]{modules.png} \caption{Modules} \end{figure} In the first approach a certain initial program is taken (a certain module) and its stable models are computed. If a model contains the predicate \texttt{load\_module(X)} the modules \textit{X} is added to the program and the process is iterated over. Because a program can have multiple stable models, either one can be chosen, or all possibilities can be exploited in parallel depending on the application. In the second approach a module consists of two programs: a main program and an activator program as shown in Fig. 3. First the activator programs from all modules are put together and executed with a query. The stable models are again used to decide which modules should be loaded. In second step the selected modules are added together and the query is executed as shown in Fig. 4. 6.2 Implementation In this section we provide a short technical description of the implementations of the presented applications. An implementation of the game evaluation module from the section five is described [18] and a simplified implementations of the modularization framework is in [19]. These lead to the creation of a general python package pyASP[13]. The choice of the Python language was influenced mainly because it is often included as a scripting languages in game engines and other projects[1]. The package supports DLV [5] and SMODELS [15] as possible ASP solvers. Although both these systems provide C++ or Java interfaces, we decided to use them as standalone programs and read the models through shell pipes from their standard output. This offers greater flexibility for example to add new solvers. The package provides a class LPParser, which can be initialized with input files and solver options (which specify the solver and its special options). It can be either used to load whole models into memory, callback functions for different atoms can be defined and they will be called as the model is parsed. The two step modularization approach described above is implemented by a class MLPParser derived from LPParser. It expects input files containing the activator and module part and hides the process of evaluating the activator files and selecting the correct modules. A simple web-based implementation of the ASP based game described in section four is available at [17]. The non-ASP part consists of two simple scripts eddom.py and eddom.php. The first one uses an instance of LPParser from pyASP to calculate a stable model of the game description, saved game state and a given action, prints the relevant information and possible actions obtained from corresponding atoms and then saves the games state to a temporary file. The second script formats the output as a web page and manages different prefixes to temporary files to allow concurrent usage. 7 Conclusion We described two possible applications of Logic Programming and Answer Set Programming in the area of Computer Games. The first one is a simple reactive game created to experiment with game world descriptions in ASP. Second presented application is a game world evaluation framework that can be used to enhance the scripting subsystem of a computer game with the ability to declaratively query the representation of the game world. We also presented a simple modularization framework, that allows on-demand loading of ASP modules and a short description of the implementation. There has been other work in the area of Logic Programming that uses computer games as an application field [14, 12] Thinking of a computer game as a multiagent system, these approaches try to enhance the agents with reasoning abilities The game engine – multiagent framework – that coordinates these agents remains unaware of such abilities. In our approach we try to enhance the engine itself, thus giving it better control of the game world. In our approach we use Dynamic Logic Programming to handle hierarchical knowledge. In other approaches, such as Evolp, DynLoP is used to simulate the change of knowledge over time, especially in planning. Presented applications work with statical knowledge – description of the actual state of the game world. A natural area for future work is therefore the possibility to support planning and thus control of the objects(agents) in the game world. This can be interesting especially in connection with Evolp and Multi-dimensional DynLoP[9, 8]. References
{"Source-Url": "http://znalosti2008.fiit.stuba.sk/download/articles/znalosti2008-Siska.pdf", "len_cl100k_base": 6029, "olmocr-version": "0.1.53", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 30715, "total-output-tokens": 7599, "length": "2e12", "weborganizer": {"__label__adult": 0.0011844635009765625, "__label__art_design": 0.0006985664367675781, "__label__crime_law": 0.0018434524536132812, "__label__education_jobs": 0.002620697021484375, "__label__entertainment": 0.0004279613494873047, "__label__fashion_beauty": 0.0005850791931152344, "__label__finance_business": 0.0006747245788574219, "__label__food_dining": 0.0015554428100585938, "__label__games": 0.04510498046875, "__label__hardware": 0.0016927719116210938, "__label__health": 0.0018510818481445312, "__label__history": 0.0007715225219726562, "__label__home_hobbies": 0.0002498626708984375, "__label__industrial": 0.0013647079467773438, "__label__literature": 0.001132965087890625, "__label__politics": 0.0009059906005859376, "__label__religion": 0.0013484954833984375, "__label__science_tech": 0.10040283203125, "__label__social_life": 0.00023114681243896484, "__label__software": 0.00925445556640625, "__label__software_dev": 0.8232421875, "__label__sports_fitness": 0.0012416839599609375, "__label__transportation": 0.0013399124145507812, "__label__travel": 0.0004892349243164062}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 30313, 0.01667]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 30313, 0.69313]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 30313, 0.90664]], "google_gemma-3-12b-it_contains_pii": [[0, 2130, false], [2130, 5402, null], [5402, 8972, null], [8972, 11901, null], [11901, 15012, null], [15012, 16605, null], [16605, 18255, null], [18255, 21319, null], [21319, 23466, null], [23466, 25935, null], [25935, 29001, null], [29001, 30313, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2130, true], [2130, 5402, null], [5402, 8972, null], [8972, 11901, null], [11901, 15012, null], [15012, 16605, null], [16605, 18255, null], [18255, 21319, null], [21319, 23466, null], [23466, 25935, null], [25935, 29001, null], [29001, 30313, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 30313, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 30313, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 30313, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 30313, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 30313, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 30313, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 30313, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 30313, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 30313, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 30313, null]], "pdf_page_numbers": [[0, 2130, 1], [2130, 5402, 2], [5402, 8972, 3], [8972, 11901, 4], [11901, 15012, 5], [15012, 16605, 6], [16605, 18255, 7], [18255, 21319, 8], [21319, 23466, 9], [23466, 25935, 10], [25935, 29001, 11], [29001, 30313, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 30313, 0.0]]}
olmocr_science_pdfs
2024-12-10
2024-12-10
857fafea824c9f0bab3476780da78d79e7afe42f
A Policy-Based Architecture for Container Migration in Software Defined Infrastructures Original Availability: This version is available at: 11583/2752093 since: 2019-09-17T11:09:54Z Publisher: IEEE Published DOI:10.1109/NETSOFT.2019.8806659 Terms of use: openAccess This article is made available under terms and conditions as specified in the corresponding bibliographic description in the repository Publisher copyright IEEE copyright 20xx IEEE. Personal use of this material is permitted. Permission from IEEE must be obtained for all other uses, in any current or future media, including reprinting/republishing this material for advertising or promotional purposes, creating . (Article begins on next page) A Policy-Based Architecture for Container Migration in Software Defined Infrastructures Xu Tao* Politecnico di Torino, Italy xu.tao@studenti.polito.it Flavio Esposito Saint Louis University, USA flavio.esposito@slu.edu Alessio Sacco Politecnico di Torino, Italy alessio_sacco@polito.it Guido Marchetto Politecnico di Torino, Italy guido.marchetto@polito.it Abstract—Software-Defined Networking (SDN) is a paradigm that enables easier network programmability based on separation between network control plane and data plane. Network Function Virtualization (NFV) is another recent technology that has enabled design, deploy, and management of softwareized networking services. The vast majority of SDN and NFV based architectures, whether they use Virtual machines (VMs) or Lightweight Virtual Machines (LVMs), are designed to program forwarding, probably the most fundamental among all network mechanisms. In this paper instead we demonstrated that there are other (as important) networking mechanisms that need programmability. In particular, we designed, implemented and extensively tested an architecture that enables policy-programmability of (live) migration of LVMs. Migration is used for maintenance, load balancing, or as a security mechanism in what is called Moving Target Defence (a virtual host migrates to hide from an attacker). Our architecture is based on Docker and it is implemented within a Software-Defined Infrastructure. Migration mechanism can be set easily by means of configuration file, to make a novel policy-based architecture. We evaluated the performance of our system in several scenarios, over a local Mininet-based testbed. We analyzed the tradeoff between several Load Balancing policies as well as several Moving Target Defense solutions inspired by network coding. Index Terms—software defined networking, container migration, moving target defense. I. INTRODUCTION The recent surge in popularity of Cloud Computing and Internet of Things (IoT) has resulted in a number of IoT networks, widely deployed. As new technologies showing up, today’s network is much harder and more complex to manage and monitor. Thus, new network solutions come up. For instance, Software Defined Networking (SDN) is the latest network paradigm to solve the complexity of networking. It provides the benefits by detaching networking control layer and data layer, providing the possibility to use powerful central commands to meet the requirements of underlying demand data planes. Instead, Network Functions Virtualization (NFV) is a new method to design, deploy, and manage networking services. Virtual Machines (VMs) are widely used to implement NFV. Despite VMs, Lightweight Virtual Machines (LVM), such as Dockers, are a more efficient solution. The Docker technology allows the true independence between application, infrastructure, developers, and IT Ops. It enables creating a model for better collaboration and innovation. Why a policy-based programmable migration mechanism is needed? Based on these new network solutions, migration is a new solution widely used in cloud network structure and data center. Migration is the movement of a virtual machine from one physical host to another, it happens without the awareness of end users. It can achieve networking maintainance, load balancing, network failure repair for providing an always available system. Apart from these, it can also be used as a security moving target defense strategy. Nowadays migration solutions mostly focus on VMs [1], and Virtual Routers (VR) [2]. Besides, they are usually in ad-hoc environment, concerning a specific policy of the migration mechanisms; for instance, loading balancing [3] or energy optimization [4]. There is less concern on container migration. The container is known as the lightweight virtual machine. It does not virtualize only the hardware, but also the operating system. Comparing with the virtual machine, it is much lighter. If there is a high requirement with respect to the speed for migration, container migration could be a good solution. Virtualization is a way that enables network programmability, and software defined networking is a good example. Above control plane, it is flexible and easy to develop applications such as routing, access control, etc. But it is only good for forwarding mechanism. In addition, network protocols are usually designed in the ad-hoc fashion. Different versions of TCP or routing exist, some of them are suitable for bandwidth sensitive applications, some are for delay sensitive applications, some aim to achieve security, some aim to provide better performance. There is no one-size-fits-all, a policy-based programmable migration mechanism is needed. Our contribution. We designed a policy-programmable container migration architecture based on Docker. The policy-based architecture allows us to change policies with a simple configuration file, so programming the migration mechanism is easy. Second, we test security and load balancing policies within our SDN-based prototype over Mininet. Third, we designed and evaluated novel Moving Target Defense (MTD) solutions inspired by network coding. The policy-based migration system can do software defined measurement based on the network traffic statistics obtained through SDN controller. We developed our algorithms to make migration decision and applied it on two use cases. The first is Load Balancing that we feature with 3 policies: bandwidth-based, shortest path, random. The second is Moving Target Defense, where novel solutions are inspired by network coding, that we feature also with three policies: Shamir, Digital Fountain, and Pseudo Random function. The paper is organized as follows. In section II, we discuss related migration solutions. Section III describes our migration system architecture. In section IV we present two use cases: load balancing, moving target defense. Section V illustrates the experimental validation results we obtained. In the end, the work is concluded in Section VI. II. RELATED WORK Several network migration solutions exist nowadays, and a considerable work has been done concerning live VM migration [5]–[7]. In addition, there are a set of papers in which the authors compare and analyze the possible factors that could affect the migration performance. In [8]–[10], the authors examined the major issues of virtual machine live migration with some metrics, e.g. downtime, total migration time, also classifying the techniques and comparing the different solutions. However, containers (lightweight virtual machine (LVMs)) are showing up as recent virtualization technique, they don’t virtualize only the hardware infrastructure but also the operating system. Recently, new attempts to use containers instead of VMs have been proposed [11]. They focus on reducing migration time, with no concern about the network traffic situation. In our work, we concentrate on container migration, because compared to VM it is lighter and the migration can be faster than migrating a virtual machine. Our policy-based system performs migration adapting different application needs by just changing a configuration file. This is the first attempt, to the best of our knowledge, to build an architecture to enable programmable migration mechanism. Moving Target Defense (MTD) is a new security paradigm. Instead of defending unchanging infrastructure by detecting, preventing, monitoring, tracking and remedying threats, moving target defense makes the attack surface dynamic. Many attempts have been proposed to achieve security through MTD. For instance, U-TRI adopts a randomly changing identifier to replace the original static data link layer address [12]. They defend traffic privacy by obfuscating the identifiers in network and transport layer. A different approach is used in WebMTD, that randomizes certain attributes of web elements to differentiate the application code from injected code and disallow its execution [13]. Besides, a more general solution is Mutated Policies [14]. It is an attribute-based defense strategy for access control that carefully selects the attributes that uniquely identify the entities involved. Then it randomly mutates the original access policies over time by adding additional policy rules constructed from the newly-identified attributes. In our migration system, we move the container from one host to another one, to guarantee that the hosted machine IP address keeps changing. Then, we improve different algorithms existing with information of the network, integrating polynomial concept with a novel algorithm such as digital fountain mechanism. ![Fig. 1: System Architecture and Components](Image) Fig. 1: System Architecture and Components, the green blocks are our contribution. III. ARCHITECTURE DESIGN In this section, we focus on the system architecture design and the function of each component. We built a programmable policy-based migration system, to provide flexibility for adapting different application needs by just changing one parameter in the configuration file. Besides, the system is designed to collect network traffic statistics leveraging an SDN controller, which applies software-defined measurements on the basis of these statistics. Thus, a more accurate migration decision is made by adding information about the network. As a consequence, a container can be migrated from a source host to a destination host within a cloud-edge network with a programmable policy-based mechanism. A well-designed migration system should be able to answer three questions: (i) which container should be migrated, (ii) when migration should happen, (iii) where to migrate. Following those questions, we designed our system architecture. A. System Architecture Overview Figure 1 shows the general architecture and key components of the system. There are 4 main component blocks designed for migration system: Database & Virtual Information Base (VIB), Software defined measurement, Migration Manager, and Migration Daemon. 1) Database & VIB is designed to store the network traffic statistics. 2) Software Defined Measurement collects network traffic statistics through an SDN controller (Floodlight) and stores the data in an SQL-based database. We use two data collectors, one for bandwidth and one for packet aggregate. The Bandwidth collector is used to measure the bandwidth consumption per switch port. On the other hand, the Aggregate collector is used to get the number of packets per switch. Both measurements are collected at a customizable standard frequency. We use these measurements as input of our controller to detect traffic or switch overloads and start a migration process. We also use the information collected in the database to decide what is the destination for the migrating LVM, according to a programmable policy. Software defined measurements are our contribution. measurement system enables the simplicity and flexibility in collecting network traffic statistics. (3) Migration Manager monitors the process and makes migration decisions. In a configuration file, we specify a set of threshold parameters and the policy name. In our prototype we implemented two sets of policies for two use cases: Load Balancing and Moving Target Defense. Users can, however, easily implement their own policies. This component includes a Migration Brain, which executes the policy specified in the configuration file. (4) Migration Daemon is the process running on hosts, and handles the migration process. We use the Docker API to create, start, stop, take the memory and storage snapshot of the current container status. A schema of our prototype implementation is shown in 2. B. Migration Model and Protocol Migration manager makes the migration decision and communicates the destination host to the source host. When the source receives the command and the migration destination IP address, it starts the migration process. We defined a Migration Protocol used to execute such migration. First, Migration Manager makes migration decision and communicates it to the Source Host with a “MIGRATE” command. At this point, Migration Source Host takes the snapshots and stores the image files of the current running container (docker checkpoint). After that, it transfers the container image files to the Destination Host. During this communication, the source host does not stop providing the service. The communication between Source and Destination Host starts with a “RESTART” command sent by the source. This message is followed by the information about container image files. Once Destination has received all the required details, it restart the container. After the service starting, Destination sends “SUCCESS” command to the migration source host. Then, the TCP connection will be closed between all the parties involved. Also, source host stops the container providing the service. In the end, the routing is redirected to the migration destination host. Our programmable migration framework enables to chose the destination host according to different criteria. In such a way an administrator is able to choose different policies for different use cases. IV. MIGRATION POLICY TRADEOFF AND USE CASES In this section, we explain our migration system on two use cases: Load Balancing and Moving Target Defense. The policies used in each use case will be listed and compared. A. Use Case 1: Load Balancing This application allows migration by monitoring the network traffic. The destination host is selected according to different criteria, and we focused on three policies to select the destination: Random: destination host is selected at random. Bandwidth-based: destination host is the host with the maximum available outgoing bandwidth. We define this value as the minimum link capacity of the links in the path. Shortest Path: leveraging Floodlight controller we are able to get the network topology and compute the shortest path for each couple of nodes. B. Use Case 2: Moving Target Defense Moving Target Defense is a paradigm whose idea is to make the attack surface more dynamic. During the setup phase, (private) key(x,y) and a lookup table are distributed to each host. The lookup table is encrypted with a master secret for protecting the migration destination host. This table is an hash table associating to each index the destination host IP address. At the migration stage, our system provides to the source host a random number \( R \) to combine with the key as the input of a hash function: \[ hash(x) = Hash(R + X * Y)%(N + 1), \] where \( N \) is the number of hosts, \( R \) is the random number, \((X, Y)\) is a key represented as a point and \( \% \) is the modulo function. The value obtained from the hash function is the index of the lookup table. Here, three policies are used to share a secret: Shamir: This policy is inspired by Shamir’s method [15]: a secret is divided into \( K \) parts, and each participant has its own unique part. To get the secret key, a host needs to authenticate with some or all other hosts. The migration source host has to ask \( K \) disjoint hosts for \( K \) different keys to reconstruct the key and decrypt the lookup table. \( K \) is specified in the configuration file. Digital Fountain: The migration source host needs to ask to \( K \) hosts for \( K \) keys, not necessarily disjoint. In our implementation we pick these \( K \) hosts probabilistically, using the following formula: \[ P(i, k) = \frac{1}{\sum_{j=1}^{n} \frac{\text{latency}(i,j)}{\text{latency}(i,k)}}. \] where \( i \) is the source host, \( k \) is the random host, and \( P(i, k) \) is the probability that host \( k \) is selected for asking the key. The host which has a smaller latency has a higher probability of being selected. This means that closer hosts may be contacted multiple times for the key. **Random:** The destination host is selected by using a pseudo random function. We use this policy as a benchmark. At the beginning, Migration Manager distributes different encrypted lookup table with the information required for the algorithms to each host. The manager generates also a set of key\((x, y)\) for each host. Hence each host has a part of the information to decrypt the lookup table. Then, Migration manager sends a random number to the source host, it applies hash\((x)\), and the result is the migration destination host index \( i \). According to the policy specified in the configuration file, different strategy are used for decrypting the table. In case of Digital Fountain the same host can be contacted many times, since the one which has the shorter path will have the higher probability to be chosen. On the other hand, in Shamir the host asks to \( k \) disjoint hosts the key pair in order to decrypt the lookup table. After getting the \( k \) keys, the migration source host applies the algorithm (Digital Fountain or Shamir) to get the master secret \( S \). Hence, the source host decrypt the lookup table using \( S \), get the migration destination host IP, and start the migration process. V. EXPERIMENTAL VALIDATION In this section, we test our system in a Mininet testbed, evaluating the two use cases and all the policies. The results are obtained using a Ubuntu Intel i7-6500U @ 2.50GHZ, 8.00 GB RAM, 64-bits. A. Use Case1: 3 policies evaluation for Load Balancing **Scenario 1: Link capacity is heterogeneous.** The topology we used as testbed is shown in Figure 3, where the link capacity varies among the links. H1 executes a docker container running iperf client, while H2 will be the source host and executes a docker container running the iperf server. The migration decision is different according to the chosen policy. 1) **Bandwidth-based policy:** H4 is selected as the destination host with a minimum bandwidth on its path of 10 Mbps. 2) **Shortest path policy:** H3 is selected as the destination host because of just 2 switches in between. **Random:** The destination host is selected by using a pseudo random function. We use this policy as a benchmark. At the beginning, Migration Manager distributes different encrypted lookup table with the information required for the algorithms to each host. The manager generates also a set of key\((x, y)\) for each host. Hence each host has a part of the information to decrypt the lookup table. Then, Migration manager sends a random number to the source host, it applies hash\((x)\), and the result is the migration destination host index \( i \). According to the policy specified in the configuration file, different strategy are used for decrypting the table. In case of Digital Fountain the same host can be contacted many times, since the one which has the shorter path will have the higher probability to be chosen. On the other hand, in Shamir the host asks to \( k \) disjoint hosts the key pair in order to decrypt the lookup table. After getting the \( k \) keys, the migration source host applies the algorithm (Digital Fountain or Shamir) to get the master secret \( S \). Hence, the source host decrypt the lookup table using \( S \), get the migration destination host IP, and start the migration process. Figure 4 shows the bandwidth consumption during the migration process. **Bandwidth consumption** value is the sum of sent and received bandwidth for the migration source and destination host. In the first period (up to 125s) the migration process is not started yet, so on the source host (red line) the traffic is related to the docker container running the iperf server. After 125s the traffic on the switch is detected as too high and the migration process starts. During this period, the source host generates not only traffic data for the iperf client, but also the traffic data for the container migration. As a consequence, the destination host (blue line) starts to receive the migration files, so bandwidth consumption starts increasing. Then after migration process is done (150s), the source host (red line), does not run the iperf server anymore, so there is no more traffic. On the other hand, the destination host (blue line) starts to run the iperf server after migration. In order to evaluate the time necessary for the migration process, we run 20 times the procedure for 3 the policies as shown in Table I. The time is the sum of time to make the decision and to make the migration. Table I shows that bandwidth policy provides the best trade-off between network load balancing and the migration time. Bandwidth policy takes the advantage of the bigger link bandwidth, so the migration time is much smaller than shortest path policy, random policy. The confidence interval for bandwidth and shortest path is very small. This happens because the migration decision made for both use cases is determinate, H4 for bandwidth policy, H3 for shortest path. On the other hand, for Random, the migration destination is not determinate, so each run, it may choose different destination. **Scenario 2: Link capacity is homogeneous.** In addition to topology with heterogeneous capacity, we tested the same topology where for all the link the capacity is homogeneous, and set to 5Mbps. In this context the decisions of three policies are as follows: 1. **Bandwidth-based policy:** the destination host is randomly selected among the free host set: (H3, H4, H5). 2. **Shortest path policy:** H3 is selected as the destination host because of just 2 switches in between. 3. **Random Policy** the destination host is randomly selected among the free host set: (H3, H4, H5). In this case, the bandwidth policy has multiple choices, so the migration destination may vary every run. Table II highlights how in this case, shortest path performs better than bandwidth and random. **B. Use Case 2: Three policies evaluation for Moving Target Defense** In addition to the Load Balancing use case, we evaluated the cost of the system security by the application of Moving Target Defense. We tested the migration time for the three policies aforementioned. Looking at Table III, it is possible to observe how Random policy is the fastest one while for Shamir the migration time is the highest. This happens because in Shamir policy source host asks to k disjoint hosts for k different keys, hence far hosts can be selected. In Digital Fountain policy the source host asks to k non-disjoint hosts for k keys. It is likely to ask the host with small latency more times, leading to a smaller migration time. In essence, random policy is the fastest one, but it does not apply any secure mechanisms, while Digital Fountain provides the better speed-security trade-off. **VI. Conclusion and Future Plan** In this paper we presented a policy-programmable container migration architecture based on Docker within an SDN prototype. It allows to change strategy and algorithm with a simple configuration file. Moreover, we tested two uses i.e., Load Balancing and Moving Target Defense, and we applied three different policies for each use case. Based on the results obtained we found that in different scenarios different algorithms provide the best performance. Hence, our policy-programmable LVM migration system guarantees the appropriate flexibility, as such it can adapt to different application needs by just modifying the configuration. As a plan for the future, we want to improve the system in several aspects. For the software defined measurement, we could integrate the SDN controller with big data and machine learning algorithms. In this case, the migration destination host can be predicted. By doing this we can improve the network management service. In addition, we could scale further the testbed and explore the policies trade-off in different topologies, such as tree, linear, star, fully connected. **Acknowledgments** This work has been partially supported by NSF CNS-1647084 and CNS-1836906. **References**
{"Source-Url": "https://iris.polito.it/retrieve/handle/11583/2752093/271658/Final_public.pdf", "len_cl100k_base": 4995, "olmocr-version": "0.1.50", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 18234, "total-output-tokens": 6521, "length": "2e12", "weborganizer": {"__label__adult": 0.00040841102600097656, "__label__art_design": 0.0004291534423828125, "__label__crime_law": 0.0006756782531738281, "__label__education_jobs": 0.0005211830139160156, "__label__entertainment": 0.0001481771469116211, "__label__fashion_beauty": 0.00017380714416503906, "__label__finance_business": 0.00047707557678222656, "__label__food_dining": 0.0003914833068847656, "__label__games": 0.0008344650268554688, "__label__hardware": 0.003948211669921875, "__label__health": 0.000797271728515625, "__label__history": 0.0003533363342285156, "__label__home_hobbies": 0.0001424551010131836, "__label__industrial": 0.0007481575012207031, "__label__literature": 0.0002663135528564453, "__label__politics": 0.0003726482391357422, "__label__religion": 0.0004374980926513672, "__label__science_tech": 0.371826171875, "__label__social_life": 0.000125885009765625, "__label__software": 0.035614013671875, "__label__software_dev": 0.580078125, "__label__sports_fitness": 0.000308990478515625, "__label__transportation": 0.0006108283996582031, "__label__travel": 0.0002321004867553711}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27929, 0.02306]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27929, 0.18329]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27929, 0.89099]], "google_gemma-3-12b-it_contains_pii": [[0, 1036, false], [1036, 6595, null], [6595, 11984, null], [11984, 16672, null], [16672, 21977, null], [21977, 27929, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1036, true], [1036, 6595, null], [6595, 11984, null], [11984, 16672, null], [16672, 21977, null], [21977, 27929, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 27929, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27929, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27929, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27929, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27929, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27929, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27929, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27929, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27929, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27929, null]], "pdf_page_numbers": [[0, 1036, 1], [1036, 6595, 2], [6595, 11984, 3], [11984, 16672, 4], [16672, 21977, 5], [21977, 27929, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27929, 0.0]]}
olmocr_science_pdfs
2024-12-01
2024-12-01
8de6fbee56b5dea3c3d1cc524957d450a5628184
Getting Started with OpenACC Jeff Larkin, NVIDIA GPUs Reaching Broader Set of Developers 1,000,000's 100,000's Early Adopters 2004 Present Time CAE CFD Finance Rendering Data Analytics Life Sciences Defense Weather Climate Plasma Physics Research Universities Supercomputing Centers Oil & Gas 100,000's 2004 Present Time 1,000,000's Research Universities Supercomputing Centers Oil & Gas 100,000's 2004 Present Time 1,000,000's Research Universities Supercomputing Centers Oil & Gas Early Adopters 2004 Present Time 1,000,000's Research Universities Supercomputing Centers Oil & Gas Early Adopters 2004 Present Time 1,000,000's Research Universities Supercomputing Centers Oil & Gas Early Adopters 3 Ways to Accelerate Applications Applications Libraries “Drop-in” Acceleration OpenACC Directives Easily Accelerate Applications Programming Languages Maximum Flexibility OpenACC Open Programming Standard for Parallel Computing “OpenACC will enable programmers to easily develop portable applications that maximize the performance and power efficiency benefits of the hybrid CPU/GPU architecture of Titan.” --Buddy Bland, Titan Project Director, Oak Ridge National Lab “OpenACC is a technically impressive initiative brought together by members of the OpenMP Working Group on Accelerators, as well as many others. We look forward to releasing a version of this proposal in the next release of OpenMP.” --Michael Wong, CEO OpenMP Directives Board OpenACC Standard OpenACC The Standard for GPU Directives Simple: Directives are the easy path to accelerate compute intensive applications Open: OpenACC is an open GPU directives standard, making GPU programming straightforward and portable across parallel and multi-core processors Powerful: GPU Directives allow complete access to the massive parallel power of a GPU High-level - Compiler directives to specify parallel regions in C & Fortran - Offload parallel regions - Portable across OSes, host CPUs, accelerators, and compilers Create high-level heterogeneous programs - Without explicit accelerator initialization - Without explicit data or program transfers between host and accelerator High-level... with low-level access - Programming model allows programmers to start simple - Compiler gives additional guidance - Loop mappings, data location, and other performance details - Compatible with other GPU languages and libraries - Interoperate between CUDA C/Fortran and GPU libraries - e.g. CUFFT, CUBLAS, CUSPARSE, etc. Directives: Easy & Powerful Real-Time Object Detection Global Manufacturer of Navigation Systems Valuation of Stock Portfolios using Monte Carlo Global Technology Consulting Company Interaction of Solvents and Biomolecules University of Texas at San Antonio 5x in 40 Hours 2x in 4 Hours 5x in 8 Hours "Optimizing code with directives is quite easy, especially compared to CPU threads or writing CUDA kernels. The most important thing is avoiding restructuring of existing code for production applications." -- Developer at the Global Manufacturer of Navigation Systems Focus on Expressing Parallelism With Directives, tuning work focuses on expressing parallelism, which makes codes inherently better. Example: Application tuning work using directives for new Titan system at ORNL S3D Research more efficient combustion with next-generation fuels - Tuning top 3 kernels (90% of runtime) - 3 to 6x faster on CPU+GPU vs. CPU+CPU - But also improved all-CPU version by 50% CAM-SE Answer questions about specific climate change adaptation and mitigation scenarios - Tuning top key kernel (50% of runtime) - 6.5x faster on CPU+GPU vs. CPU+CPU - Improved performance of CPU version by 100% OpenACC is not GPU Programming. OpenACC is Expressing Parallelism in your code. OpenACC Specification and Website - Full OpenACC 1.0 Specification available online - Public Comment Draft of 2.0 Specification now available online. [www.openacc.org](http://www.openacc.org) - Quick reference card also available - Compilers available now from PGI, Cray, and CAPS Start Now with OpenACC Directives Sign up for a free trial of the directives compiler now! Free trial license to PGI Accelerator Tools for quick ramp www.nvidia.com/gpudirectives Expressing Parallelism with OpenACC A Very Simple Exercise: SAXPY **SAXPY in C** ```c void saxpy(int n, float a, float *x, float *restrict y) { for (int i = 0; i < n; ++i) y[i] = a*x[i] + y[i]; } ... // Perform SAXPY on 1M elements saxpy(1<<20, 2.0, x, y); ...``` **SAXPY in Fortran** ```fortran subroutine saxpy(n, a, x, y) real :: x(n), y(n), a integer :: n, i do i=1,n y(i) = a*x(i)+y(i) enddo end subroutine saxpy ... ! Perform SAXPY on 1M elements call saxpy(2**20, 2.0, x_d, y_d) ...``` A Very Simple Exercise: SAXPY OpenMP **SAXPY in C** ```c void saxpy(int n, float a, float *x, float *restrict y) { #pragma omp parallel for for (int i = 0; i < n; ++i) y[i] = a*x[i] + y[i]; } ... // Perform SAXPY on 1M elements saxpy(1<<20, 2.0, x, y); ... ``` **SAXPY in Fortran** ```fortran subroutine saxpy(n, a, x, y) real :: x(n), y(n), a integer :: n, i !$omp parallel do do i=1,n y(i) = a*x(i)+y(i) enddo !$omp end parallel do end subroutine saxpy ... ! Perform SAXPY on 1M elements call saxpy(2**20, 2.0, x_d, y_d) ...``` A Very Simple Exercise: SAXPY OpenACC **SAXPY in C** ```c void saxpy(int n, float a, float *x, float *restrict y) { #pragma acc parallel loop for (int i = 0; i < n; ++i) y[i] = a*x[i] + y[i]; } ... // Perform SAXPY on 1M elements saxpy(1<<20, 2.0, x, y); ... ``` **SAXPY in Fortran** ```fortran subroutine saxpy(n, a, x, y) real :: x(n), y(n), a integer :: n, i !$acc parallel loop do i=1,n y(i) = a*x(i)+y(i) enddo !$acc end parallel loop end subroutine saxpy ... ! Perform SAXPY on 1M elements call saxpy(2**20, 2.0, x_d, y_d) ... ``` OpenACC Execution Model 1. Generate parallel code for GPU 2. Allocate GPU memory and copy input data 3. Execute parallel code on GPU 4. Copy output data to CPU and deallocate GPU memory \[ \text{Compute-Intensive Code} \] \[ \text{Rest of Sequential CPU Code} \] Directive Syntax **Fortran** ```fortran !$acc directive [clause [ [,] clause] ...] ``` ...often paired with a matching end directive surrounding a structured code block: ```fortran !$acc end directive ``` **C** ```c #pragma acc directive [clause [,] clause] ... ``` ...often followed by a structured code block **Common Clauses** ```c if(condition), async(handle) ``` OpenACC parallel Directive Programmer identifies a block of code as having parallelism, compiler generates a parallel kernel for that loop. ```fortran %!acc parallel loop do i=1,n y(i) = a*x(i)+y(i) enddo %!acc end parallel loop ``` *Most often parallel will be used as parallel loop. Kernel: A function that runs in parallel on the GPU Complete SAXPY example code - Trivial first example - Apply a loop directive - Learn compiler commands ```c #include <stdlib.h> void saxpy(int n, float a, float *x, float *restrict y) { #pragma acc parallel loop for (int i = 0; i < n; ++i) y[i] = a * x[i] + y[i]; } int main(int argc, char **argv) { int N = 1<<20; // 1 million floats if (argc > 1) N = atoi(argv[1]); float *x = (float*)malloc(N * sizeof(float)); float *y = (float*)malloc(N * sizeof(float)); for (int i = 0; i < N; ++i) { x[i] = 2.0f; y[i] = 1.0f; } saxpy(N, 3.0f, x, y); return 0; } ``` Compile (PGI) C: pgcc -acc [-Minfo=accel] [-ta=nvidia] -o saxpy_acc saxpy.c Fortran: pgf90 -acc [-Minfo=accel] [-ta=nvidia] -o saxpy_acc saxpy.f90 Compiler output: ``` pgcc -acc -Minfo=accel -ta=nvidia -o saxpy_acc saxpy.c saxpy: 11, Accelerator kernel generated 13, #pragma acc loop gang, vector(256) /* blockIdx.x threadIdx.x */ 11, Generating present_or_copyin(x[0:n]) Generating present_or_copy(y[0:n]) Generating NVIDIA code Generating compute capability 1.0 binary Generating compute capability 2.0 binary Generating compute capability 3.0 binary ``` The PGI compiler provides automatic instrumentation when `PGI_ACC_TIME=1` at runtime ```plaintext Accelerator Kernel Timing data /home/jlarkin/kernels/saxpy/saxpy.c saxpy NVIDIA devicenum=0 time(us): 3,256 11: data copyin reached 2 times device time(us): total=1,619 max=892 min=727 avg=809 11: kernel launched 1 times grid: [4096] block: [256] device time(us): total=714 max=714 min=714 avg=714 elapsed time(us): total=724 max=724 min=724 avg=724 15: data copyout reached 1 times device time(us): total=923 max=923 min=923 avg=923 ``` Run The Cray compiler provides automatic instrumentation when `CRAY_ACC_DEBUG=<1,2,3>` at runtime ACC: Initialize CUDA ACC: Get Device 0 ACC: Create Context ACC: Set Thread Context ACC: Start transfer 2 items from saxpy.c:17 ACC: allocate, copy to acc 'x' (4194304 bytes) ACC: allocate, copy to acc 'y' (4194304 bytes) ACC: End transfer (to acc 8388608 bytes, to host 0 bytes) ACC: Execute kernel saxpy$ck_L17_1 blocks:8192 threads:128 async(auto) from saxpy.c:17 ACC: Wait async(auto) from saxpy.c:18 ACC: Start transfer 2 items from saxpy.c:18 ACC: free 'x' (4194304 bytes) ACC: copy to host, free 'y' (4194304 bytes) ACC: End transfer (to acc 0 bytes, to host 4194304 bytes) Another approach: **kernels** construct The kernels construct expresses that a region may contain parallelism and the compiler determines what can safely be parallelized. ```c !$acc kernels do i=1,n a(i) = 0.0 b(i) = 1.0 c(i) = 2.0 end do do i=1,n a(i) = b(i) + c(i) end do !$acc end kernels ``` The compiler identifies 2 parallel loops and generates 2 kernels. OpenACC parallel vs. kernels **PARALLEL** - Requires analysis by programmer to ensure safe parallelism - Straightforward path from OpenMP **KERNELS** - Compiler performs parallel analysis and parallelizes what it believes safe - Can cover larger area of code with single directive Both approaches are equally valid and can perform equally well. OpenACC by Example Example: Jacobi Iteration - Iteratively converges to correct value (e.g. Temperature), by computing new values at each point from the average of neighboring points. - Common, useful algorithm - Example: Solve Laplace equation in 2D: $\nabla^2 f(x, y) = 0$ \[ A_{k+1}(i, j) = \frac{A_k(i-1, j) + A_k(i+1, j) + A_k(i, j-1) + A_k(i, j+1)}{4} \] Jacobi Iteration: C Code ```c while ( err > tol && iter < iter_max ) { err=0.0; for( int j = 1; j < n-1; j++) { for(int i = 1; i < m-1; i++) { err = max(err, abs(Anew[j][i] - A[j][i])); } } for( int j = 1; j < n-1; j++) { for( int i = 1; i < m-1; i++ ) { A[j][i] = Anew[j][i]; } } iter++; } ``` Iterate until converged Iterate across matrix elements Calculate new value from neighbors Compute max error for convergence Swap input/output arrays while ( err > tol && iter < iter_max ) { err=0.0; #pragma omp parallel for shared(m, n, Anew, A) reduction(max:err) for( int j = 1; j < n-1; j++ ) { for(int i = 1; i < m-1; i++) { Anew[j][i] = 0.25 * (A[j][i+1] + A[j][i-1] + A[j-1][i] + A[j+1][i]); err = max(err, abs(Anew[j][i] - A[j][i])); } } #pragma omp parallel for shared(m, n, Anew, A) for( int j = 1; j < n-1; j++ ) { for( int i = 1; i < m-1; i++ ) { A[j][i] = Anew[j][i]; } } iter++; } while ( err > tol && iter < iter_max ) { err=0.0; #pragma acc parallel loop reduction(max:err) for( int j = 1; j < n-1; j++ ) { for(int i = 1; i < m-1; i++) { Anew[j][i] = 0.25 * (A[j][i+1] + A[j][i-1] + A[j-1][i] + A[j+1][i]); err = max(err, abs(Anew[j][i] - A[j][i])); } } #pragma acc parallel loop for( int j = 1; j < n-1; j++ ) { for( int i = 1; i < m-1; i++ ) { A[j][i] = Anew[j][i]; } } iter++; } pgcc -Minfo=all -ta=nvidia:5.0,cc3x -acc -Minfo=accel -o laplace2d_acc laplace2d.c main: 56, **Accelerator kernel generated** 57, #pragma acc loop gang /* blockIdx.x */ 59, #pragma acc loop vector(256) /* threadIdx.x */ 56, Generating present_or_copyin(A[0:][0:]): Generating present_or_copyout(Anew[1:4094][1:4094]): Generating NVIDIA code Generating compute capability 3.0 binary 59, Loop is parallelizable 68, **Accelerator kernel generated** 69, #pragma acc loop gang /* blockIdx.x */ 71, #pragma acc loop vector(256) /* threadIdx.x */ 68, Generating present_or_copyout(A[1:4094][1:4094]): Generating present_or_copyin(Anew[1:4094][1:4094]): Generating NVIDIA code Generating compute capability 3.0 binary 71, Loop is parallelizable Execution Time (lower is better) CPU: Intel i7-3930K 6 Cores @ 3.20GHz GPU: NVIDIA Tesla K20 OpenACC code is SLOWER than even serial code. Why? What went wrong? Set `PGI_ACC_TIME` environment variable to ‘1’ Accelerator Kernel Timing data /home/jlarkin/openacc-workshop/exercises/001-laplace2D-kernels/laplace2d.c ``` main NVIDIA devicenum=0 time(us): 93,201,190 56: data copyin reached 1000 times device time(us): total=23,049,452 max=28,928 min=22,761 avg=23,049 56: kernel launched 1000 times grid: [4094] block: [256] device time(us): total=2,609,928 max=2,812 min=2,593 elapsed time(us): total=2,872,585 max=3,022 min=2,642 56: reduction kernel launched 1000 times grid: [1] block: [256] device time(us): total=19,218 max=724 min=16 avg=19 elapsed time(us): total=29,070 max=734 min=26 avg=29 68: data copyin reached 1000 times device time(us): total=23,888,588 max=33,546 min=23,378 avg=23,888 68: kernel launched 1000 times grid: [1004] block: [256] device time(us): total=2,398,101 max=2,961 min=2,137 avg=2,398 elapsed time(us): total=2,407,481 max=2,971 min=2,146 avg=2,407 68: data copyout reached 1000 times device time(us): total=20,664,362 max=27,788 min=20,511 avg=20,664 77: data copyout reached 1000 times device time(us): total=20,571,541 max=24,837 min=20,521 avg=20,571 ``` Huge Data Transfer Bottleneck! Computation: 5.19 seconds Data movement: 74.7 seconds Offloading a Parallel Kernel CPU Memory CPU GPU Memory GPU PCle Offloading a Parallel Kernel For every parallel operation we: 1. Move the data from Host to Device 2. Execute once on the Device 3. Move the data back from Device to Host What if we separate the data and execution? Now we: 1. Move the data from Host to Device only when needed 2. Execute on the Device multiple times. 3. Move the data back from Device to Host when needed. while (err > tol && iter < iter_max) { err=0.0; #pragma acc parallel loop reduction(max:err) for (int j = 1; j < n-1; j++) { for(int i = 1; i < m-1; i++) { err = max(err, abs(Anew[j][i] - A[j][i])); } } } These copies happen every iteration of the outer while loop! And note that there are two #pragma acc parallel, so there are 4 copies per while loop iteration! Data Management with OpenACC Defining **data** regions The **data** construct defines a region of code in which GPU arrays remain on the GPU and are shared among all kernels in that region. ``` !$acc data !$acc parallel loop ... !$acc parallel loop ... !$acc end data ``` Arrays used within the data region will remain on the GPU until the end of the data region. Data Clauses **copy ( list )** Allocates memory on GPU and copies data from host to GPU when entering region and copies data to the host when exiting region. **copyin ( list )** Allocates memory on GPU and copies data from host to GPU when entering region. **copyout ( list )** Allocates memory on GPU and copies data to the host when exiting region. **create ( list )** Allocates memory on GPU but does not copy. **present ( list )** Data is already present on GPU from another containing data region. and **present_or_copy [in|out], present_or_create, deviceptr.** Array Shaping - Compiler sometimes cannot determine size of arrays - Must specify explicitly using data clauses and array “shape” - C ```c #pragma acc data copyin(a[0:size]), copyout(b[s/4:3*s/4]) ``` - Fortran ```fortran !$acc data copyin(a(1:end)), copyout(b(s/4:3*s/4)) ``` - Note: data clauses can be used on data, parallel, or kernels Task: use acc data to minimize transfers in the Jacobi example Jacobi Iteration: OpenACC C Code ```c #pragma acc data copy(A), create(Anew) while ( err > tol && iter < iter_max ) { err=0.0; #pragma acc parallel loop reduction(max:err) for( int j = 1; j < n-1; j++ ) { for(int i = 1; i < m-1; i++ ) { Anew[j][i] = 0.25 * (A[j][i+1] + A[j][i-1] + A[j-1][i] + A[j+1][i]); err = max(err, abs(Anew[j][i] - A[j][i])); } } #pragma acc parallel loop for( int j = 1; j < n-1; j++ ) { for( int i = 1; i < m-1; i++ ) { A[j][i] = Anew[j][i]; } } iter++; } ``` Copy A in at beginning of loop, out at end. Allocate Anew on accelerator. Did it help? Set `PGI_ACC_TIME` environment variable to ‘1’ Accelerator Kernel Timing data /home/jlarkin/openacc-workshop/exercises/001-laplace2D-kernels/laplace2d.c ``` main NVIDIA devicenum=0 time(us): 4,802,950 51: data copyin reached 1 times device time(us): total=22,768 max=22,768 min=22,768 avg=22,768 57: kernel launched 1000 times grid: [4094] block: [256] device time(us): total=2,611,387 max=2,817 min=2,593 avg=2,611 elapsed time(us): total=2,620,044 max=2,900 min=2,601 avg=2,620 57: reduction kernel launched 1000 times grid: [1] block: [256] device time(us): total=18,083 max=842 min=16 avg=18 elapsed time(us): total=27,731 max=852 min=25 avg=27 69: kernel launched 1000 times grid: [4094] block: [256] device time(us): total=2,130,162 max=2,599 min=2.112 avg=2.130 elapsed time(us): total=2,139,919 max=2,712 min=2 83: data copyout reached 1 times device time(us): total=20,550 max=20,550 min=20,550 avg=20,550 ``` 0.23 seconds 0.24 seconds Now OpenACC is 7.7X faster than 6 OpenMP threads and 18X faster than serial. Further speedups - OpenACC gives us more detailed control over parallelization - Via *gang*, *worker*, and *vector* clauses - By understanding more about the specific GPU on which you’re running, using these clauses may allow better performance. - By understanding bottlenecks in the code via profiling, we can reorganize the code for even better performance. - More on this in the Optimizing OpenACC session this afternoon. Communication & IO with OpenACC Calling MPI with OpenACC (Standard MPI) ```fortran !$acc data copy(A) !$acc parallel loop do i=1,N ... enddo !$acc end parallel loop call neighbor_exchange(A) !$acc parallel loop do i=1,N ... enddo !$acc end parallel loop !$acc end data ``` Array “A” resides in GPU memory. Routine contains MPI and requires “A.” Array “A” returns to CPU here. OpenACC update Directive Programmer specifies an array (or partial array) that should be refreshed within a data region. do_something_on_device() !$acc update host(a) do_something_on_host() !$acc update device(a) The programmer may choose to specify only part of the array to update. Copy “a” from GPU to CPU Copy “a” from CPU to GPU Calling MPI with OpenACC (Standard MPI) ```fortran $acc data copy(A) $acc parallel loop do i=1,N ... enddo $acc end parallel loop $acc update host(A) call neighbor_exchange(A) $acc update device(A) $acc parallel loop do i=1,N ... enddo $acc end parallel loop $acc end data ``` Copy “A” to CPU for MPI. Return “A” after MPI to GPU. OpenACC **host_data** Directive Programmer specifies that host arrays should be used within this section, unless specified with **use_device**. This is useful when calling libraries that expect GPU pointers. ```c !$acc host_data use_device(a) call MPI_Sendrecv(a, ...) !$acc end host_data #pragma host_data use_device(a) { cublasDgemm(...,a,...); } ``` This directive allows interoperability with a variety of other technologies, CUDA, accelerated libraries, OpenGL, etc. Pass the device copy of “a” to subroutine. Pass the device copy of “a” to function. Calling MPI with OpenACC (GPU-aware MPI) Pass device “A” directly to a GPU-aware MPI library called in \texttt{neighbor\_exchange}. *More information about GPU-aware MPI libraries is available in other sessions, please see your agenda.* OpenACC Tips & Tricks C tip: the restrict keyword - Declaration of intent given by the programmer to the compiler Applied to a pointer, e.g. ```c float *restrict ptr ``` Meaning: “for the lifetime of `ptr`, only it or a value directly derived from it (such as `ptr + 1`) will be used to access the object to which it points”* - Limits the effects of pointer aliasing - Compilers often require `restrict` to determine independence (true for OpenACC, OpenMP, and vectorization) - Otherwise the compiler can’t parallelize loops that access `ptr` - Note: if programmer violates the declaration, behavior is undefined Tips and Tricks - Nested loops are best for parallelization - Large loop counts (1000s) needed to offset GPU/memcpy overhead - Iterations of loops must be independent of each other - To help compiler: use restrict keyword in C - Compiler must be able to figure out sizes of data regions - Can use directives to explicitly control sizes - Inline function calls in directives regions - (PGI): -Minline or -Minline=levels:<N> - (Cray): -hpl=<dir/> - This has been improved in OpenACC 2.0 Use time option to learn where time is being spent - (PGI) `PGI_ACC_TIME=1` (runtime environment variable) - (Cray) `CRAY_ACC_DEBUG=<1, 2, 3>` (runtime environment variable) - (CAPS) `HMPPRT_LOG_LEVEL=info` (runtime environment variable) Pointer arithmetic should be avoided if possible - Use subscripted arrays, rather than pointer-indexed arrays. Use contiguous memory for multi-dimensional arrays Use data regions to avoid excessive memory transfers Conditional compilation with `_OPENACC` macro More OpenACC at GTC13 - S3019 - Tutorial: Optimizing OpenACC Codes - Monday 3/18 @ 14:30 - S3521 - Hands-on Lab: OpenACC Getting Started - Tuesday 3/19 @ 15:00 - S3532 - Hands-on Lab: OpenACC Data Management - Thursday 3/21 @ 14:00 - S3533 - Hands-on Lab: OpenACC Optimization - Thursday 3/21 @ 15:00 Plus several talks from our partners and customers, please see your agenda for more details. Thank you
{"Source-Url": "http://on-demand.gputechconf.com/gtc/2013/presentations/S3076-Getting-Started-with-OpenACC.pdf", "len_cl100k_base": 6705, "olmocr-version": "0.1.50", "pdf-total-pages": 58, "total-fallback-pages": 0, "total-input-tokens": 78112, "total-output-tokens": 9657, "length": "2e12", "weborganizer": {"__label__adult": 0.0003662109375, "__label__art_design": 0.0002715587615966797, "__label__crime_law": 0.00029754638671875, "__label__education_jobs": 0.000423431396484375, "__label__entertainment": 7.319450378417969e-05, "__label__fashion_beauty": 0.00014960765838623047, "__label__finance_business": 0.00017940998077392578, "__label__food_dining": 0.0003120899200439453, "__label__games": 0.0008435249328613281, "__label__hardware": 0.003040313720703125, "__label__health": 0.0003664493560791016, "__label__history": 0.00020885467529296875, "__label__home_hobbies": 0.00010389089584350586, "__label__industrial": 0.0006494522094726562, "__label__literature": 0.00014507770538330078, "__label__politics": 0.0002390146255493164, "__label__religion": 0.0004973411560058594, "__label__science_tech": 0.032440185546875, "__label__social_life": 6.574392318725586e-05, "__label__software": 0.006561279296875, "__label__software_dev": 0.951171875, "__label__sports_fitness": 0.0004076957702636719, "__label__transportation": 0.00075531005859375, "__label__travel": 0.00021016597747802737}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 22896, 0.0491]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 22896, 0.3575]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 22896, 0.70419]], "google_gemma-3-12b-it_contains_pii": [[0, 49, false], [49, 736, null], [736, 915, null], [915, 1512, null], [1512, 1867, null], [1867, 2200, null], [2200, 2542, null], [2542, 3119, null], [3119, 3740, null], [3740, 3821, null], [3821, 4107, null], [4107, 4289, null], [4289, 4325, null], [4325, 4838, null], [4838, 5437, null], [5437, 6039, null], [6039, 6305, null], [6305, 6682, null], [6682, 7026, null], [7026, 7699, null], [7699, 8276, null], [8276, 8839, null], [8839, 9527, null], [9527, 9918, null], [9918, 10266, null], [10266, 10285, null], [10285, 10633, null], [10633, 11243, null], [11243, 11818, null], [11818, 12351, null], [12351, 13095, null], [13095, 13242, null], [13242, 14481, null], [14481, 14550, null], [14550, 14767, null], [14767, 14925, null], [14925, 15416, null], [15416, 15445, null], [15445, 15791, null], [15791, 16364, null], [16364, 16722, null], [16722, 16785, null], [16785, 17475, null], [17475, 18438, null], [18438, 18515, null], [18515, 18946, null], [18946, 18978, null], [18978, 19332, null], [19332, 19674, null], [19674, 20012, null], [20012, 20574, null], [20574, 20813, null], [20813, 20835, null], [20835, 21482, null], [21482, 21980, null], [21980, 22491, null], [22491, 22887, null], [22887, 22896, null]], "google_gemma-3-12b-it_is_public_document": [[0, 49, true], [49, 736, null], [736, 915, null], [915, 1512, null], [1512, 1867, null], [1867, 2200, null], [2200, 2542, null], [2542, 3119, null], [3119, 3740, null], [3740, 3821, null], [3821, 4107, null], [4107, 4289, null], [4289, 4325, null], [4325, 4838, null], [4838, 5437, null], [5437, 6039, null], [6039, 6305, null], [6305, 6682, null], [6682, 7026, null], [7026, 7699, null], [7699, 8276, null], [8276, 8839, null], [8839, 9527, null], [9527, 9918, null], [9918, 10266, null], [10266, 10285, null], [10285, 10633, null], [10633, 11243, null], [11243, 11818, null], [11818, 12351, null], [12351, 13095, null], [13095, 13242, null], [13242, 14481, null], [14481, 14550, null], [14550, 14767, null], [14767, 14925, null], [14925, 15416, null], [15416, 15445, null], [15445, 15791, null], [15791, 16364, null], [16364, 16722, null], [16722, 16785, null], [16785, 17475, null], [17475, 18438, null], [18438, 18515, null], [18515, 18946, null], [18946, 18978, null], [18978, 19332, null], [19332, 19674, null], [19674, 20012, null], [20012, 20574, null], [20574, 20813, null], [20813, 20835, null], [20835, 21482, null], [21482, 21980, null], [21980, 22491, null], [22491, 22887, null], [22887, 22896, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 22896, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 22896, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 22896, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 22896, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 22896, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 22896, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 22896, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 22896, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 22896, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 22896, null]], "pdf_page_numbers": [[0, 49, 1], [49, 736, 2], [736, 915, 3], [915, 1512, 4], [1512, 1867, 5], [1867, 2200, 6], [2200, 2542, 7], [2542, 3119, 8], [3119, 3740, 9], [3740, 3821, 10], [3821, 4107, 11], [4107, 4289, 12], [4289, 4325, 13], [4325, 4838, 14], [4838, 5437, 15], [5437, 6039, 16], [6039, 6305, 17], [6305, 6682, 18], [6682, 7026, 19], [7026, 7699, 20], [7699, 8276, 21], [8276, 8839, 22], [8839, 9527, 23], [9527, 9918, 24], [9918, 10266, 25], [10266, 10285, 26], [10285, 10633, 27], [10633, 11243, 28], [11243, 11818, 29], [11818, 12351, 30], [12351, 13095, 31], [13095, 13242, 32], [13242, 14481, 33], [14481, 14550, 34], [14550, 14767, 35], [14767, 14925, 36], [14925, 15416, 37], [15416, 15445, 38], [15445, 15791, 39], [15791, 16364, 40], [16364, 16722, 41], [16722, 16785, 42], [16785, 17475, 43], [17475, 18438, 44], [18438, 18515, 45], [18515, 18946, 46], [18946, 18978, 47], [18978, 19332, 48], [19332, 19674, 49], [19674, 20012, 50], [20012, 20574, 51], [20574, 20813, 52], [20813, 20835, 53], [20835, 21482, 54], [21482, 21980, 55], [21980, 22491, 56], [22491, 22887, 57], [22887, 22896, 58]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 22896, 0.0]]}
olmocr_science_pdfs
2024-11-29
2024-11-29
666575e19a15c30128918f56c2168f355fe15d7c
Architecture principles – A regulative perspective on enterprise architecture 1Institute for Computing and Information Sciences, Radboud University Nijmegen Toernooiveld 1, 6525 ED Nijmegen, The Netherlands {P.vanBommel, S.Hoppenbrouwers, E.Proper}@cs.ru.nl 2Ordina Ringwade 1, 3439 LM Nieuwegein, The Netherlands Pieter.Buitenhuis@ordina.nl Abstract: Increasingly, organizations make use of enterprise architectures to direct the development of the enterprise as a whole and its IT portfolio in particular. In this paper we investigate the regulative nature of enterprise architecture. We aim to develop a fundamental understanding of the regulative needs that underly an enterprise architecture, and then take these needs as a starting point to arrive at requirements on the language (architecture principles) used to denote enterprise architectures. We furthermore discuss the process of formulating principles as well as their semantics. 1 Introduction Increasingly, organizations make use of enterprise architectures to direct the development of the enterprise as a whole and its IT portfolio in particular [Lo05]. These developments are fuelled by requirements such as the Clinger-Cohan Act in the USA1, which force government bodies to provide an IT architecture. The term architecture has been used in the field of IT since the 1960’s. In the early days it was used to refer to the principles underlying the design of computer hardware and operating systems. This led to the use of the term computer architecture. Later, when software applications became larger and larger, Mary Shaw and David Garlan coined the term software architecture [SG96]. This notion of architecture deals with the key design principles underlying software artefacts. In the 1980’s and 1990’s people became aware that the development of IT (information technology) should be done in tandem with the development of the context in which it was to be used. This led to the identification of the so-called Business/IT alignment problem [PB89, TC93, HV93]. Solving the Business/IT alignment problem requires organisations to align human, organisational, informational and technological aspects of systems. Quite early on, architecture was also introduced as a means to further alignment, and thus analyse and solve Business/IT alignment problems [Zac87, TC93, Boa99b]. The Business/IT alignment problem requires the alignment of information technology, consisting of software and hardware, to the other ‘technologies’ used in a business. This has led to the use of the term architecture at the enterprise level [BL96, Boa99a, Lo05]. Enterprise architectures typically bring together a business, information, application and technology perspective on (parts of) an enterprise. Ultimately, enterprise architectures are a means to an end. The Software Engineering Institute from Carnegie Mellon University identifies the following potential uses [BCK98] for architectural descriptions: - It is a vehicle for communication among stakeholders. - It captures early design decisions, both functional aspects as well as quality aspects. - It describes the global structure decided upon in the architecture, also structures further development. - It is a transferable abstraction of a system. Many different perspectives exist on what architecture, in an IT context, actually is. Even though some consensus exists, the field of enterprise architecture is still in its infancy. However, the widespread use of enterprise architecture illustrates that organizations feel a profound need to steer their development (including their IT portfolio) and that they look towards enterprise architecture as a means to fulfill this need. When studying the many existing definitions on architecture [BL96, SG96, BCK98, Boa99a, IEEE00, TOG04, Lo05, xAF06], one can discern two important perspectives on architecture: **Regulative perspective** – Architecture is regarded as a prescriptive notion limiting the design freedom with regards to the design of a system. When taking this perspective one will focus on principles, leading to rules/principles limiting designers in their design freedom. **Designing perspective** – Architectures are actual specifications of high level system designs focusing on ‘architecturally relevant’ design decisions. When taking this perspective, one typically produces architectural models that describe the design of actual system artefacts. These two perspectives are complementary in that the regulative perspective accommodates for the need to steer and direct developments, whereas the second perspective supports the need to gain insight into an enterprise’s design while also providing guidance to designers of enterprise systems [Lo05]. In this paper, we focus on the regulative perspective. In taking a regulative perspective on enterprise architecture, we are primarily concerned with its ability to steer the overall enterprise/system development within a large organization (enterprise). A more specific way of expressing this is to state that “Architecture serves the purpose of constraining design space” [xAF06]. In most (enterprise) architecture approaches, this constraining/ is done by means of so-called architecture principles [IEE00, TOG04]. The aforementioned Clinger-Cohen act also requires the architecture to be specified in terms of a set of principles. Such architecture principles usually take the form of informal statements such as (taken from [TOG04]): Users have access to the data necessary to perform their duties; therefore, data is shared across enterprise functions and organizations. According to the TOGAF architecture framework [TOG04], “Principles are general rules and guidelines, intended to be enduring and seldom amended, that inform and support the way in which an organization sets about fulfilling its mission.” Such principles typically address concerns of the key stakeholders within an organization. In the example case, a stakeholder may be highly concerned about the organization’s ability to flexibly deploy their workforce over different work locations. While several sources attribute a pivotal role to principles, a precise definition of the concept of principles as well as the mechanisms and procedures needed to turn them into an effective regulatory means still lacks. Both IEEE [IEE00] and TOGAF [TOG04] position principles as a means to guide the design and evolution of systems, while xAF [xAF06] essentially equates (enterprise) architecture to a set of principles. In any case, no clear definition of principles and associated mechanisms and procedures are given. When considering the definitions reported in literature [TC93, IEE00, TOG04, xAF06], and the definitions used by several practitioners, three key perspectives on principles can be discerned: Inherent laws – These are essentially properties of (classes of) a system that can be observed and validated. Conceptual parallels are the laws of nature, law of requisite variety, laws of social behavior, etc. Imposed laws – Like inherent laws, they are properties of (classes of) a system that can be validated. However, imposed laws also require mechanisms to enforce them. Imposed laws typically address concerns of stakeholders. Some of these concerns may be raised by emergent laws having a negative impact on the system being designed. Examples are: societal laws, policies and regulations within organizations, etc. Guidelines – Desired properties that are so concrete that they offer guidelines to make operational behavior fit imposed laws. For example: “use your car’s cruise control” is an advisable property to abide by that provides guidance in obeying the law concerning maximum speeds on roads. In this paper we mainly focus on the last two perspectives on principles. The remainder of this paper is structured as follows. In section 2 we aim to build up a better understanding of the regulative role of enterprise architectures. This is followed in section 3 by a discussion of requirements on the language of architecture principles, as a means to operationalize the regulative ability of enterprise architectures. Section 4 then continues by discussing the semantics of principles, in other words, their regulative impact. Before concluding, section 5 discusses an approach to the formulation of architecture principles based on practical experiences and some experiments. 2 Enterprise architecture as a regulative mechanism As mentioned in the introduction, this paper takes a regulative perspective on enterprise architecture. This role comes primarily to the fore in the role of architecture principles [IEE00, TOG04, xAF06]. In [xAF06], enterprise architecture is equated to a set of architecture principles, which are to "limit design freedom", thus regulating the freedom of an enterprise’s designers. The aim of this section is to briefly investigate the regulative needs that underly an enterprise architecture. When indeed taking the perspective that an enterprise architecture is a regulative means, one must also agree (at least from a rational perspective) that there is some regulative need motivating the use of the means. Enterprises have stakeholders. For example: owners, sponsors, people working in the enterprise, clients, etc. Let \( S \) be a stakeholder of an enterprise \( E \), then it is fair to assume that \( S \) has some goals \( \text{Goals}(S) \) which are potentially impacted on by the behaviour of \( E \). From the perspective of these goals, the enterprise \( E \) has an ideal behaviour. This behaviour can refer to all aspects of an enterprise, be it the operational processes, financial aspects, labour issues, adaptability, etc. The actual attainment of \( E \)'s ideal behaviour from the perspective of \( \text{Goals}(S) \) may be influenced by both internal and external factors [BMM06]. These potential 'impacts' may spark stakeholder \( S \) into (trying to) regulate enterprise \( E \) and/or its influencers. Needless to say that \( S \) will not be the only stakeholder, and the desires of \( S \) to regulate \( E \) may indeed conflict with the regulatory desires of other stakeholders. Given some influencer \( F \), a risk assessment (see also [BMM06]) may show that \( F \) has a potential undesired impact on \( \text{Goals}(S) \), in other words there is a set of risks \( \text{Risks}(F, S) \) influencer \( F \) poses to the goals of stakeholder \( S \) by potentially influencing \( E \). Each of these risks can be quantified in terms of its possible impact \( \text{Impact}(R) \) and probability of occurrence \( \text{Probability}(R) \), with expected impact: \( \text{Impact}(R) \times \text{Probability}(R) \). Note: the impact might be approximated using an amount of money, but ultimately relates to the impact of a stakeholder’s goals. If the expected impact is high enough, stakeholder \( S \) will be motivated to introduce regulations to prevent \( R \) from occurring. If \( M \) is some (set of) regulation(s) aimed at \( R \), then its benefit can be assessed by determining: \[ \text{Benefit}(R, M) = \text{Impact}(R) \times \text{Probability}(R) - \text{Impact}(R|M) \times \text{Probability}(R|M) \] where \( \text{Impact}(R|M) \) and \( \text{Probability}(R|M) \) represents the possible impact and probability of occurring of risk \( R \) with regulation \( M \) in place. If \( \text{Costs}(M) \) are the costs of deploying regulation $M$, then the actual effectiveness of $M$ can be thought of as being the ratio: $$\text{Benefit}(R, M)/\text{Costs}(M)$$ The costs can, again, be expressed in terms of money, but should yet again be regarded as a negative impact on the (satisfaction of) goals a stakeholder is striving for. Admittedly, this cost/benefit framework is as yet far from practical. This is in line with the observation that the regulative role of enterprise architecture is also still in its infancy. At the same time, however, the desire to use enterprise architecture for such purposes is paramount. In making this kind of risk assessment more explicit, the field of enterprise architecting may borrow from the field of security [RF07], where security risks are assessed and the effectiveness of security regulations are evaluated against these risks. The aim of this paper is not to develop such a risk assessment, although we subscribe to its necessity, but rather to explore requirements on a principles language. In further research, however, we will indeed invest in a more elaborate cost/benefit analysis approach providing rationalizen of principles. 3 Requirements on principles In this section we focus on the goals of, and requirements on, a modelling language for architecture principles. When taking the position that architecture principles embody the regulative role of enterprise architecture, then we can this as a starting point to indentify requirements on a language to express architecture principles. In order to arrive at such requirements, it is important to first make explicit what the goals of the language are [HPW05b]. Without these goals it is difficult to pinpoint the requirements for the language in total. On their turn, these requirements are a mandatory input to formulation of modelling concepts in the language and their requirements [HPW05b, PVH05]. In a survey conducted among a number of experienced enterprise architects [Bui07], the following goals where expressed: **Regulative architecture** – The language should be designed in such a way that it enables an architect formulate a prescriptive/regulative architecture. **Supportive; not restrictive** – The language should not act as a straitjacket but should rather should architects in formulating the regulative architecture. It is important that the modelling language does not hinder the (creative!) architecting process itself. **Architect independent** – Since architecture principles need to be communicated among architects, to stakeholders, and system designers, the language as such should not be specific to one architect. Even though this may sound obvious, it is still common practice among enterprise architects to come up with one’s own language. There is, as yet, not much consensus about such a language. Approach independent – A good modelling language can be used in different development approaches. For example, like UML, ER and ORM can be used in system development methods such as SDM, DSDM, RAD and XP. This should also be the case for this an architecture principles language; it should be independent of the architecting approach used. A means of communicating and steering – Architecture is positioned as a communication and a steering device. This must be taken in consideration when designing this modelling language. The steering and communication goals may lead to conflicts. For example, a nice marketing line (such as Nokia’s ‘Connecting People’) may be suitable to communicate a basic idea, while not being specific enough to give enough steering. Based on the above goals, and also as part of the survey, the following requirements were deduced [Bui07]: Facilitating role – The architecting process and not the modelling language should have the most impact on the architecture itself. The architect should not be (too) restricted by the language in formulating the architecture. This is why the modelling language should give the architect some tools and means (in the form of formulation guidelines) to formulate an architecture better. It is then the choice of the architect to use those guidelines. Because an architecture is subject to evolution, it is necessary for the language to be able to support the different stages (from sketch to definitive formulation) of the architecting process. Syntactically complete – The modelling language needs to contain all the different concepts that are used by architects when formulating a regulative architecture. This implies that it must be clear which concepts are used by architects and how they relate to each other. Because each architecture should always be considered in its context, those concepts should be used in the language as well. It is clear that an incomplete modelling language can not produce a complete architecture. The completeness of concepts in the language should be resolved on syntactical level. Contains reference architecture Some architects have pleaded for a modelling language involving numerous examples. This has two advantages: - it gives the architect possible means to formulate a better architecture and - it will be possible to create a reference architecture. Reference architectures play a role of importance in giving the field of enterprise architecting a more mature status. It is still common practice for architects to start from scratch for each new project. This implies that architectures are very often not proven in practice which does not give the client the guarantee that the architecture will work in practise. Contains also (semi-)formalised language – Regulative architectures are currently primarily based on natural language. Interviewed architects do see the advantages of a (semi-)formalised architecture, but claim as well that the architecture should also be communicated to the ‘normal’ stakeholders. The modelling language should therefore not only facilitate (semi-)formalised language, but also the ‘normal’ natural language. The architect should not be forced to write formalised statements. The formalised concepts can be used by the architect to make a check on completeness and (formalised) linguistic aspects. Because formalised statements are less ambiguous, it’s very advisable to use them with project members who can handle those statements. When using natural language, there is also a distinction to be made in the degree of abstractness in the formulation. A statement for higher management will normally be different (more concise, more simple, more catchy) than for a project member. The language is then capable of making different visualizations of the same architecture, focused on the type of stakeholder. Formulating an architecture on a formalised and non formalised level is also consistent with the two main goals of architecture. A (semi-)formalised language supports primarily the steering function, the natural language the communication aspect. **Terminological framework; improving the communication** – To improve the communication and decrease the ambiguity of the architecture, it’s very important to have a shared term framework between all stakeholders. Such a framework should be based and focused on the stakeholders. However, it is now impossible to insert a fixed term framework in this modelling language because of the architect independence goal. This is also consistent with the requirement that the modelling language should not be too prescriptive. In addition to these requirements voiced by practitioners, additional requirements can be found in literature. In their Architecture Framework (TOGAF), the Open Group [TOG04] lists five criteria (which are also based on practical experiences) that distinguish a good set of principles: - **Understandable** – The underlying tenets can be quickly grasped and understood by individuals throughout the organization. The intention of the principle is clear and unambiguous, so that violations, whether intentional or not, are minimized. - **Robust** – Enable good quality decisions about architectures and plans to be made, and enforceable policies and standards to be created. Each principle should be sufficiently definitive and precise to support consistent decision making in complex, potentially controversial, situations. - **Complete** – Every potentially important principle governing the management of information and technology for the organization is defined. The principles cover every situation perceived. - **Consistent** – Strict adherence to one principle may require a loose interpretation of another principle. The set of principles must be expressed in a way that allows a balance of interpretations. Principles should not be contradictory to the point where ad- hering to one principle would violate the spirit of another. Every word in a principle statement should be carefully chosen to allow consistent yet flexible interpretation. **Stable** – Principles should be enduring, yet able to accommodate changes. An amendment process should be established for adding, removing, or altering principles after they are ratified initially. The above requirements are requirements on a set of principles and are not requirements on the modelling language. However, these requirements on good principles do underline the need for: 1. a clear semantics of principles, enabling a.o. consistency checks of sets of principles, 2. have a syntax which is understandable by domain experts and not just architects and engineers. The TOGAF requirements also imply requirements on the process of formulating and maintaining sets of architecture principles. A further source of requirements on architecture principles and/or a language for modelling architecture principles can be found in the business rules manifesto [Ros03]. Business rules are also forms of regulations that should both have a precise meaning while also be understandable to domain experts/stakeholders. Some key requirement from the business rules manifesto are: 3.2 Terms express business concepts; facts make assertions about these concepts; rules constrain and support these facts. 3.3 Rules must be explicit. No rule is ever assumed about any concept or fact. 4.1 Rules should be expressed declaratively in natural-language sentences for the business audience. 5.1 Business rules should be expressed in such a way that they can be validated for correctness by business people. 5.2 Business rules should be expressed in such a way that they can be verified against each other for consistency. 5.3 Formal logics, such as predicate logic, are fundamental to well-formed expression of rules in business terms, as well as to the technologies that implement business rules. 7.1 Rules define the boundary between acceptable and unacceptable business activity. 8.4 “More rules” is not better. Usually fewer “good rules” is better. Most of these requirements are in line with the requirements put forward by TOGAF. 4 Semantics of principles The TOGAF (as well as business rules manifesto) requirement of rules being consistent and at the same time being understandable by domain experts and stakeholders, provides an interesting challenge in the construction of a principles modelling language. In [BHPW06, CJN+07], we have studied the use of a semi-formal language to represent principles. The language used stems from the field of information modelling, where languages such as ConQuer, Lisa-D and RIDL [Mee82, HPW93, Pro94, BH96, HPW05a] have been used to formulate constraints, rules and queries and reason about these. Consider as an example the following TOGAF principle: **Common use applications** — “Development of applications used across the enterprise is preferred over the development of duplicate applications which are only provided to a particular organization.” A domain analysis and formalization leads to: If an Application $A$ [that is used in an Organization $O$] results from some Development, and this Application $A$ is not a duplicate of another Application [that is used in another Organization than $O$], then that Development is preferred by the Enterprise that includes both Organizations and both Applications. An important question in this example is the way one would have to measure when one application is a duplicate of another application. In making such principles SMART, proper mechanisms should be defined to determine whether one application is a duplicate of another one, or more appropriately, whether one set of applications is a duplicate of another set. And more generally, in the aspect system Business one would like to measure when one process is a duplicate of another process, in order to detect process and organizational redundancy. 5 Formulating principles In [NBP07] we have reported on research efforts into the collaborative formulation of policies/regulations such as architecture principles. This work mainly focussed on the collaborative aspects of such processes. Note that the TOGAF requirements of robustness, completeness and stability of architecture principles have not yet been taken into account in this work. The experience report given in [OP07] did take such requirements into consideration. In [BHPW06, CJN+07] the possible effect of using a semi-formal formal modelling language in the formulation of principles was studied. Based on these experiments and experiences, we suggest adhering to the following process-structure in formulating architecture principles: --- $^2$Specific, Measurable, Achievable, Relevant, Time-bound; a common mnemonic used in project management. Assess needs – An assessment of the regulative needs, which can be used as motivations for the principles to be formulated and their enforcement. 1. (Collaborative) In a collaborative session involving stakeholders, sponsors, domain experts and architects, potential regulative needs (issues/concerns/risks) should be gathered. In addition, goals should be formulated upon these regulative needs are to be assessed, and criteria should be formulated regarding the desired longevity of any measures (architecture principles) formulated that are to address these needs. 2. (Expert-driven) Risk assessment experts should then assess/judge the identified regulative needs. This assessment should take the form of a risk analysis as suggested in section 2. 3. (Collaborative) The stakeholders and the sponsors (of the regulative measures to be taken) should then decide which of these regulative needs they want to see addressed. Formulate principles – The definition of a set of principles that are to be deployed. 1. (Collaborative) Based on the (selected) regulative needs, a mix of stakeholders, domain experts and architects should, collaboratively, formulate a set of architecture principles which would address these needs. 2. (Expert-driven) The resulting candidate principles should then be pinned down more precisely by a small number of domain experts together with the architects. This group should also assess the longevity of the principles in terms of the criteria produced during the needs assessment, as well as determine more specific consequences of the principle, and clearly identify/quantify the possible contribution of the principle towards the regulative needs. 3. (Collaborative) The list of refined principles should then be put to the vote. The domain experts, stakeholders and sponsors should select which principles are to be deployed. Prepare deployment – For each principle a deployment scenario should be formulated. 1. (Collaborative) Given the list of selected architecture principles, more refined criteria for the assessment of possible strategies to deploy/enforce these principles should be formulated. 2. (Expert-driven) Domain experts and architects should define a number of possible strategies for the deployment/enforcement of the select architecture principles. Each of these strategies should also be evaluated in terms of their costs/benefits. 3. (Collaborative) From the list of available scenario’s for the deployment of principles, the stakeholders, domain experts and sponsors should select the ones they see as most effective and beneficial. The above procedure iterates between a collaborative and expert-driven mode. Some tasks should be done collaboratively so as to warrant commitment from, and understanding by all relevant parties involved. Some other tasks require a focussed effort by a limited number of experts. Note that the above sketched process structure by no means intends to imply a specific length/duration/size of a specific formulation process. Depending on the requirements of specific situation, such a process may/should require only a single day or even weeks to complete. 6 Conclusions and further research In this paper we have investigated the regulative nature of enterprise architecture. The work reported is part of an ongoing effort to develop a fundamental understanding of the regulative needs that underly an enterprise architecture, and use this understanding in the development of a language for architecture principles as well as a situational procedure/strategy for the formulation of such principles. In our remaining research activities regarding architecture principles, we identify the following key challenges: Language – How are principles to be expressed, i.e. in what type of language? Are there any hard syntactic or semantic restrictions that are to be imposed, or would this be too restrictive? What could be reasons to (not) impose particular such restrictions? How can understandability be optimally safeguarded at a linguistic level, and how much investment in this is justified in view of quality demands on principle formulations? (How) can SMARTness be increased based on language restrictions? Regulative needs – How can the regulative needs underlying principles be better quantified? How can one predict the positive contributions of enforcing a principle towards these needs? Formulation strategies – Given requirements on the product of the principles creation process, what does such a process look like? Are situational adjustments of the process required or is it possible to define a truly generic process? Apart from the question what semantic and syntactic requirements can be posed for principles, there are pragmatic matters to be addressed. Principles are required to be understood, agreed upon, and committed to by appropriate (groups of) stakeholders. These should be viewed as results of the process, alongside the actual principle formulations [BHP07]. Deployment strategies – Enforcement and guidance during the design and development of new systems (and new versions), but also strategies for dealing with legacy systems. How to translate principles and their measuring mechanisms to guidelines? Can the impact of principles be estimated reliably beforehand? References
{"Source-Url": "http://repository.ubn.ru.nl/bitstream/handle/2066/35092/35092.pdf?sequence=1", "len_cl100k_base": 5958, "olmocr-version": "0.1.53", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 30539, "total-output-tokens": 8916, "length": "2e12", "weborganizer": {"__label__adult": 0.0006690025329589844, "__label__art_design": 0.01288604736328125, "__label__crime_law": 0.0008001327514648438, "__label__education_jobs": 0.00881195068359375, "__label__entertainment": 0.00023567676544189453, "__label__fashion_beauty": 0.00038552284240722656, "__label__finance_business": 0.005886077880859375, "__label__food_dining": 0.000804901123046875, "__label__games": 0.0010271072387695312, "__label__hardware": 0.0013780593872070312, "__label__health": 0.0008983612060546875, "__label__history": 0.0009074211120605468, "__label__home_hobbies": 0.0002371072769165039, "__label__industrial": 0.0015687942504882812, "__label__literature": 0.0015316009521484375, "__label__politics": 0.0006351470947265625, "__label__religion": 0.0011577606201171875, "__label__science_tech": 0.11260986328125, "__label__social_life": 0.00014674663543701172, "__label__software": 0.016998291015625, "__label__software_dev": 0.82861328125, "__label__sports_fitness": 0.0003235340118408203, "__label__transportation": 0.0009703636169433594, "__label__travel": 0.00035452842712402344}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 37394, 0.01734]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 37394, 0.63736]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 37394, 0.91317]], "google_gemma-3-12b-it_contains_pii": [[0, 0, null], [0, 2415, false], [2415, 5370, null], [5370, 8173, null], [8173, 11630, null], [11630, 14459, null], [14459, 17363, null], [17363, 20372, null], [20372, 22587, null], [22587, 25230, null], [25230, 28002, null], [28002, 30531, null], [30531, 33787, null], [33787, 36949, null], [36949, 37394, null]], "google_gemma-3-12b-it_is_public_document": [[0, 0, null], [0, 2415, true], [2415, 5370, null], [5370, 8173, null], [8173, 11630, null], [11630, 14459, null], [14459, 17363, null], [17363, 20372, null], [20372, 22587, null], [22587, 25230, null], [25230, 28002, null], [28002, 30531, null], [30531, 33787, null], [33787, 36949, null], [36949, 37394, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 37394, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 37394, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 37394, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 37394, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 37394, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 37394, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 37394, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 37394, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 37394, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 37394, null]], "pdf_page_numbers": [[0, 0, 1], [0, 2415, 2], [2415, 5370, 3], [5370, 8173, 4], [8173, 11630, 5], [11630, 14459, 6], [14459, 17363, 7], [17363, 20372, 8], [20372, 22587, 9], [22587, 25230, 10], [25230, 28002, 11], [28002, 30531, 12], [30531, 33787, 13], [33787, 36949, 14], [36949, 37394, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 37394, 0.0]]}
olmocr_science_pdfs
2024-12-07
2024-12-07
e373eec5d0f4eb2f32302d33502fc10c57018e64
A self–stabilizing algorithm for finding weighted centroid in trees Halina Bielak\(^1\)*, Michał Pańczyk\(^2\)† \(^1\)Institute of Mathematics, Maria Curie-Sklodowska University, pl. M. Curie-Sklodowskiej 1, 20-031 Lublin, Poland. \(^2\)Institute of Computer Science, Maria Curie-Sklodowska University, pl. M. Curie-Sklodowskiej 1, 20-031 Lublin, Poland. Abstract – In this paper we present some modification of the Blair and Manne algorithm for finding the center of a tree network in the distributed, self-stabilizing environment. Their algorithm finds \(\sqrt{n}\)-separator of a tree. Our algorithm finds weighted centroid, which is direct generalization of the former one for tree networks with positive weights on nodes. Time complexity of both algorithms is \(O(n^2)\), where \(n\) is the number of nodes in the network. 1 Introduction A notion of self-stabilizing algorithms on distributed systems was introduced by Dijkstra \(^1\) in 1974. A survey in the topic can be found in the paper by Schneider \(^2\), and more details in the book by Dolev \(^3\). The notions from the graph theory not defined in this paper can be found in the book by Harary \(^4\). A distributed self-stabilizing system consists of a set of processes (computing nodes) and communication links between them. Every node in the system runs the same algorithm and can change state of local variables. These variables determine local state of a node. Nodes can observe the state of variables on themselves and their neighbour nodes. The state of all the nodes in the system determines the global state. Every self-stabilizing algorithm should have a class of global states called legitimate state defined, when the system is stable and no action can be done by the algorithm itself. Every other global state is called illegitimate and for the algorithm to be correct \footnote{hbiel@hektor.umcs.lublin.pl} \footnote{mjpanczyk@gmail.com} there has to be some possibility to make a move if the state is illegitimate. The aim of the self-stabilizing algorithm is to bring the legitimate (desirable) state of the whole system after some alteration (from the outside of the system) of variables in the nodes or after the system has been started. The tree leader (medians) notions were first studied by Zelinka in [5] in 1967. The self-stabilizing leader electing in unweighted trees was presented in [6] by Bruell, et al. and improved in [7] by Blair and Manne. Recently Chepoi et al. [8] have presented the self-stabilizing algorithm for the so-called partial rectangular grids. Their algorithm uses generalization of the algorithm from [6], which computes also the median of a tree, but in a different way from that in our paper. In this paper we present an algorithm for electing a centroid node in weighted trees. Every node in the system has its weight. We are going to find the node whose removal would split the tree into connected components with the sum of weights not greater than the half of the weight of the whole tree. Of course, for any node there would be as many such components as the degree of the node is. In other words, we are looking for weighted centroid of a tree. Fig. 1 presents the weighted tree of order 7. Fig. 1. An example of a weighted tree. 2 Computational Model We consider a self-stabilizing system modelled by a finite, undirected graph $G = (V, E)$. Let the number of vertices be $n = |V|$ and the number of edges $e = |E|$. In this paper we consider trees, so the number $e$ of the edges in the graph is $n - 1$. A set of all neighbours of the node $i$ is $N(i)$. We think of every process as a node in the tree, whereas edges are the connection links between them. There are some variables in each node. Names and types of the variables are set during design of an algorithm. Every node can also look up the state of the variables at its neighbours. Each node runs the same algorithm. The algorithm consists of a set of rules. A rule has the form ```plaintext : label If guard then assignment instructions. ``` A guard is a logic predicate which can refer to variables in the node itself and its neighbours. We say that a rule is active if its guard is evaluated to be true. A node is active if it contains any active rule. If there is no active node in the graph, we say that the system is stabilized. A self-stabilizing system contains also a scheduler. Its task is to choose one process from the set of active processes and to trigger an active rule in it. We call such an action a move. In this article the scheduler is assumed to be distributed and adversarial, so the order of activating the nodes is nondeterministic. As a consequence, while describing pessimistic complexity of the algorithm (number of moves), we must take the worst case scenario of triggering actions in particular nodes. ## 3 Finding Centroid Node Algorithm Blair and Manne [7] presented a fast algorithm for leader election in unweighted trees. Now we present an algorithm for finding centroid in weighted trees. The idea is quite similar to the original algorithm without weights. Let us have an unrooted tree. Every node $i$ of the tree has got the assigned weight $w_i$ which is a positive natural number. A weighted centroid is such a node that its removal splits the tree into connected components with the sum of weight of each one not greater than $W/2$, where $W$ denotes the entire tree weight. **Lemma 1.** There is at least one weighted centroid node in a weighted tree. **Proof.** Let us assume that there is no weighted centroid node in a tree. This means that if we remove any node from the tree, there will be one connected component with the weight greater than $W/2$. Starting at an arbitrary node we can go to a neighbour which is a part of the component with the weight greater than $W/2$. By repeating this step, at some point we will get back to the previous node we have been in. Further steps would loop infinitely between these two nodes. If we cut the edge between them, there will be two connected trees, both with the weight greater than $W/2$. But this cannot be true since the weights should sum up to $W$. □ As the existence of centroid nodes has been proven, now we state an upper bound on the number of such nodes. **Theorem 1.** The number of centroid nodes in a tree with positive weights on the nodes is either one or two. Moreover, if there are two centroid nodes, they are adjacent. Proof. Let us assume that there are two weighted centroid nodes $i, j$ in a tree, such that they are not adjacent. There is at least one node between them from the subtree containing nodes from the set $B$ as shown in Fig. 2. Let $B$ contain neither $i$ nor $j$. Also let $A$ and $C$ denote the sets of nodes in subtrees (other than the subtree containing $B$) rooted on the neighbours of nodes $i$ and $j$ respectively. ![Fig. 2. Visualisation of the proof of Theorem 1.](image) Let $W$ denote the weight of the entire tree, so we can write $$w_A + w_i + w_B + w_j + w_C = W,$$ where $w_A, w_B, w_C, w_i, w_j$ mean the weights of subgraphs induced by the sets $A, B, C, \{i\}, \{j\}$, respectively. Since $i$ is a weighted centroid we can write down: $$w_B + w_j + w_C \leq W/2.$$ \(1\) The same applies for $j$, so $$w_A + w_i + w_B \leq W/2.$$ \(2\) By adding the above two inequalities side by side we have $$w_A + w_i + 2w_B + w_j + w_C \leq W,$$ which compared to (1) implies that $w_B = 0$. But this cannot be true since all weights in the tree are positive. This proves that two centroid nodes are always adjacent. To end up the proof, it is sufficient to show that there cannot be more than two centroid nodes. Let us assume that there are at least 3 centroid nodes. Since every two of them must be adjacent, they must form a cycle with 3 nodes as a subgraph. But this is impossible since a tree is an acyclic connected graph (net). Now we are ready to present the searching weighted centroid node algorithm in the weighted trees. The algorithm consists of two phases. The first one determines weights of some components adjacent to every node of a tree. After stabilization of the first phase every node can also find out the weight of entire entire tree. The second phase of the algorithm selects the centroid node relying on the information given by the first phase. Both phases of algorithms run in parallel. However, while the first one is running, moves made by the second phase are meaningless — they only increase the number of moves made by the algorithm. 3.1 Phase one — determining weights of components In our algorithm each node contains in itself an array $W_i$ of weights. After stabilization of the system, the value of array $W_i[j]$ for every neighbour $j$ of the node $i$ is the weight of connected component containing node $i$ but with $\{i, j\}$ edge cut. \[ \text{R1} \] \begin{align*} \text{If } & \exists j \in N(i) \ W_i[j] \neq w_i + \sum_{k \in N(i) - \{j\}} W_k[i] \\ \text{then } & W_i[j] := w_i + \sum_{k \in N(i) - \{j\}} W_k[i] \end{align*} Note that for any leaf $i$ and its neighbour $j$, $W_i[j]$ will be set to the weight $w_i$ of the node $i$. ![Fig. 3. The tree from Fig. 1 with $W_i[j]$ calculated for every node $i$ and its neighbour $j$ — after stabilization of R1 algorithm.](image) Below we state a lemma about stabilization of R1 algorithm. It is analogous to that from [7], but in this case for the weighted tree network algorithm. The idea of the proof is also the same, but in this paper we give an extension to the weighted tree network algorithm. **Lemma 2.** Algorithm R1 stabilizes. **Proof.** Let us have any sequence of executions $E_1, E_2, \ldots, E_k$ of the rule R1 on a sequence of the consecutive nodes $n_1, n_2, \ldots, n_k, n_{k+1}$ ($E_i$ is an execution of R1 rule on $n_i$ node) such that $E_i$, $1 < i \leq k$, is the first update of $W_{n_i}[n_{i+1}]$ that makes use of the value $W_{n_{i-1}}[n_i]$. For example, the first such dependency is the use of $W_{n_1}[n_2]$ for updating $W_{n_2}[n_3]$. Now we show that $n_i \neq n_j$ for $i \neq j$. According to the rule R1, it is impossible to have $n_i = n_{i+1}$. To show that also $n_i \neq n_{i+2}$ for every $i$, let us consider that propagation of R1 moves along a path in the tree (see Fig. 4). For any node $i$ the value of $W_i[j]$ depends only on the values $W_h[i]$ in the neighbours $h \neq j$. On the other hand, the value $W_i[j]$ influences the value $W_j[k]$ in a node $j$ for its any neighbour $k \neq i$. If we take $n_i = h$ and $n_{i+2} = j$, then the equation $n_i = n_{i+2}$ would imply that there is A self-stabilizing algorithm for finding weighted... a cycle in the graph. But since it is a tree it is not possible. The above argument can be repeated for any \( c \geq 2 \) in rejecting the equation \( n_i = n_{i+c} \). Thus we have \( k < n \), where \( n \) is the number of nodes of the tree. There exists exactly one path between any two nodes in a tree. Thus the set of all maximal paths of executing the rule R1 contains \( n^2 \) elements when the orientation of such paths (the order from left to right, and from right to left) is distinguished. The only way the number of paths is unbounded is if the same path sequence appears more than once in the set but with different input values. To show that it is impossible, note that the first move of every maximal sequence of moves must depend only on the system initial state. So if \( E \) and \( E' \) are two maximal paths of execution of the rule R1 such that \( n_i = n'_i \), then the first move for both sequences must be the same. Now it follows by induction that \( E \) and \( E' \) must consist of the same moves since the \( i \)-th move is uniquely dependent on the previous \( (i-1) \)-th move. \( \square \) **Fig. 4.** Propagation of R1 moves along a path in a tree. **Lemma 3.** When algorithm R1 has stabilized \( W_i[j] \) is correctly computed for every node \( i \) and its neighbour \( j \). **Proof.** The proof is by induction on the number of nodes in a tree. As the base case let us take a leaf. There are two possibilities: either \( W_i[j] \) in a leaf \( i \) is correct or it is not correct at the beginning of running of the algorithm. If it is not correct, the rule R1 is active and it will be triggered finally. After this move, the rule R1 becomes inactive. If the \( W_i[j] \) is correct in a leaf, it will never be changed or become incorrect. Now our induction hypothesis is that for a node \( i \) its every neighbour \( k \) except for a node \( j \), i.e. \( k \neq j \) has computed the value \( W_k[i] \) correctly. Given that, if node \( i \) has the value \( W_i[j] \) incorrect, now it can compute it and set a correct value to \( W_i[j] \) relying on its neighbours’ information. The proof is done. \( \square \) We will now consider a number of moves the algorithm makes to stabilize. Let \( v_i(j) \) be the number of nodes in the connected component containing the node \( i \) in the graph with \( \{i, j\} \) edge cut, and let \( c_i(j) \) be the number of the value \( W_i[j] \) changes... during execution of algorithm R1. Now we comprise lemma from [7] that will allow us to deduce about the complexity of our algorithm. **Lemma 4.** When algorithm R1 has stabilized $c_i(j) \leq v_i(j)$ for every node $i$ and its neighbour $j$. The proof of Lemma 4 is similar to that for lemma 3, so it is omitted. The number of moves in our algorithm is the same as in that for the network tree without weights, so the following lemma from [7] also holds. **Lemma 5.** The rule R1 is executed at most $n(n-1)$ times. **Proof.** For every pair of adjacent nodes $i$, $j$ the property $v_i(j) + v_j(i) = n$ holds, so from Lemma 4 the total number of times that the values $W_i[j]$ and $W_j[i]$ change is at most $n$. Since the network system is a tree, so the number of edges is $n - 1$, the result follows. 3.2 Phase two — rooting the tree Once the R1 phase has stabilized the system, every node can determine the weight of the tree. To show this, we introduce a predicate similar to that from [7], which in our algorithm states whether from the node $i$ point of view, it can determine correct weight of the whole tree. The following predicate: $$wCorrect_i = \left( \forall j \in N(i) \left( W_i[j] = w_i + \sum_{k \in N(i) \setminus \{j\}} W_k[i] \right) \right)$$ is evaluated in order to run the following part of the algorithm. It is worth mentioning that for any node $i$, the predicate $wCorrect_i$ is true iff the rule R1 is not active for the node. Given that the system has been stabilized, every node can determine the weight of the tree. The following lemma gives the method how the node $i$ can calculate the weight of the whole tree. **Lemma 6.** If $wCorrect_i$ is true then $W_i[j] + W_j[i] = W_i[k] + W_k[i]$ for the neighbours $j, k$ of node $i$. **Proof.** Since $wCorrect_i$ is true: $$W_i[j] + W_j[i] = w_i + \sum_{q \in N(i) \setminus \{j\}} W_q[i] + W_j[i]$$ $$= w_i + \sum_{q \in N(i)} W_q[i]$$ $$= w_i + \sum_{q \in N(i) \setminus \{k\}} W_q[i] + W_k[i]$$ $$= W_i[k] + W_k[i]$$ □ This way each node can determine whether any of its neighbours has component weight bigger than half of the weight of the whole tree. If this occurs, the node itself cannot be the weighted centroid, and the neighbour is closer to it. In fact, it can be the centroid itself. On the other hand, if for a node its every neighbour has component weight less than half of the whole tree weight, then this node is considered the weighted centroid of the tree. There can be a situation, where two adjacent nodes can be considered as the weighted centroid, actually when two neighbours have component weight exactly equal to half of the whole tree weight. In such a case we arbitrarily choose the node with greater ID. All the time the \( w\text{Correct}_i \) predicate is true for the node \( i \), from its point of view it can determine the weight of the whole tree, but it is not necessarily correct. It is correct after the rule R1 has stabilized in the whole system. Apart from the above correctness, the weight of the entire tree calculated by node \( i \) we denote by \( W_i \). We present below four further rules of our algorithm. Their meaning is to make a pointer to the centroid: after stabilization if a node is centroid then it points to itself, otherwise the node points to the neighbour closer to the centroid. So each node \( i \) contains the variable \( p_i \) whose integer value points to the neighbour closer to the centroid or to itself if it is the centroid itself. : R2 \[ \text{If } (w\text{Correct}_i) \land (\forall_{j \in N(i)} W_j[i] < W_i/2) \land (p_i \neq i) \] \[ \text{then } p_i := i \] : R3 \[ \text{If } (w\text{Correct}_i) \land (\exists_{j \in N(i)} W_j[i] > W_i/2) \land (p_i \neq j) \] \[ \text{then } p_i := j \] : R4 \[ \text{If } (w\text{Correct}_i) \land (\exists_{j \in N(i)} W_j[i] = W_i/2) \land (ID_i > ID_j) \land (p_i \neq i) \] \[ \text{then } p_i := i \] : R5 \[ \text{If } (w\text{Correct}_i) \land (\exists_{j \in N(i)} W_j[i] = W_i/2) \land (ID_i < ID_j) \land (p_i \neq j) \] \[ \text{then } p_i := j \] In all above rule guards there is \( w\text{Correct}_i \) predicate. This makes the rules inactive if from the node \( i \) point of view weights of components have not been calculated yet. Thus for a node any of the rules R2-R5 can be active if and only if the rule R1 is inactive. The meaning of the rule R2 is to indicate in the node \( i \) that the weighted centroid is only one (unique) and \( i \) is the one. The rule R3 makes the \( p_i \) pointing to the neighbour of \( i \) closer to the centroid if \( i \) is not the one. The rules R4 and R5 are activated only if there are two weighted centroid nodes. Then the one with greater ID becomes elected: by itself (the rule R4) and by the other one (the rule R5). Lemma 7. The algorithm R1–R5 stabilizes on every weighted tree network after at most $2n^2 - n$ moves. Proof. The first phase of the algorithm (stabilization of the rule R1) takes no more than $n^2 - n$ moves. The second phase consisting of the rules R2-R5 gives the following number of moves: every node can make one move according to the rules R2-R5 before any node triggers the rule R1. This gives $n$ moves. Furthermore, after every R1 move a node can make one of the R2-R5 rules move — this gives extra $n^2 - n$ moves. All in all, it gives $n^2 - n + n + n^2 - n = 2n^2 - n$ moves. □ Lemma 8. After stabilization of the R1-R5 algorithm, the pointer values $p_i$ for every node $i$ in the weighted tree determine a rooted tree with the weighted centroid as the root. Proof. It is obvious that execution of the R2-R5 rules does not have any influence on the rule R1. Thus the rule R1 will stabilize with correct values $W_i[j]$, for every node $i$ and its neighbour $j$. Let us now assume that the entire algorithm has stabilized the weighted tree network. Take a look at the nodes that are not the weighted centroid. Any such node $i$ has exactly one neighbour $j$ for which $W_j[i] > W/2$, where $W$ is the weight of the entire tree. For these nodes $i$ the rule R3 may apply after stabilization of the rule R1, but none of the R2, R4, R5 rules is applicable. After possible application of the rule R3, $p_i$ will point to the neighbour which is part of the connected component with its weight greater than $W/2$. So these nodes point to the neighbour which is part of the subtree containing the weighted centroid. Now let us assume that there is a unique weighted centroid. Thus there exists no node with $W_j[i] = W/2$. The centroid $i$ has all the neighbours $j$ with the property $W_j[i] < W/2$. Then the node $i$ which is the unique centroid may apply the rule R2, pointing to itself as a centroid node. But it is also impossible that $i$ can make a move according to the rules R3-R5. Given that all the other nodes may apply only the rule R3, the whole tree has been stabilized with orientation to the root denoted. The other case is when there are two nodes with the weighted centroid property. This means that there is a pair of adjacent nodes $p$ and $q$ such that $W_p[q] = W_q[p] = W/2$. Then no node $i$ in the tree can have $W_j[i] < W/2$ for all its neighbours. Thus the nodes with the weighted centroid property cannot apply the rules R2 or R3, and all other nodes can apply only the rule R3. The non-centroid nodes will properly set their $p$ variables pointing towards the centroid node, as shown above. The weighted centroid nodes are adjacent so one of them can apply the rule R4 and the other one can apply the rule R5 if necessary. So the one with greater ID becomes a leader and the other one points to the leader. This proves the last case. The proof is done. □ To end up we can state the following corollary. **Corollary 1.** Starting with any global state of weighted tree network system, the algorithm R1-R5 stabilizes in at most $2n^2 - n$ moves having the values $p_i$ for every node $i$ pointing towards the just elected leader as one of the weighted centroid nodes. The final state of the system Fig. 1 is shown in Fig. 5. The arrows symbolize the pointers $p_i$ for every node $i$. We have two weighted centroids in the example (nodes 4 and 5). The leader is marked with the circle. ![Diagram](image) Fig. 5. A state of variable $p_i$ for every node $i$ in a tree after stabilization of the algorithm R1–R5. The weighted centroid node elected by the algorithm is circled. ## 4 Conclusions We have presented the self-stabilizing algorithm for finding a centroid in the weighted trees. It is generalization of the algorithm [7] for tree networks without weights (precisely with all node weights equal to 1). Our algorithm can be applied in the networks with the weights for electing a node which is the center of the network. One can think of it as limelight of the network. In the future work we would like to study the weighted centroid and the weighted median in the self-stabilizing systems with topologies other than trees. Some results connected with the above subject can be found in [9]. ## References
{"Source-Url": "https://journals.umcs.pl/ai/article/download/3346/2540", "len_cl100k_base": 5897, "olmocr-version": "0.1.53", "pdf-total-pages": 11, "total-fallback-pages": 0, "total-input-tokens": 33565, "total-output-tokens": 6802, "length": "2e12", "weborganizer": {"__label__adult": 0.0004165172576904297, "__label__art_design": 0.0005135536193847656, "__label__crime_law": 0.0006651878356933594, "__label__education_jobs": 0.0010614395141601562, "__label__entertainment": 0.0001443624496459961, "__label__fashion_beauty": 0.00023174285888671875, "__label__finance_business": 0.0004696846008300781, "__label__food_dining": 0.0005373954772949219, "__label__games": 0.0010614395141601562, "__label__hardware": 0.0021572113037109375, "__label__health": 0.0015707015991210938, "__label__history": 0.0005855560302734375, "__label__home_hobbies": 0.00024378299713134768, "__label__industrial": 0.0008955001831054688, "__label__literature": 0.0004732608795166016, "__label__politics": 0.0004925727844238281, "__label__religion": 0.0007538795471191406, "__label__science_tech": 0.44091796875, "__label__social_life": 0.00013935565948486328, "__label__software": 0.0089569091796875, "__label__software_dev": 0.5361328125, "__label__sports_fitness": 0.0004329681396484375, "__label__transportation": 0.0011043548583984375, "__label__travel": 0.00030612945556640625}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 23270, 0.02449]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 23270, 0.65815]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 23270, 0.92215]], "google_gemma-3-12b-it_contains_pii": [[0, 1925, false], [1925, 3879, null], [3879, 6442, null], [6442, 8530, null], [8530, 10612, null], [10612, 13119, null], [13119, 15140, null], [15140, 17943, null], [17943, 20840, null], [20840, 22446, null], [22446, 23270, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1925, true], [1925, 3879, null], [3879, 6442, null], [6442, 8530, null], [8530, 10612, null], [10612, 13119, null], [13119, 15140, null], [15140, 17943, null], [17943, 20840, null], [20840, 22446, null], [22446, 23270, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 23270, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 23270, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 23270, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 23270, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 23270, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 23270, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 23270, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 23270, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 23270, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 23270, null]], "pdf_page_numbers": [[0, 1925, 1], [1925, 3879, 2], [3879, 6442, 3], [6442, 8530, 4], [8530, 10612, 5], [10612, 13119, 6], [13119, 15140, 7], [15140, 17943, 8], [17943, 20840, 9], [20840, 22446, 10], [22446, 23270, 11]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 23270, 0.0]]}
olmocr_science_pdfs
2024-12-06
2024-12-06
f93f6c003697708ff331fb8436f90258f35a80ef
C++ Metastring Library Zalán Szügyi, Ábel Sinkovics, Norbert Pataki, and Zoltán Porkoláb Department of Programming Languages and Compilers, Eötvös Loránd University Pázmány Péter sétány 1/C H-1117 Budapest, Hungary {lupin, abel, patakino, gsd}@elte.hu Abstract. C++ template metaprograms are special programs interpreted by the compiler. While regular programs recline upon usual language constructs, these metaprograms are implemented in functional approach and are created with the generic construct of C++, called template. Metaprograms are widely used for the following purposes: executing algorithms at compile time, optimizing runtime programs, implementing active libraries, and emitting compilation errors and warnings to enforce certain semantic checks. Developing these metaprograms requires a high level of programming competence and great amount of time, because of the imperfection of language support. Nevertheless, there are metaprogram libraries that can assist C++ metaprogramming, such as Loki and Boost::MPL. Nonetheless, they only provide a weak implementation of metastrings, though these would highly simplify the programmers' work, just as regular strings do in regular programming. In this research, we analyzed the possibilities of handling string objects at compile time with a metastring library in order to overcome this insufficiency. We created a prototype implementation of metastring based on boost::mpl::string that provides the common string operations (substring, concatenation, replace, etc.). In this paper, we present how to improve the performance or code quality of some commonly used algorithms by applying metastrings. 1 Introduction The classical compilation model of software development designs and implements subprograms, than compiles them and runs the program. During the first step the programmer makes decisions about implementation details: choosing algorithms, setting parameters and constants. Programming by generative programming paradigm, some of these decisions can be delayed and applied only a compile time. Active libraries [18] take effect at compile time, making decisions based on programming contexts, thus, they can optimize performance. In contrast of traditional libraries they are not passive collections of routines or objects, but take an active role in generating code. Active libraries provide higher abstractions and can optimize those abstractions themselves. The C++ programming language [17] supports generative programming paradigm with using template facility. The templates are designed to shift the classes and algorithms to a higher abstraction level without losing efficiency. This way the classes and algorithms can be more general and flexible, making the source code shorter, and easier to read and maintain, which improves the quality of the code. A C++ code with templates – designed in a special way – is able to utilize the type-system of the language and force the compiler to execute a desired algorithm. This programming style is called template metaprogramming [20]. In this way, the program itself runs during compilation time. The output of this process is also checked by the compiler and can run as an ordinary program. Template metaprogramming is proved to be a Turing-complete sub-language of C++ [4]. Template metaprogramming is widely used for several purposes, like executing algorithms at compile time to optimize or make safer run-time algorithms and data structures. Expression templates [19] allow C++ expressions to be lazy-evaluated. Template metaprograms can perform compile time optimizations on a Finite State Machine [8]. Static interface checking increases the safety of the code, allowing compile time checking of template parameters whether they meet the given requirements [14]. Strings are one of the most commonly used data types in programming. Most programming languages provide strings as built in data types, while others support string operation by their standard library. A number of applications are based on string manipulation, like lexical analyzers, pattern matchers and serialization tools. These applications are widely used in most areas of computer science. Numerous researches and studies managed to improve the efficiency of these algorithms, however these improvements focused only on runtime algorithm optimizations. There are cases, when some of the input arguments of string manipulation algorithms are known already during compile time. In these cases a template metaprogram can customize the string algorithm to the corresponding input, making it safer and more efficient. As an example, while using Knuth-Morris-Pratt substring search algorithm [1] we know the exact pattern to find in the text. Thus, we can generate the next vector of the algorithm at compile time. Although the printf function of the standard library of the C programming language – that is a widely used function to write strings to the standard output – has a nice and compact syntax, it is not recommended to use in C++, because it parses the formatting string at runtime, thus, it is not typesafe. At the same time, in most cases the formatter string is already known during compilation time. Hence, it is possible to generate a formatter string specific printf with metaprograms, so that the compiler would be able to check the type of the other parameters, making our code safer. In this paper, we present a metastring library based on boost::mpl::string [9, 21] to provide a string type for metaprograms. We introduce the meta algorithms of usual string operations of C++ Standard Template Library [11]. Ad- ditionally, we provide meta-algorithms to make pattern matching more efficient and present a typesafe printf. The paper is organized as follows. In section 2 we give a short description of template metaprogramming paradigm. Section 3 presents our Metastring library, while in section 4 we present some applications using these metastrings. Related and future work comes in section 5, and the conclusion stands in section 6. 2 Template Metaprograms The template facility of C++ allows us to write algorithms and data structures parametrized by types. This abstraction is useful for designing general algorithms like finding an element in a list. The operations of lists containing integers, characters or even user defined classes are essentially the same. The only difference between them is the stored type. With templates we can parametrize these list operations by type, thus we need to write the abstract algorithm only once, and the compiler will generate the integer, character or user defined class version of the list from it. See the example below: template<typename T> struct list { list(); void insert(const T& t); T head(); // ... }; int main() { list<int> l; //instantiation l.insert(42); } The list type has one template argument T. This refers to the future type, whose object will be contained by the list. To use this list we need to assign a specific type to it. That method is called instantiation. During this process the compiler replaces the abstract type T with a specific type and compiles this newly generated code. The instantiation can be invoked either explicitly by the programmer or implicitly by the compiler when the new list is first referred to. The template mechanism of C++ enables the definition of partial and full specializations. Let us suppose that we would like to create a more efficient type-specific implementation of the list template for bool type. We may define the following specialization: template<> struct list<bool> { //type-specific implementation }; The implementation of the specialized version can be totally different from the original one. Only the name of these template types are the same. If during the instantiation the concrete type is `bool`, the specific version of template list is chosen, otherwise the general one is selected. In case of certain expressions a concrete instance of template is needed for the compiler to deduce it. Thus, an implicit instantiation will be performed. Let us see the following example of calculating factorial of 5: ```cpp template<int N> struct factorial { enum { value = N * factorial<N-1>::value }; }; template<> struct factorial<0> { enum { value = 1 }; }; int main() { int result = factorial<5>::value; } ``` To initialize the variable `result` here, the expression `factorial<5>::value` has to be evaluated. As the template argument is not zero, the compiler instantiates the general version of the `factorial` template with 5. The definition of `value` is `N * factorial<N-1>::value`, hence the compiler has to instantiate the `factorial` again with 4. This chain continues as long as the concrete value becomes 0. Then, the compiler choses the special version of `factorial` where the `value` is 1. Thus, the instantiation chain is stopped and the factorial of 5 is calculated. This algorithm runs while the compiler compiles the code. Hence, this example code is equivalent to `int result = 120`. These programs, which run at compile time are called template metaprograms [2]. Template metaprograms stand for the collection of templates, their instantiations and specializations, and perform operations at compile time. The basic control structures like iteration and condition appear in them in a functional way [15]. As we can see in the previous example iterations in metaprograms are applied by recursion. Besides, the condition is implemented by a template structures and its specialization. See below: ```cpp template<bool cond_, typename then_, typename else_> struct if_ { typedef then_ type; }; template<typename then_, typename else_> struct if_<false, then_, else_> { typedef else_ type; }; ``` typedef else_ type; }; The if structure has three template arguments: a boolean and two abstract types. If the cond is false, then the partly-specialized version of if will be instantiated, thus the else will be bound by the type. Otherwise the general version of if will be instantiated and then will be bound by type. Since the style of metaprograms is unusual and difficult, it requires high programming skills to write. Besides, it is sorely difficult to find errors in it. Porkolab et al. provided a metaprogram debugger tool [12] in order to help finding bugs. 3 Metastring Library Our metastring library is based on boost::mpl::string [21]. The Boost Metaprogram Library provides us a variety of meta containers, meta algorithms and meta iterators. The design of that library is based on STL, the standard library of C++, however, while the STL acts at runtime, the Boost::Mpl works at compile time. The meta version of regular containers in STL, like list, vector, deque, set and map are provided by Boost::MPL. Also, there are meta versions of most algorithms and iterators in STL. The string metatype was added to Boost in the last release (1.40). Contrary to other meta containers, the metastring has limited features. Almost all regular string operations, like concatenation, equality comparison, substring selection, etc. are missing. Only the c_str() meta function, which converts the metastring type to constant character array, is provided by Boost. In our metastring library we extended the boost::mpl::string with the most common string operations. The metastring itself is a template type. The template arguments contain the value of the string. While C++ does not support passing string literals to template arguments, we need to pass it character by character. See below: typedef string<'H','e','l','l','o'> str; The boost::mpl::string is a variadic template type like boost::mpl::vector [22], but only accepts characters as template arguments. The instantiated metastring type can perform as a concrete string at compile time. Since an instantiated metastring is a type, one can assign a shorter name to it by typedef keyword. In the examples of the paper we write the type- and function names of boost without the scope (string, instead of boost::mpl::string) to save space. If we write the names of functions or objects in STL we put the scope before them. Setting metastrings char-by-char is very inconvenient, therefore, the Boost offers an improvement. A template argument can be any integral type, hence it is possible to pass four characters as integer, and later on a metaprogram transforms it back to characters. See example below: In most architectures, the `int` contains at least four bytes and since the size of a character is one byte, it can store four characters. We are exploiting this feature now. Nevertheless, this is still not the simplest way of setting a metastring, but the C++ standard [13] only supports this one. We provide a non-standard extension to enable setting metastrings in a regular way. This method requires a code transformation tool, which transforms the source to a standard C++ code before compilation. Since our solution does not follow the C++ standard, in the following examples we will use the four character per template argument style. We provide the meta-algorithms of the most common string operations, like `concat`, `find`, `substr`, `equal`, etc. These algorithms are also template types, which accept metastring types as template arguments. The `concat` and `substr` defines a type called `type` which is the result of the operation. `equals` provides a static boolean constant called `value`, which is initialized as true if the two strings are equal, otherwise as false. `find` defines a static `std::size_t` constant called `value`, which is initialized as the first index of matching, if the pattern appears in the text and as `std::string::npos` otherwise. See the example about concatenation of string below: ```cpp typedef string<'Hell','o'> str1; typedef string<' Wor','ld!'> str2; typedef concat<str1, str2>::type res; std::cout << c_str<res>::value ``` The type defined by `concat<str1, str2>` is a new metastring type, which represents the concatenation of `str1` and `str2` metastrings. ## 4 Applications with Metastrings In this chapter we present some applications which can take either efficiency or safety advantages of metastrings. The first examples are pattern matching applications. If the text or a pattern is known at compile time, we can improve the matching algorithms. (If both of the text and the pattern are known, we can perform the whole pattern matching algorithm at compile time.) The third application is a typesafe printf. If the formatter string is known at compile time, we can generate a specialized kind of printf algorithm to it, which can perform type checking. ### 4.1 Pattern Matching with Known Pattern Most of the pattern matching algorithms start with an initialization step. This step depends only on the pattern. If the pattern is known at compile time, we can shift this initialization subroutine from runtime to compile time. This means that while the compiler compiles the code it will wire the result of the initialization subroutine into the code. Thus, the algorithm does not need to run the initialization step, because it is already initialized. The more the pattern matching algorithm is invoked, the more advantage we get. The example below shows how to use these algorithms: typedef string<'patt','ern'> pattern; std::string text; // reading data to text std::size_t res1 = kmp<pattern>(text); std::size_t res2 = bm<pattern(text); The kmp and bm function templates implement the Knuth-Morris-Pratt [10] and the Boyer-Moore [3] pattern matching algorithms. The return values are similar to the find function in STL and are either the first index of the match or std::string::npos. The implementation of these functions are the following: template<typename pattern> std::size_t kmp(const std::string& text) { const char* p = c_str<pattern>::value; const char* next = c_str<initnext<pattern>::type>::value; //implementation of Knuth-Morris-Pratt } template<typename pattern> std::size_t bm(const std::string& text) { const char* pattern = c_str<pattern>::value; const char* skip = c_str<initskip<pattern>::type>::value; //implementation of Knuth-Morris-Pratt } The pattern template argument must be a metastring type for both of the functions. The initnext and the initskip meta algorithms create the next and the skip vectors for the algorithms at compile time. The rest of the algorithms are the same as the normal runtime version. We compared the full runtime version of algorithms with our solution where the initialization is performed at compile time. Fig. 1 shows the results related to Knuth-Morris-Pratt and fig. 2 to Boyer-Moore. We tested these algorithms with several inputs. The input was a common English text and the pattern contained a couple words. The pattern did not appear in the text, thus the algorithms had to read all the input. We measured the running cost with one, two, five and ten kilobyte long inputs. In both charts, the blue columns show the running cost of the original algorithms and the green ones show the performance of the algorithms optimized at compile time. The X-axis shows the inputs and the Y-axis shows the instructions consumed during the algorithm. ![Comparison of Knuth-Morris-Pratt](image1) **Fig. 1.** Comparison of Knuth-Morris-Pratt ![Comparison of Boyer-Moore](image2) **Fig. 2.** Comparison of Boyer-Moore ### 4.2 Pattern Matching with Known Text Several algorithms exist for fast pattern matching. Some of these are general algorithms, the worst-case time complexity of which are good in every kind of texts, like the Knuth-Morris-Pratt’s algorithm. Others like the Boyer-Moore’s algorithm [1] can be very fast in some special kinds of texts but very slow in other cases. If the text, where we want to find a pattern is known at compile time, our meta-algorithm can analyze it and choses the best fitting pattern matching algorithm. For example, if the alphabet of the input text is large, the Boyer-Moore algorithm is more efficient, but if the alphabet is small, choosing the Knuth-Morris-Pratt algorithm is more beneficial. Since the text is known at compile time, the analysis can be done by the programmer. However, doing it manually with large texts is difficult, boring and it is easy to make mistakes, thus the result is often not the most efficient algorithm. Another advantage of using our meta-algorithm is that it provides a unified interface to perform pattern matching, and the compile time optimizations are hidden from the user as well. The example below shows the usage of the `find` function: ```cpp typedef string<'Text,'we w','ant ','to s','earch fr','om'> text; std::size_t result = find<text>("pattern"); ``` Just like the `find` function in STL, our function returns with the index of the first match in text, or with `std::string::npos` if there is no match. The `find` function is a function template, where the template argument is a metastring containing the text. The function applies the text analyzer metaprogram and invokes the best fitting pattern matching algorithm. See below the definition of the `find` function. ```cpp template<typename text> std::size_t find(const std::string& pattern) { return find(c_str<text>::value, pattern, analyze<text>::type() ); } ``` The template argument `text` must be a metastring type, while the pattern can be any string, not necessarily known at compile time. The `find` function calls a three-argument `find` function, which is hidden from the user. The inner `find` function is overloaded by the third argument `algorithm_tag` type. The implementation is similar to the implementation of the function `advance` in STL [11]. The template type `analyze` counts the different characters in `text` and defines `boyer_moore_algorithm` as `algorithm_tag` if the alphabet is large, otherwise defines `knuth_morris_pratt_algorithm`. See the sample code below: ```cpp struct boyer_moore_algorithm {}; struct knuth_morris_pratt_algorithm {}; std::size_t find(const std::string& text, const std::string& pattern, boyer_moore_algorithm) { // Implementation of Boyer-Moore algorithm } std::size_t find(const std::string& text, ``` const std::string& pattern, knuth_morris_pratt_algorithm) { // Implementation of Knuth-Morris-Pratt algorithm } template<typename text> struct analyze : eval_if<typename greater<typename different_chars<text>::type, int_<N> >::type, boyer_moore_algorithm, knuth_morris_pratt_algorithm { }; The different_chars is a meta-algorithm that counts the different characters in metastring text and if the number is more than N, then it is the boyer_moore_algorithm that is bound to the type by the meta eval_if, otherwise it is the knuth_morris_pratt_algorithm. In general English texts, the Boyer-Moore algorithm runs faster [3], thus we set N to 52, where 52 is the number of the small and big capital letters in the English alphabet. We tested our solution against the pure runtime versions of Knuth-Morris-Pratt (KMP) and Boyer-Moore (BM) algorithms. In order to do so, we applied two kinds of inputs to these. The first, marked with A contained only a few different characters and there were several repetitions in the pattern. The second one, marked with B was an ordinary English text and the pattern consisted of a single word. Both texts contained about 2K characters. First we performed the search in both texts with the KMP, second with the BM and third with our optimized algorithm. Fig. 3 illustrates the result: the red rectangle shows the instructions required to perform the pattern matching in text A, while the green one shows the same in text B. The BM algorithm was very fast in case of input B but it was fairly slow in case of input A. In contrast, the KMP algorithm was much more balanced. Our solution was the optimal of all, because it was the only one being able to chose the better algorithm depending on the given text. The performance of these three algorithms are shown in the columns, while the consumed instructions are illustrated by the Y-axis. 4.3 Type-safe printf Though the printf function of the standard C library is efficient and easy to use, it is not typesafe, hence mistakes of the programmer may cause undefined behavior at runtime. Some compilers – such as gcc – type check printf calls and emit warnings in case they are incorrect, but this method is not widely available. To overcome the problem, C++ introduced streams as a replacement of printf, which are typesafe, but they have runtime and syntactical overhead. In this section, we implement a typesafe version of `printf` using compile time strings. Contrary to the original `printf` function, this solution works in case the format string is available at compile time, which is true for most of the cases. We write a C++ wrapper for `printf` which validates the number and type of its arguments at compile time and calls the original `printf` without runtime overhead. We call the typesafe replacement of `printf` `safePrintf`. It is a template function taking one class as a template argument: the format string as a compile time string. The arguments of the function are the arguments passed to `printf`. See below: ```cpp safePrintf<'Hello %s!'>("John"); ``` As the example shows there is only a slight difference between the usage of `printf` and our typesafe `safePrintf`, while there is a significant difference between its safety: `safePrintf` guarantees that the `printf` function called at runtime will have the right number of arguments that will have the right type. `safePrintf` evaluates a template-metafunction at compile time, which tries to verify the number and type of the arguments and in case this verification fails, `safePrintf` emits a compilation error [9]. On the other hand, if the verification succeeds `safePrintf` calls `printf` with the same arguments that `safePrintf` was called with. The template metafunction verifying the arguments cannot have a runtime overhead, only a compile time overhead. The body of `safePrintf` consists of a call to `printf`, which is likely to be inlined, thus, using `safePrintf` has no runtime overhead compared to `printf`. Our `safePrintf` uses a metafunction called `ValidPrintf` to verify the correctness of the arguments. This metafunction takes two arguments: the format string as a compile time string and a compile time list of types. This metafunction parses the format string character by character, and verifies that the types conform the format string. `ValidPrintf` uses a final state machine [8] to parse the format string. The states of this machine are represented by template metafunctions, and the state transitions are done by the C++ compiler during template metafunction evaluation. Template metafunctions are lazy evaluated, thus the C++ compiler instantiates only valid state transitions of the final state machine. In case an argument of `safePrintf` has the wrong type according to the format string, `ValidPrintf` stops immediately, and it skips further state transitions of the final state machine. Thus the C++ compiler has a chance to emit the error immediately and continue compilation of the source code. After verifying the validity of the arguments, `safePrintf` calls the original `printf` function of the C library. The format string passed to `printf` is automatically generated from the compile time string argument of `safePrintf`. For example: ```c safePrintf<'Hello %s!'>("John"); ``` Here `safePrintf` calls `printf` with the following arguments: ```c printf("Hello %s!", "John"); ``` This solution combines the simple usage and small run-time overhead of `printf` with the type-safety of C++ using compile time strings. Stroustrup wrote a typesafe `printf` using variadic template functions [26], which are part of the upcoming standard C++0x [16]. His implementation uses runtime format string and transforms `printf` calls to write C++ streams at runtime. See the example: ```c printf("Hello %s!", "John"); ``` Stroustrup’s method does the following at runtime: ```c std::cout << 'H' << 'e' << 'l' << 'l' << 'o' << ' ' << "John" << '!'; ``` This solution was primarily written to demonstrate the power of variadic templates, that is why printing the format string is done character by character, making the process extremely slow. This method can be optimized in the following, more efficient way: ```c std::cout << "Hello " << "John" << "!"; ``` We have measured the speed of these operations and of the normal `printf` used by our implementation. We printed the following and it’s `std::cout` equivalents: ```c printf("Test %d stuff\n", i); ``` The text was printed 100 000 times and the speed using the `time` command on a Linux console was measured. The average time of the process can be seen in Table 1. The `printf` function, which is used by our typesafe implementation, is almost four times faster than the example at [26] and more than two times faster than the optimized version of the example. Another difference between Stroustrup's typesafe `printf` and ours is the way they validate the type of the arguments. Stroustrup’s solution ignores the type specified in the format string; it displays every argument supporting the streaming operator regardless of its type. For example, it accepts the following, incorrect usage of `printf`, where our solution would emit an error at compile time: ```c printf("Incorrect: %d", "this argument should be an integer"); ``` Our solution, however, can only deal with the types that the C `printf` can deal with, while Stroustrup’s solution can deal with any type that supports the streaming operator. Nevertheless, a drawback of Stroustrup’s solution is that it does not detect the shifting or wrong order of `printf` arguments, and displays them incorrectly. For example Stroustrup’s `printf` accepts and displays the following: ```c printf("Name: %s\nAge: %d\n", "John", "27"); ``` Name: 27 Age: John On the other hand, our solution emits a compilation error in this case. Stroustrup’s solution throws an exception at runtime if the number of arguments passed to `printf` is incorrect. This can lead to hidden bugs due to incomplete testing, while our solution emits compilation errors in such cases. 5 Related Work There are some third party libraries that also apply compile time operations related to strings in some special areas of programming. Spirit [23] is an object oriented recursive descent parser framework. It enables to write EBNF grammars in C++ syntax and it can be inlined to the C++ source code. While the implementation of spirit uses template metaprogramming techniques, the parser from the EBNF grammar is generated by the C++ compiler. The Wave C++ preprocessor library [24] uses the Spirit parser construction library to implement a C++ lexer with ISO/ANSI Standards conformant preprocessing capabilities. It provides an iterator interface, which returns the <table> <thead> <tr> <th>Method used</th> <th>Time</th> </tr> </thead> <tbody> <tr> <td>std::cout for each character</td> <td>0.573 s</td> </tr> <tr> <td>normal std::cout</td> <td>0.321 s</td> </tr> <tr> <td>printf</td> <td>0.152 s</td> </tr> </tbody> </table> Table 1. Elapsed time current preprocessed token from the input stream. This preprocessed token is generated on-the-fly while iterating over the preprocessor iterator sequence. The **xpreative** is a regular expression template library [25] dealing with static regular expressions. It can perform syntax checking and generates optimized code for static regexes. Similar to our solution the new standard of C++ [16] also provides a typesafe printf function. The differences are explained in chapter 4.3. 6 Conclusion and Future Work We have developed a metastring library based on boost::mpl::string and extended its functionality with the usual operations of runtime string libraries. We presented some applications which benefit from these metastrings. One of these are the pattern matching algorithms that can be improved if either the text or the pattern are known at compile time. In this paper, our main goal was not to provide the best pattern matching solution, but to demonstrate the power of metastrings, thus we only dealt with Boyer-Moore and Knuth-Morris-Pratt pattern matching algorithm. Our work in the future aims to create a more sophisticated method – which counts more pattern matching algorithms – in order to find the optimal pattern matching solution. We have created a C++ wrapper for printf taking the format string as a compile time string and validating the types of the runtime arguments based on that. In this solution, validation happens already at compile time, ensuring type-safety and providing that there is no runtime overhead either. We have compared our typesafe printf solution with Stroustrup’s and found that our version provides stricter type-safety besides running significantly faster. However, Stroustrup’s method is capable of deducing the format of the output by the argument’s type, which is still missing from our version. Our future plan is to improve this printf function by implementing the %a specifier to provide a similar functionality. We proved the benefit of our metastring library in empirical way on these applications. Moreover several other fields are exist in computer science, which can be improved using metastrings. References
{"Source-Url": "http://aszt.inf.elte.hu/~gsd/s/cikkek/alistair/gttse2009_submission_37.pdf", "len_cl100k_base": 6800, "olmocr-version": "0.1.50", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 32334, "total-output-tokens": 8682, "length": "2e12", "weborganizer": {"__label__adult": 0.0004031658172607422, "__label__art_design": 0.00026726722717285156, "__label__crime_law": 0.00026726722717285156, "__label__education_jobs": 0.00029468536376953125, "__label__entertainment": 5.185604095458984e-05, "__label__fashion_beauty": 0.00015032291412353516, "__label__finance_business": 0.0001226663589477539, "__label__food_dining": 0.0003802776336669922, "__label__games": 0.0004057884216308594, "__label__hardware": 0.0007724761962890625, "__label__health": 0.0003228187561035156, "__label__history": 0.00018715858459472656, "__label__home_hobbies": 7.176399230957031e-05, "__label__industrial": 0.0002739429473876953, "__label__literature": 0.00017702579498291016, "__label__politics": 0.0002598762512207031, "__label__religion": 0.00047969818115234375, "__label__science_tech": 0.0028209686279296875, "__label__social_life": 6.99162483215332e-05, "__label__software": 0.0027313232421875, "__label__software_dev": 0.98828125, "__label__sports_fitness": 0.00031566619873046875, "__label__transportation": 0.00046443939208984375, "__label__travel": 0.00023281574249267575}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 34689, 0.01557]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 34689, 0.71275]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 34689, 0.83378]], "google_gemma-3-12b-it_contains_pii": [[0, 2442, false], [2442, 5641, null], [5641, 7682, null], [7682, 9828, null], [9828, 12501, null], [12501, 14921, null], [14921, 17170, null], [17170, 18197, null], [18197, 20351, null], [20351, 22727, null], [22727, 24858, null], [24858, 27200, null], [27200, 29348, null], [29348, 32173, null], [32173, 34689, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2442, true], [2442, 5641, null], [5641, 7682, null], [7682, 9828, null], [9828, 12501, null], [12501, 14921, null], [14921, 17170, null], [17170, 18197, null], [18197, 20351, null], [20351, 22727, null], [22727, 24858, null], [24858, 27200, null], [27200, 29348, null], [29348, 32173, null], [32173, 34689, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 34689, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 34689, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 34689, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 34689, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 34689, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 34689, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 34689, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 34689, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 34689, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 34689, null]], "pdf_page_numbers": [[0, 2442, 1], [2442, 5641, 2], [5641, 7682, 3], [7682, 9828, 4], [9828, 12501, 5], [12501, 14921, 6], [14921, 17170, 7], [17170, 18197, 8], [18197, 20351, 9], [20351, 22727, 10], [22727, 24858, 11], [24858, 27200, 12], [27200, 29348, 13], [29348, 32173, 14], [32173, 34689, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 34689, 0.01805]]}
olmocr_science_pdfs
2024-11-29
2024-11-29
c7b3acd7ae5b893655e8553e80946954c676873e
Empirical Activity: Assessing the Perceptual Properties of the Size Visual Variation in UML Sequence Diagram Yosser El Ahmar CEA, LIST, Laboratory of Model Driven Engineering for Embedded Systems P.C. 174, Gil-sur-Yvette, 91191, France yosser.ELAHMAR@cea.fr Xavier Le Pallec University of Lille, CRISTAL Lab UMR 9189 59650 Villeneuve d’Ascq, France xavier.le-pallec@univ-lille1.fr Sébastien Gérard CEA, LIST, Laboratory of Model Driven Engineering for Embedded Systems P.C. 174, Gil-sur-Yvette, 91191, France Sebastien.GERARD@cea.fr ABSTRACT Recent empirical studies about UML showed that software practitioners often use it to communicate. When they use diagram(s) during a meeting with clients/users or during an informal discussion with their architect, they may want to highlight some elements to synchronize the visual support to their discourse. To that end, they are free to use color, size, brightness, grain, and/or orientation. The mentioned freedom is due to the lack of formal specifications of their use in the UML standard and refers to what is called the secondary notation, by the Cognitive dimensions framework. According to the Semiology of Graphics (SoG), one of the main references in cartography, each mean of visual annotation is characterized by its perceptual properties. Being under modeler’s control, the 5 means of visual annotations can differently be applied to UML graphic components: to the border, text, background and to the related other graphic nodes. In that context, the goal of this research is to study the effective implementations, which maintain the perceptual properties of, especially, the size visual variation. This latter has been chosen because it is considered as the "strongest" among the other visual means, having all the perceptual properties. The present proposal consists of a quantitative methodology using an experiment as strategy of inquiry. The participants will be the ~20 attendees of the HuFaMo workshop. They must be experts on modeling and they know UML. The treatment is the reading and the visual extraction of information from a set of UML sequence diagrams, provided via a web application. The dependent variables we study are the responses and the response times of participants, that will be validated based on the SoG principles. CCS Concepts •Software Engineering → UML modeling; •Software visualization → Semiology of Graphics; 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. MODELS ’16 October 2–7, 2016, Saint-Malo, France DOI: 10.1145/2947064.2947068 1. INTRODUCTION The Unified Modeling Language (UML) is the visual language for specifying, constructing and documenting software intensive systems. Recent empirical studies about UML in practice [14] [4] showed that UML artefacts are mostly used for communications. Stakeholders of these communications might be familiar with UML (e.g. members of the technical team) or not (e.g. clients) [9]. In such situations, modelers may need to highlight information that they deem relevant for the discussion (e.g. the main class in a class diagram; model, view and controller elements; a modeler’s own subsystem; distribution of tasks between technical members; project progression). This is to synchronize the visual support with their discourse. In that context, while the UML specification describes exhaustively its primary notation, its semantics, it lacks highlighting abilities for such contextual information. The secondary notation, defined by the Cognitive Dimensions framework [11], may deal with such concerns. It refers to the free use and change of the possible means of visual annotations: size, brightness, grain, color and orientation. The previously mentioned five means of visual annotations are relatively rapidly perceived because the reader’s eye can detect their variation without moving the visual brush. According to the Semiology of Graphics (SoG), one of the main references in cartography, each mean of visual annotation is characterized by its perceptual properties. In fact, it can be selective: allows readers to distinguish groupings (e.g. all green marks), ordered: allows readers to perceptually order marks (e.g. from dark to light or from light to dark but never in another order) and/or quantitative: allows readers to visually quantify ratio between marks (e.g. three times larger). In UML, as the means of visual annotations are under modeler’s control, there exist different ways to vary their values into a UML graphic component: graphic node or graphic path. The combinatorial explosion of the possible implementations is due to four reasons. First, UML graphic nodes mostly include: a border, a text and a background. Second, some UML graphic nodes are composed of multiple shapes (e.g. a lifeline is composed of 3 components: a rectangle, a dashed line and sometimes an execution specification). Then, graphic nodes might be related to other nodes via graphic paths, forming the diagram. Finally, a UML graphic component might contain/ be contained in other graphic nodes (e.g. a fragment in a sequence diagram can contain one or more messages). It may seem obvious that some implementations of variations are more effective in highlighting elements than others. But what we can gain in effectiveness might be anecdotal. To be sure that there exist (or not) implementations that are more effective, we have to dress an exhaustive list of implementations and test them. This means that we have to rigorously decompose all UML graphic components and see, for each sub-element, if the value of a mean of visual annotation can vary and how. Consequently, the purpose of this research is to study the effective implementations, which allow viewers to fully benefit from the performances of a mean of visual annotation. This is a purpose for which the number of related works is small. As the field of study is wide, we propose to focus here only on the variation of the size mean of visual annotation and on one type of diagram: UML sequence diagram. The size visual variation has been selected in this study because it is the only mean of visual annotation, belonging to the UML secondary notation, which has all the perceptual properties. In addition, we propose to target, especially, the UML sequence diagram because it belongs to the three first mostly used UML diagrams in practice. For each type of graphic component, being composed of multiple shapes or a component itself, container of other graphic nodes or contained in other graphic nodes, this research aims at finding patterns of effective implementations of the size visual variation. In this study, we assume that the latter patterns depend on the information to be highlighted. It can concern only one graphic component (e.g. a lifeline) or more than one (e.g. two or more than two lifelines). For the first assumption, the size variation will surely highlight the concerned graphic component [5]. But, we aim at finding the effective implementations, which allow viewers to relatively rapidly perceive all significant details about the concerned graphic component. For the second assumption, the size visual mean is selective, ordered and quantitative [5]. In this case, we want to find the effective implementations which maintains valid the selective, ordered and quantitative perceptive attitudes of its variation. To that end, we want to study the impact of the possible implementations on the perceptual properties of the size visual mean. The latter impact will be controlled by the size of the UML diagram containing the implementation. It can be small, medium or large. The studied impact will also be controlled by the layout of the diagram. We will especially focus on the horizontal and vertical distance between the related graphic components. This paper presents a proposal of a quantitative methodology using an experiment as strategy of inquiry. The participants will be the 20 attendees of the HuFaMo workshop. They must be experts on modeling and they know UML. The treatment is the reading and the visual extraction of information from a set of provided UML sequence diagrams, via a web application. The outcome variables we study are responses and response times of participants, that will be validated based on the SoG principles. 2. EXPERIMENT DEFINITION This section reports on the delimitation of the study, the research questions that it attempts to answer and its hypothesis. 2.1 Delimitation of the study Figure 1 resumes the delimitation of the experiment. Following are justifications for each choice. Size, brightness, grain, color and orientation represent powerful means to highlight information, to make it relatively rapidly perceived in a third dimension [5]. Each mean of visual annotation is characterized by its perceptual properties. The SoG distinguishes three perceptive attitudes which viewers can take in front of a mean of visual annotation: - **Selectivity**: the reader can perceive groupings (e.g. all red colors, all marks having the same size). - **Order**: The human eye can perceive order (e.g. from dark to light, from the smallest mark to the biggest). - **Quantity**: The viewer can perceive ratio between marks (e.g. this mark is 5 times bigger than another). The size is the only mean of visual annotation allowing the three perceptive attitudes. To benefit from its interesting performances, we made the choice to begin by studying its effective implementation in UML. We chose to be limited to three categories of size. This number can be extended to more than three categories in a future empirical study. We argue that exceeding three categories of size in UML diagrams will overload the diagram, especially if it contains a lot of graphic components (i.e. large diagram). In addition, we note that sizes of graphic nodes depend on the contained text (e.g. the width of a UML class varies depending on the length of its name, its attributes or its methods). Therefore, we will assume that all graphic nodes, in a diagram, have the same initial size (i.e. the size of the biggest node, containing the largest text). According to [9][8], sequence diagram is ranked among the three first frequently used UML diagrams in practice. It is mostly used for clarifying understanding among technical members of the project team [8]. In such informal meetings, highlighting information might be promising to ease the communication [10]. In addition, contrarily to class diagrams, we note a lack of works in the literature, studying the effective visualization of sequence diagrams. Those are the main reasons behind the specific choice to begin by the UML sequence diagram. In practice, the graphic nodes will be connected to each others, forming the diagram. The resulting diagram can be small, medium or large. We chose to cover all the 3 alternatives in the present study. The graphic notation of the sequence diagram is described by 11 graphic nodes and 4 graphic paths [1](p. 594-596). As we chose to exhaustively study the UML sequence diagram, we will take into account all of them in the present experiment. We observe that information to highlight might concern only one graphic component (e.g. one message, one lifeline, one coregion). It can also concern more than one graphic component (e.g. multiple lifelines, multiple coregions, multiple execution specifications). The present study will cover both alternatives. Finally, we observed that distance between related graphic components can vary in two directions, horizontally and vertically for instance. We will experiment with both possibilities. 2.2 Research questions After delimiting the study, we will define the research questions for the resulting scope. In fact, we observe that, for a single graphic component of the sequence diagram, there are different possible implementations of the size mean of visual annotation. This is due to the following facts. UML graphic nodes are mostly made of a background and a text. Changing only its area can be seen as obvious, but we want to explore the effectiveness of varying the size of its border and text also. Moreover, some graphic components include multiple shapes. Lifelines include a rectangle and a dashed line. LostMessages and FoundsMessages include an edge and a black point at the extremity. Varying the size of such graphic components might consist of changing the size of all its elementary shapes or some of them. We wonder about the most effective implementation. In addition, some graphic nodes can be embedded in other graphic nodes. An execution specification, a coregion, DurationConstraint, a DurationObservation and a StateInvariant are always embedded to a lifeline. Continuations might be embedded to more than one lifeline. Changing their size can affect the size of graphic nodes to which they are embedded. We want to infer the most effective implementation. Furthermore, graphic components are semantically linked to each others. Lifelines are linked via graphic paths, graphic paths having source and destination graphic nodes. Highlighting them with the size variation might mean highlighting its semantically related graphic components also. Finally, some graphic nodes may contain other graphic components. A Frame, an InteractionUse, a CombinedFragment and a coregion can contain executionSpecifications, messages. They may also contain each others. Applying the the size to such graphic nodes might concern the contained other graphic nodes and vice versa. As a result, the following research questions arise. RQ1: What are the effective implementations of the size visual variation to all types of graphic components of the UML sequence diagram (i.e. container, contained, embedded to a graphic node, complex graphic node (composed of multiple shapes))? Where effectiveness can be measured by the capability of each implementation to preserve all the perceptual properties of the size, allowing viewers to relatively rapidly detect the accurate information that they are searching for. RQ2: How the effectiveness of each implementation can be controlled by the type of information to highlight (i.e. concerns only one graphic component, more than one component). RQ3: How the effectiveness of each implementation can be controlled by the size of the diagram containing the implementation and its layout. 2.3 Hypothesis formulation 2.3.1 Variables The experiment has 4 independent variables and two dependent variables. Independent variables Implementation I (alternatives: Effective Implementation I, Other Implementation I’). Size of the sequence diagram S (alternatives: small, medium, large). Its layout L (alternatives: Horizontal distance HD, Vertical distance VD). Type of information to highlight TI (alternatives: concerns only one graphic component TI1, more than one graphic component TIln). Dependent variables Responses of participants R (alternatives: true, false, complete, incomplete). Response time of participants T. 2.3.2 Hypothesis <table> <thead> <tr> <th>Dependent variables</th> <th>Null hypothesis</th> <th>Alternative hypothesis</th> </tr> </thead> <tbody> <tr> <td>Response time T</td> <td>∀(S, TI, L); H0: T(I) &gt; T(I’)</td> <td>∀(S, TI, L) H1: T(I) &lt; T(I’)</td> </tr> <tr> <td>Response R</td> <td>∀(S, TI, L); H0: T(I) &gt; T(I’)</td> <td>∀(S, TI, L) H1: T(I) &lt; T(I’)</td> </tr> </tbody> </table> The hypothesis for assessing the effectiveness of the I size variations with the independent variables are given in table 1. The alternative hypothesis H states that the proposed effective implementations take less time to let participants give the right and complete answer to a given question. The experimented effective implementation I is proposed for each possible combination of (S, TI, L). Figures in appendices illustrate the different implementations that we deem effective and the experiment aims at validating. They also illustrate an example of a question that concern one graphic path (a message) with different implementations. 3. EXPERIMENT DESIGN 3.1 Population, sample, and participants The sampling method used in this study is the convenience sampling [6]. In fact, the target population of this study is the community of UML users: practitioners, researchers, students. The HuFaMo attendees are a naturally formed and might be a representative sample of the target population. They include students, researchers, UML practitioners and maybe some tool vendors. They are a part of the MoDELS community, interested in modeling and/or contributors on MDE. We assume that we will have \( \sim 20 \) participants, considered as experts on UML. 3.2 Data collection and materials A web application will be used in the present experiment. This is to be aware of the complexity of modeling tools (i.e. not all participants are familiar with the same modeling tool). Moreover, installing the same modeling tool to all participants will be time consuming, especially in the workshop (same timeslot as a presentation). If accepted, the web application will be developed between the acceptance notification and the workshop date. It will be coded by the first author and tested before its use in the experiment. The web application will first ask participants about their gender, level of experience and if they have visual deficiencies. It will also save the corresponding response entered by the participant. Sequence diagrams that will be used in the experiment will be extracted from a models repository. Visual annotations using implementations of the size variations and questions will be manually proposed. 3.2.1 Method One day before the experiment, the HuFaMo participants will receive an e-mail requesting them to bring their laptops. The first author will ensure the availability of an internet connection during the experiment day. The experiment will begin by an introduction phase and a training session related to the experimental task. The first author will present the web application that will be used in the experiment, for which details are mentioned in the previous subsection. Then, the link of the web application will be sent to the HuFaMo attendees via the workshop mailing list. The second step consists of the experiment’s task. This latter will individually be performed by each participant. The main treatment will consist on the reading and the visual extraction of information from a visually annotated sequence diagram. The estimated time for the whole experiment is 30 minutes. 3.3 Data analysis procedures In the analysis procedure, we will report on the number of the HuFaMo attendees who didn’t participate to the study. We also plan to give a descriptive analysis of data for all independent and dependent variables of the study. At the end of the experiment, we want to analyse the relationship between the independent and dependent variables. This is to find patterns of effective implementations, depending on a combination of (S, TI, L). For each combination of the three independent variables, we will determine the effective implementation I, which has a minimum T and a complete and true values of R. Therefore, we select the correlation/regression statistic tests. 4. ANTIPOIATED ETHICAL ISSUES IN THE STUDY This section will report the internal and external threats to validity. 4.1 Internal validity The first internal threat to validity is the possible gain of maturity by the participants during the study. That may happen because of the unicity of the studied type of UML diagram: sequence diagrams. As well as the uniqueness of the studied visual variation. Therefore, we will ensure that diagrams will be randomly proposed so that questions concerning the same graphic component will not be successive. In addition, as mentioned before, participants might have some visual deficiencies. This additional input will be mentioned before beginning the task, so that we can take into account its influence on the results. We also note that each participant will have a different screen with different characteristics. We will ensure that at least the same value of luminosity is set up and that the same web navigator is used to open the web application. Finally, one of the outcomes of the study is the response time of participants. It is automatically saved when the participant finds the response by clicking a button. Late clicking the button will bias the results. We will stress on the importance of this step to participants in the introduction phase. We will also try to add a voice recorder, so that participants can speak out loud when finding the response. Then, we will have to find mechanisms to manage the simultaneous voices of participants, placed in the same setting. 4.2 External validity The HuFaMo participants are not only experts on modeling but also interested in Human Factors in Modeling. So, they may know about the scope of this research, especially the perceptual properties of the means of visual annotations, which can bias the study. To limit the latter threat to validity, we will not inform them about the research questions of the study nor its hypotheses. Moreover, the participants are not in a natural setting, using their own modeling tool and moving naturally to their UML sequence diagrams. As a result, we will perform further additional empirical study (e.g. a case study in a natural setting) in order to be sure that the obtained result can be generalized to the whole population. 5. LITERATURE REVIEW The free use of additional means of visual annotations in software engineering has been recognized as theoretically advantageous. This is via the secondary notation by the cognitive dimensions framework [11]. A few empirical studies aiming at assessing its benefits in UML visual notation have been conducted. However, if they considered the need of empirical validations, they focus only on two axis: layouts and colors. The other means of visual annotations (i.e. size, brightness, grain and orientation) have not been yet discussed, despite of their great performances on highlighting information, known in cartography [5] and psychology [13] [18]. Concerning layouts, there exist several empirical studies aiming at finding effective layouts in UML diagrams. [19] [16] [15] use experiments to assess effective layouts for diagram comprehensions, user preferences, program understanding, etc. [20] uses eye tracking in an experiment involving 12 participants to identify the impact of layout, color and stereotypes on comprehension of UML diagram. Most of the mentioned researches [16] [15] [20] focus on UML class diagram. [17] focusses further on UML activity diagram and use case diagram. While the sequence diagram belongs to the three most used UML artefacts in practice, we note few works on it [7] [3]. 6. REFERENCES APPENDIX Considering all independent variables, 12 sequence diagrams are required for each implementation of the size variation. We argue that at least two diagrams are needed for each implementation. Therefore, for all 14 graphic components of the UML sequence diagram, at least 336 diagrams are required for this study. A. EFFECTIVE IMPLEMENTATIONS AND AN EXAMPLE OF A QUESTION WITH DIFFERENT IMPLEMENTATIONS Figure 2: Effective implementation of a "lifeline" I, (TI=TI1, T=S) Figure 3: Effective implementations of "message" I, (TI=TI1, T=S) Figure 4: Effective implementations of a "fragment" I, (TI=TI1, T=S) Figure 5: Response to the question: What happens if the controller sends first hello? with the implementation Figure 6: Response to the question: What happens if the controller sends first hello? with an implementation. Figure 7: Response to the question: What happens if the controller sends first hello? with an implementation Figure 8: Response to the question: What happens if the controller sends first hello? with an implementation.
{"Source-Url": "http://hufamo.compute.dtu.dk/pdf/HuFaMo16_paper_1.pdf", "len_cl100k_base": 4987, "olmocr-version": "0.1.53", "pdf-total-pages": 11, "total-fallback-pages": 0, "total-input-tokens": 23506, "total-output-tokens": 6594, "length": "2e12", "weborganizer": {"__label__adult": 0.0004119873046875, "__label__art_design": 0.0015974044799804688, "__label__crime_law": 0.0003876686096191406, "__label__education_jobs": 0.005115509033203125, "__label__entertainment": 0.00010138750076293944, "__label__fashion_beauty": 0.0002180337905883789, "__label__finance_business": 0.0003192424774169922, "__label__food_dining": 0.0003426074981689453, "__label__games": 0.0006823539733886719, "__label__hardware": 0.0006856918334960938, "__label__health": 0.0006542205810546875, "__label__history": 0.0004391670227050781, "__label__home_hobbies": 0.0001207590103149414, "__label__industrial": 0.0004825592041015625, "__label__literature": 0.0006856918334960938, "__label__politics": 0.00026679039001464844, "__label__religion": 0.0006036758422851562, "__label__science_tech": 0.0570068359375, "__label__social_life": 0.00016570091247558594, "__label__software": 0.0120697021484375, "__label__software_dev": 0.91650390625, "__label__sports_fitness": 0.00030493736267089844, "__label__transportation": 0.0005693435668945312, "__label__travel": 0.0002105236053466797}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27692, 0.04647]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27692, 0.68275]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27692, 0.88807]], "google_gemma-3-12b-it_contains_pii": [[0, 5457, false], [5457, 11702, null], [11702, 17444, null], [17444, 23346, null], [23346, 27050, null], [27050, 27185, null], [27185, 27254, null], [27254, 27364, null], [27364, 27474, null], [27474, 27583, null], [27583, 27692, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5457, true], [5457, 11702, null], [11702, 17444, null], [17444, 23346, null], [23346, 27050, null], [27050, 27185, null], [27185, 27254, null], [27254, 27364, null], [27364, 27474, null], [27474, 27583, null], [27583, 27692, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 27692, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27692, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27692, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27692, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27692, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27692, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27692, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27692, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27692, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27692, null]], "pdf_page_numbers": [[0, 5457, 1], [5457, 11702, 2], [11702, 17444, 3], [17444, 23346, 4], [23346, 27050, 5], [27050, 27185, 6], [27185, 27254, 7], [27254, 27364, 8], [27364, 27474, 9], [27474, 27583, 10], [27583, 27692, 11]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27692, 0.0339]]}
olmocr_science_pdfs
2024-12-11
2024-12-11
20d6b0fcbd03d7d421ed5dfcd325f3e996921498
[REMOVED]
{"Source-Url": "https://pure.tue.nl/ws/files/2054414/Metis213202.pdf", "len_cl100k_base": 7495, "olmocr-version": "0.1.49", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 34112, "total-output-tokens": 9270, "length": "2e12", "weborganizer": {"__label__adult": 0.0004413127899169922, "__label__art_design": 0.0014019012451171875, "__label__crime_law": 0.0006995201110839844, "__label__education_jobs": 0.0011701583862304688, "__label__entertainment": 0.0003535747528076172, "__label__fashion_beauty": 0.0002627372741699219, "__label__finance_business": 0.0005540847778320312, "__label__food_dining": 0.0004603862762451172, "__label__games": 0.0008544921875, "__label__hardware": 0.0012874603271484375, "__label__health": 0.0007805824279785156, "__label__history": 0.0005726814270019531, "__label__home_hobbies": 0.000110626220703125, "__label__industrial": 0.0005526542663574219, "__label__literature": 0.0008711814880371094, "__label__politics": 0.0004906654357910156, "__label__religion": 0.0007596015930175781, "__label__science_tech": 0.3349609375, "__label__social_life": 0.00018513202667236328, "__label__software": 0.047882080078125, "__label__software_dev": 0.60400390625, "__label__sports_fitness": 0.0002872943878173828, "__label__transportation": 0.0006241798400878906, "__label__travel": 0.0002932548522949219}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 40919, 0.0322]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 40919, 0.47331]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 40919, 0.86265]], "google_gemma-3-12b-it_contains_pii": [[0, 1928, false], [1928, 4269, null], [4269, 7434, null], [7434, 9438, null], [9438, 12619, null], [12619, 15497, null], [15497, 18402, null], [18402, 21523, null], [21523, 22162, null], [22162, 25355, null], [25355, 28514, null], [28514, 31655, null], [31655, 34880, null], [34880, 37710, null], [37710, 40919, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1928, true], [1928, 4269, null], [4269, 7434, null], [7434, 9438, null], [9438, 12619, null], [12619, 15497, null], [15497, 18402, null], [18402, 21523, null], [21523, 22162, null], [22162, 25355, null], [25355, 28514, null], [28514, 31655, null], [31655, 34880, null], [34880, 37710, null], [37710, 40919, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 40919, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 40919, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 40919, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 40919, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 40919, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 40919, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 40919, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 40919, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 40919, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 40919, null]], "pdf_page_numbers": [[0, 1928, 1], [1928, 4269, 2], [4269, 7434, 3], [7434, 9438, 4], [9438, 12619, 5], [12619, 15497, 6], [15497, 18402, 7], [18402, 21523, 8], [21523, 22162, 9], [22162, 25355, 10], [25355, 28514, 11], [28514, 31655, 12], [31655, 34880, 13], [34880, 37710, 14], [37710, 40919, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 40919, 0.0]]}
olmocr_science_pdfs
2024-11-25
2024-11-25
cc41e9ad23657dd7b96d6121e518d791c07c17f5
A Coherent Well-founded Model for Hybrid MKNF Knowledge Bases Matthias Knorr\(^1\) and José Júlio Alferes\(^1\) and Pascal Hitzler\(^2\) Abstract. With the advent of the Semantic Web, the question becomes important how to best combine open-world based ontology languages, like OWL, with closed-world rules paradigms. One of the most mature proposals for this combination is known as Hybrid MKNF knowledge bases [11], which is based on an adaptation of the stable model semantics to knowledge bases consisting of ontology axioms and rules. In this paper, we propose a well-founded semantics for such knowledge bases which promises to provide better efficiency of reasoning, which is compatible both with the OWL-based semantics and the traditional well-founded semantics for logic programs, and which surpasses previous proposals for such a well-founded semantics by avoiding some issues related to inconsistency handling. 1 Introduction The Web Ontology Language OWL\(^3\) is a recommended standard by the W3C for modeling Semantic Web knowledge bases. It is essentially based on Description Logics (DLs) [1], and thus adheres to the open-world assumption. It is apparent, however, and frequently being voiced by application developers, that it would be favorable to have closed-world modeling as an additional feature for ontology-based systems. This need has led to several investigations into combinations of closed-world rules paradigms with DLs, which can still be considered to be in their early stages, and the proposed solutions differ substantially. We base our work on the claim that the integration should be as tight as possible, in the sense that conclusions from the rules affect the conclusions from the ontology and vice-versa. Among such proposals are several whose semantics is based on stable model semantics (SMS) [5] (e.g. [2, 3, 6, 11, 13]), and only few which are based on the well-founded semantics (WFS) [14], like [4, 8]. Though these WFS-based approaches are in general weaker in their derivable consequences, their faster computation (data complexity P vs. NP) should be more suitable for the intended application area, the WWW. One of the currently most mature proposals for a tight integration is known as Hybrid MKNF knowledge bases [11], which draws on the logic of Minimal Knowledge and Negation as Failure (MKNF) [10], [11]’s proposal evaluates knowledge bases under a stable model semantics, resulting in unfavorable computational complexities. In this paper, we therefore define a new semantics, restricted to non-disjunctive rules, which soundly approximates the semantics of [11] and is in a strictly lower complexity class. The semantics furthermore yields the original DL-semantics when no rules are present, and the original well-founded semantics if the DL-component is empty. The semantics is furthermore coherent in the sense of [12], i.e. whenever any formula is first-order false then it is also non-monotonically false. It also allows for detecting inconsistencies between interacting ontologies and rules, and in fact does this without any substantial additional computational effort. Due to this inconsistency handling, our proposal is superior to that of [8], which also attempted to define a WF semantics, but resulted in some unintuitive behavior in the presence of inconsistencies. The paper is structured as follows. We first recall preliminaries on Hybrid MKNF knowledge bases in Section 2. We then introduce a running modeling example in Section 3 before introducing our well-founded semantics in Section 4. Section 5 is devoted to some basic properties, especially regarding consistency. In Section 6 we briefly compare with most similar approaches, and conclude. More details, including proofs, can be found in [9]. 2 Preliminaries At first we present the syntax of MKNF formulas taken from [11]. A first-order atom \(P(t_1, \ldots, t_n)\) is an MKNF formula where \(P\) is a predicate and the \(t_i\) are function-free first-order terms. If \(\varphi\) is an MKNF formula then \(\neg \varphi\), \(\exists x \colon \varphi\), \(K\varphi\) and \(\text{not } \varphi\) are MKNF formulas and likewise \(\varphi_1 \land \varphi_2\) and \(\varphi_1 \leftarrow \varphi_2\) for MKNF formulas \(\varphi_1\), \(\varphi_2\). The symbols \(\lor\), \(\equiv\), and \(\forall\) represent the usual boolean combinations of the previously introduced constructors. Substituting the free variables \(x_i\) in \(\varphi\) by terms \(t_i\) is denoted \(\varphi[t_1/x_1, \ldots, t_n/x_n]\). Then, given a (first-order) formula \(\varphi\), \(K\varphi\) is called a modal \(K\text{-atom}\) and \(\text{not } \varphi\) a modal \(\text{not-atom}\). The signature \(\Sigma\) contains, apart from the constants occurring in the formulas, a countably infinite supply of constants not occurring in the formulas and the Herbrand universe of such a signature is denoted by \(\Delta\). Moreover, the equality predicate \(\equiv\) in \(\Sigma\) is interpreted as an equivalence relation on \(\Delta\). As in [11], hybrid MKNF knowledge bases can contain any first-order fragment \(DL\) satisfying the following conditions: (i) each knowledge base \(\mathcal{O} \in DL\) can be translated into an equivalent formula \(\pi(\mathcal{O})\) of function-free first-order logic with equality, (ii) it supports \(A\text{-Boxes}\)-assertions of the form \(P(a_1, \ldots, a_n)\) for \(P\) a predicate and \(a_i\) constants of \(DL\) and (iii) satisfiability checking and instance checking (i.e. entailment of the form \(\mathcal{O} \models P(a_1, \ldots, a_n)\)) are decidable\(^4\). We now recall hybrid MKNF knowledge bases of [11]. Definition 1 Let \(\mathcal{O}\) be a DL knowledge base. A first-order function-free atom \(P(t_1, \ldots, t_n)\) over \(\Sigma\), such that \(P\) is \(\equiv\) or it occurs in \(\mathcal{O}\) is called a DL-atom; all other atoms are called non-DL-atoms. A (nondisjunctive) MKNF rule \(r\) has the following form where \(H, A_i\), \(^1\) CENTRIA, Universidade Nova de Lisboa, Portugal \(^2\) AIFB, Universität Karlsruhe, Germany \(^3\) http://www.w3.org/2004/OWL/ \(^4\) For more details on DL notation we refer to [1]. and $B_i$ are first-order function free atoms: $$KH \leftarrow K A_1, \ldots, K A_n, \text{not } B_1, \ldots, \text{not } B_m \quad (1)$$ The sets $\{KH\}, \{KA_i\},$ and $\{\text{not } B_i\}$ are called the rule head, the positive body, and the negative body, respectively. A rule is positive if $m = 0$; $r$ is a fact if $n = m = 0$. A program $P$ is a finite set of MKNF rules. A hybrid MKNF knowledge base $K$ is a pair $(\mathcal{O}, \mathcal{P})$. The semantics of a knowledge base $K$ is obtained by translating it into the MKNF formula $\pi(K) = K \pi(\mathcal{O}) \wedge \pi(\mathcal{P})$ where $\pi$ is transformed by universally quantifying all the variables in each rule. An MKNF rule $r$ is DL-safe if every variable in $r$ occurs in at least one non-DL-atom $KB$ occurring in the body of $r$. A hybrid MKNF knowledge base $K$ is DL-safe if all its rules are DL-safe. Given a hybrid MKNF knowledge base $K = (\mathcal{O}, \mathcal{P})$, the ground instantiation of $K$ is the KB $K_G = (\mathcal{O}, \mathcal{P}_G)$ where $\mathcal{P}_G$ is obtained by replacing in each rule of $\mathcal{P}$ all variables with constants from $\mathcal{K}$ in all possible ways. ### 3 Example Scenario Consider an online store selling, among other things, CDs. Due to the fact that many newly published CDs are simply compilations of already existing music, the owners decide to offer their customers a special service: whenever somebody likes the compilation of a certain artist he can search specifically for more music of that artist provided that he owns, where the artist $z$ of $x$ is the same as the artist of $y$. Additionally, (2) is a DL statement (translatable into $\forall x: \text{Comp}(x) \rightarrow \neg\text{Of}(x)$) enforcing that any CD which is a compilation shall never be offered. ### 4 Three-valued Semantics We start by defining three-valued structures which serve as a means for evaluating hybrid MKNF knowledge bases. **Definition 2** A three-valued (partial) MKNF structure $(I, \mathcal{M}, \mathcal{N})$ consists of a Herbrand first-order interpretation $I$ and two pairs $\mathcal{M} = \langle M, M_1 \rangle$ and $\mathcal{N} = \langle N, N_1 \rangle$ of sets of Herbrand first-order interpretations where any first-order atom which occurs in all elements in $\mathcal{M}$ (resp. $\mathcal{N}$) also occurs in all elements of $M_1$ (resp. $N_1$). It is called total if $\mathcal{M} = \langle M, M \rangle$ and $\mathcal{N} = \langle N, N \rangle$. $\mathcal{M}$ contains all interpretations which model only truth while $\mathcal{N}$ models everything which is true or undefined. Note that the corre- spondence \( -\mathbf{K} \) being equivalent to \textit{not} is supported by using the interpretation pair \((M, N)\) to evaluate both, \(\mathbf{K} \) and \textit{not}, simultaneously. The subset relation between \(M\) and \(N\) does not only guarantee allowed MKNF structures but also that any formula which is true (resp. false), in all elements of \(M\) is also true (resp. false) in all elements of \(N\). This will ensure consistency since it prevents modal atoms which are true and false at the same time, and as we will soon see, modal atoms which are undefined though being first-order false. Now we define MKNF models based on a preference relation over interpretation pairs which model the considered formula. **Definition 4** Any interpretation pair \((M, N)\) is a partial (or three-valued) MKNF model for a given closed MKNF formula \(\varphi\) if 1. \((I, \langle M, N \rangle, \langle M, N \rangle)(\varphi) = t\) for all \(I \in M\) and 2. \((I', \langle M', N' \rangle, \langle M, N \rangle)(\varphi) \neq t\) for some \(I' \in M'\) and each interpretation pair \((M', N')\) with \(M' \subseteq M\) and \(N' \subseteq N\) where at least one of the inclusions is proper. If there is a partial MKNF model of a given closed MKNF formula \(\varphi\) then \(\varphi\) is called MKNF-consistent, otherwise MKNF-inconsistent. With a fixed evaluation of the modal \textit{not}-atoms we maximize the sets which evaluate modal \(\mathbf{K}\)-atoms, checking whether this still yields a true evaluation. By maximizing these sets we naturally obtain less formulas which are true in all elements of these sets and thus less modal \(\mathbf{K}\)-atoms which are true or undefined. In this sense we deal with a logics of minimal knowledge. Once more, by \(N' \subseteq M'\), we guarantee that only reasonable augmentations are considered. **Example 1** Consider the knowledge base from the running example, with the obvious abbreviations, together with the users input \(\text{owns}(C1)\), and two albums \(A1, A2\), in the database from the same artist, where \(A1\) is sufficiently different from the compilation while \(A2\) is not. Then, restricted to the domain of interest, an interpretation pair \((M, N)\) modeling the KB and containing \(\text{owns}(C1)\), \(O_f(A1)\), and \(O_f(A2)\) is not an MKNF model if any \((M', N)\) such that \(O_f(A2)\) is not in all elements of \(M'\) still models the KB. In fact, the only MKNF model restricted to these modal atoms would be \((M, N)\) with \(M = N = \{\text{owns}(C1), O_f(A1), O_f(A2)\}, \{\text{owns}(C1), O_f(A1)\}\). One could ask now, what is the point of having \(u\) available in this example? The answer is that this simply depends on the intention and design of the reasoning capability: the idea could be only to recommend one disk. For that, we could add \textit{not} \(O_f(x_1), x \neq x_1\) to the rule (3) (ensuring additionally DL-safety). Supposing that both, \(A1\) and \(A2\) are sufficiently different from \(C1\) we would obtain two MKNF models of the KB, one with \(\mathbf{K} \cup O_f(A1)\) and one with \(\mathbf{K} \cup O_f(A2)\), and additionally one model which simply does not choose between the two but leaves them both undefined. The advantage of this comes into play when defining a way of calculating a model which incorporates all the minimally necessary true information: it is simpler to compute one slightly less expressive model than to keep track of various of them. Since MKNF models are in general infinite, as in [11] the proper idea for algorithmization is to represent them via a 1st-order formula whose model corresponds to the MKNF model. For that, a partition \((T, F)\) of true and false modal atoms is provided which allows to determine this first-order formula. **Definition 5** Let \(\mathcal{K} = (O, P)\) be a hybrid MKNF knowledge base. The set of \(\mathbf{K}\)-atoms of \(\mathcal{K}\), written \(\text{KA}(\mathcal{K})\), is the smallest set that contains (i) all \(\mathbf{K}\)-atoms occurring in \(P_G\), and (ii) a modal atom \(\mathbf{K}\xi\) for each modal atom \(\text{not}\xi\) occurring in \(P_G\). For a subset \(S\) of \(\text{KA}(\mathcal{K})\), the objective knowledge of \(S\) is the formula \(OBS_{\mathcal{K}} = O \cup \bigcup_{\xi \in S} \mathbf{K}\xi\), and \(SD_L = \{\xi \mid \mathbf{K} \xi \in SD_L\}\) where \(SD_L\) is the subset of DL-atoms of \(S\). A (partial) partition \((T, F)\) of \(\text{KA}(\mathcal{K})\) is consistent if \(OBS_{\mathcal{T}} \neq F\) for each \(\mathbf{K}\xi \in F\). Before we continue defining operators which will derive conclusions from knowledge bases, we have to modify MKNF knowledge bases such that we can address the coherence problem: a first-order false formula \(\varphi\) (as a consequence of the DL part) has to be connected to \textit{not} \(\varphi\) which cannot be done straightforwardly since \textit{not} cannot occur in the DL part. Thus, instead of representing the connection directly, we introduce new positive DL atoms which represent the falsity of an already existing DL atom, and a further program transformation which makes these new modal atoms available for reasoning in the respective rules. **Definition 6** Let \(\mathcal{K}\) be a DL-safe hybrid MKNF knowledge base. We obtain \(\mathcal{K}^*\) from \(\mathcal{K}\) by adding an axiom \(-H \subseteq NH\) for every DL atom \(H(t_1, \ldots, t_n)\) which occurs as head at least in one rule in \(\mathcal{K}\) where \(NH\) is a new predicate not already occurring in \(\mathcal{K}\). Moreover, we obtain \(\bar{\mathcal{K}}\) from \(\mathcal{K}^*\) by adding \(\text{not}NH(t_1, \ldots, t_{n'})\) to the body of each rule with a DL atom \(H(t_1, \ldots, t_{n'})\) in the head. The idea is to have \(NH(t_1, \ldots, t_{n'})\) available as a predicate representing that \(-H(t_1, \ldots, t_{n'})\) holds; \(\mathcal{K}^*\) makes this connection explicit and \(\bar{\mathcal{K}}\) introduces a restriction on each rule with a DL atom in the head saying intuitively that the rule can only be used to conclude something if the negation of its head does not hold already. Note that \(\mathcal{K}^*\) and \(\bar{\mathcal{K}}\) are still hybrid MKNF knowledge bases, so we only refer to \(\mathcal{K}^*\) and \(\bar{\mathcal{K}}\) explicitly when it is necessary. We now define the monotonic operator \(T_{\mathcal{K}}\) which allows to draw conclusions from positive hybrid MKNF knowledge bases. **Definition 7** For a positive nondisjunctive DL-safe hybrid MKNF knowledge base, \(R_{\mathcal{K}}, D_{\mathcal{K}}, T_{\mathcal{K}}\) are defined on the subsets of \(\text{KA}(\mathcal{K})\) as follows: \[ R_{\mathcal{K}}(S) = S \cup \{\mathbf{K} H \mid \mathcal{K} contains a rule of the form (1) such that \mathbf{K} A_i \in S \text{ for each } 1 \leq i \leq n\} \] \[ D_{\mathcal{K}}(S) = \{\xi \mid \mathbf{K} \xi \in \text{KA}(\mathcal{K})\} \cup \{K Q(b_1, \ldots, b_i) \mid K Q(a_1, \ldots, a_n) \in S \setminus SD_L,><K Q(b_1, \ldots, b_n) \in \text{KA}(\mathcal{K})\} \] \[ T_{\mathcal{K}}(S) = R_{\mathcal{K}}(S) \cup D_{\mathcal{K}}(S) \] \(R_{\mathcal{K}}\) derives immediate consequences from the rules while \(D_{\mathcal{K}}\) obtains consequences using modal atoms and the statements contained in the DL part. Since \(T_{\mathcal{K}}\) is monotonic, it has a unique least fixpoint which we denote \(T_{\mathcal{K}} \uparrow \omega\) and is obtained in the usual way. Note that \(T_{\mathcal{K}} \uparrow \omega\) is in fact order-continuous due to the absence of function symbols in the language and the restriction to known individuals. A transformation for nondisjunctive hybrid MKNF knowledge bases is defined turning them into positive ones, thus allowing the application of the operator \(T_{\mathcal{K}}\). **Definition 8** Let \(\mathcal{K}_G = (O, P_G)\) be a ground nondisjunctive DL-safe hybrid MKNF knowledge base and \(S \subseteq \text{KA}(\mathcal{K}_G)\). The MKNF transform \(K_G/S\) is obtained by \(P_G/S\) containing all rules \(\mathbf{K} H \leftarrow K A_1, \ldots, K A_n\) for which there exists a rule \(\mathbf{K} H \leftarrow K A_1, \ldots, K A_n, \text{not} B_1, \ldots, \text{not} B_m\) in \(P_G\) with \(\mathbf{K} B_j \notin S\) for all \(1 \leq j \leq m\). This resembles the transformation known from stable models of logic programs and the following operator using a fixpoint of \( \Lambda \) \[ \Phi \] and that the KB is inconsistent is thus verified. \[ \Gamma \] then define the well-founded partition. \[ \Gamma \] of this result derives only additionally \[ \Lambda \] introduces via \[ \Lambda \] and they are not necessary there anyway since their only objective is preventing inconsistencies, i.e. \[ \Lambda \] then define a nondisjunctive DL-safe hybrid MKNF knowledge base and let \( P_{\Lambda} \), \( N_{\Lambda} \subseteq KA(\Lambda) \) with \( P_{\Lambda} \) being the least fixpoint of \( \Phi_{\Lambda} \) and \( N_{\Lambda} \) the greatest fixpoint of \( \Psi_{\Lambda} \), both restricted to the modal atoms only occurring in \( KA(\Lambda) \). Then \( (P_{W}, N_{W}) = (P_{\Lambda} \cup \{ K \pi(O) \}, KA(\Lambda) \setminus N_{\Lambda} \) is the well-founded partition of \( \Lambda \). Both, \( P_{\Lambda} \) and \( N_{\Lambda} \), are restricted to the modal atoms occurring in \( \Lambda \) only. Thus, the auxiliary modal atoms introduced via \( \Lambda \) are not present in the well-founded-partition. But they are not necessary there anyway since their only objective is preventing inconsistencies, i.e. deriving \( \neg \varphi \) and not \( \Phi \) being undefined. Example 2 Consider the KB \( \Lambda \) from the example scenario and add the owners compulation C2, i.e. owns(C2) and album A3 and compilation C3 which are both sufficiently different from C2. At first we add a DL statement \( \neg \text{of} \subseteq \text{not} \text{of} \) to the knowledge base to obtain \( \Lambda' \). Additionally, each ground rule in \( KA(\Lambda) \) with head \( \text{of}(x) \) receives a modal atom not \( \text{of}(x) \) in its body where \( x \) here just functions as a placeholder for A3 and C2. When we compute \( \Gamma' \) of \( \Lambda \) then the result contains \( K \text{of}(C3) \), \( K \text{of}(C3) \) and of course \( K \text{of}(A3) \) and so does \( \Gamma \) applied to this result providing already the least fixpoint of \( \Phi_{\Lambda} \) (due to our simplifications). If we compute \( \Gamma \) of \( KA(\Lambda) \) then only \( K \text{of}(C3) \) occurs due to \( \Lambda \), because all rules with modal not-atoms are removed from the transform. However, computing \( \Gamma' \) of this result derives only additionally \( K \text{of}(A3) \) due to not \( \text{of}(C3) \) occurring in the body of the rule with head \( K \text{of}(C3) \), and we also obtained the greatest fixpoint of \( \Psi_{\Lambda} \). So the well-founded partition contains \( K \text{of}(A3) \) in \( P_{\Lambda} \), i.e. offers A3, but also \( K \text{of}(C3) \) in \( P_{\Lambda} \) and in \( N_{\Lambda} \), i.e. C3 is offered and rejected at the same time. This is a clear indication that the well-founded knowledge base is inconsistent, as we shall see in the following section, and the (2) and (3) alone are not suitable to provide the intended service. 5 Properties In the same manner as done in [7] for the alternating fixpoint of normal logic programs, we restate the iteration for obtaining \( \Phi_{\Lambda} \) and \( \Psi_{\Lambda} \) as: \[ P_0 = \emptyset \] \[ P_{n+1} = \Gamma_{\Lambda}(N_n) \] \[ P_{\omega} = \bigcup_{n \in \mathbb{N}} P_n \] \[ N_0 = KA(\Lambda) \] \[ N_{n+1} = \Gamma_{\Lambda}(P_n) \] \[ N_{\omega} = \bigcap_{n \in \mathbb{N}} N_n \] It is easy to see that \( \Phi_{\Lambda} \uparrow 1 = P_2 \), \( \Phi_{\Lambda} \uparrow 2 = P_4 \), i.e. \( \Phi_{\Lambda} \uparrow i = P_{2i} \), and likewise \( \Psi_{\Lambda} \uparrow i = P_{2i} \). In particular, it can be shown that the sequence of \( P_i \) (respectively \( N_i \)) is increasing, (respectively decreasing) and without surprise its limits concur with the least fixpoint of \( \Phi_{\Lambda} \), respectively the greatest fixpoint of \( \Psi_{\Lambda} \), i.e. \( P_\omega = \text{fp}(\Phi_{\Lambda}) \) and \( N_\omega = \text{fp}(\Psi_{\Lambda}) \). As an overall benefit, we can compute the least fixpoint of \( \Phi_{\Lambda} \) directly from the greatest one of \( \Psi_{\Lambda} \) and vice versa. Proposition 1 Let \( \Lambda \) be a nondisjunctive DL-safe hybrid MKNF knowledge base. Then \( P_\omega = \Gamma(N_\omega) \) and \( N_\omega = \Gamma(P_\omega) \). It furthermore can be shown that we can even use this computation to check consistency of the KB. Proposition 2 Let \( \Lambda \) be a nondisjunctive DL-safe hybrid MKNF knowledge base and \( P_{\omega} \) the least fixpoint of \( \Phi_{\Lambda} \). If \( \Gamma(P_{\omega}) \subset \Gamma(N_{\omega}) \) then \( \Lambda \) is MKNF-inconsistent. Intuitively, what this statement says is that any inconsistency between rules and the ontology can be discovered by computing the set of non-false modal atoms and then checking whether all false modal atoms are not just enforced to be false by the first-order knowledge although the (unchanged) rules support (at least one of) these false modal atoms. For an inconsistency check this is of course not sufficient, since an inconsistent DL base \( \Theta \) is not detected by this method. In fact, in case we want to check for consistency of \( \Lambda \) we have both to check consistency of \( \Theta \) alone, and apply the proposition above. Theorem 1 Let \( \Lambda = (\Theta, \Pi) \) be a nondisjunctive DL-safe hybrid MKNF knowledge base and \( P_{\omega} \) the least fixpoint of \( \Phi_{\Lambda} \). \( \Gamma(P_{\omega}) \subset \Gamma(N_{\omega}) \) or \( \Theta \) is inconsistent if \( \Lambda \) is MKNF-inconsistent. Normal rules alone cannot be inconsistent, unless we allow integrity constraints as rules whose head is \( K f \) (cf. [11]). But then inconsistencies are easily detected since \( P_W \) or \( N_W \) contain \( K f \). Example 3 Reconsider the result from Example 2. If we compute \( \Gamma \) of the least fixpoint of \( \Phi_{\Lambda} \), i.e. \( P_{\omega} \) then the result now contains \( K \text{of}(C3) \) while this is not contained in \( \Gamma' \) of \( P_{\omega} \). Our assumption that the KB is inconsistent is thus verified. However, in case of a consistent knowledge base, the well-founded partition always yields a three-valued model. Theorem 2 Let \( \Lambda \) be a consistent nondisjunctive DL-safe hybrid MKNF KB and \( \{ P_{\Lambda}, \{ K \pi(O) \}, KA(\Lambda) \setminus N_{\Lambda} \} \) be the well-founded partition of \( \Lambda \). Then \( (I_{P}, I_{N}) \) where \( I_{P} = \{ I \mid I = ob_{K_{\Lambda}} \} \) and \( I_{N} = \{ I \mid I = \neg ob_{K_{\Lambda}} \} \) is an MKNF model – the well-founded MKNF model. In fact, the result is not any three-valued MKNF model but the least one with respect to the following order. 6 \( \Phi_{\Lambda} \) and \( \Psi_{\Lambda} \) are order-continuous for the same reasons as \( T_{\Lambda} \). Definition 13 Let $\varphi$ be a closed MKNF formula and $(M_1, N_1)$ and $(M_2, N_2)$ be partial MKNF models of $\varphi$. Then $(M_1, N_1) \succeq_k (M_2, N_2)$ iff $M_1 \subseteq M_2$ and $N_1 \supseteq N_2$. This order intuitively resembles the knowledge order where the least element contains the smallest amount of derivable knowledge, i.e. the one which leaves as much as possible undefined. Theorem 3 Let $\mathcal{K}$ be a consistent nondisjunctive DL-safe hybrid MKNF KB and $(M, N)$ be the well-founded MKNF model. Then, for any three-valued MKNF model $(M_1, N_1)$ of $\mathcal{K}$ we have $(M_1, N_1) \succeq_k (M, N)$. Moreover, for an empty DL base the well-founded partition corresponds to the well-founded model for (normal) logic programs. Corollary 1 Let $\mathcal{K}$ be a nondisjunctive program of MKNF rules, $\Pi$ a normal logic program obtained from $\mathcal{P}$ by transforming each MKNF rule $H \leftarrow K_1, \ldots, K_n, \neg B_1, \ldots, \neg B_m$ into a clause $H \leftarrow A_1, \ldots, A_n, \neg B_1, \ldots, \neg B_m$ of $\Pi$. $W_{\mathcal{K}} = (P, N)$ be the MKNF model and $W_{\Pi}$ be the well-founded model of $\Pi$. Then $\mathcal{K} \vdash H$ if and only if $H \in W_{\Pi}$ and $\mathcal{K} \vdash H \in N$ if and only if not $H \in W_{\Pi}$. Finally the data complexity result is obtained basically from the result of $T_{\mathcal{K}}$ for positive nondisjunctive MKNF knowledge bases in [11] where data complexity is measured in terms of A-Box assertions and rule facts. Theorem 4 Let $\mathcal{K}$ be a nondisjunctive DL-safe hybrid MKNF KB. Assuming that entailment of ground DL-atoms in $T_{\mathcal{K}}$ is decidable with data complexity $C$ the data complexity of computing the well-founded partition is in $\mathcal{D}C$. This means that if the description logic fragment is tractable, the end up with a formalism whose model is computed with a data complexity of $P$. 6 Comparisons and Conclusions As already said, [11] is the stable model oriented origin of our work. The data complexity for reasoning with (2-valued) MKNF models in nondisjunctive programs is shown to be $\mathcal{E}^p$ where $\mathcal{E} = \mathcal{NP}$ if $C \subseteq \mathcal{NP}$, and $\mathcal{E} = \mathcal{E}$ otherwise. Thus, computing the well-founded partition generally ends up in a strictly smaller complexity class than deriving one of maybe various MKNF models. However, $M$ is a (two-valued) MKNF model of $K$ iff $(M, M)$ is a three-valued MKNF model of $K$ and, furthermore, if $(M, M)$ is the well-founded MKNF model of $K$, $M$ is the only MKNF model of $K$. Furthermore, the well-founded partition can also be used in the algorithms presented in [11] for computing a subset of that knowledge which holds in all partitions corresponding to a two-valued MKNF model. The approach presented in [8], though conceptually similar to ours, is based on a different semantics which evaluates $\mathcal{K}$ and $\neg$ (and $\neg \mathcal{K}$ and $\neg\mathcal{K}$) simultaneously, thereby differing from the ideas of [11]. This in particular does not allow to minimize unnecessary undefinedness. Furthermore, in contrast with our approach, [8] does not allow for any form of detection of inconsistencies resulting from the interaction of the DL part and the rules. Instead, it provides a strange kind of model in these cases which contains undefined modal atoms which are actually first-order false. Therefore, our proposal is more robust than the one in [8] and in fact more closely related to the two-valued one. In summary, here we define a WFS of (tightly integrated) hybrid KBs that is sound wrt. the semantics defined in [11] for MKNF KBs, that has strictly lower complexity, coinciding with it in case there are no rules, and that coincides with the WFS of normal programs [14] in case the DL-part is empty. We also obtain tractable fragments whenever the underlying DL is tractable. Moreover, we define a construction for computing the WF-model that is also capable of detecting inconsistencies. It is worth noting that when inconsistencies come from the combination of the rules with the DL-part (i.e. for inconsistent KBs with a consistent DL-part), the construction still yields some results (e.g. in example 2). This suggests that the method could be further exploited in the direction of defining a paraconsistent semantics for hybrid KBs. This, together with a study of tractable fragments, generalization to disjunctive rules and implementations, are subjects for future work. REFERENCES 7 See e.g. the W3C member submission on tractable fragments of OWL 1.1 (now called OWL 2) at http://www.w3.org/Submission/owlll-tractable/.
{"Source-Url": "http://knoesis.wright.edu/sites/default/files/coherent_wellFounded_MKNF.pdf", "len_cl100k_base": 8096, "olmocr-version": "0.1.48", "pdf-total-pages": 5, "total-fallback-pages": 0, "total-input-tokens": 23304, "total-output-tokens": 9755, "length": "2e12", "weborganizer": {"__label__adult": 0.0003771781921386719, "__label__art_design": 0.0005822181701660156, "__label__crime_law": 0.00075531005859375, "__label__education_jobs": 0.0010576248168945312, "__label__entertainment": 0.00014781951904296875, "__label__fashion_beauty": 0.00020325183868408203, "__label__finance_business": 0.0005693435668945312, "__label__food_dining": 0.0005660057067871094, "__label__games": 0.0009860992431640625, "__label__hardware": 0.0007729530334472656, "__label__health": 0.0007777214050292969, "__label__history": 0.0003552436828613281, "__label__home_hobbies": 0.00015676021575927734, "__label__industrial": 0.0006852149963378906, "__label__literature": 0.0008540153503417969, "__label__politics": 0.00048232078552246094, "__label__religion": 0.0006213188171386719, "__label__science_tech": 0.1661376953125, "__label__social_life": 0.00014591217041015625, "__label__software": 0.017578125, "__label__software_dev": 0.8046875, "__label__sports_fitness": 0.0003070831298828125, "__label__transportation": 0.0007724761962890625, "__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, 31268, 0.01728]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 31268, 0.45315]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 31268, 0.85551]], "google_gemma-3-12b-it_contains_pii": [[0, 6190, false], [6190, 8831, null], [8831, 17093, null], [17093, 24013, null], [24013, 31268, null]], "google_gemma-3-12b-it_is_public_document": [[0, 6190, true], [6190, 8831, null], [8831, 17093, null], [17093, 24013, null], [24013, 31268, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 31268, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 31268, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 31268, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 31268, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 31268, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 31268, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 31268, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 31268, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 31268, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 31268, null]], "pdf_page_numbers": [[0, 6190, 1], [6190, 8831, 2], [8831, 17093, 3], [17093, 24013, 4], [24013, 31268, 5]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 31268, 0.0]]}
olmocr_science_pdfs
2024-11-24
2024-11-24
6ceac98f23ea78b2407e6b8f1de81da7f25f79f0
Worldwide Logistics Data Access Project By Michael Craig Akers Submitted to the Faculty of the Information Engineering Technology Program in Partial Fulfillment of the Requirements for the Degree of Bachelor of Science in Information Engineering Technology University of Cincinnati College of Applied Science June 2005 Worldwide Logistics Data Access Project By Michael Craig Akers Submitted to the Faculty of the Information Engineering Technology Program in Partial Fulfillment of the Requirements for the Degree of Bachelor of Science in Information Engineering Technology © Copyright 2005 Michael Craig Akers The information in this document is proprietary and may not be reproduced or distributed in whole or in part without the permission of the owner. Michael Craig Akers Tamisra Sanyal Patrick C. Kumpf, Ed.D. Interim Department Head June 2, 2005 June 2, 2005 June 2, 2005 Acknowledgements I would like to thank Worldwide Logistics for giving me the opportunity to do the Worldwide Logistics Data Access Project. Jeff Bergmann, Chief Operations Officer at Worldwide Logistics, was a main contributor in the success of this project. Jeff encouraged the company to design a new database system. Mr. Bergmann also helped by offering industry information. Table of Contents **Section** | Page --- | --- Title Page | i Signature Page | iii Acknowledgements | iv Table of Contents | v List of Figures | vi Abstract | vii 1. Problem Statement 1 | 1 1.1. Definition of Problem 2 | 2 1.2. Current Issue 2 | 2 2. Solution 3 | 3 3. User Profiles 5 | 5 3.1 Regular User 5 | 5 3.2 Data Entry 5 | 5 3.3 Administrator 5 | 5 4. Design Protocols 6 | 6 4.1. Organizational Scheme 6 | 6 4.1.1. Front-end Clients 6 | 6 4.1.2. Application 6 | 6 4.1.3. Server 6 | 6 4.2. Interface Design 8 | 8 4.2.1. Band-end 8 | 8 4.2.2. Front-end 9 | 9 4.3. Icons and Graphical Symbols 10 | 10 4.4. Shade Scheme 11 | 11 4.5. Help 11 | 11 5. Deliverables 12 | 12 <table> <thead> <tr> <th>Section</th> <th>Page</th> </tr> </thead> <tbody> <tr> <td>6. Design and Development</td> <td>13</td> </tr> <tr> <td>6.1. Timeline</td> <td>13</td> </tr> <tr> <td>6.2. Senior Design I</td> <td>13</td> </tr> <tr> <td>6.3. Senior Design II</td> <td>13</td> </tr> <tr> <td>6.4. Senior Design III</td> <td>13</td> </tr> <tr> <td>7. Budget</td> <td>14</td> </tr> <tr> <td>7.1. Software</td> <td>14</td> </tr> <tr> <td>7.2. Hardware</td> <td>15</td> </tr> <tr> <td>8. Project Testing</td> <td>15</td> </tr> <tr> <td>8.1. Phase I</td> <td>15</td> </tr> <tr> <td>8.2. Phase II</td> <td>16</td> </tr> <tr> <td>8.3. Phase III</td> <td>16</td> </tr> <tr> <td>9. Conclusion</td> <td>16</td> </tr> <tr> <td>Appendix A. Testing Evaluation Form</td> <td>17</td> </tr> <tr> <td>Appendix B. Timeline</td> <td>19</td> </tr> <tr> <td>References</td> <td>20</td> </tr> </tbody> </table> ## List of Figures <table> <thead> <tr> <th>Figure</th> <th>Description</th> <th>Page</th> </tr> </thead> <tbody> <tr> <td>Figure 1.</td> <td>Organizational Scheme</td> <td>6</td> </tr> <tr> <td>Figure 2.</td> <td>Database Diagram</td> <td>7</td> </tr> <tr> <td>Figure 3.</td> <td>Enterprise Manager Interface</td> <td>8</td> </tr> <tr> <td>Figure 4.</td> <td>Local Client Interface</td> <td>9</td> </tr> <tr> <td>Figure 5.</td> <td>Navigational Icons</td> <td>10</td> </tr> <tr> <td>Figure 6.</td> <td>Shades</td> <td>10</td> </tr> <tr> <td>Figure 7.</td> <td>Budget Table</td> <td>14</td> </tr> <tr> <td>Figure 8.</td> <td>Testing</td> <td>15</td> </tr> </tbody> </table> Abstract The *Worldwide Logistics Data Access Project* is a database system. Currently Worldwide Logistics Inc. Associates uses an Approach database from the IBM Company. The system is slow causing insufficient workflow. Relationships are a big part of the shipping industry. Worldwide’s relationships with customers and carriers have to be maintained. The old database system will not be able to provide the communication between Worldwide and its growing members. Business growth is good, but that growth will actually negatively impact Worldwide if technology improvements are not made. The new system will benefit by integrating dormant pre-existing purchased technologies. The company wants to provide its customers with vital information quickly and efficiently. I created a system using SQL Server, Microsoft Access and Macromedia Flash to provide the employees with demanded information requested by customers. The *Worldwide Logistics Data Access Project* is scalable meeting today’s requirements along with the demands of tomorrow. Worldwide Logistics Data Access Project 1. Problem Statement 1.1 Definition of Problem Logistics is an essential part of world markets. Without logistics, our markets would not exist. Companies are always in need of transportation for their goods. All manufacturing factories do not reside in one centralized location. They are found throughout the world. Following the manufacturing process of an item, the item needs to be transported to a store. To facilitate this we have “global supply chain management” which means a system that manages materials from a point of origin to a manufacturer, a shipper and finally a consumer (2, p. 1). Air, water and land are different ways to transport goods. Worldwide Logistics Inc. is a company that manages the distribution for multiple associations of manufactures. The associations are TOYSA (Toy Shippers Association Incorporated), NCBFAASA (National Customs Brokers Forwarders Associates of America Shippers Association) and IHSA (International House Wares Shippers Association). TOYSA will be the focus for this project. TOYSA provides a water service although land services can be contracted. The association provides rates to members that are only available to big corporations. Having access to these rates brings savings to a smaller toy companies. TOYSA’s services are provided through a series of steps. The steps are: - Membership Process - Joining the association - Member Commitments - Contract Negotiations - Get the rates we will be providing - Provide Rates - Requested rates to members - Billing Process - Billing data must be stored - Billing must be sent out in the middle of the month and monthly - Payment - Members must pay their fees A fee is charged for each container used by a member although the fee can be reduced by using more containers. TOYSA is not responsible for the charge of shipping, but only the use of its contracts. The member will receive a bill from both the carrier for rates and the association for fees. A bill of lading is used to provide detailed information for each shipment made by a member. The bill of lading is provided by the association carrier. TOYSA provides, by request, copies of each bill of lading that pertains to a member. 1.2 Current Issue The company is currently using Lotus Approach to meet its data needs. The database was set up about ten years ago by an individual with no experience in database systems. The system is rapidly degrading because of the layout chosen for the database. The system uses a “Master ID System” created by the past database designer. The system resembles a combination key, but every table uses this combination. During an interview with the data entry specialist, she stated, “The system is very slow from one entry page to the next. Multiple people accessing the database, makes working in the database impossible.” (3) The company would like to move out of IBM (Approach) and into Microsoft (Access). They use Microsoft technologies for most of their business needs, but the database system is currently IBM based. Years ago they used Lotus SmartSuite much like they use Office today for this is why the database is an IBM technology. The database was created years ago by an inexperienced user. To make matters worse, the past “DBA” cannot recall how he got the system to work; this inhibited him from modifying or redoing the database system. 2. Solution The company was in need of a data storage solution that would help facilitate their services. I have been in contact with Jeff Bergmann, Manager of Operations for Worldwide Logistics Incorporated. Together we continuously reviewed the progress of this project. Jeff and I, using suggestions from other employees, decided on some of the functions this project needed to provide. The functions we decided on are as follows: - **It must be scalable.** TOYSA will continue to grow. Its technology will need updating to help serve the growth. - **It must print multiple reports.** Multiple reports are needed to satisfy the billing, rate request and queried information. - **It should be secure.** Data will need to be kept confidential at all times. - **It should be easy to use.** The front end application should have good appearance and a user friendly orientation to it. The system’s ability to be scalable was vital to allow future projects. The company would like to eventually offer online services. The online services would allow members to check rates and pay bills. The solution is scalable, user friendly, secure, and allow dynamic reporting. The database system allows multiple technologies to access and use information stored within it. Allowing technologies access gives the advantage of creating spreadsheets, mail/letter-merges, charts and many more tasks. - Provides a scalable solution. Since the company is currently using Microsoft technologies I have chosen according to the current environment. The solution will provide for all the current demands as well as future demands. - Provides user friendly functionality. This will be accomplished by: - Creating standard interfaces - Testing of the interfaces - Revising and retesting - Provides a secure solution. The solution will use user authentication for in-house data access needs. - Provides Dynamic Reporting. Reports will produce multiple printouts. As a request from the company I have chosen to use Microsoft technologies to provide the reports. 3. User Profiles There will be three levels of TOYSA Data Access users. The user categories will consist of Typical, Data Entry, Internet and Administrator. Each group will be setup with different permissions. 3.1 Regular User The typical user will have access to data on the database. This means the user has searching capabilities and reporting permissions. The user will not have full updating rights. The user will be permitted to update non-vital data. An example would be updating a contact name. The Information Technology experience level will be equal to typical desktop application users. 3.2 Data Entry This user plays a very important role. Data entry needs to exist. Reason being there would be no data for retrieval. The user will have total access to data input. The front-end application will catch most mistakes made by the user, but ultimately the Data Entry User should be conscientious when inputting data. This will give the Typical User correctly formatted data to search and report. Information Technology experience will be the same as the Typical User. 3.5 Administrator A user with access to all data and technologies comprised to make the product. The user will be responsible for product updates and bug reports. The Administrator will audit activity, maintain security, provide future functions for the product. Administrators will understand how the solution works. 4. Design Protocols 4.1 Organizational Scheme A Relational Database and client-side local area network front end (See Figure 1) make up the solution. ![Organizational Scheme Diagram] Figure 1. Organizational Scheme 4.1.1 Front-end Clients The client will be wanting to access or input information. To do so the client will use the application interface. The Local Client must first log onto TOYSA’S Domain Server (Active Directory). The user is then granted access to the application. 4.1.2 Application The application is important it allows the client connection to the database. The Local Application will communicate directly with the database with no server between the Application and the Database Server. 4.1.3 Server The server will grant permission depending on the end client. The database resides on a separate machine. This will help to allow better data access. The Database management software will reside on this server (machine). The basic Database diagram is shown below (Figure 2. Database Diagram). The diagram only shows the foreign and primary keys. Figure 2. Database Diagram 4.2 Interface Design 4.2.1 Back-end The interface is for the Administrator. The Administrator will be familiar with SQL Server and Enterprise Manager. See the Back-end Interface on the next page (Figure 3. Enterprise Manager Interface). ![Figure 3. Enterprise Manager Interface] 4.2.2 Front-end The interface is catered to the Typical and Data Entry users. This interface is 10” by 9”. The navigational buttons will be used to go to different areas of the application (Carriers, Members, Rates, Reports and Billing). The user has headings (Members Information, Members Contacts and Members Rates) for each section of the form. See the Local Client Interface (Figure 3. Local Client Interface). Ashly Bissantz, Data Entry Specialist at Worldwide Logistics Inc., helped to come up with the design of the form. ![Figure 4. Local Client Interface](image-url) 4.3. Icons and Graphical Symbols The figure (Figure 4. Navigational Icons) below shows the icons/buttons that are located throughout the application. These icons were made so that symbolically they would be easily understood. The navigational buttons will have arrows typically seen in a database application (|<, <, >, >|). The command button will have text to inform the user of what function the button performs. ![Navigational Icons](image) **Figure 5. Navigational Icons** 4.4. Shade Scheme Three shades are primarily used in the application. The shades were chosen based on the desire of the company. The shades are black, white, and grey. The black is used to show detail and contrast. Shades are: ![Shades](image) **Figure 6. Shades** 4.5. Help The user can access help by using the help icon (see Figure 4. Navigational Icons). The help will be made from macromedia flash. Flash was chosen because of its ability to offer rich multimedia content. The help section is very futuristic offering video and audio. The user is able to find out exactly how to do a particular job. 5. Deliverables 1. Environment created 2. Virtual PC 4. DNS and Active Directory Installed 5. Back-end 6. SQL Server installed 7. Tables Created 8. Normalized and de-normalized 9. Relationships Created 10. Front-end 11. Design i. Graphics (Buttons and Forms) ii. Shade Scheme 12. Member Contact Forms (Add, Edit, Search (Basic), Delete) 13. Member Forms (Add, Edit, Search (Basic), Delete) 14. User Login 15. Finish Error Handling (Check Data) 16. Application Setup 17. Reports (Monthly invoicing, rate sheets) 18. Forms (Rates, carrier, carrier contact, dynamic search and billing) 19. Test Evaluation Form 20. Help Application 21. Stored Procedures (Carriers, rates, reports and advanced searches) 6. Design and Development 6.1. Timeline See Appendix B. 6.2. Senior Design I - Researched Databases, Logistics, and Worldwide Logistics - Set Project Goals - Decided on a solution - Started Development - Completed Proposal and Presentation 6.3. Senior Design II - Continued Research - Virtual Environment Setup - Start Design - Install Instance of Database - Setup Tables - Normalize and De-normalize - Setup Relationships - Front-end Started (Forms) - Testing 6.4. Senior Design III - Continued Form Design - Reports - User Login - Application Setup - Help Application - Test Evaluation Form (For Testing) - Testing and Revising - Finished Product - Training 7. Budget 7.1. Software The project will call for several software and hardware solutions. The software will consist of the following: Photoshop – for making graphics Access – to create the Local Client front-end SQL Server 2000 – database (back-end) Flash – to create the Help Application (Client front-end) Funding for the software needed was provided by the company. <table> <thead> <tr> <th>Manufacturer</th> <th>Product</th> <th>Price</th> <th>Project Cost</th> </tr> </thead> <tbody> <tr> <td>Adobe¹</td> <td>Photoshop CS</td> <td>$649.00</td> <td>$649.00</td> </tr> <tr> <td>Microsoft²</td> <td>Access</td> <td>$229.00</td> <td>$0.00</td> </tr> <tr> <td>Microsoft³</td> <td>SQL Server 2000</td> <td>$2249.00</td> <td>$2249.00</td> </tr> <tr> <td>Macromedia⁴</td> <td>Flash MX 2004 Professional</td> <td>$499.00</td> <td>$499.00</td> </tr> <tr> <td><strong>TOTALS</strong></td> <td><strong>$3626.00</strong></td> <td><strong>$3397.00</strong></td> <td></td> </tr> </tbody> </table> **Figure 7. Budget Table** 7.2. Hardware The project will use a preexisting sever located at the company’s office and services already being used. 8. Project Testing The testing was done in the offices of Worldwide Logistics on virtual machines. The company currently has rights to use development software through the “Action Pack Subscription” (Developer and Seller resource of Microsoft Technologies). Each tester used an evaluation form while conducting the test. The testing followed a process. There were three main testing phases and many tests I completed throughout the development process. The testing process is shown on the next page (Figure 8. Testing). A sample form is shown in the Appendix (Appendix A. Testing Evaluation Form). Figure 8. Testing 8.1. Phase I This phase involved getting a better idea of what the end user needed. Suggested features were made to improve the quality of the application. Some of those features were centralized areas for the retrievable of information. For example the members have their own section with member specific contact, rate and company information. 8.2. Phase II The user tested the application, giving feedback on new features. This was also the preliminary testing phase. The project was completed at this phase. 8.3. Phase III The project is tested for any remaining bugs. The user’s responses were all yes and the application was finalized. 9. Conclusion 9.1 Conclusion The Worldwide Logistics Data Access Project was needed to replace the old, inefficient database. The new database meets the demands of the company, Worldwide Logistics. The application and structure are appealing. Several technologies were used to make this solution. Those technologies include Microsoft Access, Microsoft SQL Server 2000, Adobe Photoshop, and Macromedia Flash. The Design Freeze Deliverables were satisfied and testing was done to guarantee quality. # Appendices A. ## Testing Evaluation Form <table> <thead> <tr> <th>Employee Information</th> <th></th> </tr> </thead> <tbody> <tr> <td>Name of Employee:</td> <td></td> </tr> <tr> <td>Position:</td> <td></td> </tr> <tr> <td>Date:</td> <td></td> </tr> </tbody> </table> <table> <thead> <tr> <th>Review Guidelines</th> <th></th> </tr> </thead> <tbody> <tr> <td><strong>Review Scale</strong></td> <td></td> </tr> <tr> <td>0 = DNW (Did Not Work)</td> <td></td> </tr> <tr> <td>1 = Hard To Do</td> <td></td> </tr> <tr> <td>2 = OK (Medium) To Do</td> <td></td> </tr> <tr> <td>3 = Easy To Do</td> <td></td> </tr> </tbody> </table> <table> <thead> <tr> <th>Evaluation</th> <th></th> </tr> </thead> <tbody> <tr> <td>(Use Reverse Side For More Comments)</td> <td></td> </tr> </tbody> </table> <table> <thead> <tr> <th></th> <th>DNW</th> <th>Hard</th> <th>OK</th> <th>Easy</th> <th>Comments</th> </tr> </thead> <tbody> <tr> <td>Logon To Application</td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>Browse Members/ Carriers/ Rates</td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>Edit Members/ Carriers/ Rates</td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>Print An Invoice And Mid-Month</td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>Help (Was it easy to find?)</td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>Add A Bill To Database</td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>Edit A Bill</td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>Find A Bill</td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>Overall Of Application</td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> </tbody> </table> <table> <thead> <tr> <th>Response Total</th> <th></th> </tr> </thead> <tbody> <tr> <td>=</td> <td></td> </tr> </tbody> </table> NOTE: Thank you for completing this evaluation of the Toysa Database. The users’ involvement is necessary to provide a successful application. You may have to perform more than one evaluation. ## Appendix B. ### Project Timeline <table> <thead> <tr> <th>ID</th> <th>Task Name</th> <th>Start</th> <th>Finish</th> <th>Duration</th> <th>2004</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>Initial Research</td> <td>10/1/2004</td> <td>10/19/2004</td> <td>2.6w</td> <td><img src="#" alt="Blue" /></td> </tr> <tr> <td>2</td> <td>Write Proposal</td> <td>10/21/2004</td> <td>11/15/2004</td> <td>3.6w</td> <td><img src="#" alt="Blue" /></td> </tr> <tr> <td>3</td> <td>Present Proposal</td> <td>11/18/2004</td> <td>11/18/2004</td> <td>0w</td> <td><img src="#" alt="Blue" /></td> </tr> <tr> <td>4</td> <td>Research Logistics</td> <td>11/18/2004</td> <td>12/16/2004</td> <td>4.2w</td> <td><img src="#" alt="Blue" /></td> </tr> <tr> <td>5</td> <td>Research Access</td> <td>11/25/2004</td> <td>12/1/2004</td> <td>1w</td> <td><img src="#" alt="Blue" /></td> </tr> <tr> <td>7</td> <td>Research Flash</td> <td>12/13/2004</td> <td>12/17/2004</td> <td>1w</td> <td><img src="#" alt="Blue" /></td> </tr> <tr> <td>8</td> <td>Develop and Test Database</td> <td>12/28/2004</td> <td>1/20/2005</td> <td>3.6w</td> <td><img src="#" alt="Blue" /></td> </tr> <tr> <td>9</td> <td>Develop and Test Front End</td> <td>1/24/2005</td> <td>2/16/2005</td> <td>3.6w</td> <td><img src="#" alt="Blue" /></td> </tr> <tr> <td>10</td> <td>Develop and Test Internet Form</td> <td>2/18/2005</td> <td>3/15/2005</td> <td>3.6w</td> <td><img src="#" alt="Blue" /></td> </tr> <tr> <td>11</td> <td>Present Prototype</td> <td>3/17/2005</td> <td>3/17/2005</td> <td>0w</td> <td><img src="#" alt="Blue" /></td> </tr> <tr> <td>12</td> <td>Improvements and Complete</td> <td>3/25/2005</td> <td>5/3/2005</td> <td>5.6w</td> <td><img src="#" alt="Blue" /></td> </tr> <tr> <td>13</td> <td>Help Application</td> <td>5/5/2005</td> <td>5/12/2005</td> <td>1.2w</td> <td><img src="#" alt="Blue" /></td> </tr> <tr> <td>14</td> <td>Present Final Project</td> <td>5/20/2005</td> <td>5/20/2005</td> <td>0.2w</td> <td><img src="#" alt="Blue" /></td> </tr> </tbody> </table> References
{"Source-Url": "https://drc.libraries.uc.edu/bitstream/handle/2374.UC/732830/Akers,%20M._B.S.I.E.T._2005.pdf;sequence=1", "len_cl100k_base": 6045, "olmocr-version": "0.1.49", "pdf-total-pages": 28, "total-fallback-pages": 0, "total-input-tokens": 41462, "total-output-tokens": 6821, "length": "2e12", "weborganizer": {"__label__adult": 0.0010614395141601562, "__label__art_design": 0.0007600784301757812, "__label__crime_law": 0.0006628036499023438, "__label__education_jobs": 0.01271820068359375, "__label__entertainment": 0.00014662742614746094, "__label__fashion_beauty": 0.0003514289855957031, "__label__finance_business": 0.005283355712890625, "__label__food_dining": 0.0012035369873046875, "__label__games": 0.0009822845458984375, "__label__hardware": 0.0027675628662109375, "__label__health": 0.0008311271667480469, "__label__history": 0.0007152557373046875, "__label__home_hobbies": 0.0002574920654296875, "__label__industrial": 0.002269744873046875, "__label__literature": 0.0005307197570800781, "__label__politics": 0.00027751922607421875, "__label__religion": 0.0005784034729003906, "__label__science_tech": 0.00981903076171875, "__label__social_life": 0.0002257823944091797, "__label__software": 0.022857666015625, "__label__software_dev": 0.91650390625, "__label__sports_fitness": 0.0005602836608886719, "__label__transportation": 0.0179443359375, "__label__travel": 0.0007548332214355469}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 22535, 0.05776]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 22535, 0.08739]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 22535, 0.8851]], "google_gemma-3-12b-it_contains_pii": [[0, 324, false], [324, 897, null], [897, 1277, null], [1277, 1957, null], [1957, 2667, null], [2667, 3194, null], [3194, 4237, null], [4237, 4237, null], [4237, 5685, null], [5685, 6920, null], [6920, 8538, null], [8538, 9701, null], [9701, 11104, null], [11104, 12001, null], [12001, 12212, null], [12212, 12494, null], [12494, 13072, null], [13072, 13823, null], [13823, 14658, null], [14658, 15327, null], [15327, 15904, null], [15904, 17188, null], [17188, 18212, null], [18212, 18353, null], [18353, 19559, null], [19559, 19752, null], [19752, 21125, null], [21125, 22535, null]], "google_gemma-3-12b-it_is_public_document": [[0, 324, true], [324, 897, null], [897, 1277, null], [1277, 1957, null], [1957, 2667, null], [2667, 3194, null], [3194, 4237, null], [4237, 4237, null], [4237, 5685, null], [5685, 6920, null], [6920, 8538, null], [8538, 9701, null], [9701, 11104, null], [11104, 12001, null], [12001, 12212, null], [12212, 12494, null], [12494, 13072, null], [13072, 13823, null], [13823, 14658, null], [14658, 15327, null], [15327, 15904, null], [15904, 17188, null], [17188, 18212, null], [18212, 18353, null], [18353, 19559, null], [19559, 19752, null], [19752, 21125, null], [21125, 22535, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 22535, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 22535, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 22535, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 22535, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 22535, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 22535, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 22535, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 22535, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 22535, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 22535, null]], "pdf_page_numbers": [[0, 324, 1], [324, 897, 2], [897, 1277, 3], [1277, 1957, 4], [1957, 2667, 5], [2667, 3194, 6], [3194, 4237, 7], [4237, 4237, 8], [4237, 5685, 9], [5685, 6920, 10], [6920, 8538, 11], [8538, 9701, 12], [9701, 11104, 13], [11104, 12001, 14], [12001, 12212, 15], [12212, 12494, 16], [12494, 13072, 17], [13072, 13823, 18], [13823, 14658, 19], [14658, 15327, 20], [15327, 15904, 21], [15904, 17188, 22], [17188, 18212, 23], [18212, 18353, 24], [18353, 19559, 25], [19559, 19752, 26], [19752, 21125, 27], [21125, 22535, 28]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 22535, 0.25]]}
olmocr_science_pdfs
2024-11-25
2024-11-25
4a9c4aa7902016f2db67a61d0cffbe8df89b58e9
Review Article Open Access Journal of Mathematical & Computer Applications ISSN: 2754-6705 Volume 3(2): 1-7 Open Access Journal of Mathematical & Computer Applications ISSN: 2754-6705 J Mathe & Comp Appli, 2024 Volume 3(2): 1-7 Automating Test Reporting: Integrating Allure Reports with GitHub Workflows for Enhanced Software Testing Abhiram Reddy Peddireddy Devops Engineer, USA ABSTRACT Allure Reports, an open-source framework, significantly enhance the visualization and comprehensibility of test results in software testing. This paper explores the integration of Allure Reports with GitHub Workflows to automate the generation, publication, and management of detailed and interactive test reports. The primary focus is on improving communication, debugging processes, and overall testing efficiency through automated, real-time reporting solutions. Key features of Allure Reports include interactive visualizations, comprehensive overviews, detailed test case information, customizable reports, and seamless integration with Continuous Integration/Continuous Deployment (CI/CD) pipelines. Additionally, the paper discusses the role of GitHub Pages and GitHub Artifacts in making test results accessible and supporting continuous integration and delivery processes. The implementation of this integration resulted in enhanced transparency, collaboration, and efficiency within development teams, as well as improved test result visibility and debugging capabilities. Empirical studies support our findings, highlighting improvements in task efficiency and reduced debugging time through the use of automated reporting and continuous integration practices [1-3]. *Corresponding author Abhiram Reddy Peddireddy, Devops Engineer, USA. Received: March 07, 2024; Accepted: March 13, 2024, Published: March 20, 2024 Keywords: Allure Reports, GitHub Workflows, Continuous Integration, Continuous Deployment, CI/CD, Software Testing, Test Result Visualization, Automated Reporting, GitHub Pages, GitHub Artifacts, Debugging, Software Development Introduction Allure Reports are a popular reporting framework used in software testing to add value to the test results obtained during the various test executions. They provide users with an easily understandable interface that reflects the details of the test execution in a very comprehensible way. The relevance of Allure Reports in the context of software testing can be understood by the contributions they make towards communication, debugging and overall testing effectiveness. Allure Reports significantly improve the software development process through enhanced visualization, communication, and debugging. By converting plain test results into interactive visualizations, charts, and dashboards, they help teams grasp overall trends and identify issues efficiently. These visual reports also facilitate effective communication among team members, stakeholders, and departments by providing a clear understanding of test results and the current state of the software. Additionally, the detailed reports enable developers to quickly locate and fix failures and defects, thereby reducing debugging time and accelerating the development lifecycle [4]. Background Allure Reports is an open-source reporting framework that offers the possibility to create rich, detailed, informative and interactive test reports from different types of test executions including unit tests, integration tests, end-to-end tests etc. The primary intent of Allure Reports is to present the test results in a very understandable and visual manner so that developers, testers and other stakeholders involved in the software project get a clear idea of where the software is in terms of the quality and the tests that are currently running or have been run on it. Introduction to GitHub Pages and GitHub Artifacts GitHub Pages allows users to host websites from a GitHub repository, enabling the sharing of documentation, tutorials, blogs, wikis, and automated test reports like Allure Reports. This promotes transparency and effective communication within teams by making test results accessible to various audiences. GitHub Artifacts, a feature of GitHub Actions, allows users to upload, manage, and download data generated during workflows. It stores and exchanges test results, logs, screenshots, and other relevant information, ensuring essential data is accessible for review and analysis, thereby streamlining CI/CD practices effectively [5]. Importance of GitHub Workflows for Automation GitHub Workflows, powered by GitHub Actions, play a crucial role in automating tests through a unified environment for continuous integration and continuous deployment (CI/CD). They facilitate the automation of tasks such as testing, building, and deploying code, minimizing manual involvement, and ensuring tests are executed automatically with each repository change. This automation enhances consistency and reliability, boosts the dependability of test outcomes, and supports the scalability of projects. GitHub Workflows promote transparency and teamwork by making all changes, test outcomes, and deployment statuses visible to the team. They integrate with various third-party tools and services, enabling the inclusion of features like code analysis and security checks in CI/CD pipelines. Traditional test reporting methods often involve manual processes that are time-consuming and error-prone. This can lead to delays in decision-making and increased risk of bugs. By automating the deployment process, GitHub Workflows ensure consistent and reliable deployments, reduce downtime, and minimize deployment errors. Overall, they improve consistency, reliability, and efficiency in the development process, aid in issue identification, promote collaboration, and support custom automation solutions [6-10]. **Problem Statement** Sharing test results in agile and distributed software development teams is challenging due to the need for timely access to outcomes for decision-making. The lack of an effective reporting system can lead to miscommunications, delays, and increased risk of bugs, especially when teams are dispersed across various locations and time zones. Traditional reporting methods like email updates or manual reports are inadequate as they can be time-consuming and error-prone. Therefore, automated reporting systems that integrate with development processes are essential to provide up-to-date test results and maintain transparency and accountability. **Objectives** The goal is to implement Allure Reports with GitHub Workflows to enhance transparency, optimize reporting efficiency, and improve collaboration among development teams through automated, continuous reporting [8]. This involves configuring GitHub Pages and integrating Allure Reports with GitHub Workflows using YAML files for automated testing and report generation. Additionally, the objective includes utilizing GitHub Artifacts to export test results, enhancing data accessibility for debugging and analysis [11]. The process aims to streamline test management, provide interactive insights in real-time, and continuously refine configurations based on feedback to bolster quality assurance and the software development lifecycle. **Significance** Improving transparency and collaboration within development teams enhances communication, minimizes misunderstandings, and facilitates real-time decision-making. Increased transparency encourages accountability by allowing easy tracking of contributions and consistent meeting of deadlines. Tools like GitHub Workflows and Allure Reports optimize documentation sharing and review processes, ultimately driving productivity, elevating software quality, and fostering a cohesive team dynamic. Additionally, improving efficiency in the software development lifecycle through refined procedures, task automation, and better team collaboration leads to timely project delivery, higher quality outcomes, and cost savings. Empirical studies have shown that integrating tools like Allure Reports with CI environments significantly enhances task efficiency and reduces debugging time, leading to more effective software development [2,3]. **Literature Review** **Overview of Allure Reports** Allure Reports offer a user visually appealing way to showcase test results with features, like test case information, compatibility with different testing frameworks and seamless integration with CI/CD tools [7]. They help improve the visibility of test results simplifying debugging processes and foster collaboration by providing reports that can be shared among team members. Allure Reports are utilized across various development environments, from small projects to large enterprises. They are particularly beneficial in environments requiring rigorous testing and continuous integration, as they offer a unified view of test results, helping teams quickly identify and address issues. **GitHub Workflows** GitHub Workflows, which are part of GitHub Actions, automate software development tasks [12]. They empower developers to create customized workflows for CI/CD processes, automate activities such as code testing, building applications and deployment. These workflows also allow integration with tools and services to streamline the development cycle. Common automation tasks include running tests whenever code is pushed creating documentation automatically managing project dependencies efficiently. Workflows are set up using YAML syntax, for adaptability to project requirements [13]. **GitHub Pages for Reporting** GitHub Pages is a service, for hosting websites that pulls files directly from a GitHub repository and displays them online. It is commonly used for sharing project documentation, personal blogs or any type of web content. To set up GitHub Pages you need to adjust the repository settings to activate the Pages feature and specify the source branch and directory. Sharing reports through GitHub Pages comes with benefits, such as providing access to reports through a simple URL receiving automated updates through the CI/CD pipeline and seamless integration with other GitHub tools [4]. This helps make reports easily accessible to team members and stakeholders promoting transparency and collaboration. **GitHub Artifacts** GitHub Artifacts enable the storage and sharing of data generated during workflow processes. These artifacts can include test results build outputs, logs or any other files that are essential for debugging, analysis or further operations. By preserving data and making it accessible even after a workflow is completed GitHub Artifacts support improvement efforts and ensure accountability [5]. Furthermore, they enhance collaboration by simplifying the sharing of information, among team members. Developers have the option to download artifacts, for investigating problems replicating bugs or confirming outcomes without having to redo the workflow, which saves both time and resources. GitHub interfaces make managing artifacts smooth and efficient thus improving the effectiveness of the CI/CD pipeline. In CI/CD pipelines artifacts play a role in transferring data between workflow steps and jobs to ensure that intermediate data and results are preserved and easily accessible [14]. Typical scenarios involve storing test results for analysis archiving build artifacts, for deployment purposes and sharing logs to troubleshoot issues. GitHub Artifacts contribute to maintaining a traceable CI/CD process by storing essential data [15]. **Methodology** **Setting Up GitHub Pages** Configuring GitHub Pages in repository settings. - To Navigate Repository Settings: Go to your GitHub repository. Click on the “Settings” tab. - Enable GitHub Pages: In the settings menu, scroll down... to the “GitHub Pages” section. Under “Source,” select the gh-pages branch from the dropdown menu. Click “Save” to apply the changes. - **Deploy Content:** Ensure your static site content (HTML, CSS, JavaScript, etc.) is pushed to the gh-pages branch, which we will discuss in the upcoming steps in detail on how to push allure report as site content generated in the GitHub workflows to gh-pages branch. - **GitHub Pages** will automatically publish the content from this gh-pages branch to your site. - **Access Your Report:** Once configured, your site will be accessible at for ex: https://potential-adventure-227v3vz.pages.github.io/. Here the link is generated by GitHub by default. We can access the link initially in two ways, they are By going to settings -> pages, Navigating to Actions and workflow called “Pages Build and Deployment”. Once you open this workflow run, we can access the link as shown in the below. We can keep this link handy as each time out content is pushed to gh-pages branch, GitHub pages use the same link to override the old content with the new content. ### Configuring GitHub Workflows Creating workflow YAML files is a critical step in configuring GitHub Actions to automate software development tasks such as building, testing, and deploying applications. These files define the steps and conditions under which workflows run, specifying actions like checking out code, setting up the environment, running tests, and deploying artifacts. Workflow YAML files provide a structured, code-based approach to automating processes, ensuring consistency and efficiency in continuous integration and continuous deployment (CI/CD) pipelines. Research indicates that employing continuous integration practices in software development projects enhances productivity and maintains high code quality, which is crucial for efficient debugging and overall testing [3]. For example: The sample “Allure Test Workflow” employs GitHub Actions, defined in a YAML configuration, to automate the testing and reporting processes in software development. Triggered by push events to the main branch or manually via the workflow dispatch trigger, this workflow facilitates continuous integration and delivery by ensuring consistent testing across various development phases. The workflow operations are structured as follows: - **Code Checkout:** Utilizes the actions/checkout@v2 action, specified in the YAML file, to clone the latest version of the repository code, ensuring that tests are performed on the most current commit. - **Java Environment Setup:** Configures a Java 11 runtime environment using the actions/setup-java@v2 action. This step is vital for projects that depend on Java, as it ensures the environment consistency across different execution contexts. - **Test Execution:** Executes tests through the Gradle build tool by running the command “./gradlew clean test”, which is specified in the YAML. This ensures that all tests are run on a clean state, thereby maintaining the accuracy of the test results. - **Allure CLI Installation:** This step involves installing the Allure Command Line Interface on the GitHub runner, which is necessary for the subsequent generation of test reports. This installation step is adaptable; depending on the project’s reporting needs, different versions of Allure or entirely different reporting tools can be installed. - **Allure Report Generation:** Generates a comprehensive visual report from test results using allure generate, directed at the “path/to/allure-results”. This step enhances the visibility and understandability of test outcomes. - **Report Upload:** The generated Allure report is uploaded as an artifact via actions/upload-artifact@v2, facilitating easy access and subsequent analysis directly from the GitHub platform. This GitHub Actions workflow exemplifies how YAML configurations can be leveraged to automate crucial aspects of software testing and reporting, thereby accelerating development cycles and enhancing the overall software quality. The sample workflow illustrates the overall process of how test results are generated and how one can produce and publish an Allure report to GitHub Pages. We will explore in detail the methods involved in generating reports in the subsequent sections of this paper. In the ensuing discussion, we will delineate a methodical approach to generating and disseminating Allure reports within a project framework. This exposition aims to systematically outline the procedural integration of Allure for testing and reporting purposes, the subsequent deployment of these reports to GitHub Pages, and the enhancement of cross-team accessibility, thereby augmenting the collaborative dynamics throughout the developmental lifecycle. The procedural steps articulated herein predominantly focus on the generation of test results and Allure reports, examining the dependencies and variabilities across different frameworks. This structured exploration not only facilitates a deeper understanding of Allure’s application in diverse environments but also underscores the significance of comprehensive documentation and accessibility in fostering an informed and collaborative project atmosphere. ![Figure 1: YAML Configuration Example for Allure Test Workflow](image.png) Setting Up Allure in the Project Running tests and generating Allure Reports In this section, we explore an automated deployment testing process implemented in a GitHub Actions workflow, essential for validating software functionality in a production-like environment. The step “Execute Deployment Tests” utilizes a Gradle wrapper script to conduct tests, configured dynamically based on environmental variables such as browser type, build version, and deployment environment. This occurs within the default GitHub Actions workspace, ensuring file path accuracy. Test outputs are both displayed live and saved to output.txt for thorough examination. Specific errors, indicated by failures in the test scenarios, are extracted into overview.txt, allowing for quick identification and resolution of issues. Finally, the log file is systematically renamed with the GitHub Actions run number, augmenting the traceability and accountability of the testing process. This automated approach exemplifies effective continuous integration practices, demonstrating how structured testing and detailed logging can significantly enhance software development and deployment strategies. Step-By-Step Guide for Installing and Configuring Allure In the outlined workflow, we detail the incorporation of the Allure command-line tool within a GitHub Actions environment, focusing on enhancing the automation and precision of software testing reports. The process is segmented into three structured steps, emphasizing systematic execution and standardization in reporting. Figure 2: Command Line Instructions for Installing Allure CLI • Installation of Allure Command-Line Tool This initial step involves the automated installation of the Allure tool, executed via a series of commands that download the specified version (2.17.1) from the Maven repository, unzip the package in a temporary directory, and relocate the installation to a more permanent location (/opt/allure). This sequence ensures that the Allure tool is both accessible and updated to maintain consistency across testing environments. • Environment Setup Subsequently, an environment variable (REPORT NAME) is defined to systematically name the Allure report, incorporating the GitHub Actions run number. This convention facilitates the easy identification and correlation of reports with specific test executions, critical for historical data analysis and audit trails. • Generation of Allure Report The final step utilizes the installed Allure tool to generate a report from test results located in a specified directory (gradleReports/cucumber/deployment/allure-results). The report is outputted to a dynamically named directory based on the previously set environment variable, ensuring that each report is uniquely identifiable and stored systematically. Through this approach, the workflow not only automates the generation of detailed testing reports but also institutes a methodical naming and storage protocol, significantly enhancing the manageability and traceability of software testing outcomes within project cycles. This structured reporting mechanism is pivotal in supporting continuous integration and development practices in modern software engineering environments. Publishing Reports to GitHub Pages • Deploying Allure Reports to GitHub Pages the workflow employs the peaceiris/actions-gh-pages@v2 GitHub Action, a widely used tool for deploying content to GitHub Pages. This action simplifies the process of web publishing directly from GitHub repositories, allowing for seamless integration of test reports into a project’s documentation ecosystem. • The action uses a GitHub token ($ secrets.YOUR TOKEN), which securely authenticates the workflow to GitHub, ensuring that operations are performed with integrity and without exposing sensitive access credentials. • Directory specification The deployment is directed towards the publish_dir, which dynamically references the environment variable $ env.REPORT_NAME. This variable specifies the directory where the Allure report is stored, thereby linking the publishing process directly to the uniquely named output directory of the test report generated in previous steps. This publishing step not only enhances the visibility of the test results by making them available on a web platform but also ensures that they are accessible to stakeholders at any time. By integrating these reports into GitHub Pages, the process fosters greater collaboration and communication across teams, facilitating a more transparent review and analysis of continuous testing outcomes. This approach exemplifies best practices in leveraging automation for the efficient dissemination of key project artifacts within the software development lifecycle. Facilitating Cross-Team Access By Integrating report links in team communication tools, this step is configured to operate within the GitHub workspace where it constructs a detailed message combining various elements: • Test Results Heading: Includes a descriptive title and a hyperlink to the detailed actions run, facilitating direct access to full execution logs and additional details within the GitHub repository. • Overview of Test Results: Extracts and formats the contents of overview.txt, which contains a summary of failed scenarios from the deployment sanity tests, into a readable format for the Teams message. • Link to Allure Report: Adds a formatted message providing a link to the Allure report (which we can retrieve and use as explained in the previous steps on Gh-pages), enhancing the message with direct access to comprehensive test reports for detailed review. • Message Formatting and Sending: The constructed message is formatted to escape special characters and newline transformations suitable for JSON payloads. It is then sent to the specified Microsoft Teams channel using a webhook URL stored in GitHub secrets, ensuring the message’s secure transmission. This automated notification step is instrumental in bridging the gap between test execution and stakeholder notification, enabling real-time updates and fostering an environment of immediate feedback and continuous improvement. By integrating direct communications into the workflow, teams are kept informed of testing statuses, which is essential for rapid response to potential issues and maintaining high standards of software quality in fast-paced development environments. This practice underscores the importance of communication. Figure 3: Integrating Report Links into Team Communication Tools tools in modern software engineering, aligning with research that emphasizes the role of transparency and collaboration in successful project outcomes. Utilizing GitHub Artifacts By uploading test results as artifacts. This workflow step employs the GitHub Action actions/upload-artifact@v2 to systematically upload the generated Allure report to GitHub's artifact storage. This facilitates both the preservation and sharing of detailed test results, which are pivotal for continuous integration and development cycles. Figure 4: Uploading Test Results as GitHub Artifacts • Artifact Configuration The action is configured to name and locate the artifact using the environment variable REPORT_NAME, which dynamically specifies both the name of the artifact and the directory path from which the report is uploaded. This ensures that each report is distinctly named according to its specific test run, enhancing the traceability of artifacts. • Purpose and Impact Uploading the Allure report as an artifact serves multiple purposes: it secures a permanent record of test outputs, provides team members with immediate access to test results, and supports compliance with audit requirements. By automating this step, the workflow ensures that all pertinent test data is readily available for any necessary review or retrospective analysis. These artifacts can be accessed by going to the respective workflow run summary. Figure 5: Accessing Artifacts in GitHub Workflow Runs We can download the allure report artifact and run it using command “python3 -m http.server 8000” (This requires python to be installed in terminal either in Mac or WSL for Windows) then access it at the http://localhost:8000 for future reference. Once downloaded navigate to the directory where artifact is present. Once you are in the directory use command "python3 -m http.server 8000" and it will serve the report at http://localhost:8000. Navigate to the browser and you can access the report at “http://localhost:8000.” This automated archival method exemplifies best practices in managing test data, aligning with research that emphasizes the importance of data preservation in software engineering. It highlights how automated workflows can significantly contribute to improving project documentation, accountability, and overall project management efficiency. Figure 6: Raw Format of Downloaded Allure Report Locally Figure 7: Serving Allure Report to Local Host Using Python J Mathe & Comp AppI, 2024 Volume 3(2): 5-7 Results and Discussion Implementation Outcomes Achievements Figure 8: Accessing Allure Report via Loopback URL - Enhanced Visualization: Allure Reports offer interactive representations facilitating comprehension of test outcomes and issue identification. A study on Feedback-Driven Development highlights that developers using automated feedback mechanisms, such as Allure Reports integrated with CI tools, achieve more efficient task completion and reduced debugging time [1]. - Automation and Efficiency: By integrating with GitHub Workflows, report generation and distribution are automated, ensuring results, with manual input. Research shows that continuous integration improves productivity of project teams, enabling more efficient integration of contributions and maintaining code quality [2]. This supports our observed 25% increase in overall testing efficiency. - Improved Communication: Clear visual reports promote transparency and comprehension among team members and stakeholders. - Efficient Debugging: Comprehensive insights assist developers in pinpointing and resolving issues reducing downtime. Study evaluating the impact of continuous integration practices reveals that projects adhering to CI best practices experience fewer bugs and improved productivity, supporting our finding of a 30% reduction in debugging time [3]. Visual examples of published Allure Reports and artifacts. Challenges - Configuration Complexity: Setting up the integration requires thorough understanding and careful planning. - Compatibility Issues: Ensuring compatibility across testing frameworks and CI/CD tools can be challenging, potentially requiring configurations. - Maintenance Overhead: Regular updates and adjustments are essential to sustain integration operation. - Resource Constraints: Efficient handling and storage of test reports is vital to prevent performance issues. In summary, integrating Allure Reports with GitHub Workflows improves visualization, efficiency, and collaboration in software development, despite some configuration and maintenance challenges. Sharing test reports on GitHub Pages has proven to be a method for improving accessibility and transparency. This approach allows team members to access real-time test results supporting project monitoring. The smooth integration with GitHub Pages makes it easy for stakeholders to view and evaluate test outcomes fostering a culture of openness and accountability. Benefits for Cross-Team Collaboration By integrating Allure Reports with GitHub Workflows, transparency is increased through automated generation and sharing of test reports. This ensures that all team members have access to the results promoting collaboration and enhancing collective decision making. Efficiency in Test Result Exporting - Evaluation of GitHub Artifacts in streamlining test result sharing. GitHub Artifacts play a crucial role in efficiently exporting and sharing test results. By storing test outputs as artifacts, the workflow ensures that results are easily accessible for further analysis. This capability is particularly beneficial for debugging, as artifacts provide a consistent and reliable way to access necessary data without rerunning tests. Example: A company implementing continuous delivery used Allure Reports integrated with GitHub Workflows to ensure that all stakeholders, including non-technical members, had real-time access to test outcomes. This accessibility reduced the time spent in meetings to discuss testing progress and allowed for quicker feedback and iteration. - Metrics and feedback from team members. Feedback: Developers highlighted that integrating Allure Reports with GitHub Workflows and leveraging GitHub Artifacts significantly decreased the time spent on reporting tasks enabling developers to concentrate more on coding and less on duties. Conclusion Summary of Findings To enhance visualization, accessibility, and organization of test results, Allure Reports were integrated with GitHub Workflows. This setup involved automating report generation, publishing on GitHub Pages, and using GitHub Artifacts for storing and sharing test outcomes. The integration improved transparency, teamwork, and productivity within the development unit. Automated reporting reduced manual work, provided easy access to test results, and expedited issue resolution. Allure Reports’ improved visualization facilitated better understanding and communication of test findings. These findings are supported by empirical research, which demonstrates the positive impact of continuous integration and automated reporting tools on reducing debugging time and increasing testing efficiency [1-3]. **Implications of Future Work** There is potential to further enhance the CI/CD pipeline by integrating additional tools and automating more aspects of the testing and deployment processes. This includes exploring more advanced features of GitHub Actions and Allure Reports to further streamline workflows and improve efficiency. For ex: currently GitHub pages support only one report for hosting, when new report is generated old one is replaced with new one potential developments in future may support hosting multiple pages at once. Other teams are encouraged to adopt similar integrations to improve their development workflows. Key recommendations include thorough planning and configuration of workflows, continuous monitoring and adjustment to maintain compatibility and efficiency, and leveraging the capabilities of GitHub Pages and Artifacts to enhance accessibility and collaboration. Implementing these practices can lead to better project management, higher code quality, and more effective communication among team members. **References** 5. M Mowad, H Fawareh, M A Hassan (2022) Effect of Using Continuous Integration (CI) and Continuous Delivery (CD) Deployment in DevOps to reduce the Gap between Developer and Operation. 2022 International Arab Conference on Information Technology (ACIT), Abu Dhabi, United Arab Emirates1-8.
{"Source-Url": "https://www.onlinescientificresearch.com/articles/automating-test-reporting-integrating-allure-reports-with-github-workflows-for-enhanced-software-testing.pdf", "len_cl100k_base": 5624, "olmocr-version": "0.1.50", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 20034, "total-output-tokens": 6927, "length": "2e12", "weborganizer": {"__label__adult": 0.00023508071899414065, "__label__art_design": 0.00023674964904785156, "__label__crime_law": 0.00016236305236816406, "__label__education_jobs": 0.0006241798400878906, "__label__entertainment": 4.8220157623291016e-05, "__label__fashion_beauty": 9.739398956298828e-05, "__label__finance_business": 0.00014495849609375, "__label__food_dining": 0.00018799304962158203, "__label__games": 0.0004394054412841797, "__label__hardware": 0.0003809928894042969, "__label__health": 0.0002071857452392578, "__label__history": 0.00011974573135375977, "__label__home_hobbies": 4.7266483306884766e-05, "__label__industrial": 0.00016927719116210938, "__label__literature": 0.0001703500747680664, "__label__politics": 0.00011795759201049803, "__label__religion": 0.0002598762512207031, "__label__science_tech": 0.004962921142578125, "__label__social_life": 8.296966552734375e-05, "__label__software": 0.01136016845703125, "__label__software_dev": 0.9794921875, "__label__sports_fitness": 0.00016570091247558594, "__label__transportation": 0.0001977682113647461, "__label__travel": 0.00013077259063720703}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 35183, 0.02411]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 35183, 0.14392]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 35183, 0.88536]], "google_gemma-3-12b-it_contains_pii": [[0, 5105, false], [5105, 11834, null], [11834, 17143, null], [17143, 23349, null], [23349, 26214, null], [26214, 30569, null], [30569, 35183, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5105, true], [5105, 11834, null], [11834, 17143, null], [17143, 23349, null], [23349, 26214, null], [26214, 30569, null], [30569, 35183, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 35183, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 35183, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 35183, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 35183, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 35183, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 35183, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 35183, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 35183, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 35183, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 35183, null]], "pdf_page_numbers": [[0, 5105, 1], [5105, 11834, 2], [11834, 17143, 3], [17143, 23349, 4], [23349, 26214, 5], [26214, 30569, 6], [30569, 35183, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 35183, 0.0]]}
olmocr_science_pdfs
2024-11-28
2024-11-28
44d702614e3211bba04d73c7fef2a55c508239a3
Integration Panel: Whole Label Evaluation (WLE) Rules Background What are Whole Label Evaluation (WLE) rules Whole label evaluation rules determine the validity of a label based on whether its code points appear in permissible contexts. They are called “whole label” because the context may, in some cases, involve the whole label. However, in many cases of practical relevance, rules based on the immediate context (adjacent code points or label boundaries) are sufficient to decide whether the label should be valid. Because any label that consists entirely of code points in the repertoire is normally valid, the effect of a WLE rule is to further restrict the set of valid labels. For example, a WLE rule may not permit labels that start (or end) with certain code points. WLE rules can be formulated to apply to specific code points or classes of similar code points. They can be used to evaluate an entire label, or just the context around a specific instance of a particular code point at a given position in the label. Why are WLE rules needed Many kinds of code points can occur in any position and in any combination in a label without causing any problems. Labels are intended to be mnemonics and there is no requirement that they form actual words in any language. However, certain code points can cause issues in processing and presentation if they appear out of their intended context. Labels that cannot be processed or rendered reliably present a risk of confusion or a risk to DNS security. WLE rules exist to prevent such labels. In contrast, WLE rules are not intended to enforce “spelling rules” for any particular orthography, such as requiring that the letter “q” always be followed by the letter “u”. When to consider WLE rules WLE rules may be considered whenever some sequences of code points should be generally prohibited within a script, and when it is not possible to prevent such sequences by removing some or all of their constituent code points altogether from the repertoire. Such prohibited sequences are particularly important wherever the display of the code points outside these contexts becomes unpredictable for a given script or gives rise to a security risk. A typical example of this would be combining marks, code points that graphically combine with the preceding code point. While Unicode does not restrict their application, most rendering engines are only prepared to deal with combinations actually required or allowed in a given language or script. For many scripts, WLEs may not be needed. Their benefit may not be compelling and their complexity cost may be high. If a label merely ‘looks bad’ when ill-formed, that may not be a reason to filter it. The same applies to sequences of code points that ‘can’t happen’ in a given writing system, but that merely look incorrect to the native reader, while not posing issues to a rendering system, or for security. Simple requirements such as pair context can often be addressed by declaring the pair a member of the repertoire as itself, while making sure that at least one code point in each sequence is not also part of the repertoire. To do so enforces the requirement that the code point may only occur as part of that specific sequence. For example, if a certain combining mark occurs with only one or a few base code points, the repertoire could list the permissible sequences, but not the combining mark itself. This makes sure that labels containing permissible sequences are valid, but prevents arbitrary application of the combining mark. This simple technique avoids the need to create a WLE rule. If needed, the approach can be extended to longer sequences as well. Rule based approaches are more suitable where marks can occur in many contexts. **Complex scripts** In general, WLE rules are more appropriate for code points in “complex scripts” as opposed to “simple” scripts. A simple script is one where each code point forms an isolated unit, and code points can generally appear in any order (combining diacritics would be an exception). Complex scripts are those that have complex layout behavior, and only a subset of all possible code point sequences would ever expected to occur. The unit of writing is generally a cluster of code points, or even a full syllable. Inside a syllable, the constituent code points corresponding to consonants, vowels, tone marks etc. do not occur in arbitrary positions, but reflect a syllable structure specific to the script. **Appropriate WLE rules** WLE rules can be used to limit the context in which certain code points or marks may appear, so that they fall in the range expected (and supported) by typical rendering engines. Examples of WLE rules that might be appropriate include: - limiting combining diacritics to those combinations that are required (unless handled by adding the sequence, but not the diacritic, to the repertoire) - disallowing vowel marks where they can’t be rendered, such as at the start or following other vowel marks - disallowing tone marks where they aren’t expected, such as following another tone mark, or not following a vowel - disallowing marks like halants, that are intended to act on consonants, from appearing after vowels - disallowing multiple combining marks (diacritics) applied to the same base letter, for writing systems where such use is not required **What contexts can WLE rules describe?** WLE rules effectively implement a subset of the functionality of common regular expressions, but with a few extensions. They support these common features: • literals, • greedy repetition (0 or more, 1 or more, minimal, maximal repetition) with yielding, • character classes (enumerated or based on Unicode properties), • set operations on character classes, • grouping • alternatives (or) • positional operators (start / end of label) They also support the following extensions: • common subexpressions • anchored evaluation (parameterized) The former perform like macros, the latter allows a rule to be evaluated at a particular location in the label and substituting the actual code point at that location as if it was a literal in the regex. Anchored evaluation is used to implement context rules for a given code point, while all the other features are used for ordinary WLE rules that evaluate a whole-label. **How are WLE Rules expressed in XML?** WLE rules can be expressed in the formal XML syntax for Label Generation Rules [RFC7940] in several ways. The simplest way is a context rule associated with a specific code point. WLE rules can define constraints in two ways: • Required contexts – positive assertions that the code point must appear in a certain location or together with specific code points; or • Prohibited contexts – negative assertions that the code point must not appear in a certain location or together with specific code points. In both cases, the intent of the WLE rule is to specify which labels are not valid – even though they contain only valid code points – due to not meeting the constraints on context for these code points in the given label. Whether a context is defined as required or as prohibited is a choice that would be based on the nature of the restriction, and sometimes on whether it makes it easier to express the restriction in [RFC7940] as one or the other. In [RFC7940], such contexts are described as named `<rule>` elements, which are associated with a given code point via a “when” or “not-when” attribute that refers to the context by name. ```xml <char cp="0000" when="some-required-context" /> <char cp="0001" not-when="some-prohibited-context" /> ``` The context rules may contain an `<anchor>` element as placeholder for the code point for which the context is to be evaluated. When an `<anchor>` is used, any context before or after it in the same `<rule>` must be enclosed in a `<look-behind>` or `<look-ahead>` element. ```xml <rule name="some-required-context"> ``` The preceding rule defines a sample context where the code point in question follows code point U+0002. Whether this is a required or prohibited context is defined by how it is used. If used with a “when” attribute it acts a required context, if used with the “not-when” attribute it acts as a prohibited context. Each label is scanned for the contexts associated with any “when” or “not-when” attributes for each of its code points. If a code point is found in a prohibited context, or conversely, if the code point is not found in a required context, then the code point at that position in the label is deemed invalid, invalidating the label. Some rules require the context of the full label. They are expressed in [RFC7940] as rules that do not contain an <anchor> element. In some cases, they may not even be associated with specific code points. Instead, they would be associated with one or more <action> elements by using a “match” or “not-match” attribute as in the following examples: ```xml <action disp="invalid" match="ill-formed-label" /> <action disp="invalid" not-match="well-formed-label" /> ``` Here “ill-formed-label” and “well-formed-label” are assumed to be the names of <rule> elements matched by certain ill-formed or well-formed labels respectively. Each action is evaluated at most once per label, and if a label matches a rule describing an ill-formed label (or in the second case, if it doesn’t match the description of a well-formed label) the action causes a final disposition to be assigned to the label, as specified in the action’s “disp” attribute. For example, when an <action> element has the disposition of “invalid” the rule and type of match attribute on the action are chosen in such a way that the action is only triggered if a label is invalid. That label is then given the disposition “invalid”. The choice of whether a rule is constructed as positive (matches valid labels) or negative (matches invalid labels) does not affect the result as long as the correct match attribute is chosen. In many cases, one or the other expression, though equivalent, is easier to understand and verify than the alternative, making it the preferred choice. More details on how to specify WLE rules in XML can be found in [RFC7940], [Regex-XML] and in the section on Examples of WLE rules below. **Examples of WLE rules** This section gives a number of examples of different types of WLE rules. The last one of these examples covers a strategy that can be used to reduce the complexity of certain rules, without necessarily compromising their benefits. Context rules in IDNA2008 IDNA2008 contains a number of context rules, which cover a wide range of scenarios for WLE rules. In the IDNA2008 specification they are given in pseudocode. “IDNA 2008 Rules in XML” [IDNA-XML] shows how they can be translated into the XML format defined in [RFC7940]. Example 1, Restricting a combining mark to specific sequences Code Point U+0331 COMBINING MACRON BELOW is used in various pre-composed letters (in the Unicode character names for these letters it is typically called LINE BELOW but it is the same diacritical mark). Normally, because a U-label in IDNA 2008 is in normalization form NFC, code points that can only be part of already composed sequences are not needed, because the sequences are normalized away in favor of the precomposed forms. However, the African Reference Alphabet\(^1\) defines letters that would require additional sequences (such as c, q, s, and x) with a line below and which are not already encoded. It might be desirable to allow those, but not any other sequences. A WLE rule could be defined to restrict the combining macron below to occur only after the letters c, q, s, and x. Such a rule would require the definition of a class, or set of code points, (here called cqsx after the letters it contains) that includes all the supported base characters for the combining mark. ```xml <class name="cqsx"> <char cp="0063" /> <char cp="0071" /> <char cp="0073" /> <char cp="0078" /> </class> ``` This definition is referenced in a rule that requires the code point for which the rule is evaluated (the “anchor”) to be in the context defined by the rule. Here, the code point must follow the class “cqsx”. ```xml <rule name="follows-cqsx"> <look-behind> <class by-ref="cqsx" /> </look-behind> <anchor /> </rule> ``` This rule would be invoked with a `when="follows-cqsx"` attribute for the code point U+0331: ```xml <char cp="0331" when="follows-cqsx" /> ``` When everything is put together, the effect of the XML fragments in this example is that the only letters that can occur with a line below are any of the precomposed letters as well as the combinations <0063 0331>, <0071 0331>, <0073 0331> and <0078 0331>. Alternatively, these sequences, but not the combining mark itself (0331), could have been directly added to the repertoire. This is a simpler and therefore preferable method whenever the permissible code point sequences are easily enumerated. For example: ```xml <char cp="063 0331" comment="c with macron below" /> <char cp="071 0331" comment="q with macron below" /> <char cp="073 0331" comment="s with macron below" /> <char cp="078 0331" comment="x with macron below" /> ``` **A note on naming** It is convenient to name rules for left-hand contexts “following-XXXX” where “XXXX” is chosen to be as descriptive of the details of the context. For example, “following-cqsx” can be readily understood when seen where it is applied ```xml <char cp="0331" when="follows-cqsx" /> ``` whereas a name like “context-for-0331” can only be understood by reference to the actual rule itself. For right-hand contexts, the convention would be “precedes-XXXX”. Because simple contexts are always preferable over complex ones, the majority of rule names would follow one of these two patterns. **Example 2, Intersyllabic tsheg** The Tibetan intersyllabic tsheg (U+0F0B) is a code point that is exceptionally PVALID in IDNA2008. Unicode classifies the code point as a punctuation mark, but the tsheg is required between all syllables of all polysyllabic words in Tibetan. While leaving this code point out of a zone repertoire would make it impossible to use readable polysyllabic words as mnemonic labels in Tibetan, it is probably a good idea to prevent extraneous tshegs in a label. That would require a WLE rule that prevents a tsheg from starting or ending a label, or from being adjacent to another tsheg. This requirement is captured, for example, by the following regular expression that defines the three prohibited contexts, where T stands for the tsheg. `(^T|TT|T$)` Here ^ and $ stand for the start and end of the label. () and | indicate that there are three alternative contexts that are prohibited. Any label *matching* that regular expression would not be a valid label. [Regex-XML] provides a listing of elements in the XML format and their equivalent regular expression operators. Using this, we can translate the regular expression into the corresponding XML format. In the XML format, the context is expressed as a single named rule (prohibited-for-intersyllabic-tshek). Because it is essentially a compound of three alternatives, that rule in turn consists of a single <choice> element with three subordinate rules describing the three alternative terms of the regular expression above. Each subordinate rule defines one of the ineligible contexts for an intersyllabic tshek, with the special elements <start> and <end> referring to the beginning and end of the label, just like ^ and $ in a regular expression. Inside each subordinate rule, all elements are matched in sequence, while in the <choice> each subordinate rule is matched in order until there is a match for the entire context or there are no more subordinate rules left. Note that with one exception, none of these subordinate rules references the intersyllabic tshek (0F0B) directly. Instead they each contain an instance of an <anchor> element, which is a stand-in for the code point for which the rule is being evaluated. To invoke the rule every time a label contains an intersyllabic tshek, we attach it to the entry for code point U+0F0B in the <data> section of the XML file using a “not-when” attribute: ``` <char cp="0F0B" not-when="prohibited-for-intersyllabic-tshek" /> ``` Doing so attribute marks the intersyllabic tshek as invalid whenever it is placed in a context that matches the rule referenced by the “not-when” attribute. When evaluating the rule, each <anchor> element is replaced by a intersyllabic tshek at the given location. The rule would be evaluated repeatedly, once for every tshek in the label. There are indications that in actual texts the *tshegs* may occur at the end of words. If it is desirable to support this, the WLE rule for this code point would have to be revised accordingly. **Example 3, Syllables in the Thaana script** The Thaana script is written in syllables, but the encoding form chosen is that of an alphabet. As a result, all consonants, with one exception, must be followed by a vowel sign. Also, each syllable only has one vowel sign. Because Thaana vowels are encoded as combining marks, applying multiple vowels to a consonant not only creates forms that native readers will not understand, but could also lead to the marks being undetectably overprinted on top of each other, which would be a security risk. These restrictions being fundamental to the script itself, they might make a good candidate for a WLE rule. There are several alternative, yet equivalent ways that these restrictions can be expressed in the XML format. **Alternative 1 — Associate Code Points with Tags** The following defines the entire repertoire of the Thaana script, as used for IDNs, and associates each code point with a tag, indentifying code point as consonant or vowel. All code points, except U+0782, are also associated with one of two required contexts by using the “when” attribute. ```xml <data> <range first-cp="0780" last-cp="0781" tag="consonant" when="precedes-vowel" /> <char cp="0782" tag="consonant" /> <!-- no when rule --> <range first-cp="0783" last-cp="07A5" tag="consonant" when="precedes-vowel" /> <range first-cp="07A6" last-cp="07B0" tag="vowel" when="follows-consonant" /> <char cp="07B1" tag="consonant" when="precedes-vowel" /> </data> ``` The contexts define whether a code point must follow a consonant (true for vowels) or must precede a vowel (true for all but one consonant). Here are the XML fragments defining these contexts. Note how they refer to the classification of the code point by the tag values. ```xml <rules> <rule name="follows-consonant"> <look-behind> <class from-tag="consonant" /> </look-behind> <anchor /> </rule> <rule name="precedes-vowel"> <anchor /> <look-ahead> <class from-tag="vowel" /> </look-ahead> <anchor /> </rule> <!-- any code point with tag="vowel" --> </rules> ``` Note how this set of contexts is really equivalent to requiring that every syllable be well-formed, thus essentially requiring each label to be sequence of well formed syllables. However, these rules do not introduce the concept of a syllable, nor do they necessarily evaluate the context of the entire label, resulting in a considerable reduction in complexity. We will use the same technique in a later example where the rules for syllable formation are more complex. But first, we show some alternative formulations of WLE rules that achieve the same results. **Alternative 2—Use Explicit Character Classes** This alternative formulation avoids the use of “tag” values in favor of defining explicit character classes. ```xml <!-- same repertoire as before, except not using "tag" --> <data> <range first-cp="0780" last-cp="0781" when="precedes-vowel" /> <char cp="0782" /> <rule name="precedes-vowel"> <look-ahead> <class by-ref="vowel" /> </look-ahead> <anchor /> </rule> <rule name="follows-consonant"> <look-behind> <class by-ref="consonant" /> </look-behind> <anchor /> </rule> </rules> <!-- explicit definition of sets --> <class name="consonant" comment="set of consonants"> <range first-cp="0780" last-cp="07A5" /> <char cp="07B1" /> </class> <class name="vowel" comment="set of vowels"> <range first-cp="07A6" last-cp="07B0" /> </class> <!-- same context rules as before, except using "by-ref" --> ``` The downside of explicitly declared classes is that they could get out of synch with the repertoire and where tags match the natural division of a script into elements like vowels and consonants, having tags serves to document the organization of the script and can make it easier to understand the intent of the rules. In some situations, declaring some classes explicitly, or using the available set operators defined in [RFC7940] to create classes by combining other ones may make the statement of a particular rule more elegant or easier to understand and verify. **Alternative 3—Evaluating the Whole Label** It is possible to achieve the same restriction without the context rule, that is, by formally writing a rule evaluated over a whole label. In this example, the statement of the rules becomes rather simpler, but it is perhaps more difficult to tell which code point is affected by which context. ```xml <data> <range first-cp="0780" last-cp="07A5"/> <range first-cp="07A6" last-cp="07B0"/> <char cp="07B1"/> </data> <rules> <!-- same set definitions as before --> <class name="consonant" comment="set of consonants"> <range first-cp="0780" last-cp="07A5"/> <char cp="07B1"/> </class> <class name="vowel" comment="set of vowels"> <range first-cp="07A6" last-cp="07B0"/> </class> <!-- by using "class" instead of "anchor" the two contexts become the same --> <rule name="vowel-follows-consonant"> <class by-ref="consonant"/> <class by-ref="vowel"/> </rule> ... </rules> ``` To force evaluation of these rules we need a rule that expresses a Thaana label as a sequence of permissible contexts as well as an action that disposes as invalid any label that does not match a sequence of Thaana syllables from start to end: ```xml <rule name="Thaana-Syllables"> <start/> <choice count="1+"> <rule by-ref="vowel-follows-consonant"/> <char cp="0782"/> </choice> <end/> </rule> ... <action disp="invalid" not-match="Thaana-Syllables"/> </rules> ``` In all the alternatives for these WLE rules, the restrictions are slightly looser than the full linguistic rule, which allows a “bare” U+0782 only in certain contexts. However, to model the script behavior more faithfully in this regard seems to provide only limited benefit, but with substantial increase in complexity. Example 4, Syllables in neo-Brahmi scripts When it comes to the neo-Brahmi scripts of India, the encoding model adopted by the Unicode Standard does not automatically prohibit code point sequences that cannot occur in actual writing. It merely encodes the elements that make up each syllable (akshara), and not the aksharas directly. Labels that contain ill-formed aksharas may not render in a predictable manner. That makes it tempting from a security point of view to strictly limit the label to a sequence of well-formed syllables. Alternative 1 — Well-formed Syllables Notionally, a sequence of well-formed syllables can be expressed as a pseudo regular expression as follows: ``` ^Syllable+$ ``` where ^ and $ correspond to the start and end of the label, and Syllable+ indicates one or more occurrences of a valid syllable. We would need to define what constitutes a well-formed syllable. A definition of a syllable, conveniently expressed in Backus-Naur form can be found in [Indic-Layout]. Indic Syllables can be formed using one of three rules Rule 1: **V[m]** Rule 2: **{CnH}Cn[v][m]** Rule 3: **CnH** (at end of label) Where: - **V** independent vowel - **v** dependent vowel sign (matra) - **m** vowel modifier (Devanagari Anusvara, Visarga, and Candrabindu) - **Cn** consonant (with inherent vowel), optionally followed by a Nukta, short for C[n] - **H** Halant (or Virama) - **{}** encloses items which may be repeated zero or more times - **[]** encloses items which may or may not be present --- 2 Please note that the syllable constraints shown here are presented as an example to show different methods of representing complex script contexts in WLE rules. The details of the constraints may not correspond to the full complexity of such syllables. Likewise, a real design for an actual LGR supporting one of these scripts may well differ in important ways from the pedagogical examples presented here. (A common reason for deviation from the theoretical model is the fact that different languages may have slightly different constraint, but mixed use may need to be supported). Let’s look at these rules in turn. Here are examples of all the syllable types formed by Rule 1: \( V[m] \) \[ \begin{align*} \text{\texttt{\textbackslash u0b09\textbackslash u0b1c\textbackslash u091a\textbackslash u092b}} &= V \\ \text{\texttt{\textbackslash u0b09\textbackslash u0b1c\textbackslash u091a\textbackslash u092b\textbackslash u0930\textbackslash u093e\textbackslash u0915}} &= Vm \\ \end{align*} \] Here are examples of some of the syllables that can be formed under Rule 2: \( \{CnH\}Cn[v][m] \) \[ \begin{align*} \text{\texttt{\textbackslash u091c\textbackslash u093e\textbackslash u0916\textbackslash u092a\textbackslash u0930\textbackslash u093e\textbackslash u0915}} &= C \\ \text{\texttt{\textbackslash u091c\textbackslash u093e\textbackslash u0916\textbackslash u092a\textbackslash u0930\textbackslash u093e\textbackslash u0915\textbackslash u0923}} &= Cn \\ \text{\texttt{\textbackslash u091c\textbackslash u093e\textbackslash u0916\textbackslash u092a\textbackslash u0930\textbackslash u093e\textbackslash u0915\textbackslash u0923\textbackslash u090c\textbackslash u0930\textbackslash u093e\textbackslash u0915}} &= CnH \\ \text{\texttt{\textbackslash u091c\textbackslash u093e\textbackslash u0916\textbackslash u092a\textbackslash u0930\textbackslash u093e\textbackslash u0915\textbackslash u0923\textbackslash u090c\textbackslash u0930\textbackslash u093e\textbackslash u0915\textbackslash u091c\textbackslash u0930\textbackslash u093e\textbackslash u0915}} &= CnHC \\ \text{\texttt{\textbackslash u091c\textbackslash u093e\textbackslash u0916\textbackslash u092a\textbackslash u0930\textbackslash u093e\textbackslash u0915\textbackslash u0923\textbackslash u090c\textbackslash u0930\textbackslash u093e\textbackslash u0915\textbackslash u091c\textbackslash u0930\textbackslash u093e\textbackslash u0915\textbackslash u091c}} &= CnHCv \\ \end{align*} \] Translating this into a single WLE rule seems formidable; therefore we will consider an alternate. **Alternative 2—Reduction to Pair Contexts** From the rules we can read off several simpler restrictions on some of the constituents: 1. H must follow Cn 2. v must follow Cn\(^3\) 3. n must follow C 4. m must not follow H 5. H must precede C or end of label (rule 3) Note that the first two requirements describe an identical context even though they apply to different sets of code points. If presented as “when” rule both would be implemented as \[\text{\texttt{\textbackslash u091c\textbackslash u093e\textbackslash u0916\textbackslash u092a\textbackslash u0930\textbackslash u093e\textbackslash u0915\textbackslash u0923\textbackslash u090c\textbackslash u0930\textbackslash u093e\textbackslash u0915\textbackslash u091c\textbackslash u0930\textbackslash u093e\textbackslash u0915\textbackslash u091c}}\] \[^3\] A sequence of type Vv is sometimes recommended, so as to obviate the need to encode yet another independent vowel V’ with a glyph corresponding to that of the sequence Vv. Examples exist in the Bengali script. A complete set of rules would have to go beyond the BNF in [Indic-Layout] in order to account for such exceptions. and invoked with a when=“follows-nukta-or-consonant” attribute on any code point for a dependent vowel or halant. When the rule is evaluated, the <anchor /> would either be a dependent vowel or a halant and any label not matching the context condition would be invalid. In the repertoire, the code point for the nukta (09C3) would have a tag=“nukta”, and all consonant code points would need to be tagged with tag=“consonant” so that they can be referred to in the rule using the <class> element with a "from-tag" attribute as shown above. An alternative to a single-member class as for the nukta is to list the code point directly in the rule <char cp="093C" comment="nukta" /> This may be appropriate when the code point is also part of some other larger set, for example, if a rule needs to exceptionally treat one of the consonants. But when the code point forms a class of its own (a nukta is neither a consonant nor vowel nor a halant) then giving it a tag may be more natural. The next two requirements lead to rules that are slightly simpler: The second rule assumes that halant is tagged with tag=“halant”. The rule would be invoked with a “not-when” tag, since, according to requirement 4, a preceding halant is a prohibited context. Finally, we need to associate each halant with the rule ```xml <rule name="precedes-consonant-or-end"> <anchor /> <look-ahead> <choice> <class from-tag="consonant" /> </choice> </look-ahead> </rule> ``` describing the contexts specified by the last requirement (must precede C or end of label). Compare this set of simple rules to the Indic Structure example in the XML specification [RFC7940] and the reduction in complexity becomes very apparent. Why is this? The one term of Rule 2 that we have not covered is \[ \{C_n H\} C... \] which rules out creating syllables from \(C_n C_n\) without intervening H, but because \(C_n\) can occur on its own (without any of the other terms) sequences of consonants not connected by a Halant \(C_n\) do occur, except not in a single syllable. Since we are not interested in knowing where the syllables begin or end, accounting for the term \(\{C_n H\} C...\) is unnecessary. **Conclusion** WLE rules are an invaluable tool for restricting labels that are problematic or potentially risky, but they introduce complexity into the label generation rules for a zone. In designing WLE rules for any zone, it is beneficial to strive for the least complex solution that achieves the required restriction on labels. For the root zone, in particular, this approach has been mandated in the [LGR-Procedure] by reference to the principles laid out in [RFC6912]. These were originally formulated in reference to the task of repertoire selection, but are nevertheless adaptable and applicable to this purpose. Techniques to reduce the complexity include - disallowing a code point by excluding it from the repertoire in order to avoid complex behavior associated with that code point; - specifying a pair or sequence to limit acceptable sequences to only those enumerated in the repertoire; - defining simple (usually pair) contexts, commonly for left-hand contexts, over more complex rules modeling full syllables or labels; - using context rules on sequences to avoid having to build a sequence into a rule; - and finally, recognizing that not all labels that a user might perceive as ‘malformed’ need to be restricted; some do not pose security issues. References
{"Source-Url": "https://community.icann.org/download/attachments/43989034/Whole-Label-Evaluation-Rules-2017-09-15.pdf?api=v2&modificationDate=1506443392000&version=1", "len_cl100k_base": 7562, "olmocr-version": "0.1.50", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 41667, "total-output-tokens": 9142, "length": "2e12", "weborganizer": {"__label__adult": 0.0004210472106933594, "__label__art_design": 0.00264739990234375, "__label__crime_law": 0.000732421875, "__label__education_jobs": 0.0025634765625, "__label__entertainment": 0.0004131793975830078, "__label__fashion_beauty": 0.0002586841583251953, "__label__finance_business": 0.0005621910095214844, "__label__food_dining": 0.0002834796905517578, "__label__games": 0.001125335693359375, "__label__hardware": 0.0010576248168945312, "__label__health": 0.0002925395965576172, "__label__history": 0.0006170272827148438, "__label__home_hobbies": 0.00011646747589111328, "__label__industrial": 0.0005941390991210938, "__label__literature": 0.0031566619873046875, "__label__politics": 0.0004169940948486328, "__label__religion": 0.000865936279296875, "__label__science_tech": 0.12744140625, "__label__social_life": 0.00017464160919189453, "__label__software": 0.0682373046875, "__label__software_dev": 0.787109375, "__label__sports_fitness": 0.00032258033752441406, "__label__transportation": 0.0004191398620605469, "__label__travel": 0.00021827220916748047}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 32855, 0.02241]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 32855, 0.82114]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 32855, 0.86847]], "google_gemma-3-12b-it_contains_pii": [[0, 2711, false], [2711, 5566, null], [5566, 7954, null], [7954, 10540, null], [10540, 12872, null], [12872, 15155, null], [15155, 16784, null], [16784, 19097, null], [19097, 20888, null], [20888, 22587, null], [22587, 25017, null], [25017, 28147, null], [28147, 29396, null], [29396, 31611, null], [31611, 32855, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2711, true], [2711, 5566, null], [5566, 7954, null], [7954, 10540, null], [10540, 12872, null], [12872, 15155, null], [15155, 16784, null], [16784, 19097, null], [19097, 20888, null], [20888, 22587, null], [22587, 25017, null], [25017, 28147, null], [28147, 29396, null], [29396, 31611, null], [31611, 32855, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 32855, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 32855, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 32855, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 32855, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 32855, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 32855, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 32855, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 32855, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 32855, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 32855, null]], "pdf_page_numbers": [[0, 2711, 1], [2711, 5566, 2], [5566, 7954, 3], [7954, 10540, 4], [10540, 12872, 5], [12872, 15155, 6], [15155, 16784, 7], [16784, 19097, 8], [19097, 20888, 9], [20888, 22587, 10], [22587, 25017, 11], [25017, 28147, 12], [28147, 29396, 13], [29396, 31611, 14], [31611, 32855, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 32855, 0.0]]}
olmocr_science_pdfs
2024-11-29
2024-11-29
8304376f6f0f2f18ed4706797c4d3cfae212ae70
YAM++: (not) Yet Another Matcher for Ontology Matching Task Duy Hoa Ngo, Zohra Bellahsene To cite this version: HAL Id: lirmm-00720648 https://hal-lirmm.ccsd.cnrs.fr/lirmm-00720648 Submitted on 25 Jul 2012 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. YAM++ : (not) Yet Another Matcher for Ontology Matching Task DuyHoa Ngo, Zohra Bellahsene Université Montpellier 2, INRIA, LIRMM Montpellier - France {firstname.name@lirmm.fr} August 21, 2012 Abstract In this paper, we present the capability of our ontology matching tool YAM++. We show that YAM++ is able to discover mappings between entities of given two ontologies by using machine learning approach. Besides, we also demonstrate that if the training data are not available, YAM++ can discover mappings by using information retrieval techniques. Finally, we show that YAM++ is able to deal with multi-lingual ontologies matching problem. 1 Introduction Ontology matching is a key solution to deal with the semantic heterogeneity problem. It discovers the mappings between semantically related entities of ontologies. By agreeing with these mappings, a common vocabulary and a unified understanding can be used to describe and ultimately analyze data [2]. Many diverse solutions of matching have been proposed so far; however, there is no integrated solution that is a clear success [8]. Therefore, ontology matching still attracts a lot of interest and attention of researchers. There are many challenges in ontology matching task. A matcher tool can be seen as a combination of three sub-matchers such as: Element level matcher, Structural matcher and Semantical matcher. Generally, element level matcher discovers mappings by comparing annotation (i.e., labels, comments) of entities. It may use many different similarity metrics to handle the high terminological heterogeneity of ontologies. A difficult challenge here is how to combine different metrics effectively. Additionally, if labels of entities in ontologies are represented by different languages, the matching process is even more difficult. Structural matcher discovers mappings of entities based on analyzing their structural information. However, according to [2], most of them don’t work well when the structures of ontologies are different. Moreover, structural matcher is error-prone, since it strongly depends on initial mappings provided by element level matcher. Semantical matcher is mainly used to refine candidate mappings. It exploits the semantic constraints between entities in ontologies in order to remove inconsistent mappings. It is a NP-complete problem [3] to find the global optimization results. To handle these challenges, we propose our solution as follows: • If labels of entities are written by different languages, we use a multi lingual translator to translate labels from other languages into English. • We use machine learning based approach to combine different similarity metrics at element level matcher. In case we don’t have training data, we propose a similarity metrics based on information retrieval techniques. • We use a graph matching, in particular similarity propagation method, which is known as the most stable method dealing with structural information to discover additional mappings. • In terms of semantic refinement, we use the Global Optimal Diagnosis method [3]. The rest of the paper is organized as follows. In Section 2, we present an overview of YAM++ system. Section 3 contains the demonstration scenarios. In section 4, we summarize our contributions. 2 YAM++ Overview YAM++ system is an extension of our previous system YAM - not Yet Another Matcher for schema matching [1] to deal with ontology matching task. In the new system, we maintain the basis idea of using machine learning technique to combine different similarity metrics. However, YAM++ was also extended to work without using machine learning (i.e., when learning data are not available). In this extension, YAM++ exploits the intrinsic textual features of ontologies in order to provide a similarity metrics based on information retrieval techniques. Moreover, we add similarity propagation method and semantic verification module in order to discover and refine mappings between entities based on their structural and semantic information. Fig. 1 depicts the main components of YAM++ system. YAM++ discovers mappings between two input ontologies by two matchers: element level matcher and structural level matcher. The combination results of element level and structural level are then revised by the semantic checking in order to remove inconsistent mappings. - At element level, input ontologies are processed in order to extract annotation information for every entity. Based on these information, similarity score between entities are computed by different terminological metrics. Here, similarity metrics can work independently or can be combined by combination methods in order to produce mappings at element level. Currently, YAM++ support machine learning based combination methods such as Decision Tree, SVM, NaiveBayes\(^1\), etc. In that case, the training data are provided by user or are taken from knowledge base (KB) resources. - At structural level, input ontologies are parsed and transformed into graph data structure. Then, YAM++ takes result obtained from element level as initial mappings to run a similarity propagation process. The propagation algorithm here is inspired from the well known Similarity Flooding algorithm [4]. See [6] for more detail about our extension of similarity propagation method. - In semantical checking module, we make use of global constraint optimization method proposed in Alcomo tool\(^2\). The resulting mappings of two ontologies alinment are displayed in graphical user interface. User can judge a mapping as correct or not by their knowledge of ontologies’domain. User can also modify, remove incorrect mappings or add new mappings with the help of command operations shown in system’s menu (Fig. 2). 3 Demonstration Scenarios YAM++ has been implemented in Java, offering a GUI to select different configuration options and display matching results. In this demo, we show the capabilities of YAM++: (i) matching with --- \(^1\)http://www.cs.waikato.ac.nz/ml/weka/ \(^2\)http://web.informatik.uni-mannheim.de/alcomo/ machine learning method, (ii) matching with information retrieval method, and (iii) matching with multi-lingual ontologies. ### 3.1 Experiment Settings #### Evaluation Metrics In the experiments, we use three standard evaluation metrics such as harmonic mean (H-mean) of precision, recall and f-measure to evaluate the matching quality of YAM++ on a set of tests. \[ H(p) = \left( \frac{\sum_{i=1}^{n} |C_i|}{\sum_{i=1}^{n} |A_i|} \right), \quad H(r) = \left( \frac{\sum_{i=1}^{n} |C_i|}{\sum_{i=1}^{n} |R_i|} \right), \quad H(fm) = \frac{2 \cdot H_p \cdot H_r}{H_p + H_r} \] Here, assume that we have \( n \) tests. Let \( i \) indicates \( i \)th test; \( |R_i| \) refers to the number of reference mappings provided by expert domain, \( |A_i| \) is the total number of mappings discovered by a matching system and \( |C_i| \) is the number of correct mappings. #### Test Cases In demonstration, YAM++ is able to discover mappings between any two input ontologies provided by user. In order to evaluate the matching quality of YAM++, we use two data sets widely used in the ontology matching field to compare the matching quality of other participants of OAEI campaign. - The Conference\(^3\) track contains 16 ontologies from the same domain (conference organization) and each ontology can be matched against with other ontology. Due to the high heterogeneity of these ontologies, finding mappings between them is very difficult. - The Multifarm\(^4\) data sets, which has been designed as a comprehensive benchmark for multilingual ontology matching. This dataset is composed of a subset of the Conference dataset, translated in eight different languages (Chinese, Czech, Dutch, French, German, Portuguese, Russian, and Spanish). ### 3.2 Matching with machine learning method. In the first scenario, we assume that user has several gold standard data sets, which consist of two ontologies and a corresponding alignment provided by expert of domain. User may think that he/she can study some matching patterns from the existing data sets to discover new mappings from new matching scenario with to-be-matched ontologies. Obviously, manually finding mappings is not applicable with the big size of ontologies. Therefore, user would like to use the existing data as training data to train a machine learning model. Then, the learning model will automatically examine every pair of entities from to-be-matched ontologies and classify them into match or not. ![Figure 3: Comparison result on Conference 2011 track](http://oaei.ontologymatching.org/2011/conference/index.html) \( ^3 \)http://oaei.ontologymatching.org/2011/conference/index.html \( ^4 \)http://web.informatik.uni-mannheim.de/multifarm/ Based on this idea, YAM++ provides different kinds of similarity metrics, which can be used to represent different features of each pair of entities from two to-be-matched ontologies. The existing data selected by user are then transformed into training data. Then, YAM++ performs a training process on the user’s selected machine learning model to produce a trained classifier. The classifier produces mappings between ontologies. If user select structural method in the next step, these mappings will be passed to input of the similarity propagation process. Finally, the mapping results will be shown in the display for user’s judgment. For more detail about similarity metrics and machine learning based combination, we refer reader to our paper [5, 7]. Fig. 3 shows the comparison result of YAM++ with other participants on the Conference track in OAEI 2011 campaign5. This was the first time we participate in the OAEI competition. At this time, YAM++ stayed in Top 2 among all participants. Especially, in terms of $F_1$ measure, it achieved the best matching tool title. 3.3 Matching with information retrieval method. In this second scenario, we assume that related gold standard data sets are not available. In that case method of using machine learning model is not applicable. In order to overcome this weakness, YAM++ supports a discovering method based on information retrieval techniques. In particular, YAM++ studies annotation information of entities in the both to-be-matched ontologies. Based on the frequency appearance of a word, YAM++ determines amount of informativeness of that word within the ontology. Then, YAM++ provides a metric to compare similarity between entities’ labels. Moreover, YAM++ studies the context to which entities belong. The context information is also used to compute similarity between entities. Both labels method and context method are inspired from information retrieval techniques. Similar to the first scenario, user can select similarity propagation for next step to discover more mappings by exploiting structural information of entities. Fig. 4 shows the comparison result of YAM++ with other participants on the Conference track in OAEI 2011.5 campaign6. This was the second time we participate to the OAEI competition with non learning YAM++ system. At this time, YAM++ obtained the best matching result and dominated all other participants. <table> <thead> <tr> <th>Matcher</th> <th>Threshold</th> <th>Precision</th> <th>P@0.5 measure</th> <th>$F_1$ measure</th> <th>$F_2$ measure</th> <th>Recall</th> </tr> </thead> <tbody> <tr> <td>YAM++</td> <td>0</td> <td>0.87</td> <td>0.73</td> <td>0.71</td> <td>0.68</td> <td>0.69</td> </tr> <tr> <td>LogMap</td> <td>0</td> <td>0.62</td> <td>0.61</td> <td>0.59</td> <td>0.59</td> <td>0.57</td> </tr> <tr> <td>CODI</td> <td>0</td> <td>0.74</td> <td>0.64</td> <td>0.64</td> <td>0.6</td> <td>0.57</td> </tr> <tr> <td>Hertuda</td> <td>0</td> <td>0.79</td> <td>0.6</td> <td>0.6</td> <td>0.53</td> <td>0.49</td> </tr> <tr> <td>WeSE</td> <td>0.33</td> <td>0.71</td> <td>0.65</td> <td>0.58</td> <td>0.53</td> <td>0.5</td> </tr> <tr> <td>Baseline2</td> <td>0</td> <td>0.79</td> <td>0.7</td> <td>0.64</td> <td>0.59</td> <td>0.47</td> </tr> <tr> <td>LogMap1</td> <td>0</td> <td>0.73</td> <td>0.67</td> <td>0.59</td> <td>0.53</td> <td>0.5</td> </tr> <tr> <td>COMMA</td> <td>0</td> <td>0.84</td> <td>0.71</td> <td>0.58</td> <td>0.49</td> <td>0.44</td> </tr> <tr> <td>AUTOMSYS5</td> <td>0</td> <td>0.79</td> <td>0.69</td> <td>0.56</td> <td>0.47</td> <td>0.43</td> </tr> <tr> <td>Baseline</td> <td>0</td> <td>0.78</td> <td>0.66</td> <td>0.56</td> <td>0.47</td> <td>0.43</td> </tr> <tr> <td>MamMiche</td> <td>0.89</td> <td>0.74</td> <td>0.64</td> <td>0.54</td> <td>0.46</td> <td>0.42</td> </tr> <tr> <td>MapSSS</td> <td>0</td> <td>0.79</td> <td>0.69</td> <td>0.56</td> <td>0.47</td> <td>0.43</td> </tr> <tr> <td>MapPSO</td> <td>0.67</td> <td>0.79</td> <td>0.68</td> <td>0.56</td> <td>0.47</td> <td>0.43</td> </tr> <tr> <td>MapEvo</td> <td>0.02</td> <td>0.04</td> <td>0.03</td> <td>0.03</td> <td>0.02</td> <td>0.02</td> </tr> </tbody> </table> Figure 4: Comparison result on Conference 2011.5 track 3.4 Matching with multi-lingual ontologies In the last scenario, we show the ability of YAM++ to work with multi-lingual ontologies matching. When user provide two to-be-matched ontologies, YAM++ read annotations of entities in order to determine which language is used in each ontology. Once the languages are defined, YAM++ use Microsoft Bing Translator tool7 to translate all labels from other languages to English. After that, 5http://oaei.ontologymatching.org/2011/ 6http://oaei.ontologymatching.org/2011.5/ 7http://www.microsofttranslator.com/ YAM++ discovers mappings between entities based on their translated labels by our proposed information retrieval methods. The returned mappings are passed as input to similarity propagation process to discover more mappings. <table> <thead> <tr> <th>Matching system</th> <th>Different ontologies (type i)</th> <th>Same ontologies (type ii)</th> </tr> </thead> <tbody> <tr> <td></td> <td>Size</td> <td>Precision</td> </tr> <tr> <td>YAM++</td> <td>4211</td> <td>0.24</td> </tr> <tr> <td>AUTOMSv2</td> <td>4211</td> <td>0.24</td> </tr> <tr> <td>WeSeE</td> <td>737</td> <td>0.42</td> </tr> <tr> <td>CIDER</td> <td>345</td> <td>0.34</td> </tr> <tr> <td>MapSSS</td> <td>1273</td> <td>0.16</td> </tr> <tr> <td>LogMap</td> <td>335</td> <td>0.36</td> </tr> <tr> <td>LogMapLt</td> <td>417</td> <td>0.26</td> </tr> <tr> <td>CSA</td> <td>8482</td> <td>0.02</td> </tr> <tr> <td>MapLEVO</td> <td>4731</td> <td>0.01</td> </tr> </tbody> </table> Fig. 5 shows the comparison result between YAM++ and other participants of OAEI 2011.5 campaign on Multifarm data sets. There are two types of evaluation. In the first type, all matching tools deal with different ontologies with different languages. In this evaluation, YAM++ achieved the best matching quality (Fmeasure = 0.45). In the second type, all tools discover mappings of the same ontologies but translated in different languages. In this evaluation, YAM++ obtained the second position among all participants. 4 Conclusion In this paper, we present YAM++ - an ontology matching tool, which supports: (i) discovering alignment of ontologies by machine learning approaches; (ii) discovering alignment of ontologies by generic methods without using learning techniques; (iii) discovering alignment of ontologies represented in different languages. Moreover, our YAM++ tool produces the best matching quality on Benchmark, Conference and Multifarm tracks in comparison with other participants on OAEI 2011 and OAEI 2011.5 campaigns. The running tool can be found at http://www2.lirmm.fr/~dngo/. References
{"Source-Url": "https://hal-lirmm.ccsd.cnrs.fr/lirmm-00720648/document", "len_cl100k_base": 4198, "olmocr-version": "0.1.51", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 12958, "total-output-tokens": 5091, "length": "2e12", "weborganizer": {"__label__adult": 0.0004088878631591797, "__label__art_design": 0.0006289482116699219, "__label__crime_law": 0.0006737709045410156, "__label__education_jobs": 0.0021381378173828125, "__label__entertainment": 0.0002052783966064453, "__label__fashion_beauty": 0.0002548694610595703, "__label__finance_business": 0.0006804466247558594, "__label__food_dining": 0.0004513263702392578, "__label__games": 0.0008096694946289062, "__label__hardware": 0.0008549690246582031, "__label__health": 0.0009984970092773438, "__label__history": 0.0005488395690917969, "__label__home_hobbies": 0.00013124942779541016, "__label__industrial": 0.0006341934204101562, "__label__literature": 0.0010395050048828125, "__label__politics": 0.0006475448608398438, "__label__religion": 0.0008006095886230469, "__label__science_tech": 0.331298828125, "__label__social_life": 0.00032639503479003906, "__label__software": 0.06451416015625, "__label__software_dev": 0.5908203125, "__label__sports_fitness": 0.0003497600555419922, "__label__transportation": 0.0005731582641601562, "__label__travel": 0.0003390312194824219}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 17932, 0.07336]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 17932, 0.12429]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 17932, 0.82248]], "google_gemma-3-12b-it_contains_pii": [[0, 1019, false], [1019, 4306, null], [4306, 7104, null], [7104, 9817, null], [9817, 14383, null], [14383, 17932, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1019, true], [1019, 4306, null], [4306, 7104, null], [7104, 9817, null], [9817, 14383, null], [14383, 17932, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 17932, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 17932, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 17932, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 17932, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 17932, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 17932, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 17932, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 17932, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 17932, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 17932, null]], "pdf_page_numbers": [[0, 1019, 1], [1019, 4306, 2], [4306, 7104, 3], [7104, 9817, 4], [9817, 14383, 5], [14383, 17932, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 17932, 0.26168]]}
olmocr_science_pdfs
2024-12-04
2024-12-04
022f455d5584d0b96c62e6d8c0e448b0b0becd12
TopCoffea with the work queue executor Ben Tovar btovar@nd.edu where we are "This demo topcoffea runs on my laptop, but I need much more for the real application. It would be great if we can run $O(10K)$ tasks like this on this cloud/grid/cluster I have heard so much about." where we want to be Cooperative Computing Lab Tools (CCTools) (work queue, resource monitor, ...) CCTools Objectives • Harness all the resources that are available: desktops, clusters, clouds, and grids. • Make it easy to scale up from one desktop to national scale infrastructure. • Provide familiar interfaces that make it easy to connect existing apps together. • Allow portability across operating systems, storage systems, middleware... • Make simple things easy, and complex things possible. • No special privileges required. CCTools - Open source, GNU General Public License. - Runs on Linux, MacOS* - Interoperates with many distributed computing systems. - Condor, SGE, Torque, Globus, iRODS, Hadoop... most used components **Makeflow**: A portable workflow manager What to run? **Work Queue**: A lightweight distributed execution system What to run and where to run it? **Chirp**: A user-level distributed filesystem Where to get/put the data? **Parrot**: A personal user-level virtual file system How to read/write the data? topcoffea as a manager-worker application manager-worker application all events chunk chunk chunk topcoffe chunk chunk chunk chunk = task manager-worker application topcoffea In a manager worker application... manager-worker application The manager process generates tasks, puts them in a queue... manager-worker application ... delivers them to worker processes to execute... manager-worker application ... waits for workers to execute tasks ... manager-worker application and gathers the results on completion. manager-worker application and on and on until no more tasks are generated. manager-worker application topcoffe worker process in campus condor cluster worker process in Amazon cloud resources $$$ 15 TopCoffea without work queue Need to replicate environment at workers local machine remote work queue worker python environment topcoffea + wq topcoffea task using the work queue executor ```python # topcoffea/analysis/topEFT/work_queue_run.py ... # minimum executor arguments: executors_args = { 'schema': NanoAODSchema, 'master-name': '{}-wq-coffea'.format(os.environ['USER']), 'environment-file': topeftenv.get_environment(), 'port': 9123, # or a range [9123, 9130] 'extra-input-files': ['topeft.py'], } ... 'environment-file': topeftenv.get_environment(), - get_environment() generates a python environment that can easily be transferred to workers. - the environment is created once per the latest git commit in the topcoffea directory. - if there are unstaged changes, the environment is regenerated everytime! - (this is expensive, so remember to commit your changes) - last three environments are kept in: topcoffea/analysis/topEFT/envs running work queue $ conda activate topcoffea-env $ cd topcoffea/analysis/topEFT $ python work_queue_run.py --chunksize 10000 ..../topcoffea/cfg/mycfg.cfg # in some other terminal, launch a worker for that manager # workers don't need PYTHONPATH set. # -M my-manager-name to serve managers with that name # it could be a regexp. # --single-shot to terminate after serving one manager # In general workers may serve many managers in their # lifetime, but only one at a time. $ conda activate topcoffea-env $ work_queue_worker -M $USER-wq-topcoffea --single-shot how do workers find the manager? - my name is... - I am at... - catalog server - ccl.cse.nd.edu - worker process - where is a manager with name ...? <table> <thead> <tr> <th>PROJECT</th> <th>HOST</th> <th>PORT</th> <th>WAITING</th> <th>RUNNING</th> <th>COMPLETE</th> <th>WORKERS</th> </tr> </thead> <tbody> <tr> <td>geomTRIC</td> <td>128.120.146.3</td> <td>9000</td> <td>823</td> <td>0</td> <td>761</td> <td>0</td> </tr> <tr> <td>geomTRIC</td> <td>128.120.146.3</td> <td>8999</td> <td>793</td> <td>0</td> <td>791</td> <td>0</td> </tr> <tr> <td>btovar-wq-topcoffee</td> <td>earth.crc.nd.edu</td> <td>9123</td> <td>10</td> <td>0</td> <td>0</td> <td>0</td> </tr> <tr> <td>lobster_kmohrman_EFT</td> <td>earth.crc.nd.edu</td> <td>9000</td> <td>2680</td> <td>899</td> <td>125466</td> <td>565</td> </tr> <tr> <td>lobster_rgoldouz_L1A</td> <td>earth.crc.nd.edu</td> <td>9001</td> <td>0</td> <td>7</td> <td>79</td> <td>11</td> </tr> <tr> <td>EEMT-cc58588456b17c2</td> <td>vm65-195.iplantcollaborator</td> <td>20003</td> <td>365</td> <td>0</td> <td>0</td> <td>0</td> </tr> <tr> <td>EEMT-cc58588456b17c2</td> <td>vm65-195.iplantcollaborator</td> <td>20007</td> <td>365</td> <td>0</td> <td>0</td> <td>0</td> </tr> <tr> <td>EEMT_LARGE-cc5858845</td> <td>vm65-195.iplantcollaborator</td> <td>20015</td> <td>365</td> <td>0</td> <td>0</td> <td>0</td> </tr> <tr> <td>EEMT-cc58588456b17c2</td> <td>vm65-195.iplantcollaborator</td> <td>20001</td> <td>365</td> <td>0</td> <td>0</td> <td>0</td> </tr> <tr> <td>EEMT-cc58588456b17c2</td> <td>vm65-195.iplantcollaborator</td> <td>20012</td> <td>365</td> <td>0</td> <td>0</td> <td>0</td> </tr> <tr> <td>EEMT-cc58588456b17c2</td> <td>vm65-195.iplantcollaborator</td> <td>20008</td> <td>365</td> <td>0</td> <td>0</td> <td>0</td> </tr> <tr> <td>EEMT-cc58588456b17c2</td> <td>vm65-195.iplantcollaborator</td> <td>20000</td> <td>365</td> <td>0</td> <td>0</td> <td>0</td> </tr> </tbody> </table> chosen manager name create a worker in condor # using \ to break the command in multiple lines # you can omit the \ and put everything in one line # run 3 workers in condor, each of size 1 cores, 2048 MB # of memory and 4096 MB of disk, # to serve ${USER}-my-makeflow # and which timeout after 60s of being idle. $ condor_submit_worker --cores 1 \ --memory 2000 \ --disk 4000 \ -M my-manager-name \ --timeout 60 \ 3 work queue resource management resources contract: running several tasks in a worker concurrently Worker has available: i cores j MB of memory k MB of disk Task needs: m cores n MB of memory o MB of disk Task runs only if it fits in the currently available worker resources. resources contract example Worker has available: 8 cores 512 MB of memory 512 MB of disk Task a: 4 cores 100 MB of memory 100 MB of disk Task b: 3 cores 100 MB of memory 100 MB of disk Tasks a and b may run in worker at the same time. (Work could still run another 1 core task.) Beware! tasks use all worker on missing declarations Worker has available: 8 cores 512 MB of memory 500 TB of disk Task a: 4 cores 100 MB of memory Task b: 3 cores 100 MB of memory Tasks a and b may NOT run in worker at the same time. (disk resource is not specified.) specifying tasks resources # categories are groups of tasks with the same resource requirements # specify resources in executor args: executors_args = { 'schema': NanoAODSchema, 'master-name': '{}-wq-coffea'.format(os.environ['USER']), 'environment-file': topeftenv.get_environment(), 'port': 9123, # or a range [9123, 9130] 'extra-input-files': ["topeft.py"], 'cores': 1, 'memory': 2000, # in MB 'disk': 4000, # in MB } managing resources Do nothing (default if tasks don't declare cores, memory or disk): One task per worker, task occupies the whole worker. Honor contract (default if tasks declare resources): Task declares cores, memory, and disk (the three of them!) Worker runs as many concurrent tasks as they fit. Tasks may use more resources than declared. Monitoring and Enforcement: Tasks fail (permanently) if they go above the resources declared. Automatic resource labeling: Tasks are retried with resources that maximize throughput, or minimize waste. Monitoring resource usage ```python # executors_args = { 'schema': NanoAODSchema, 'master-name': '{}-wq-coffea'.format(os.environ['USER']), 'environment-file': topeftenv.get_environment(), 'port': 9123, # or a range [9123, 9130] 'extra-input-files': ['topeft.py'], 'cores': 1, 'memory': 2000, # in MB 'disk': 4000, # in MB 'resource-monitor': True, # does not work in OSX 'verbose': True } ``` Monitoring resource usage Task (id #1) complete: ./certs_wrapper.sh --environment full_env_d7122b27_HEAD.tar.gz --unp nction.p item_0.p output_0.p (Return code 0) Allocated cores: 1, memory: 2000 MB, disk: 4000 MB, gpus: 0 Measured cores: 1, memory: 631 MB, disk 408 MB, gpus: 0, runtime 39.550364 Tasks fail permanently on resource exhaustion Task (id #1) complete: ./certs_wrapper.sh --environment full_env_d7122b27_HEAD.tar.gz --unpack-to ction.p item_0.p output_0.p (return code 143) Allocated cores: 1, memory: 2 MB, disk: 2 MB, gpus: 0 Measured cores: 1, memory: 1 MB, disk 391 MB, gpus: 0, runtime 0.003314 Task id #1 failed with code: 16 automatic resource labeling when you don't know how big your tasks are Tasks which size (e.g., cores, memory, and disk) is not known until runtime. One task per worker: Wasted resources, reduced throughput. Many tasks per worker: Resource contention/exhaustion, reduced throughput Task-in-the-Box workers Task-in-the-Box Allocations inside a worker workers Task-in-the-Box One task per allocation One task per allocation workers Task-in-the-Box One task per allocation Task exhausted its allocation workers Task-in-the-Box - One task per allocation - Retry allocating a whole worker workers automatic resource labeling ```python # executors_args = { 'schema': NanoAODSchema, 'master-name': '{}-wq-coffea'.format(os.environ['USER']), 'environment-file': topeftenv.get_environment(), 'port': 9123, # or a range [9123, 9130] 'extra-input-files': ['topeft.py'], 'cores': 2, # now resources are maximum allowed 'memory': 4000, # in MB 'disk': 4000, # in MB 'resource-monitor': True, 'resources-mode': 'auto', 'verbose': True } ``` what work queue does behind the scenes 1. Some tasks are run using full workers. 2. Statistics are collected. 3. Allocations computed to maximize throughput, or minimize waste. a. Run task using guessed size. b. If task exhausts guessed size, keep retrying on full (bigger) workers, or a specified cores, memory or disk is reached. 4. When statistics become out-of-date, go to 1. At least one task that is now waiting, failed exhausting these much of the resource. ~ no fixed resource set, and all tasks have run under this value other work queue capabilities how many workers do I submit? my name is XYZ I am at HOSTPORT catalog server ccl.cse.nd.edu worker process where is a manager with name XYZ? topcoffea the work queue factory my name is XYZ I am at HOSTPORT catalog server ccl.cse.nd.edu how many workers XYZ needs? where is a manager with name XYZ? worker process batch system submit work queue workers topcoffe work queue factory the work queue factory Factory creates workers as needed by the manager: ``` $ work_queue_factory -Tcondor \ -M ${USER}-wq-topcoffeea --min-workers 5 --max-workers 200 --cores 1 --memory 4096 --disk 10000 ``` the work queue factory -- conf file to make adjustments the configuration file can be modified once the factory is running $ work_queue_factory -Tcondor -C my-conf.json $ cat my-conf.json { "manager-name": "btovar-wq-topcoffea", "max-workers": 200, "min-workers": 5, "workers-per-cycle": 5, "cores": 4, "disk": 10000, "memory": 4096, "timeout": 900, "tasks-per-worker": 4 } for topcoffea, set to number of cores of workers configuring runtime logs We recommend to always enable all the logs. ```python eexecutors_args = { 'schema': NanoAODSchema, 'master-name': '{}-wq-coffeal'.format(os.environ['USER']), 'environment-file': topeftenv.get_environment(), 'port': 9123, # or a range [9123, 9130] 'extra-input-files': ['topeft.py'], 'cores': 2, # now resources are maximum allowed 'memory': 4000, # in MB 'disk': 4000, # in MB 'resource-monitor': True, 'resources-mode': 'auto', 'verbose': True 'debug-log': 'debug.log', 'transactions-log': 'tr.log', 'stats-log': 'stats.log', } ``` $ grep '\<TASK 1\>' tr.log 1550697985850270 9374 TASK 1 WAITING my-tasks FIRST_RESOURCES {"cores": [1, "cores"]} 1550698004105770 9374 TASK 1 RUNNING 127.0.0.1:40730 FIRST_RESOURCES {"cores": [1, "cores"], "memory": "MB"} 1550698004473367 9374 TASK 1 WAITING RETRIEVAL 127.0.0.1:40730 1550698004475215 9374 TASK 1 RETRIEVED RESOURCE_EXHAUSTION {"disk": [20, "MB"]} 1550698004475384 9374 TASK 1 WAITING my-tasks MAX_RESOURCES {"cores": [1, "cores"], "memory": "MB"} 1550698046053626 9374 TASK 1 RUNNING 127.0.0.1:40734 MAX_RESOURCES {"cores": [1, "cores"], "memory": "MB"} 1550698046444043 9374 TASK 1 WAITING RETRIEVAL 127.0.0.1:40734 1550698046444540 9374 TASK 1 RETRIEVED SUCCESS {"start": [1550698046079981, "us"], "end": [155069804638569, "us"], "memory": [1, 38569, "MB"], "virtual_memory": [6, "MB"], "swap_memory": [0, 0, "MB"], "bytes_written": [0, 0, "MB"], "bytes_received": [0, 0, "MB"], "bytes_sent": [0, 0, "MB"], "bandwidth": [7, 0, "Mbps"], "disk": [20, "MB"], "machine_cpu": [8, "cores"], "machine_load": [0.31, 0.31, "procs"]} 1550698046445762 9374 TASK 1 DONE SUCCESS {"start": [1550698046079981, "us"], "end": [1550698046445762, "us"], "memory": [1, 38569, "MB"], "virtual_memory": [6, "MB"], "swap_memory": [0, 0, "MB"], "bytes_written": [0, 0, "MB"], "bytes_received": [0, 0, "MB"], "bytes_sent": [0, 0, "MB"], "bandwidth": [0, 0, "Mbps"], "disk": [201, "MB"], "machine_cpu": [8, "cores"], "machine_load": [0.31, 0.31, "procs"]} statistics log Use `work_queue_graph_log` to visualize the statistics log: ``` $ work_queue_graph_log stats.log $ display my_stats.*.svn ``` other ways to access statistics $ work_queue_status -l HOST PORT {"name":"cclws16.cse.nd.edu","address":"129.74.153.171","tasks_total_disk":0,... Work Queue API http://ccl.cse.nd.edu/software/manuals/api/python http://ccl.cse.nd.edu/software/manuals/api/perl http://ccl.cse.nd.edu/software/manuals/api/C thanks! questions: btovar@nd.edu forum: https://ccl.cse.nd.edu/community/forum manuals: http://ccl.cse.nd.edu/software repositories: https://github.com/cooperative-computing-lab/cctools https://github.com/cooperative-computing-lab/makeflow-examples This work was supported by: NSF grant ACI 1642609 "SI2-SSE: Scaling up Science on Cyberinfrastructure with the Cooperative Computing Tools" DOE grant ER26110 "dV/dt - Accelerating the Rate of Progress Towards Extreme Scale Collaborative Science" extra slides using the work queue executor: setup ```bash # install miniconda from # https://docs.conda.io/en/latest/miniconda.html $ conda create --yes --name topcoffea-env python=3.8 dill $ conda activate --yes topcoffea-env $ conda install --yes -c conda-forge coffea ndcctools xrootd $ git clone https://github.com/TopEFT/topcoffea.git $ cd topcoffea $ pip install -e . $ cd topcoffea/analysis/topEFT ``` Stand-alone resource monitoring ``` resource_monitor -L"cores: 4" -L"memory: 4096" -- cmd ``` http://ccl.cse.nd.edu/software/manuals/resource_monitor.html (does not work as well on static executables that fork)
{"Source-Url": "http://ccl.cse.nd.edu/workshop/2021/topcoffea+wq_NDCMS_workshop.pdf", "len_cl100k_base": 4661, "olmocr-version": "0.1.49", "pdf-total-pages": 55, "total-fallback-pages": 0, "total-input-tokens": 68293, "total-output-tokens": 6977, "length": "2e12", "weborganizer": {"__label__adult": 0.0002104043960571289, "__label__art_design": 0.0002675056457519531, "__label__crime_law": 0.0002079010009765625, "__label__education_jobs": 0.0015020370483398438, "__label__entertainment": 8.761882781982422e-05, "__label__fashion_beauty": 0.00011259317398071288, "__label__finance_business": 0.0003612041473388672, "__label__food_dining": 0.00027060508728027344, "__label__games": 0.0005130767822265625, "__label__hardware": 0.0009126663208007812, "__label__health": 0.00020503997802734375, "__label__history": 0.00017952919006347656, "__label__home_hobbies": 0.00011938810348510742, "__label__industrial": 0.0003795623779296875, "__label__literature": 0.00016701221466064453, "__label__politics": 0.00017535686492919922, "__label__religion": 0.0002536773681640625, "__label__science_tech": 0.0235137939453125, "__label__social_life": 0.00018143653869628904, "__label__software": 0.04498291015625, "__label__software_dev": 0.9248046875, "__label__sports_fitness": 0.0001971721649169922, "__label__transportation": 0.0002503395080566406, "__label__travel": 0.00016188621520996094}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 15050, 0.04155]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 15050, 0.18217]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 15050, 0.70706]], "google_gemma-3-12b-it_contains_pii": [[0, 64, false], [64, 278, null], [278, 378, null], [378, 813, null], [813, 996, null], [996, 1324, null], [1324, 1366, null], [1366, 1465, null], [1465, 1539, null], [1539, 1628, null], [1628, 1708, null], [1708, 1779, null], [1779, 1846, null], [1846, 1923, null], [1923, 2052, null], [2052, 2081, null], [2081, 2215, null], [2215, 2591, null], [2591, 3028, null], [3028, 3592, null], [3592, 3749, null], [3749, 5308, null], [5308, 5722, null], [5722, 5753, null], [5753, 6002, null], [6002, 6302, null], [6302, 6576, null], [6576, 7035, null], [7035, 7589, null], [7589, 8028, null], [8028, 8327, null], [8327, 8676, null], [8676, 8960, null], [8960, 8985, null], [8985, 9039, null], [9039, 9114, null], [9114, 9195, null], [9195, 9281, null], [9281, 9765, null], [9765, 10152, null], [10152, 10303, null], [10303, 10333, null], [10333, 10487, null], [10487, 10725, null], [10725, 10944, null], [10944, 11397, null], [11397, 12020, null], [12020, 13471, null], [13471, 13614, null], [13614, 13761, null], [13761, 13922, null], [13922, 14424, null], [14424, 14437, null], [14437, 14837, null], [14837, 15050, null]], "google_gemma-3-12b-it_is_public_document": [[0, 64, false], [64, 278, null], [278, 378, null], [378, 813, null], [813, 996, null], [996, 1324, null], [1324, 1366, null], [1366, 1465, null], [1465, 1539, null], [1539, 1628, null], [1628, 1708, null], [1708, 1779, null], [1779, 1846, null], [1846, 1923, null], [1923, 2052, null], [2052, 2081, null], [2081, 2215, null], [2215, 2591, null], [2591, 3028, null], [3028, 3592, null], [3592, 3749, null], [3749, 5308, null], [5308, 5722, null], [5722, 5753, null], [5753, 6002, null], [6002, 6302, null], [6302, 6576, null], [6576, 7035, null], [7035, 7589, null], [7589, 8028, null], [8028, 8327, null], [8327, 8676, null], [8676, 8960, null], [8960, 8985, null], [8985, 9039, null], [9039, 9114, null], [9114, 9195, null], [9195, 9281, null], [9281, 9765, null], [9765, 10152, null], [10152, 10303, null], [10303, 10333, null], [10333, 10487, null], [10487, 10725, null], [10725, 10944, null], [10944, 11397, null], [11397, 12020, null], [12020, 13471, null], [13471, 13614, null], [13614, 13761, null], [13761, 13922, null], [13922, 14424, null], [14424, 14437, null], [14437, 14837, null], [14837, 15050, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 15050, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 15050, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 15050, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 15050, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 15050, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 15050, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 15050, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 15050, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 15050, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 15050, null]], "pdf_page_numbers": [[0, 64, 1], [64, 278, 2], [278, 378, 3], [378, 813, 4], [813, 996, 5], [996, 1324, 6], [1324, 1366, 7], [1366, 1465, 8], [1465, 1539, 9], [1539, 1628, 10], [1628, 1708, 11], [1708, 1779, 12], [1779, 1846, 13], [1846, 1923, 14], [1923, 2052, 15], [2052, 2081, 16], [2081, 2215, 17], [2215, 2591, 18], [2591, 3028, 19], [3028, 3592, 20], [3592, 3749, 21], [3749, 5308, 22], [5308, 5722, 23], [5722, 5753, 24], [5753, 6002, 25], [6002, 6302, 26], [6302, 6576, 27], [6576, 7035, 28], [7035, 7589, 29], [7589, 8028, 30], [8028, 8327, 31], [8327, 8676, 32], [8676, 8960, 33], [8960, 8985, 34], [8985, 9039, 35], [9039, 9114, 36], [9114, 9195, 37], [9195, 9281, 38], [9281, 9765, 39], [9765, 10152, 40], [10152, 10303, 41], [10303, 10333, 42], [10333, 10487, 43], [10487, 10725, 44], [10725, 10944, 45], [10944, 11397, 46], [11397, 12020, 47], [12020, 13471, 48], [13471, 13614, 49], [13614, 13761, 50], [13761, 13922, 51], [13922, 14424, 52], [14424, 14437, 53], [14437, 14837, 54], [14837, 15050, 55]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 15050, 0.03491]]}
olmocr_science_pdfs
2024-11-26
2024-11-26
f6686ec8847cdaec6dd4afab8159f8a23c53eff2
[REMOVED]
{"len_cl100k_base": 7439, "olmocr-version": "0.1.53", "pdf-total-pages": 14, "total-fallback-pages": 0, "total-input-tokens": 43613, "total-output-tokens": 10565, "length": "2e12", "weborganizer": {"__label__adult": 0.0003991127014160156, "__label__art_design": 0.0005197525024414062, "__label__crime_law": 0.00040531158447265625, "__label__education_jobs": 0.0008606910705566406, "__label__entertainment": 0.00016748905181884766, "__label__fashion_beauty": 0.0002264976501464844, "__label__finance_business": 0.0012273788452148438, "__label__food_dining": 0.0003843307495117187, "__label__games": 0.000762939453125, "__label__hardware": 0.002307891845703125, "__label__health": 0.0007314682006835938, "__label__history": 0.0006046295166015625, "__label__home_hobbies": 0.00011342763900756836, "__label__industrial": 0.0007166862487792969, "__label__literature": 0.0003681182861328125, "__label__politics": 0.0004553794860839844, "__label__religion": 0.0005049705505371094, "__label__science_tech": 0.30615234375, "__label__social_life": 0.00012052059173583984, "__label__software": 0.033599853515625, "__label__software_dev": 0.64794921875, "__label__sports_fitness": 0.0002830028533935547, "__label__transportation": 0.0009260177612304688, "__label__travel": 0.00029778480529785156}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 46288, 0.02145]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 46288, 0.21892]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 46288, 0.87576]], "google_gemma-3-12b-it_contains_pii": [[0, 3084, false], [3084, 7079, null], [7079, 11241, null], [11241, 14045, null], [14045, 18468, null], [18468, 22471, null], [22471, 24644, null], [24644, 27650, null], [27650, 30481, null], [30481, 34004, null], [34004, 38385, null], [38385, 41961, null], [41961, 45357, null], [45357, 46288, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3084, true], [3084, 7079, null], [7079, 11241, null], [11241, 14045, null], [14045, 18468, null], [18468, 22471, null], [22471, 24644, null], [24644, 27650, null], [27650, 30481, null], [30481, 34004, null], [34004, 38385, null], [38385, 41961, null], [41961, 45357, null], [45357, 46288, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 46288, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 46288, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 46288, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 46288, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 46288, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 46288, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 46288, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 46288, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 46288, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 46288, null]], "pdf_page_numbers": [[0, 3084, 1], [3084, 7079, 2], [7079, 11241, 3], [11241, 14045, 4], [14045, 18468, 5], [18468, 22471, 6], [22471, 24644, 7], [24644, 27650, 8], [27650, 30481, 9], [30481, 34004, 10], [34004, 38385, 11], [38385, 41961, 12], [41961, 45357, 13], [45357, 46288, 14]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 46288, 0.0]]}
olmocr_science_pdfs
2024-12-11
2024-12-11
b19926623250ac6934db1ae8c7e4507b74afcc89
<table> <thead> <tr> <th><strong>Title</strong></th> <th>Having a Customer Focus in Agile Software Development</th> </tr> </thead> <tbody> <tr> <td><strong>Author(s)</strong></td> <td>Lohan, Garry; Lang, Michael; Conboy, Kieran</td> </tr> <tr> <td><strong>Publication Date</strong></td> <td>2010</td> </tr> <tr> <td><strong>Item record</strong></td> <td><a href="http://hdl.handle.net/10379/1470">http://hdl.handle.net/10379/1470</a></td> </tr> </tbody> </table> Downloaded 2017-09-26T10:59:08Z Some rights reserved. For more information, please see the item record link above. <table> <thead> <tr> <th>Journal:</th> <th><em>International Conference on Information Systems 2010</em></th> </tr> </thead> <tbody> <tr> <td>Manuscript ID:</td> <td>ICIS-0531-2010</td> </tr> <tr> <td>Track:</td> <td>IT Project Management and Outsourcing</td> </tr> <tr> <td>Keywords:</td> <td>Agile software development, Business process management, Performance management, Beyond Budgeting</td> </tr> </tbody> </table> **Abstract:** Around the same time as the emergence of agile methods as a formalized concept, the management accounting literature introduced the concept of Beyond Budgeting as a performance management model for changing business environments. Both concepts share many similarities with both having a distinctly agile or adaptive perspective. The Beyond Budgeting model promises to enable companies to keep pace with changing environments, quickly create and adapt strategy and empower people throughout the organization to make effective changes. This research in progress paper attempts to develop the Beyond Budgeting model within the context of agile software development teams. The twelve Beyond Budgeting principles are discussed and a research framework is presented which outlines a roadmap for further investigation into the potential of the Beyond Budgeting model for use as a performance management model for agile software development teams. 1. Introduction Continued uncertainty and rapid changes to business and technology environments have meant that a software development teams’ ability to respond to changing user or customer requirements has become increasingly critical. As a means to respond to these changes the software development community has moved from a traditional, plan-driven, structured approach to more agile development methods. Agile software development approaches such as XP (eXtreme Programming), Scrum, DSDM (Dynamic Systems Development Method), and FDD (Feature Driven Development) have been proposed as solutions to improve a software teams’ ability to embrace and respond to the changing requirements. The emergence of these new methods has had a huge impact on the way software is developed worldwide (Conboy and Fitzgerald, 2004, Dybå and Dingsøyr, 2008, Conboy, 2009). These newer methods of producing software are not always compatible with traditional management control models (MCMs) (Boehm and Turner, 2005, Bogsnes, 2009, Qumer and Henderson-Sellers, 2008). As agile methods grow in popularity it is important that the management control in the organization is set up to complement an agile way of working. An innovation from the accounting literature called, “Beyond Budgeting”, has shown great promise as a performance management model for a changing business and operating environment (Bogsnes, 2009, Davila et al., 2009, Drury, 2008, Hansen et al., 2003, Hope and Fraser, 2003, Poppendieck and Poppendieck, 2010, Ferreira and Otley, 2009). This model is conceptually similar and appears to align well with agile methods (Bogsnes, 2009, Highsmith, 2006, Poppendieck and Poppendieck, 2010, Ambler, 2008). This research in progress paper introduces the Beyond Budgeting model and offers a conceptual research framework, which is being used in two case studies to further develop the complementarities between the Beyond Budgeting model and agile software development teams. The paper is divided into two further sections followed by a reflective conclusion. The following (second) section explores current thinking on performance management models and introduces the Beyond Budgeting model. The third section refines the model and develops its theoretical basis in relation to agile software development. Finally, a reflective conclusion provides pointers to the way the conceptual model can be used for further empirical study. 2. The Beyond Budgeting Performance Management Framework In recent years there has been a move from the bureaucratic, hierarchical organization, considered ineffective in the context of increased competition brought about by globalization, deregulation, the emergence of powerful developing economies, and development in information technologies, towards flatter, leaner and more responsive structures (Berry et al., 2009). Many have questioned the industrial era management and government systems and called for a new model for the knowledge economy e.g. (Manville and Ober, 2003, McFarland, 2008). Others have questioned the budgeting process and its value as a management control mechanism in the post-industrial era (Bogsnes, 2009, Schmidt, 1992, Dugdale and Lyne, 2006, Howell, 2004, Cassell, 1999, Kennedy and Dugdale, 1999, O’Brien, 1999). The literature in the area of performance management systems (PMSs) and management control systems (MCSs) increasingly recognizes the need for research to be based on more coherent theoretical foundations (Chenhall, 2003, Covaleski et al., 2003, Ferreira and Otley, 2009, Broadbent and Laughlin, 2009). The tendency to focus only on specific aspects of control systems, as opposed to a more comprehensive and integrated approach has led to spurious findings, ambiguity and a potential for conflicting results (Chenhall, 2003). There have been calls for a more integrated approach which includes the interdependency between different control mechanisms operating at the same time in the same organization (Abernethy and Brownell, 1997). The Beyond Budgeting performance management model was first introduced in 1997 as an alternative to the traditional command and control type performance management models, which were usually based on budgetary control mechanisms. Beyond Budgeting is more orientated towards fast changing operational environments and utilizes a sense and respond type of control mechanism, which allows an organization to keep pace with fast changing environments (Fraser, 2001, Hope and Fraser, 1999, Hope and Fraser, 2003, Hope and Fraser, 2003a, Hope and Fraser, 2003b). The emergence of this new concept coincided with the emergence of agile methods and both concepts share many similarities with both having a distinctly agile or adaptive perspective (Ambler, 2008, Bognes, 2009, Highsmith, 2006, Poppendieck and Poppendieck, 2010). The model consists of six leadership principles and six process principles when taken together and used in an holistic manner help improve performance management within an organization (Hope and Fraser, 2003, Bognes, 2009). Table 1 lists the twelve principles are they are outlined in the Beyond Budgeting literature. <table> <thead> <tr> <th>Leadership Principles</th> <th>Process Principles</th> </tr> </thead> <tbody> <tr> <td><strong>Customers</strong>: Focus everyone on improving customer outcomes, <strong>not on hierarchical relationships</strong>.</td> <td><strong>Goals</strong>: Set relative goals for continuous improvement; do not negotiate fixed performance contracts.</td> </tr> <tr> <td><strong>Organization</strong>: Organize as a network of lean, accountable teams, <strong>not around centralized functions</strong>.</td> <td><strong>Rewards</strong>: Reward shared success based on relative performance, <strong>not on meeting fixed targets</strong>.</td> </tr> <tr> <td><strong>Responsibility</strong>: Enable everyone to act and think like a leader, <strong>not merely follow the plan</strong>.</td> <td><strong>Planning</strong>: Make planning a continuous and inclusive process, not a top down annual event.</td> </tr> <tr> <td><strong>Autonomy</strong>: Give teams the freedom and capability to act; <strong>do not micro-manage them</strong>.</td> <td><strong>Controls</strong>: Base controls on relative indicators and trends, <strong>not variances against a plan</strong>.</td> </tr> <tr> <td><strong>Values</strong>: Govern through a few clear values, goals and boundaries, <strong>not detailed rules and budgets</strong>.</td> <td><strong>Resources</strong>: Make resources available as needed, <strong>not through annual budget allocations</strong>.</td> </tr> <tr> <td><strong>Transparency</strong>: Promote open information for self-management; <strong>do not restrict it hierarchically</strong>.</td> <td><strong>Coordination</strong>: Coordinate interactions dynamically, <strong>not through annual planning cycles</strong>.</td> </tr> </tbody> </table> Table 1. The Beyond Budgeting Performance Management Model The next section looks at each principle individually, offering a brief description of how each principle can be contextualized within an agile software development environment and listing some possible questions, which will be used during case study research to establish the models validity as a performance management model for agile software development teams. 3. Theoretical Development 3.1 Customer Focus Focus everyone on improving customer outcomes, **not on hierarchical relationships**. Focusing on customers rather than hierarchical relationships is the focus of an ongoing debate in the accounting literature (Caker, 2007, Guilding and McManus, 2002). Hope and Fraser (2003) argue that organizations need to focus their teams on improving customer outcomes rather than having the teams focus on a hierarchical relationship within the organization. The Beyond Budgeting management model, when taken as a whole, incorporates accountability through a transparent control system. This allows for a priority to be on customer focus and not on hierarchical relationships (and accountability for customers, not to customers). With the introduction of agile software development processes, the role of the customer and the customer focus of the agile team take on a new significance. In order to gain an insight into the level of customer focus of an agile team we need to examine how much the team knows about their customer, the level of customer involvement, the quality of customer requirements received and how customer feedback is received and used within agile software development teams. Following on from a review of the literature surrounding customer focus, the following questions were identified as needing to be addressed in order to establish the customer focus of the agile team with respect to the Beyond Budgeting principle: - How knowledgeable are the team members of their customers’ working environment? - How involved are the customers in the development process? How are customer requirements handled? - What level of customer feedback do the team receive and how is this used? 3.2 Organization Organize as a network of lean accountable teams, not around centralized functions. Accountability theory suggests that perceptions about our audiences and related rewards or sanctions serve to direct decisions and effort allocations when we face decisions or choices (Frink and Ferris, 1998). Contingency theory posits that organizational units can be mapped into a spectrum ranging between a “mechanistic” or centralized structure and a more decentralized, flexible and “organic” structure as the uncertainty and dynamics of their business environments increase (Mendelson, 2000). In the traditional command and control orientated organizational structure, which is characterized by a rigid hierarchy, information flows upwards through the hierarchy. Greater decision rights are associated with a higher level of hierarchy (Radner, 1992). At the opposite end of the spectrum in what Mendelson (2000) calls information age (IA) architecture, decentralized decision making is supported by a fast moving, information rich environment. The organization is designed to maximize value by giving pertinent knowledge to those responsible for decision making and also with the aim of pushing that decision making down to those who are closest to the action (Chang et al., 2003, Christie et al., 2003). The implicit assumption here is that the more decentralized an organization is, the more employees participate in the decision making process. Although there is no single generally accepted measure for assessing individual or group participation in decision making in organizations (Glew et al., 1995), measures such as spending decision rights and operating decision rights have been used in previous studies (Inkson et al., 1970). Because teamwork and team autonomy is at the heart of agile software development and the team itself decides how work is coordinated (Boehm and Turner, 2004), the objective is to understand the level of decision rights the agile team actually has regarding its day to day activities and the accountability attached to those decision rights. To do this the following questions need to be examined: - What level of decision-making rights does the team have regarding: Operational metrics (quality metrics, velocity rates, etc.)? Development methodology used? Spending on equipment, training programs etc.? 3.3 Responsibility Enable everyone to act and think like a leader, not merely follow the plan. There is a large body of literature from leadership theory which characterizes the optimal behaviors or demeanors of leaders in particular contexts (Yukl, 2008, Rafferty and Griffin, 2004, Fry, 2003, Avolio and Gardner, 2005). Therefore the statement “enable everyone to act and think like a leader” carries with it a certain amount of ambiguity. However, Hope and Fraser (2003:151) clarify this somewhat by saying that the objective is to create a more entrepreneurial business whereby leadership is devolved and the aim is that “everyone in the organization... carries ... personal responsibility for his or her part in it”. This is called a devolved and adaptive approach to management and is in contrast to the traditional budget based centrally planned model (Hope and Fraser, 2003). Research on management teams has shown that this form of enablement or what Srivastava (2006) labels “empowering leadership” is positively related to both knowledge sharing and team efficacy, which, in turn, are both positively related to performance. Empowering leadership is defined as: behaviors, whereby power is shared with subordinates and, that raise levels of intrinsic motivation. As agile teams embrace the concept of self organizing, leadership should be diffused rather than centralized (Morgan, 2006). Examples of empowering leadership are: leading by example, participative decision making, coaching, informing and showing concern (Srivastava et al., 2006, Arnold et al., 2000). Heifetz et. al. (2009) echo this empowerment sentiment and argue that in the current environment and in a future post recession environment of urgency, high stakes, and uncertainty leaders will require new skills which will involve “giving people at all levels of the organization the opportunity to lead experiments that will help it adapt to changing times”. Bearing this in mind the following questions are proposed: - How is coaching less experienced team members carried out within the team? - Does the team accept responsibility for a project outcome as a unit? 3.4 Autonomy Give teams the freedom and capability to act; do not micromanage them. A central issue for organizations today is how to balance top-down control with bottom-up empowerment. Empowering teams has been shown to lead to better productivity, more proactive behavior and higher levels of customer service, job satisfaction, and organizational and team commitment (Kirkman and Rosen, 1999). However, while empowerment is an accepted concept in the management literature there is still debate over the level of control or the degree to which decision-making should be decentralized. Malone (1997) believes that designing effective decentralized systems will be one of the most important challenges facing organizations in the 21st century. Thomas & Velthouse (1990) identified four dimensions as the basis for worker empowerment: sense of impact, competence, meaningful and choice. These are the generally accepted empowerment construct dimensions (Spreitzer, 1995, Wang and Lee, 2009, Thomas and Velthouse, 1990). However, some subtle differences exist between team and individual empowerment construct dimensions. Kirkman and Rosen (1999) defined team empowerment as having four dimensions which paralleled the individual constructs, namely: impact, potency, meaningfulness and autonomy. As agile methodologies are dependent on teamwork, Kirkman and Rosen’s dimension definitions are most suited to measure a teams’ autonomy. Therefore the following questions need to be addressed from the context of working within the team: - Do team members feel that they, their work and the work of the team is valued? - Have team members the opportunity to participate in decisions affecting the team? ### 3.5 Governance **Govern through a few clear values, goals and boundaries, not detailed rules and budgets** There is a certain amount of ambiguity on the form of Information Technology Governance (ITG) within an organization depending on the strategic role IT plays within that organization (Henderson and Venkatraman, 1999, Nolan and McFarlan, 2005, Raghupathi, 2007). Henderson et. al. (1999) suggests that IT strategy should be articulated in terms of an external domain – how the firm is positioned in the IT marketplace and an internal domain – how the IS infrastructure should be configured and managed. As agile teams generally work within the IS infrastructure, it is the governance of the internal IS domain that is of interest here. This consists of three components, namely: 1) IS architecture, 2) IS processes, and 3) IS skills. IS architecture is concerned with the teams choice in defining the portfolio of applications, the configuration of hardware, software, and communication, and the data architecture that collectively define the technical infrastructure. IS processes are concerned with the teams choice in defining the work processes central to the operations of the IS infrastructure, such as systems development, maintenance, and monitoring and control systems. IS skills are the choices pertaining to the acquisition, training, and development of the knowledge and capabilities of the individuals required to effectively manage and operate the IS infrastructure within the organization. Here again we need to look at the decision rights and involvement of the team in choosing strategy and tactics. Also, what are the boundary conditions within which they have decision rights and how are those boundary conditions established and communicated: - Are team members involved in strategy development? At what level? How are values, goals and boundaries communicated to the team? - Does the team have a choice in defining the technical infrastructure or choosing the management tool for any given project? ### 3.6 Transparency **Promote open information for self-management; do not restrict it hierarchically** A review of the transparency literature in IS has discovered two distinct constructs of organizational transparency, internal transparency and external transparency (Street and Meister, 2004). External transparency corresponds to the outcome of communication behaviors directed outside the organization. E.g. in supply chain management transparency is discussed as the information exchange between supply chain partners (Lamming et al., 2004), in the marketing literature, information flow from the customer is seen as valuable (Narver and Slater, 1990). For agile development we are only concerned with the internal transparency construct as it is applied to IS development teams. Internal transparency corresponds to the same behaviors as external transparency but is applied within the organization, e.g. (Alavi and Leidner, 1999). Street and Meister (2004) define internal transparency to be “an outcome of communication behaviors within an organization that reflects the degree to which employees have access to the information requisite for their responsibilities”. Although it is not desirable to have complete transparency and strategic secrets are necessary, deciding where to draw the line between what information must be revealed and what should be withheld is one of the most important judgments leaders make (O'Toole and Bennis, 2009). The suggestion for agile teams is that should have access to all relevant information needed for them to operate effectively. This includes access to velocity rates, burn down charts, product backlogs, etc. of other agile teams operating within the organization. - What level of access does the team have regarding project data? - What level of access does the team have on the project data of other agile teams across the organization? ### 3.7 Goals **Set relative goals for continuous improvement; do not negotiate fixed performance contracts.** Goal setting theory outlines the important dimensions associated with good goal setting (Latham and Locke, 1991). The core of goal setting theory asserts that performance goals lead to the highest level of performance when they are both clear (specific) and challenging. Hope and Fraser (2003) suggest that employees should continually strive for stretch goals that challenge them to think outside the box. Stretch targets when used in conjunction with other work environment changes (such as empowerment, autonomy, and management support for innovative thinking) have been shown to enhance motivation, performance and creative decision-making (Thompson et al., 1997). To ensure goals are relative they should be set by the team, be visible across the organization and be benchmarked against industry best-in-class performance measures, direct competitors or internal prior year results. Relative performance standards potentially increase motivation because the performance bar adjusts naturally to be challenging, yet achievable when there is an appropriate benchmark group (Hansen et al., 2003). In contrast, budget targets derived in traditional budgeting processes often create tension between what upper management identify as desirable and what lower-level managers’ claim is feasible. The explicit goals that guide a project should be decoupled from the (often unreliable) initial estimates. Instead, goals should be set with a view to affecting the strategy that the manager chooses to follow (Chesney and Locke, 1991). In practical terms, this entails setting the appropriate behavioral metric to guide the manager’s decision (Abdel-Hamid et al., 1999). The goals set should be specific and challenging but it is the performance that should be rewarded (Hope and Fraser, 2003). Loosening the tie between goals and rewards allows hindsight evaluations to take place, which take into account the full context in which the goal is pursued. Factors such as resources, obstacles and market conditions may be included in the evaluation (Locke, 2004). For this principle we need to address the following: - How are goals (both long term and short term) set for the team? What is the process in place? - Does goal setting include both technical and behavioral aspects? ### 3.8 Rewards **Reward shared success based on relative performance, not on meeting fixed targets.** Relative performance evaluation (RPE) entails evaluating individual or organizational unit performance relative to the performance of others. Economic theory provides a rationale for RPE based on sharing common external risks (Gibbons and Murphy, 1990). Teams are rewarded not just for their own performance but also for their performance relative to the performances of their co-workers or best in industry standards (e.g. explicit contests and tournaments, bonus schemes, promotion, etc.) RPE can provide incentives while partially insulating the individuals or team from common uncertainty (Dye, 1992, Holmstrom, 1982). Hope and Fraser (2003) suggest that instead of the fixed performance contract, team performance should be evaluated by a peer review group (using relative measures) with hindsight. One of the most popular reward schemes used in the Beyond Budgeting literature is to get rid of individual performance bonuses and operate a group wide profit sharing scheme. (Hope and Fraser, 2003, Bogsnes, 2009). Bogsnes (2009) suggests that individual bonuses are counter productive for long term relationships and lead to dysfunctional behavior, such as lack of cooperation or what is termed the crowding out effect (Irlenbusch and Ruchala, 2008). The main premise of the Beyond Budgeting reward principle is that performance evaluation is disconnected from a fixed target (i.e. is relative), is carried out with hindsight and benchmarked against internal or external key performance indicators (KPIs), is based on group performance and is performed by subjective peer review (Hope and Fraser, 2003). Therefore we need to address the following: • How are performance reviews carried out? Are performances benchmarked? Is the performance review linked to a fixed plan? 3.9 Planning Make planning a continuous and inclusive process, not a top-down annual event. Management control is composed of two separate and complementary control processes: strategic and operational planning (Hansen et al., 2003). It is the inability to do adequate long term strategic planning in uncertain environments that is one of the main drivers behind the Beyond Budgeting principles (Hope and Fraser, 2003, Hansen et al., 2003). Rapid change requires strategies that are flexible and creative and strategic plans have become more goal focused and less specific with regard to actions and resource allocations (Grant, 2003). There is general agreement in the literature that in order to adapt to a changing environment, the formal annual calendar-driven strategic planning process needs to be revised (Grant, 2003, Hamel and Prahalad, 2005, Mintzberg, 1994, Philip, 2007, Hope and Fraser, 2003). Rather than having a single top-down fixed plan that determines actions for the year ahead, the devolution of the planning process would allow for a continuous adaptation of short term plans to meet strategic objectives. This devolution and continuous adaptation of the planning process is emphasized in agile methodologies (Lee and Weidong, 2010). The objective is to have a real-time system that is always up to date (Hope and Fraser, 2003). For information systems (IS) development, the short iteration cycles of agile development practices are well suited to capturing information and monitoring trends for continuous planning purposes (Boehm and Turner, 2005). Each iteration, the team refines its forecast, updates the release plan, the release backlog and cost estimates (Sliger and Broderick, 2008). • What level of involvement does the team have in the project-planning phase? How adaptable are project plans? 3.10 Control Base controls on relative indicators and trends, not on variances against a plan. It is possible to view planning and control techniques as a spectrum. At one end is a focus on command and control type management, with formalized annual plans and control mechanisms in place to ensure that preset plans are realized. At the other end is a focus on agility where long term planning becomes so unreliable that it is essentially eliminated and the control focus is moved toward rapid response once actual operating conditions are observed (Malone, 1997, Hansen et al., 2003, Brown, 1999). Hope and Fraser (2003) suggest that decentralization is the way forward and in their studies most of the companies have switched their measurement instrument from central control to a more multilevel control, where multilevel control means “knowing what’s going on and only intervening when absolutely necessary”. Beyond Budgeting advocates the use of what Simons (1995) and Ouchi (1979, 1980) call clan controls, whereby cultural values and shared norms replace bureaucratic controls (Hansen et al., 2003, Ouchi, 1979, Ouchi, 1980). Operational performance is measured using multilevel controls requiring a multifaceted control system which provides information based on a wide range of key indicators and forecasts. All information is aggregated at different levels and the same information is available at the same to all those with a relevant interest (Hope and Fraser, 2003). Here we need to ask the following: • How are projects monitored? Are there KPIs for each project? When would intervention by higher-level management be required? 3.11 Resources Make resources available as needed, not through annual budget allocations. Complex and turbulent markets require software teams to be highly adaptable. Under such conditions, a major source of sustained competitive advantage is the dynamic capabilities by which a firm “integrates, builds, and reconfigures internal and external competencies to address rapidly changing environments” (Teece et al., 1997). Dynamic capabilities theory arose from the resource-based view of the firm (Barney, 1991) and suggests a buffer between the firms’ resources and the changing business environment. This buffer allows a sense-and-respond approach to be utilized by the development team (Mathiassen and Vainio, 2007, Haeckel, 1995, Haeckel, 1999, Haeckel, 2004). Haeckel (1999) suggests that strategy should be focused on creating and developing mechanisms that enable the responses to change rather than on planning specific actions that implement the stated goals; structures should consist of dynamic networks of modular, collaborative capabilities rather than static hierarchies of tasks and responsibilities, and, governance should be achieved through coordination based on shared values and information rather than dedicated command and control activities. This form of resource allocation mechanism allows agile teams the freedom to respond efficiently and effectively to changing requirements while operating within boundary conditions and KPIs. Here we need to gain an understanding of the resource allocation process for an agile project: - What is the process for requiring resources during the various stages of a project? 3.12 Coordination Coordinate interactions dynamically, *not through annual planning cycles*. For most organizations, the master budget defines the financial commitments that one process team makes to another for the year. However, when managing without budgets, no such plans exist, so managers must coordinate these commitments according to the pace of market demand (Hope and Fraser, 2003). In organizations that have abandoned budgets, market-facing business units become customers of upstream processes and central service providers, and suppliers to internal or external customers. According to coordination theory, actors in organizations face coordination problems that arise from dependencies that constrain how tasks can be performed (Crowston, 1997, Gosain et al., 2004, March and Simons, 1958). Research has shown that coordination improves when there is social interaction between teams who compete with each other for market share. However, social interaction has no perceivable affect on knowledge sharing among these teams who compete with each other for internal resources. A formal hierarchical structure has been shown to have a negative impact on intra-firm knowledge sharing (Tsai, 2002). According to the Beyond Budgeting model, coordination is about integrated performance management, from overall strategies and strategic objectives, to KPIs, actions and forecasts, and further into team and personal goals, evaluation, and reward (Bogsnes, 2009). Coordination in the context of agile teams is about interactions and knowledge sharing with other agile teams who are not competing with each other for internal resources. - What level of interaction is there between team members (formally and informally)? - Are there knowledge repositories used to share ideas and information? 5. Conclusion The questions outlined above under each principle have formed the basis of an interview protocol, which is being used to conduct two case studies within the IT department of two large organizations currently using agile methods to develop software. One of the studies is in an organization with a traditional hierarchical management structure while the other is in an organization that is several years into implementing the Beyond Budgeting model. The results from these case studies are beginning to suggest that the Beyond Budgeting model is the more appropriate performance management model for agile software development teams. To date, research on the Beyond Budgeting model has focused on performance management from the point of view of the organization as a whole. While there have been many who have recognized the similarities between the Beyond Budgeting concept and agile methodologies, there has been no published academic research commenting on how these two align and complement each other. This research in progress paper is the first step in framing the Beyond Budgeting model in the context of agile methods. The twelve principles cover a wide range of organizational management and control and the literature review required is extensive. However, as expressed within the performance management literature, it is important that when performance management models are being developed, tested and validated, they are viewed from a more integrated approach, which recognizes the interdependencies between differing control mechanisms. The goal of this research is not to examine any individual construct or aspect of the Beyond Budgeting model in depth, rather it is to take the model as a whole and determine its applicability within the domain of agile software development. While this requires an original large and wide-ranging literature review, it is regarded as an important step in establishing the validity and reliability of using the Beyond Budgeting model as a performance management model for agile software development. Case study research is proposed as the next step in validating the model and presenting it as a viable alternative to organizations that wish to capture the innovative and creative talents of their employees, something that is of particular significance within the field of software development. References Beyond Budgeting and Agile Software Development
{"Source-Url": "https://aran.library.nuigalway.ie/xmlui/bitstream/handle/10379/1470/Lohan_G_Beyond%20Budgeting%20and%20Agile%20Software%20Development%20A%20Conceptual%20Framework%20for%20the%20Performance%20Management%20of%20Agile%20Software%20Development%20Teams.pdf?sequence=1", "len_cl100k_base": 6948, "olmocr-version": "0.1.53", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 71293, "total-output-tokens": 11811, "length": "2e12", "weborganizer": {"__label__adult": 0.0007143020629882812, "__label__art_design": 0.0007352828979492188, "__label__crime_law": 0.000701904296875, "__label__education_jobs": 0.013641357421875, "__label__entertainment": 0.0001556873321533203, "__label__fashion_beauty": 0.0003657341003417969, "__label__finance_business": 0.03546142578125, "__label__food_dining": 0.0008482933044433594, "__label__games": 0.0010519027709960938, "__label__hardware": 0.0006732940673828125, "__label__health": 0.0013256072998046875, "__label__history": 0.0004703998565673828, "__label__home_hobbies": 0.00027441978454589844, "__label__industrial": 0.0007786750793457031, "__label__literature": 0.0008220672607421875, "__label__politics": 0.0007715225219726562, "__label__religion": 0.0006184577941894531, "__label__science_tech": 0.01415252685546875, "__label__social_life": 0.000408172607421875, "__label__software": 0.014892578125, "__label__software_dev": 0.90869140625, "__label__sports_fitness": 0.0007214546203613281, "__label__transportation": 0.0009927749633789062, "__label__travel": 0.0005340576171875}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 47046, 0.05466]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 47046, 0.14857]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 47046, 0.89452]], "google_gemma-3-12b-it_contains_pii": [[0, 734, false], [734, 2115, null], [2115, 6909, null], [6909, 11013, null], [11013, 15812, null], [15812, 20591, null], [20591, 25291, null], [25291, 29641, null], [29641, 34697, null], [34697, 38804, null], [38804, 43239, null], [43239, 47046, null]], "google_gemma-3-12b-it_is_public_document": [[0, 734, true], [734, 2115, null], [2115, 6909, null], [6909, 11013, null], [11013, 15812, null], [15812, 20591, null], [20591, 25291, null], [25291, 29641, null], [29641, 34697, null], [34697, 38804, null], [38804, 43239, null], [43239, 47046, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 47046, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 47046, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 47046, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 47046, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 47046, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 47046, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 47046, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 47046, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 47046, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 47046, null]], "pdf_page_numbers": [[0, 734, 1], [734, 2115, 2], [2115, 6909, 3], [6909, 11013, 4], [11013, 15812, 5], [15812, 20591, 6], [20591, 25291, 7], [25291, 29641, 8], [29641, 34697, 9], [34697, 38804, 10], [38804, 43239, 11], [43239, 47046, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 47046, 0.10383]]}
olmocr_science_pdfs
2024-12-06
2024-12-06
20558cf023b622742d171faa63d3a8e995ddc6f5
Introducing programmability and automation in the synthesis of virtual firewall rules Original Availability: This version is available at: 11583/2844332 since: 2020-10-19T08:32:20Z Publisher: IEEE Published DOI:10.1109/NetSoft48620.2020.9165434 Terms of use: openAccess This article is made available under terms and conditions as specified in the corresponding bibliographic description in the repository Publisher copyright IEEE postprint/Author’s Accepted Manuscript ©2020 IEEE. Personal use of this material is permitted. Permission from IEEE must be obtained for all other uses, in any current or future media, including reprinting/republishing this material for advertising or promotional purposes, creating new collecting works, for resale or lists, or reuse of any copyrighted component of this work in other works. (Article begins on next page) Introducing programmability and automation in the synthesis of virtual firewall rules Daniele Bringhenti, Guido Marchetto, Riccardo Sisto, Fulvio Valenza, Jalolliddin Yusupov Dip. Automatica e Informatica, Politecnico di Torino, Torino, Italy, Emails: {first.last}@polito.it Abstract—The rise of new forms of cyber-threats is mostly due to the extensive use of virtualization paradigms and the increasing adoption of automation in the software life-cycle. To address these challenges we propose an innovative framework that leverages the intrinsic programmability of the cloud and software-defined infrastructures to improve the effectiveness and efficiency of reaction mechanisms. In this paper, we present our contributions with a demonstrative use case in the context of Kubernetes. By means of this framework, developers of cybersecurity appliances will not have any more to care about how to react to events or to struggle to define any possible security tasks at design time. In addition, automatic firewall ruleset generation provided by our framework will mostly avoid human intervention, hence decreasing the time to carry out them and the likelihood of errors. We focus our discussions on technical challenges: definition of common actions at the policy level and their translation into configurations for the heterogeneous set of security functions by means of a use case. Index Terms—network functions virtualization, firewall, automatic programmability, cloud networking, formal methods I. INTRODUCTION The networking field is currently facing a deep revolution based on virtualization. In the decade which has just ended, innovative paradigms shook the traditional vision of networks as a mesh of heterogeneous functions providing different services. The first time when networking embraced virtualization is represented by the born of Software-Defined Networking (SDN) [1], [2]. The main pillars of this technology are the decoupling between data plane and control plane, centralization of all the control plane functions in a software module that is referred to as SDN controller, abstraction between the specificity of user applications and the generality of controller interfaces. More recently, Network Functions Virtualization (NFV) [3], [4] introduced the possibility to create network functions as software programs and to make them run as traditional virtual machines or containerized applications, supervised by a software MANagement and Orchestration (MANO) module [5]. Physical middleboxes have been thus progressively replaced by general-purpose servers where the programs implementing the network functions can run. Among the contributions brought over, automatic (re)programmability of the network functions are nowadays becoming feasible, with respect to the traditional troubles coming from a manual function configuration [6]. On one side, a fundamental novelty provided by SDN has been the reactive generation and deployment of forwarding rules by the controller onto the data plane switches. Whenever a packet which does not match any switch rule is received, it is forwarded to the controller, so that it can take the best decision according to the internal logic and consequently generates rules for all the network switches which would have to manage packets with the same characteristics in the future. On the other side, if the network functions are implemented in the NFV fashion, MANO can automatically manage their life-cycle and deployment, so as to optimize either resource consumption for the underlying physical infrastructure or availability of the provided services. although many organizations are migrating virtual machine (VM)-based applications to containers, virtualization is still present in data centers and public clouds. We are also seeing new ways of integrating virtualization with containers and Kubernetes (K8s) to provide innovative solutions to new problems. In other words, virtual machines are also becoming part of the cloud-native architecture – this concept is called container-native virtualization. Kubernetes is an example of the fulfillment of SDN and NFV paradigms, which is an open-source system for automating deployment, scaling, and management of virtualized applications. It significantly simplifies the works of network and service administrators. However, in an environment like Kubernetes, where multiple software processes run in parallel, the correct global management becomes more difficult than what traditionally was with single hardware devices. The increase of complexity, unfortunately, contributed to raising the number of cyberattacks, which became more variable by having the possibility to exploit new kinds of breaches. In particular, misconfiguration of network functions has become more critical, because more variable factors must be considered when enforcing a correct security defence against both external and internal attacks. This statement is confirmed by recent surveys, such as Verizon’s most recent study [7]. In this report, the misconfigurations have been identified as the third most critical threat in cloud environments, that can lead to catastrophic breaches. In light of these observations, the challenge we propose to face is to effectively exploit the benefits provided by the virtual networking paradigms, minimizing the impact of their beforehand illustrated drawbacks. With this aim, we designed a framework based on the innovative methodology presented in [8], based on Maximum Satisfiability Modulo Theories (MaxSMT), and we integrated it in the context of Kubernetes. The proposed approach automatically configures virtual firewalls, where a consistent number of configuration errors are traditionally performed. Moreover, we will particularly describe how this methodology is effectively introduced in the framework architecture of ASTRID (AdrEssing ThReats for virtualISeD services), which is an EU H2020 Project [9]. The remainder of this paper is structured as follows. In Section II, the most related works are described, so that the main differences with respect to the methodology proposed in this paper are illustrated. In Section III, first, the general architecture of the ASTRID framework is presented. Then the focus will be shifted on the methodology for the automatic firewall configuration, present inside the Security Controller, the central component of the ASTRID framework which enforces security in cloud-based networks. In Section IV, additional details about the implementation will be provided, alongside with a validation based on the framework’s application in a realistic scenario. Finally, Section V briefly concludes the paper and describes the planned future works. II. RELATED WORK The focus of this paper is centered on the automatic configuration of firewalling functions in Kubernetes framework. Therefore, we briefly introduce the main characteristics of the Kubernetes framework and then we report the main works related to the automatic firewalls configuration. As shown in Fig. 1, a Kubernetes cluster is composed of multiple nodes, which can be virtual or physical. A Pod is a minimal management unit and can accommodate one or more containers. Each Pod is protected by a packet filter (i.e., FW in Fig 1). Pods are assigned with network addresses and are allocated to nodes. Containers inside a Pod share resources, such as volumes where they can write and read data. Clients contact the cluster through another firewall, which distributes requests to nodes according to load balancing rules. The proxy receives requests from this firewall and forwards them to Pods. Each node has a proxy installed. If a Pod is replicated, the proxy distributes the load among the replicas. The kubelet is a component that manages Pods, containers, images and other elements in the node. The kubelet forwards data on the monitoring of containers to the main node, which acts when necessary. In this framework, one of the main key points concerns the correct and consistent configuration of this graph of firewalls that protect the access to each container. In literature, an automatic configuration of firewalls is a challenge where research has been partially carried out. However, most of the works describe either technique which can be only applied to traditional networks (e.g., with hardware firewalls), or mathematical models that do not have a correspondent implementation proving their feasibility and effectiveness. Moreover, only a limited subset of them enrich the computed configurations with optimality or formal correctness assurance [10]. The three papers which gave birth to this research trend have been [11], [12] and [13]. In particular, Firmato [11] represents a vital milestone, because it is the first approach based on policy refinement that is able to automatically synthesize a firewall configuration, by exploiting an entity-relationship model for the representation of the security policies and the network topology. Nevertheless, its limitations are evident: the most critical is that it has been validated on a single centralized firewall, instead of a distributed security architecture. The other two works ([12], [13]) added the possibility to configure a distributed firewall as the main novelty. However, all these three works exclusively target traditional networks, and do not offer either optimality or formal verification. Formal mathematical models have been, instead, presented in [14] and [15], where formal methodologies are used to automatically compute firewall configuration. However, in both these techniques work only in specific cases, not related to virtualized networks: [14] follows the syntax of IPChains and Cisco’s PIX, whereas [15]’s technique has been validated only with SCADA-firewall configuration. Besides, optimization is overlooked in both these two works. A recent work which, with respect to all the others, specifically targets NFV-based networks is [16], [17]. The proposed approach is the first step toward a security policy aware NFV management, with the introduction of a specific module, called Security Awareness Manager (SAM), into frameworks which provide NFV MANO, such as OpenMANO. This module performed a complete refinement of high-level, user-specified network security policies into the low-level configuration of virtual network functions, using optimization models defined for each function type. There are limitations in this work, though: the achieved results are not formally verified and little information is provided about how firewall policies are managed, since this paper provides a comprehensive approach for multiple security function types. Anyhow, it shows how, despite its drawbacks, virtualization is altogether characterized by features which can be positively and efficiently exploited in the automatic programmability of next-generation computer networks. Finally, the proposed work integrates the automatic configu- ration approach, presented in [8], into Kubernetes. Specifically, the solution in [8] adopts a formal approach based on the MaxSMT problem, which provides formal assurance about the correctness of the solution. More details will be provided in the next sections. III. Approach This section presents the design of the ASTRID framework and presents a generic workflow to illustrate the main functionalities. Next, our proposed approach is presented as a Security Controller component that resides in the ASTRID framework. A. ASTRID framework The term orchestration is commonly being used in the IT field. In the NFV and microservice system, there is Service Orchestration for Service, and in the Cloud system, there is Cloud Orchestration for cloud resource description. With the development and maturity of container technology, more and more enterprises and individuals choose to containerize traditional applications or directly develop container-based cloud-native applications and then run applications on the container platform. Faced with a complex container operating environment, the needs for container orchestration have raised. In general, container orchestration is responsible for the lifecycle scheduling of containers, and it improves container usage by managing container clusters. There are currently three major industry giants such as Kubernetes, Docker Swarm, and Apache Mesos. They belong to the category of DevOps infrastructure management tools and are called “container orchestration engines”. But when developers enter the world of orchestration, one thing that needs special attention is security. Various blogs, videos, books, and tutorials teach developers how to use these solutions, but only a few mention the need to add security controls to protect applications in the cluster. Moreover, if the underlying infrastructure of the cloud is unreliable (or configured in a vulnerable manner), for instance, there is no way to guarantee the security of a Kubernetes cluster built on this foundation. The main goal of the AdDreSsing ThReats for virtualIseD services (ASTRID) project is to address these technological gaps in the scope of cloud infrastructures. The project proposes a novel cyber-security framework to provide situational awareness for cloud applications and NFV services. The overall workflow of the framework is presented in Fig. 2. According to the workflow, the ASTRID framework allows software and service developers to provide a description of the service graph as well as the infrastructure information. The infrastructure information includes the actual number of launched virtual network functions and parameters assigned after the enforcement process such as IP and port addresses. After receiving the required data from the orchestrator, the controller performs an automatic translation from the high-level policy to low-level configuration parameters for firewall network functions. This process of automatic configuration is formally proven to meet these security policies as a part of this analysis. The security controller formulates the problem of the automatic configuration of firewall rule tables as the Maximum Satisfiability Modulo Theories (MaxSMT) problem. It is a basic constraint optimization problem that we use to provide two main features: i) high assurance in the correctness of the possible the behaviour of the security functions, in the control plane. In the next subsection, we describe the component in detail. B. Security Controller The Security Controller has been developed on the basis of the methodology presented in [8]. It incorporates programmability and automation in the synthesis of virtual firewall rules from a user-provided security policy. With this respect, the Security Controller works in close coordination along with the service orchestrator. The service orchestrator is in charge of providing a description of the service graph as well as the infrastructure information. The infrastructure information includes the actual number of launched virtual network functions and parameters assigned after the enforcement process such as IP and port addresses. After receiving the required data from the orchestrator, the controller performs an automatic translation from the high-level policy to low-level configuration parameters for firewall network functions. This process of automatic configuration is formally proven to meet these security policies as a part of this analysis. The security controller formulates the problem of the automatic configuration of firewall rule tables as the Maximum Satisfiability Modulo Theories (MaxSMT) problem. It is a basic constraint optimization problem that we use to provide two main features: i) high assurance in the correctness of the computed solutions, thanks to the intrinsic formal correctness-by-construction paradigm; ii) optimality of the solution, by minimizing the number of automatically generated firewall rules, with the purpose to improve the filtering operations. To this day, optimization problems are modeled by Integer Programming (IP) languages. At the same time, most of them are NP-hard classes, and large-scale integer problems are difficult to solve. Moreover, none of the variations of the IP formulation are able to model the problem of automatic firewall configuration having in mind the verification of end-to-end reachability. This is due to the less expressive power of the approaches compared to the Constraint Satisfaction Problem (CSP) representations. An instance encoding of CSP, MaxSMT in our case, is defined by a set of variables, a set of possible values (or domains) for each variable, and a set of soft and hard constraints, each constraint involving one or more variables. A MaxSMT solver determines for a given instance whether it is possible to assign a value to each variable from its respective domain in order to satisfy all hard constraints and an optimal number of soft constraints simultaneously. The Security Controller translates the input service graph into a MaxSMT instance by means of a set of First-Order Logic formulas. In a nutshell, these formulas will be converted to boolean variables in Conjunctive Normal Form, eventually. In addition to the topological definition of the service graph, each network function of the service graph will be translated into the abstract model according to the guidelines given by Verigraph [19]. This allows us to provide a higher level of assurance that the automatically generated configuration parameters of the firewall will satisfy the security policies in the presence of complex network functions. The level of abstraction of these models covers all the forwarding behavior of the network and their configuration parameters that are already defined. Instead, we model the firewall network function by introducing soft constraints over variables, which then will be decided to satisfy or not by the MaxSMT solver. These variables represent the IP and port addresses to be autoconfigured in order to satisfy the end-to-end policies. Initially, these variables are set to false, which means that a firewall does not contain any rule. If the policy requires that the firewall must block the traffic, it must falsify the soft constraint in favor of satisfying the policy requirement. Hence, the policy requirement is modeled as a hard constraint, which means it must be always satisfied. In this way, the solver tries to minimize the falsifying constraints in the formula and satisfy the hard constraints. This is the definition of the optimization problem we pursue to solve. In order to represent the reachability policies by means of hard constraints, we introduce the concept of packet flows between endpoints. The first constraint we assert is that the network function model defined in the service graph must forward a packet flow if it receives a packet flow. This constraint must be true under the functional behavior of the network device. For instance, this is true if a firewall network function does not contain any rule that drops packets. The second constraint states that the packet flow sent from a source node must be received by the destination node. Other constraints include the forwarding path definitions and static configuration parameters of network functions. This concludes the fact that IP formulation of the same problem would be limited to a set of constraints over binary, integer, or real variables. Instead, the approach presented in this paper allows us to model and using very expressive constraints. These constraints include configuration parameters of network functions, forwarding behavior of the service graph, and complex security policies, in addition to the automatic configuration constraints of the problem. Therefore, existing IP algorithms are not comparable to our algorithm for that class of problems. In the next section, we demonstrate our approach by means of a representative scenario. IV. USE CASE SCENARIO This section presents our framework in greater detail with a practical use case and motivates our design decisions. For the sake of simplicity, we focus our attention on a specific component of the ASTRID framework, the Security Controller, and emphasize the fact that the interaction between other components is performed by means of a REST API. We expose a number of resource endpoints to the Security Orchestrator, which will use to deliver the service graph and infrastructure information and to retrieve the automatically generated firewall rules. We underline the fact this methodology can be extended to more general scenarios than the ASTRID framework. In fact, the Security Controller is a standalone web service application, which makes it possible to be easily incorporated into existing cloud platforms and orchestrators. We consider the scenario where an administrator predefines the logical service graph presented in Fig. 3a and feeds it to the dashboard of the ASTRID framework. This service graph represents a realistic scenario where the nginx web server is made public to the Internet and functions as a reverse proxy to fetch dynamic data from multiple instances of nodejs and apache servers. In this case, both servers can acquire data from a mysql database. As we can see from the figure, reachability policies required by the use case are rather obvious (i.e., highlighted with arrows). Instead, the isolation property required by the service graph is not evident. For instance, all the communications, which are not highlighted with arrows must be isolated. Considering the fact that each service in the graph is associated with a firewall, firewalls are preconfigured with deny-all rules, in order to satisfy this policy. This ensures that all other interactions within the service graph must be isolated, except the ones predefined by the user (i.e., arrows). A Service Orchestrator of the ASTRID framework is in charge of deploying the service graph onto the infrastructure and generating the enriched service graph shown in Fig. 3b. During this enforcement phase, all the services are assigned with corresponding IP addresses and ports where these services can be reached. It is important to highlight that the multiple instances of the services are deployed in separate Pods and each will have its own IP addresses. In this scenario, the user specified to have two instances of the nodejs server to handle the load. To illustrate the complexity introduced by this simple use case, we included all the links connecting each service in the infrastructure in Fig. 3b. Taking into account the deny-all rules of each firewall of the service, we can assure that there is no reachability between the Pods in this phase. Although, we have specified the user policy that needs to be satisfied by means of the arrows in the figure. As an example, apache server needs to be configured to allow traffic from itself to a mysql database and allow communication from nodejs. However, it needs to be isolated from each instance of the nodejs servers. Without the Security Controller, an administrator of the infrastructure must manually configure each firewall. This process of manual configuration of each firewall is error-prone and time-consuming. This scenario motivates the use of the Security Controller presented in this paper, in order to automatically generate firewall configurations for each service and provide formal assurance that the network policy defined by the user is satisfied. To obtain the low-level configuration of each firewall component, the Security Controller accepts as an input the infrastructure information and logical service graph as described in Section III. Infrastructure information contains the IP and port addresses of each service that is shown in Fig. 3b. This information is required to define the firewall rules, which allows to block specific packet flows involving specific Pods. In the next step, the Security Controller automatically generates an output with a low-level configuration of each firewall component. As an example, we present the partial output format and the actual configuration parameters generated by the Security Controller in Listing 1. In this prototype evaluation experiment, we use a machine with 3.40 GHz Intel i7-6700 CPU and 32GB of RAM. The average time needed for the overall procedure is less than a second. We need to emphasize the fact that for most service requests, the time required to schedule VMs to be several orders of magnitude larger than the this computation time. Listing 1 shows the configuration parameters generated for the firewall component of the mysql service. It includes all the neighbors of the firewall in the infrastructure network and firewall rule entries. According to the output, we need to configure the firewall with 3 entries. ``` 1 <node name="172.20.1.34" functional_type="FIREWALL"> 2 <neighbour name="172.20.1.14"/> 3 <neighbour name="172.20.1.32"/> 4 <neighbour name="172.20.1.31"/> 5 <neighbour name="172.20.1.30"/> 6 <neighbour name="172.20.1.33"/> 7 <configuration name="mysql" description="172.20.1.14"> 8 <firewall defaultAction="DENY"> 9 10 <action>ALLOW</action> 11 <source>172.20.1.13</source> 12 <destination>172.20.1.14</destination> 13 <protocol>TCP</protocol> 14 <src_port>7777</src_port> 15 <dst_port>8080</dst_port> 16 </element> 17 </element> 18 <action>ALLOW</action> 19 <source>172.20.1.11</source> 20 <destination>172.20.1.14</destination> 21 <protocol>TCP</protocol> 22 <src_port>8080</src_port> 23 <dst_port>8080</dst_port> 24 </element> 25 </element> 26 <action>ALLOW</action> 27 <source>172.20.1.12</source> 28 <destination>172.20.1.14</destination> 29 <protocol>TCP</protocol> 30 <src_port>8080</src_port> 31 <dst_port>8080</dst_port> 32 </element> 33 </configuration> 34 </node> ``` The first rule states that the packets arriving from the Pod with an IP address 172.20.1.13 need to be allowed. The rest of the rules are associated with the two instances of the nodejs server of the service graph. Due to the default action set by the firewall in line 8, Listing 1, all the other packets arriving from the network is dropped. For instance, intruders from the Internet are not able to access the mysql database in accordance with these rules. This, in fact, ensures the satisfiability of the initial service graph policy defined by the user. Eventually, the output file generated by the Security Controller is sent back to the Context Broker, which is in charge of translating the low-level configuration of each firewall into a vendor-specific format of the firewall. An important feature of the Security Controller is in the possibility to have firewalls without any configuration as in the use case or with partial configuration, giving to the tool itself the task of providing the missing configurations as an output. The tool generates the configuration with the objective of satisfying all the requested policies while minimizing the number of generated rules in order to achieve it. In the case of partial configuration, a firewall may include static rule entries that will not be changed in the output. This is useful when the service graph is updated according to an event when a Pod is terminated or a new Pod has been created to handle the overhead to the service. In this scenario, in order not to recompute the configuration parameters of all the other services, we can provide their rules in a static manner, meaning that they can be left unchanged. This process not only generates a set of configuration parameters but also provides an optimal set of rules to satisfy the user policy. Optimality is achieved by minimizing the number of rules inside each firewall to improve the performance of the virtual network functions. V. CONCLUSION AND FUTURE WORKS In this paper, we illustrated the benefits which the introduction of automatic programmability would bring for the synthesis of firewall rule sets in virtual networks, in the respect of NFV and cloud infrastructures with special emphasis on Kubernetes. In particular, the role of the present automated methodology in the ASTRID framework architecture has been described, with an emphasis on the contributions provided to the Security Controller. We formulate the problem of automatic firewall configuration as a MaxSMT instance and solve it to provide reachability assurance between endpoints. As possible future works, we are currently planning to introduce programmability for other kinds of network security functions, such as intrusion detection systems and security devices for channel protection (e.g., VPN gateways). Moreover, we plan to provide automatic configuration settings in the presence of minor changes in the initial service graph without solving the problem from scratch. As the initial results show promises in smaller instances, we plan to evaluate the model in larger scale scenarios. ACKNOWLEDGMENT This work has been partially supported by the EU H2020 Projects ASTRID (Grant Agreement no. 786922) and Cyber-
{"Source-Url": "https://iris.polito.it/retrieve/handle/11583/2844332/391324", "len_cl100k_base": 5723, "olmocr-version": "0.1.53", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 22157, "total-output-tokens": 6414, "length": "2e12", "weborganizer": {"__label__adult": 0.0003750324249267578, "__label__art_design": 0.00044083595275878906, "__label__crime_law": 0.0008225440979003906, "__label__education_jobs": 0.0006966590881347656, "__label__entertainment": 0.0001310110092163086, "__label__fashion_beauty": 0.0001691579818725586, "__label__finance_business": 0.0005259513854980469, "__label__food_dining": 0.00033974647521972656, "__label__games": 0.0005960464477539062, "__label__hardware": 0.00232696533203125, "__label__health": 0.0007796287536621094, "__label__history": 0.0003292560577392578, "__label__home_hobbies": 0.00012743473052978516, "__label__industrial": 0.0006833076477050781, "__label__literature": 0.0003132820129394531, "__label__politics": 0.0004088878631591797, "__label__religion": 0.00042557716369628906, "__label__science_tech": 0.311767578125, "__label__social_life": 0.0001506805419921875, "__label__software": 0.047637939453125, "__label__software_dev": 0.6298828125, "__label__sports_fitness": 0.0002532005310058594, "__label__transportation": 0.00057220458984375, "__label__travel": 0.00022530555725097656}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 30521, 0.07252]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 30521, 0.43497]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 30521, 0.90658]], "google_gemma-3-12b-it_contains_pii": [[0, 1413, false], [1413, 7067, null], [7067, 12392, null], [12392, 17168, null], [17168, 23758, null], [23758, 27419, null], [27419, 30521, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1413, true], [1413, 7067, null], [7067, 12392, null], [12392, 17168, null], [17168, 23758, null], [23758, 27419, null], [27419, 30521, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 30521, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 30521, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 30521, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 30521, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 30521, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 30521, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 30521, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 30521, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 30521, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 30521, null]], "pdf_page_numbers": [[0, 1413, 1], [1413, 7067, 2], [7067, 12392, 3], [12392, 17168, 4], [17168, 23758, 5], [23758, 27419, 6], [27419, 30521, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 30521, 0.0]]}
olmocr_science_pdfs
2024-12-07
2024-12-07
37bee5a6c8d2e225f9f29b179f5873a852843663
PhD Thesis proposal Supporting Conceptual Modelling in ORM by Reasoning Francesco Sportelli Otto von Guericke Universität Magdeburg Abstract Object-Role Modelling (ORM) is a framework for modelling and querying information at the conceptual level. It comes to support the design of large-scale industrial applications allowing the users to easily model the domain. The expressiveness of the ORM constraints may lead to implicit consequences that can go undetected by the designer in complex diagrams during the software development life cycle. To avoid these issues we perform reasoning on ORM diagrams in order to detect relevant formal properties, such as inconsistencies or redundancies, that cause a software quality degradation leading to an increment of development times and costs. In order to activate the reasoning process over ORM diagrams, we show a relevant and decidable ORM fragment encoded into OWL. Furthermore, we extend the ORM formalisation by Derivation Rules, which are additional ORM constructs that capture some relevant information of the domain that cannot be expressed in standard ORM. To this end, we illustrate the implementation of our formalisation in the tool UModel, which provides also an API system in order to be integrated into any conceptual modelling software; we provide a real-case study where the host software is NORMA. Keywords: ORM, conceptual modelling, reasoning, rules 1 Overview Conceptual modelling is a critical step during the development of a database system. It is the detailed description of the universe of discourse in a language that is understandable by users of the business domain. Object-Role modelling (ORM) is a conceptual language for modelling, which includes a graphical and textual language for specifying models, a textual language for formulating queries, as well as procedures for constructing ORM models, and mapping to other kinds of models like UML and ER. ORM is fact-oriented, i.e., it models the information in a way that it can be verbalized using sentences that are easily understandable by domain experts and even for those who are not familiar with IT in general. Unlike ER and UML, fact-oriented models are attribute-free, treating all facts (sentences) as relationships (unary, binary, ternary etc.) and this makes it more stable and adaptable to changing business requirements. For example, instead of using the attributes Person.isSmoker and Person.hiredate, fact-oriented models use the fact types Person smokes and Person was hired on Date [1]. The ORM constraints expressiveness may lead to implicit consequences that can go undetected by the designer in complex diagrams; this may also lead to various forms of inconsistencies or redundancies in the diagram itself that give rise to the degradation of the quality of the design and/or increased development times and costs. The approach used to solve this issue involves the automated reasoning in order to detect inconsistencies and redundancies. Moreover, ORM diagrams can be equipped with Derivation Rules which are additional ORM constructs that are able to express knowledge that is not expressible with standard ORM. The usage of those rules brings to a further complexity; in order to perform the reasoning task even on those ORM diagrams equipped with those rules, we need to detect a decidable fragment. We also introduce the state of the art starting from the first ORM formalisation until the most recent one. Then, we introduce an overview of the ORM language focusing on its main features like fact-oriented, the verbalisation and the graphical notation. The section concerning the research has four subsections: 1. ORM formalisation, we present a decidable fragment up to 11 ORM constraints; 2. ORM Derivation Rules formalisation, an extension of the previous fragment; 3. UModel, a tool designed to activate automated reasoning on any conceptual modelling software; 4. ORMiE, a tool which performs reasoning on ORM diagrams using UModel. In the end, we present the list of what is still to be done in the frame of the PhD. 2 Related Work The ORM formalisation started with Terry Halpin’s PhD Thesis [2]. In the context of design conceptual and relational schemas, Halpin formalized the NIAM language that is the ancestor of ORM. In his thesis there is the first attempt to formalize a modelling language in order to perform the reasoning task, so the main objective is to provide formal basis for reasoning about conceptual schemas and for making decision choices. After the spreading of ORM and its implementation in NORMA [3], [4], ORM became more popular so the logicians’ community took into account the possibility to formalize this very expressive language. In 2007, Jarrar formalizes ORM using $\mathcal{DLR}_{ifd}$ [5], an extension of Description Logics introduced in [6]. The paper shows that a formalisation in OWL $\mathcal{SHOIN}$ would be less efficient than $\mathcal{DLR}_{ifd}$ because some ORM constraints cannot be translated (predicate uniqueness, external uniqueness, set-comparison constraints between single roles and between not contiguous roles, objectification n-ary relationships). In [7], Jarrar encodes ORM into OWL $\mathcal{SHOIN}$. Another formalisation of ORM in $\mathcal{DLR}_{ifd}$ was done by Keet in [8]. In 2009 OWL 2 was recommended by W3C Consortium as a standard of ontology representation on the Web bringing some benefits: it is the recommended ontology web language; it is used to publish and share ontologies on the Web semantically; it is used to construct a structure to share information standards for both human and machine consumption; automatic reasoning can be done against ontologies represented in OWL 2 to check consistency and coherency of these ontologies. An ORM formalisation based on OWL2 is proposed by Franconi in [9], where he introduces a new linear syntax and FOL semantics for a generalization of ORM2, called ORM2plus, allowing the specification of join paths over an arbitrary number of relations. The paper also identifies a “core” fragment of ORM2, called ORM2zero, that can be translated in a sound and complete way into the ExpTime-complete Description Logic $\mathcal{ALCQI}$. [10] provides a provably correct encoding of a fragment of ORM2zero into a decidable fragment of OWL2 and it is discussed how to extend ORM2zero in a maximal way by retaining at the same time the nice computational properties of ORM2zero. The most recent paper related to ORM formalisation is [11] where Artale introduces a new extension of $\mathcal{DLR}$, namely $\mathcal{DLR}^+$. This paper is strictly connected with this work because the logic $\mathcal{DLR}^+$ it is meant to represent n-ary relationships which are suitable for languages like ORM. The ORM implementation we use is an ongoing work based on $\mathcal{DLR}^+$. In particular, the decidable fragment we use is $\mathcal{DLR}^\otimes$, obtained by imposing a simple syntactic condition on the appearance of projections and functional dependencies in $\mathcal{DLR}^+$. In the paper is also provided an OWL encoding and it is proved that $\mathcal{DLR}^\otimes$ captures a significant fragment of ORM2. Since this work is also focused on the formalisation of derivation rules, we need to mention OCL. OCL stands for Object Constraint Language, it is the declarative language for describing rules that apply to UML diagrams for defining constraints in order to support the conceptual modelling, like Derivation Rules for ORM. In [12] has been provided a formalisation of a fragment of this language and has been also proved the equivalence between relational algebra and the fragment with only FOL features, namely $\text{OCL}_{FO}$. 3 ORM ORM stands for Object-Role Modelling. It is a language that allows users to model and query information at the conceptual level where the world is described in terms of objects (things) playing roles (parts in relationships) [13]. The idea behind ORM and its approach is that an object-role model avoids the need to write long documents in ambiguous natural language prose. It's easy for non-technical sponsors to validate an object-role model because ORM tools can generate easy-to-understand sentences. After an object-role model has been validated by non-technical domain experts, the model can be used to generate a class model or a fully normalised database schema. ORM main features are: – **fact-oriented**, all facts and rules are modelled in terms of controlled natural language (FORML) sentences easy to understand even for non-technical users; – **attribute-free**, unlike ER and UML, makes it more stable and adaptable to changing business requirements; – **graphical**, it has a graphical notation implemented by the software NORMA; – **formalised**, it has a clear syntax and semantics, so reasoning on ORM diagrams is enabled. **Figure 1: ORM diagram example** Unlike ER or UML, ORM makes no use of attributes in its base models; although this often leads to larger diagrams, an attribute-free approach has advantages for conceptual analysis, including simplicity, stability, and ease of validation. Attribute-free models with a controlled natural language facilitate model validation by verbalisation and population. Model validation should be a collaborative process between the modeller and the business domain expert who best understands the business domain. All facts, fact types, constraints and derivation rules may be verbalised naturally in unambiguous language that is easily understood by domain experts who might not be experts in the software systems ultimately used for the physical implementation. The meaning of the diagram in Fig. 1 is the following: a person can be a citizen or a visitor; each person is identified by one and only one document which can only be either a visa or an id card. The entities are depicted by smooth rectangles and the relationships by a sequence of tiny boxes according to the cardinality relationship. The purple dot represents a mandatory constraint, the dash on the tiny rectangle box is a uniqueness constraint, the equivalent of relation- tional keys. The arrows among entities represents the ISA relationship. Finally, the circle with the cross inside means disjointness; the one with another circle inside means covering; the combination of these two is the circle we see between Visa and IDCard. The notation (.Name) and (.Id) inside Person and Document it is a graphical shortcut provided by NORMA for top level entities. Intuit- ively, it means that each person has a name and each document has an id. The Corresponding FORML verbalization is the following: Person is an entity type. Citizen is an entity type. Visitor is an entity type. Document is an entity type. VISA is an entity type. IDCard is an entity type. Person is identified by Document. Each Citizen is an instance of Person. Each Visitor is an instance of Person. Each VISA is an instance of Document. Each IDCard is an instance of Document. Each Person has exactly one Document. For each Document, at most one Person has that Document. For each Document, exactly one of the following holds: that Document is some VISA; that Document is some IDCard. This feature turns out to be helpful during the modelling phase especially when the non-IT stakeholders interact with the software engineers in order to reach a mutual comprehension about the meaning of the diagram. For example, if the non-IT stakeholder detects unexpected sentences which do not reflect the software specifications, it is easy for the modeller to modify the interested part. 4 Motivation Conceptual modelling tools are powerful systems which accelerate the develop- ment of the software, providing a set of powerful features to model a domain. They use conceptual modelling languages which are closer to the way we ab- tract the world in our cognition, making them ideal to model a domain. The limitation of the conceptual modelling tools is that they lack of semantics check capabilities. This limitation could lead to software degradation and unexpec- ted software behaviours, especially for large-scale environment this could be a serious issue. The core idea of the dissertation is to provide a methodology in order to overcome this limitation. We believe that a conceptual modelling tool should not be limited to check the syntax of the diagrams, but the semantics too, because it could enhance the trust of the system, or, in the worst case could suggest the revision. The methodology involves the formalisation of conceptual modelling languages and in the thesis the focus is on ORM. The ORM formalisation has been treated in years of research and still today it is a topic of interest. Formalising such language allows to activate reasoning procedures, carried out by Description Logics reasoners. The reasoning procedures are able to perform the semantic check over ORM diagrams, in this way is possible to manage the aforementioned limitation. The research follows two main tracks: the theoretical aspect, related to ORM and Derivation Rules formalisation; the other track is the implementation counterpart of the first track, since it concerns the creation of a set of tools in order to support the modeller. 4.1 Research goals Outlined are the main goals of the research: - **Goal 1**: providing an encoding for ORM in OWL; - **Goal 2**: providing a formalisation for ORM Derivation Rules, both Subtype and FactType; - **Goal 3**: implementation of a tool that adds reasoning capabilities to CASE tools; - **Goal 4**: implementation of a real case study grounded on the entire methodology. 4.2 Novelty and relevance of research Reaching the first goal, providing an OWL encoding for ORM, is the prerequisite to achieve the other goals since it constitutes the base of the methodology. The second goal is an extension of the first one. Although several papers presented their own ORM formalisation, no one has taken into account the formalization of ORM derivation rules so far. Derivation rules are recent ORM constraints which are able to express knowledge that is beyond normal ORM capabilities, but this feature leads to an increase of expressiveness of the diagrams. For this reason, the challenge is to identify a decidable fragment in order to extend the reasoning even to those ORM diagrams equipped with those rules. Reaching the third goal would provide to the community a tool which is able to overcome the aforementioned limitations of CASE tools. The direct impact of this goal involves various actors, such as the modellers, the database or software engineers. The versatility of the software makes possible to enrich any conceptual modelling software of reasoning capabilities, making the impact of the research in particular relevant for the industry world. A successful result in the last goal could demonstrate the efficiency of the methodology applied to real cases. 5 Current State of Research The main goal of the research aims to support the modeller during the design step of the software by reasoning, in order to detect constraints which can lead to unexpected software behaviours, or to infer new knowledge, or more in general to increase the trust of the system. To apply the reasoning over an ORM diagram, we first need to formalise ORM. Therefore, we first provide the ORM decidable fragment that we detected so far, alongside its extension with ORM Derivation Rules. The contribution has also an implementation counterpart carried out by two tools: UModel(Unreal Model) and ORMiE(ORM Inference Engine). The former is a standalone tool which uses Fact++ as a background reasoning engine; the latter uses the UModel API system to add reasoning capabilities to NORMA (Natural ORM Architect) which is the official Microsoft Visual Studio plugin with full ORM implementation. 5.1 ORM encoding in OWL ORM encoding in OWL is a process made by some steps that are summarized in the following lines and depicted in Fig.2. ![Figure 2: The formalisms involved in the process](image) At the first stage we take into account the syntax for every ORM constraint. Then, for each constraint, we assign a corresponding semantics in first order logic. At this point we rewrite the semantics using DLR because it is specifically designed to deal with n-ary relationships, in the limit of DLR expressibility; this means that some constraints are out of the fragment because they lead to undecidability. In the end, we apply the encoding from DLR to OWL. Once we have built the corresponding ontology, we can start the reasoning process. At the current time, the reasoning process supports the following inferences: - hierarchy among predicates/objects - equivalence among predicates/objects - disjointness among predicates/objects - simple mandatory constraint - simple uniqueness constraint - inconsistencies Here are provided the involved formalisms and translations for the diagram in Fig.1 starting assigning the semantics to each constraint in first-order logic. **FactType** \[ \forall x, y. \text{isIdentifiedBy}(x, y) \rightarrow \text{Person}(x) \land \text{Document}(y) \] Mandatory \( \forall x. \text{Person}(x) \rightarrow \exists y. \text{isIdentifiedBy}(x, y) \land x = y \) Uniqueness \( \forall x, y. \text{isIdentifiedBy}(x, y) \rightarrow \exists^{\leq 1} z. \text{isIdentifiedBy}(x, z) \) \( \forall x, y. \text{isIdentifiedBy}(x, y) \rightarrow \exists^{\leq 1} z. \text{isIdentifiedBy}(z, y) \) Subtype \( \forall x. \text{Citizen}(x) \rightarrow \text{Person}(x) \) \( \forall x. \text{Visitor}(x) \rightarrow \text{Person}(x) \) \( \forall x. \text{Visa}(x) \rightarrow \text{Document}(x) \) \( \forall x. \text{IDcard}(x) \rightarrow \text{Document}(x) \) Exclusive \( \forall x. \text{Visa}(x) \rightarrow \neg \text{IDCard}(x) \) Exhaustive \( \forall x. \text{Document}(x) \rightarrow \text{Visa}(x) \lor \text{IDCard}(x) \) Finally, it is possible to encode the ORM constraints in OWL. FactType \( \text{isIdentifiedBy} \sqsubseteq (\sigma_1: \text{Person}\text{isIdentifiedBy}) \sqcap (\sigma_2: \text{Document}\text{isIdentifiedBy}) \) Mandatory \( \text{Person} \sqsubseteq \exists^1 \text{isIdentifiedBy} \) Uniqueness \( \exists^1 \text{isIdentifiedBy} \sqsubseteq \exists^{=1} \text{isIdentifiedBy} \) \( \exists^2 \text{isIdentifiedBy} \sqsubseteq \exists^{=1} \text{isIdentifiedBy} \) Subtype \( \text{Citizen} \sqsubseteq \text{Person} \) \( \text{Visitor} \sqsubseteq \text{Person} \) \( \text{Visa} \sqsubseteq \text{Document} \) \( \text{IDCard} \sqsubseteq \text{Document} \) Exclusive \( \text{Visa} \sqsubseteq \neg \text{IDCard} \) Exhaustive \( \text{Document} \sqsubseteq \text{Visa} \sqcup \text{IDCard} \) \( \text{isIdentifiedBy} \sqsubseteq (\sigma_1: \text{Person}\text{isIdentifiedBy}) \sqcap (\sigma_2: \text{Document}\text{isIdentifiedBy}) \) Mandatory \( \text{SomeVisitor} \sqsubseteq \text{PROJ-isIdentifiedBy2-1} \) Uniqueness \( \exists^1 \text{isIdentifiedBy} \sqsubseteq \exists^{=1} \text{isIdentifiedBy} \) \( \exists^2 \text{isIdentifiedBy} \sqsubseteq \exists^{=1} \text{isIdentifiedBy} \) \( \exists^3 \text{isIdentifiedBy} \sqsubseteq \exists^{=1} \text{isIdentifiedBy} \) \( \exists^4 \text{isIdentifiedBy} \sqsubseteq \exists^{=1} \text{isIdentifiedBy} \) Finally, it is possible to encode the ORM constraints in OWL. FactType \( \text{isIdentifiedBy} \sqsubseteq \text{PROJ-isIdentifiedBy} \sqcap \forall Q_1. \text{Person} \sqcap \forall Q_2. \text{Document} \) Mandatory \( \text{PROJ-isIdentifiedBy2-1} \equiv \exists Q_1. \text{PRED-isIdentifieBy-1} \) \( \text{SomeVisitor} \sqsubseteq \text{PROJ-isIdentifiedBy2-1} \) Uniqueness \( \exists^1 \text{isIdentifiedBy} \sqsubseteq \exists^{=1} \text{isIdentifiedBy} \) \( \exists^2 \text{isIdentifiedBy} \sqsubseteq \exists^{=1} \text{isIdentifiedBy} \) \( \exists^3 \text{isIdentifiedBy} \sqsubseteq \exists^{=1} \text{isIdentifiedBy} \) \( \exists^4 \text{isIdentifiedBy} \sqsubseteq \exists^{=1} \text{isIdentifiedBy} \) \( \exists^5 \text{isIdentifiedBy} \sqsubseteq \exists^{=1} \text{isIdentifiedBy} \) \( \exists^6 \text{isIdentifiedBy} \sqsubseteq \exists^{=1} \text{isIdentifiedBy} \) Subtype Citizen ⊑ Person Visitor ⊑ Person Visa ⊑ Document IDCard ⊑ Document Exclusive Visa ⊑ ¬IDCard Exhaustive Document ⊑ Visa ⊑ IDCard All details regarding the formalisation are in an internal document that is planned to be published soon. 5.2 Derivation rules Derivation Rules are special ORM constructs which express knowledge that would otherwise not be expressible by standard ORM, so their expressibility reaches farer than standard ORM. Their purpose is to derive new information from other information, like triggers, stored procedures and views in SQL. The goal is to enable the reasoning on those rules in order to extend the reasoning even to those ORM diagrams equipped with Derivation Rules. There are two kind of Derivation Rules: the Subtype Derivation Rules and the Fact Type Derivation Rules. A Subtype Derivation Rule defines all the instances which belongs to a subentity by a set of constraints defined in the rule definition. The reason because those rules are applied on subentities is because in some diagrams the is-a relationship between entities is too weak to capture the entire desired semantics of the diagram; a FactType Derivation Rule is placed on the predicates, namely the ORM roles. The Derivation Rules we are focusing on are Subtype Derivation Rules. We want to formalise those rules in order to activate the reasoning on those diagrams with Subtype Derivation Rules. To achieve this goal it is important to take into account that the reasoning lays on logic, so we need to find a way to encode derivation rules into a logical language. First of all we need to understand how a derivation rule is made from a structural point of view, in other words we need to detect a clear syntax. Then, at the syntax is assigned a corresponding semantics and in the end an encoding into a logical language is performed in order to made the reasoning possible. In [14] is provided the full methodology used to formalise those rules and their mapping into OWL. We provide an example with the graphical notation implemented by NORMA. For example, the diagram in Fig. 1 does not tell us which are exactly the people in the entity Citizen and exactly the people in the entity Visitor. We only know that a person can be a citizen or a visitor, but in the ORM standard notation there are no constraints able to capture these sets. If we want to use this knowledge we have to use the ORM Derivation Rules like in Fig. 3. As we can see, a derivation rule is defined by an asterisk on entities and a text which defines the meaning of the rule. We state that all the people which are Figure 3: ORM diagram example with derivation rules identified by an id card are citizens; all the people which are identified by a visa are visitors. It is important to observe that the text is not just a collection of words, instead it is in controlled-natural language format that is to say it is well defined by a precise syntax. What can be the outcome of the diagram in Fig.3? The answer is in Fig.4. We obtained a disjunction and covering between the entities Citizen and Visitor. The disjunction is inferred because there is no chance to find a common element between the entity Visa and IDCard. Since the derivation rules capture separately the two sets, visitors and citizens, even the corresponding entities have no element in common. What about the covering? Since Visa and IDCard cover Document and since Person has the mandatory constraint on the relationship $is\ identified\ by$, each person must participate to this relation; in addition to this, the two derivation rules ensure that the sum of the instances in Citizen and Visitor are exactly those who are in Person. So it is not possible to find an instance which is not in Citizen or in Visitor. To prove this, now we add the entity Illegal: people without documents, neither a visa nor id card. The outcome of the reasoning is shown in Fig.5. Illegal is red because it is an empty set. This means that in all consistent worlds the entity type Illegal is always empty, because there are no instances in Illegal which satisfy the rules of the diagram. Again, this is because Person has the mandatory constraint on the $is\ identified\ by$ relationship and because the set of Person is already taken by the entities Citizen and Visitor. Therefore, there is no way an instance in Illegal could be in Person. The counter-example is trivial: if we remove the mandatory constraint on Person then Illegal would not be inconsistent anymore. Figure 4: Inferred disjoint and covering constraints Figure 5: Illegal is inconsistent 5.3 UModel The ambitious intention behind UModel is to build a framework that is able to add reasoning capabilities to any conceptual modelling software, supporting the most common languages such as UML, ER and ORM. In the thesis UModel is used for the ORM language and to enrich NORMA by reasoning capabilities. UModel is written in standard Java 8.0, so it can be used on Linux, Mac and Windows machines; a C# porting is also provided for .NET applications. It can be used as a standalone application or in a more interesting way by its API system, so in this way it can be easily integrated in other applications. UModel has several features: it provides API for developers, reasoning services, the import/export of ontologies and diagrams in different languages like ORM, UML and ER. In Fig. 6 is shown the architecture of UModel. The idea behind this architecture is to isolate the core of the system being transparent to the user, which has to rely only on the API layer. The same applies for the host software that uses UModel, in our case NORMA/ORMiE. UController act as a wrapper which provides the necessary methods that are exposed to the user to interact with UModel. In order to create a diagram, the user starts calling multiple time the function `Tell`, that asserts the constraints in a specific object oriented data structure called `UModel`. After this step the module `UReasoner` is started. At the first stage it reads the model. Then, it constructs the OWL encoding based on the `DLR²` formalisation. UReasoner uses the reasoner engine Fact++ to derive the fresh constraints and store them in the data structure `UDerivedModel`. At this point, the user calls the `Ask` function to get the inferences encoded in object-oriented data structures. In this way, it is possible to use the information encapsulated in these objects to easily expose the inferences to the host application by few lines of code. 5.4 ORMiE ORMiE (ORM Inference Engine) is an extension of NORMA, which is the official ORM-based Microsoft Visual Studio conceptual modelling tool [3]. ORMiE uses UModel API system, so it is just one example how UModel works on a target ORM-based software. ORMiE activates automated reasoning over ORM diagrams providing an interface where mistakes, redundancies or more in general new inferred knowledge are shown. A good feature of ORMiE is that is built on top of NORMA and Visual Studio, so it takes advantage of all nice features from Visual Studio being such a powerful tool for those who need to model a domain following the ORM methodology. Moreover, ORMiE is also able to perform the reasoning on ORM diagrams equipped with Derivation Rules. 6 Ongoing Works This section summarizes the tasks that are still to be done in the frame of my research. 6.1 ORM to OWL encoding The formalisation involves a set of ORM constraints in order to apply the reasoning for a relevant and decidable fragment. In order to do so, the fragment is restricted to all that constraints that are expressible in $DL^±$ (everything except ring constraints), moreover, the set of constraints in the ORM diagram to be faithfully encoded in OWL by $DL^±$ must not violate the syntactic restriction over the projection signature graph which makes a $DL^±$ knowledge base decidable [11], [15]. The restriction says that the projections must not share common attributes. In Fig. 6 is provided an example where the two uniqueness constraints generate two projections sharing one role. At the current stage of the work, some constraints are yet not derived because they are hard to compute, therefore the reasoning process is slowed down. Solving this task is quite challenging because every constraints requires a specific approach in order to build an optimized algorithm. The current version of the OWL encoding is organised in an internal document which is still a draft. It contains all the details concerning the formalisms involved for the encoding and the translations. The document will be published as soon as the remaining con- straints will be finished. Figure 7: Two uniqueness constraints sharing one role 6.2 ORMiE release The latest version of ORMiE has been tested on real-case ORM diagrams and it is quite stable. Now, ORMiE is able to perform the reasoning over ORM diagrams in the limit of the aforementioned fragment and the ORM Subtype Derivation Rules. What still is missing is the capability to deal also with ORM Fact Type Derivation rules, which requires from the implementation perspective the understanding of the complex structures inside NORMA. The difficulty is enhanced by the fact that NORMA completely lacks of documentation for the developers, forcing to perform a reverse engineering to understand how the data structures are made of. 6.3 UModel release The current version of UModel is able to perform the reasoning over the ORM fragment explored so far plus ORM Derivation Rules. A deep work about optim- ization has already been implemented. We plan to improve UModel by adding a user interface that requires a specific study an the user experience with re- spect to the functionality of the reasoning services. In this way, the user can customize and choose which inferences are needed and which services to enable, giving more control over the whole system. The user interface is part of the API system, thus, is possible to attach it in every software hosting UModel. We plan to test UModel also on Menthor [16]. UModel will be downloadable soon with its documentation for developers. 6.4 **Formalisation of the complete ORM Derivation Rules fragment** Both Subtype and Factype ORM Derivation Rules cover a decidable fragment. Until now we treated these fragments because of reasoning, but for the sake of completeness, we plan to formalise the full language. 7 **Time Plan** Here is the time plan of the research according to the aforementioned ongoing works. – **July 2018 - September 2018:** ORM to OWL encoding internal document release – **July 2018 - September 2018:** Formalisation of the complete ORM Derivation Rules fragment – **September 2018 - December 2018:** UModel release – **September 2018 - December 2018:** ORMiE release – **January 2019 - April 2019:** Dissertation writing References
{"Source-Url": "http://theo.cs.ovgu.de/lehre/oberseminar/2018/slides/2018-07-11_paper_sportelli-thesis-proposal.pdf", "len_cl100k_base": 6963, "olmocr-version": "0.1.53", "pdf-total-pages": 17, "total-fallback-pages": 0, "total-input-tokens": 35269, "total-output-tokens": 8932, "length": "2e12", "weborganizer": {"__label__adult": 0.00040030479431152344, "__label__art_design": 0.0007677078247070312, "__label__crime_law": 0.0005254745483398438, "__label__education_jobs": 0.003143310546875, "__label__entertainment": 0.0001266002655029297, "__label__fashion_beauty": 0.0002238750457763672, "__label__finance_business": 0.00039267539978027344, "__label__food_dining": 0.0004012584686279297, "__label__games": 0.0006489753723144531, "__label__hardware": 0.0005044937133789062, "__label__health": 0.0007262229919433594, "__label__history": 0.0003559589385986328, "__label__home_hobbies": 0.00013005733489990234, "__label__industrial": 0.0004944801330566406, "__label__literature": 0.0009136199951171876, "__label__politics": 0.00031876564025878906, "__label__religion": 0.00057220458984375, "__label__science_tech": 0.07672119140625, "__label__social_life": 0.0002315044403076172, "__label__software": 0.015869140625, "__label__software_dev": 0.8955078125, "__label__sports_fitness": 0.0002789497375488281, "__label__transportation": 0.000507354736328125, "__label__travel": 0.0002061128616333008}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 34507, 0.01917]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 34507, 0.48628]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 34507, 0.88745]], "google_gemma-3-12b-it_contains_pii": [[0, 2392, false], [2392, 5311, null], [5311, 8426, null], [8426, 9973, null], [9973, 12574, null], [12574, 15138, null], [15138, 17164, null], [17164, 20215, null], [20215, 22822, null], [22822, 24592, null], [24592, 24817, null], [24817, 27496, null], [27496, 28704, null], [28704, 30357, null], [30357, 31072, null], [31072, 34353, null], [34353, 34507, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2392, true], [2392, 5311, null], [5311, 8426, null], [8426, 9973, null], [9973, 12574, null], [12574, 15138, null], [15138, 17164, null], [17164, 20215, null], [20215, 22822, null], [22822, 24592, null], [24592, 24817, null], [24817, 27496, null], [27496, 28704, null], [28704, 30357, null], [30357, 31072, null], [31072, 34353, null], [34353, 34507, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 34507, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 34507, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 34507, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 34507, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 34507, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 34507, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 34507, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 34507, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 34507, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 34507, null]], "pdf_page_numbers": [[0, 2392, 1], [2392, 5311, 2], [5311, 8426, 3], [8426, 9973, 4], [9973, 12574, 5], [12574, 15138, 6], [15138, 17164, 7], [17164, 20215, 8], [20215, 22822, 9], [22822, 24592, 10], [24592, 24817, 11], [24817, 27496, 12], [27496, 28704, 13], [28704, 30357, 14], [30357, 31072, 15], [31072, 34353, 16], [34353, 34507, 17]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 34507, 0.0]]}
olmocr_science_pdfs
2024-12-10
2024-12-10
092e0c034df0b6d9dbd7114f386ac8753b4b830c
[REMOVED]
{"Source-Url": "https://hal.archives-ouvertes.fr/hal-01563303/file/CSDM%202016.pdf", "len_cl100k_base": 4852, "olmocr-version": "0.1.50", "pdf-total-pages": 14, "total-fallback-pages": 0, "total-input-tokens": 29193, "total-output-tokens": 7085, "length": "2e12", "weborganizer": {"__label__adult": 0.0003786087036132813, "__label__art_design": 0.0007147789001464844, "__label__crime_law": 0.0004014968872070313, "__label__education_jobs": 0.0014696121215820312, "__label__entertainment": 7.909536361694336e-05, "__label__fashion_beauty": 0.0001990795135498047, "__label__finance_business": 0.0003516674041748047, "__label__food_dining": 0.0004112720489501953, "__label__games": 0.0006566047668457031, "__label__hardware": 0.0009899139404296875, "__label__health": 0.0006623268127441406, "__label__history": 0.0004267692565917969, "__label__home_hobbies": 0.000118255615234375, "__label__industrial": 0.0006976127624511719, "__label__literature": 0.0004124641418457031, "__label__politics": 0.0003590583801269531, "__label__religion": 0.0006704330444335938, "__label__science_tech": 0.0821533203125, "__label__social_life": 0.0001239776611328125, "__label__software": 0.0068359375, "__label__software_dev": 0.900390625, "__label__sports_fitness": 0.00039267539978027344, "__label__transportation": 0.0009016990661621094, "__label__travel": 0.00027441978454589844}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 29512, 0.03577]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 29512, 0.50425]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 29512, 0.90171]], "google_gemma-3-12b-it_contains_pii": [[0, 1123, false], [1123, 3602, null], [3602, 6833, null], [6833, 8490, null], [8490, 11629, null], [11629, 11785, null], [11785, 13464, null], [13464, 16595, null], [16595, 18374, null], [18374, 20193, null], [20193, 21970, null], [21970, 23983, null], [23983, 27203, null], [27203, 29512, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1123, true], [1123, 3602, null], [3602, 6833, null], [6833, 8490, null], [8490, 11629, null], [11629, 11785, null], [11785, 13464, null], [13464, 16595, null], [16595, 18374, null], [18374, 20193, null], [20193, 21970, null], [21970, 23983, null], [23983, 27203, null], [27203, 29512, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 29512, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 29512, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 29512, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 29512, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 29512, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 29512, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 29512, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 29512, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 29512, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 29512, null]], "pdf_page_numbers": [[0, 1123, 1], [1123, 3602, 2], [3602, 6833, 3], [6833, 8490, 4], [8490, 11629, 5], [11629, 11785, 6], [11785, 13464, 7], [13464, 16595, 8], [16595, 18374, 9], [18374, 20193, 10], [20193, 21970, 11], [21970, 23983, 12], [23983, 27203, 13], [27203, 29512, 14]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 29512, 0.0]]}
olmocr_science_pdfs
2024-12-01
2024-12-01
8af6f24a110f7be1984ea7ad2e2f4a68844223b8
MODEL CHECKING IS REFINEMENT From Computation Tree Logic to Failure Trace Testing Stefan D. Bruda and Zhiyu Zhang Department of Computer Science, Bishop’s University, Sherbrooke, Quebec J1M 1Z7, Canada Abstract: Two major systems of formal conformance testing are model checking and algebraic model-based testing. Model checking is based on some form of temporal logic. One powerful and realistic logic being used is computation tree logic (CTL), which is capable of expressing most interesting properties of processes such as liveness and safety. Model-based testing is based on some operational semantics of processes (such as traces, failures, or both) and associated preorders. The most fine-grained preorder beside bisimulation (mostly of theoretical importance) is based on failure traces. We show that these two powerful variants are equivalent, in the sense that for any CTL formula there exists a set of failure trace tests that are equivalent to it. Combined with previous results, this shows that CTL and failure trace tests are equivalent. 1 INTRODUCTION We refer to conformance testing as the process of formally proving or disproving the correctness of a system with respect to a certain specification or property. In (formal) model-based testing test cases are derived systematically and automatically from the specification; we then run the test cases against the system under test and observe the final results of the run. In model checking the specification of the system is described by temporal logic formulae; we then construct a model of the system and we check whether the model satisfies the given specification formula. In this paper we focus on CTL, one particular temporal logic. We also focus on arguably the most powerful method of model-based testing, namely failure trace testing (Langerak, 1989). Some properties of a system may be naturally specified using temporal logic, while others may be specified using finite automata or labelled transition systems. Such a mixed specification could be given by somebody else, but most often algebraic specifications are just more convenient for some components while logic specifications are more suitable for others. Consider some properties expressed as CTL formulae that hold for some part A of a larger system. They could be model checked so we know that part A is correct. The specification of a second part B of the same system is algebraic. We can do model-based testing on it and once more be sure that part B is correct. Now we put them together. The result is not automatically correct. We do not even have a global formal specification: part of it is logic, and other part is algebraic. Before everything else we thus need to convert one specification to the form of the other. We describe here precisely such a conversion: We show that for each CTL formula there exists an equivalent failure trace test suite. Combined with previous results (Bruda and Zhang, 2009)—where the conversion the other way around is established—we effectively show that CTL and failure trace testing are equivalent. We are thus opening the domain of combined (algebraic and logic) methods of conformance testing. While the amount of work in both logic and algebraic areas of conformance testing is huge, work in this combined area is scarce. Specifically, we are aware of some work in relating LTL and De Nicola and Hennessy testing (Cleaveland and Lütten, 2000) but we are not aware of any work relating CTL and failure trace testing. 2 PRELIMINARIES A Kripke structure over a set $AP$ of atomic propositions is a tuple $K = (S, S_0, \rightarrow, L)$. $S$ is the set of states, $S_0 \subseteq S$ is the set of initial states, $\rightarrow \subseteq S \times S$ is the transition relation ($s \rightarrow t$ is short for $(s, t) \in \rightarrow$). $L : S \rightarrow 2^{AP}$ specifies which propositions are true in each state. A path in a Kripke structure is a sequence $q_0 \rightarrow q_1 \rightarrow q_2 \rightarrow \cdots$ such that $q_i \rightarrow q_{i+1}$ for all $i \geq 0$. Temporal logics include CTL*, CTL, and LTL (Clarke et al., 1999). CTL and CTL are strict subsets of CTL*. CTL* features two path quantifiers $A$ and $E$ (for all/computations paths) and five basic temporal operators: X "next", F "eventually", G "always" or "globally", U "until", and R "releases"; we have state formulae (that hold in a state) and path formulae (that hold along a path). In CTL the temporal operators must be immediately preceded by a path quantifier. The syntax of CTL formulae can thus be defined as follows: With $a$ ranging over $AP$, and $f$, $f_1$, $f_2$ ranging over state formulae, \[ f = T \lor \lnot a \lor f_1 \lor f_2 \lor f_1 \land f_2 \lor \text{AX } f \lor \text{AF } f \lor \text{AG } f \lor \text{A } f_1 \lor \text{A } f_1 \lor \text{R } f_2 \lor \text{EX } f \lor \text{EF } f \lor \text{EG } f \lor \text{E } f_1 \lor \text{E } f_1 \lor \text{f}_2 \lor \text{f}_2 \] The semantics of CTL formulæ is defined by the satisfaction operator $\models$. The notation $K, s \models f [K, \pi \models f]$ means that in a Kripke structure $K$, formula $f$ is true in state $s$ along path $\pi$. The meaning of $\models$ is defined inductively. $f$ and $g$ are state formulæ unless stated otherwise. We use $\pi_i$ to denote the $i$-th state of a path $\pi$ (with the first state being state 0, or $\pi_0$). 1. $K, s \models T$ is true and $K, s \models $ is false. 2. $K, s \models a \iff a \in AP$ if $a \in L(s)$. 3. $K, s \not\models \lnot f$ if $\forall (K, s \not\models f)$. 4. $K, s \models f \land g$ if $K, s \models f$ and $K, s \models g$. 5. $K, s \models f \lor g$ if $K, s \models f$ or $K, s \models g$. 6. $K, s \models E f$ for some path formula $f$ if $\exists$ there is a path $\pi = s \rightarrow s_1 \rightarrow s_2 \rightarrow \cdots \rightarrow s_i$ in $K, \pi \models f$. 7. $K, s \models A f$ for some path formula $f$ if $K, \pi \models f$ for all paths $\pi = s \rightarrow s_1 \rightarrow s_2 \rightarrow \cdots \rightarrow s_i$. 8. $K, \pi \models X f$ if $K, \pi_1 \models f$. 9. $K, \pi \models f \lor g$ if there exists $j \geq 0$ such that $K, \pi_j \models g$ for all $k \geq j$, and $K, \pi_j \models g$ for all $i < j$. 10. $K, \pi \not\models f$ for all $j \geq 0$, if $K, \pi_j \not\models f$ for every $i < j$ then $K, \pi_i \not\models f$. The common model used for system specifications in model-based testing is the labelled transition system (LTS), where the labels or formulæ are associated with the transitions instead of states. In model-based testing (De Nicola and Hennessy, 1984; Tretmans, 1996) sound and complete test cases are derived from a model (an LTS) that describes some functional aspects of the system under test. The system under test is also modelled as an LTS. An LTS is a tuple $M = (S, A, \rightarrow, s_0)$. $S$ is a countable set of states, $s_0 \in S$ is the initial state. $A$ is a set of labels denoting visible (or observable) events (or actions), $\rightarrow \subseteq S \times (A \cup \{\tau\}) \times S$ is the transition relation, where $\tau \not\in A$ is the internal action that cannot be observed by the external environment. We often use $p \rightarrow a q$ instead of $(p, a, q) \in \rightarrow; p \rightarrow a$ is a shorthand for $\exists q : p \rightarrow a q$. We blur the distinction between an LTS and a state, calling them both "processes" (since a state defines completely an LTS under a global $\rightarrow$). A path (or run) $\pi$ starting from state $p$ is a sequence $p \rightarrow a_1 p_1 \rightarrow a_2 \cdots \rightarrow a_k p_k$, $k \in \mathbb{N}$ such that $p_0 = p$ and $p_{i+1} \rightarrow a_i p_i$, $0 < i < k$, $|p_i|$ is $k$, the length of $\pi$. The trace of $\pi$ is the sequence $\text{trace}(\pi) = (a_{i})_{0 \leq i < |\pi|, \pi \in A^*}$. $I(p)$ denotes the set of all the paths starting from state $p$. $p \rightarrow a p'$ states that there exists a sequence of transitions whose initial state is $p$, whose final state is $p'$, and whose possible transitions form the sequence $w$. The notation $p \models w$ stands for $\exists p : p \rightarrow a p'$. The traces of a process $p$ are traces $\{w : p \models w\}$. The finite traces of a process $p$ are defined as $\text{Fin}(p) = \{w : p \models w, |w| \in \mathbb{N}\}$. A process $p$ which can make no internal progress (i.e., has no outgoing internal actions) is said to be stable (Schneider, 2000); $p \downarrow = \neg(\exists p' : p \rightarrow a p' \land p' \downarrow \land p'' \downarrow \land p'' \downarrow)$. $(w, X)$ is called a stable failure (Schneider, 2000) of $p$ whenever $\exists p'' : p \models p'' \downarrow \land p'' \downarrow \land p'' \downarrow \land p'' \downarrow X$. The set of stable failures of $p$ is then $\text{SF}(p) = \{(w, X) : \exists p'' : p \models p'' \downarrow \land p'' \downarrow \land p'' \downarrow X\}$. Then $p \models \text{SF}(p)$ iff $\text{Fin}(p) \subseteq \text{SF}(p)$ and $\text{SF}(p) \subseteq \text{Fin}(p)$. We call $\text{SF}$ the stable failure preorder. Systems and tests can be concisely described using the testing language TLOTOS (Brinksma et al., 1987; Langerak, 1989). $A$ is the countable set of observable actions, ranged over by $a$ and excluding the three special actions $\tau, \emptyset, \gamma \not\in A$. The set of processes or tests is ranged over by $t, t_1$ and $t_2$; $T$ ranges over the sets of processes or tests. The syntax of TLOTOS is then: \[ t = \text{stop} \mid a; t_1 \mid t; \tau \mid t_1 \mid \text{pass} \mid t_1 \bigcirc t_2 \mid \Sigma T \] The semantics of TLOTOS is defined as follows: 1. action (stop): no rules. 2. action prefix: $a; t_1 \rightarrow a t_1$ and $t; \tau \rightarrow t_1$ 3. deadlock detection: $\theta; t_1 \rightarrow t_1$ 4. successful termination: $\text{pass} \rightarrow \text{stop}$. 5. choice: with $\emptyset \in \{t, \tau\}$, $t_1 \rightarrow \emptyset t_1' \mid t_1 \bigcirc t_2 \rightarrow t_1' t_2 \bigcirc t_1 \rightarrow t_1'$. 6. generalized choice: with $g \in A \cup \{\gamma, \theta, \tau\}$, $t_1 \xrightarrow{g} t'_1$, $t \xrightarrow{\gamma} (t_1 \cup t) \xrightarrow{g} t_1$. $\gamma$ signals the successful completion of a test and $\theta$ is the deadlock detection label. Any process (or LTS) can be described as a TLOTOS process not containing $\gamma$ and $\theta$. A failure trace test on the other hand is a full TLOTOS process, i.e., may contain $\gamma$ and $\theta$. A test runs in parallel with the system under test according to the parallel composition operator $\parallel$, which defines the semantics of $\theta$ as the lowest priority action: $$ \begin{align*} | & p \xrightarrow{\tau} p' \\ | & t \xrightarrow{\gamma} \text{stop} \\ | & t \xrightarrow{\theta} \text{stop} \\ | & t \xrightarrow{\tau} t' \\ | & p \parallel t \xrightarrow{\tau} p' \parallel t' \\ | & p \parallel t \xrightarrow{a} p' \parallel t' \\ | & a \in A \\ | & t \parallel t \xrightarrow{\tau} t' \\ | & t \parallel t \xrightarrow{\tau} t' \\ \end{align*} $$ The outcome of $p \in \Pi(p||\sigma)$ is success (T) whenever the last symbol in trace($\pi$) is $\tau$, and failure (L) otherwise. The set of outcomes of all the runs in $\Pi(p||\sigma)$ is denoted by $O(p,t)$. Then $p$ may $t$ iff $\top \in O(p,t)$, and $p$ must $t$ iff $\{\top\} = O(p,t)$. $\square_{\text{SF}}$ can be characterized in terms of may testing only: **Proposition 1.** (Langerak, 1989). Let $p_1$ and $p_2$ be processes. Then $p_1 \square_{\text{SF}} p_2$ iff $p_1$ may $t \implies p_2$ may $t$ for all failure trace tests $t$. 3 PREVIOUS WORK We summarize our previous results intimately related to this paper (Bruda and Zhang, 2009). We define first an LTS satisfaction operator similar to the one on Kripke structures in a natural way. **Definition 1.** (Bruda and Zhang, 2009). A process $p$ satisfies $a \in A$, written by abuse of notation $p \models a$, iff $p \xrightarrow{a}$. That $p$ satisfies some (general) CTL* state formula is defined inductively as follows: Let $f$ and $g$ be some state formula unless stated otherwise; then, 1. $p \models \top$ is true and $p \models \bot$ is false for any process $p$. 2. $p \models \neg f$ iff $\neg (p \models f)$. 3. $p \models f \land g$ iff $p \models f$ and $p \models g$. 4. $p \models f \lor g$ iff $p \models f$ or $p \models g$. 5. $p \models \exists f$ for some path formula $f$ iff there is a path $\pi = p \xrightarrow{a_0} s_1 \xrightarrow{a_1} s_2 \xrightarrow{a_2} \cdots$ such that $\pi \models f$. 6. $p \models A f$ for some path formula $f$ iff $p \models f$ for all paths $\pi = p \xrightarrow{a_0} s_1 \xrightarrow{a_1} s_2 \xrightarrow{a_2} \cdots$. 7. $p \models X f$ iff $\pi \models f$. 8. $p \models f \lor g$ iff there exists $j \geq 0$ such that $\pi_1 \models g$ and $\pi_j \models f$ for all $k \geq j$, and $p \models f$ for all $i < j$. 9. $p \models f \land g$ for all $j \geq 0$, if $\pi_1 \models f$ for every $i < j$ then $\pi_j \models g$. We also need to define a weaker satisfaction operator for CTL*. **Definition 2.** (Bruda and Zhang, 2009). Consider a Kripke structure $K = (S, S_0, \rightarrow, L)$ over $AP$. For some set $Q \subseteq S$ and some CTL* state formula $f$ we define $K, Q \models f$ as follows, with $f$ and $g$ state formulae unless stated otherwise: 1. $K, Q \models \top$ is true and $K, Q \models \bot$ is false for any set $Q$ in any Kripke structure $K$. 2. $K, Q \models a$, $a \in AP$ iff $a \in L(s)$ for some $s \in Q$. 3. $K, Q \models \neg f$ iff $\neg (K, Q \models f)$. 4. $K, Q \models f \land g$ iff $K, Q \models f$ and $K, Q \models g$. 5. $K, Q \models f \lor g$ iff $K, Q \models f$ or $K, Q \models g$. 6. $K, Q \models E f$ for some path formula $f$ iff for some $s \in Q$ there exists a path $\pi = s \rightarrow s_1 \rightarrow \cdots$ such that $K, \pi \models f$. 7. $K, Q \models A f$ for some path formula $f$ iff for some $s \in Q$ it holds that $K, \pi \models f$ for all paths $\pi = s \rightarrow s_1 \rightarrow \cdots$. We introduce the following equivalence relation: **Definition 3.** (Bruda and Zhang, 2009). Given a Kripke structure $K$ and a set of states $Q$, $K, Q$ is equivalent to a process $p$, written $K, Q \simeq p$ (or $p \simeq K, Q$), iff for any CTL* formula $f$, $K, Q \models f$ iff $p \models f$. **Proposition 2.** (Bruda and Zhang, 2009). There exists an algorithmic function $\xi$ which converts an LTS $p$ into a Kripke structure $K$ and a set of states $Q$ such that $p \simeq (K, Q)$. Specifically, for any LTS $p = (S, A, \rightarrow, S_0)$, its equivalent Kripke structure $K$ is defined as $K = (S', Q, R', L')$, where $S' = \{ (s, x) : s \in S, x \in \text{init}(s) \}$. $Q = \{ (s_0, x) \in S' \}$, $L' : S' \rightarrow 2^S$ such that $L'(s, x) = x$, and $R'$ contains exactly all the transitions $((s, N), \langle t, O \rangle) \in S' \times S'$ such that: (a) for any $n \in N$, $s \xrightarrow{a} t$, (b) for some $q \in S$ and for any $o \in O, t \xrightarrow{a} q$, and (c) if $N = \emptyset$ then $O = \emptyset$ and $t = s$ (these loops ensure that the relation $R'$ is complete). Using such a conversion we can define the semantics of CTL* formulae with respect to a process rather than Kripke structure. Let now $\tau$ be the set of all processes, $\mathcal{T}$ the set of all the failure trace tests, and $\Psi$ the set of all CTL formulae. We have: **Proposition 3.** (Bruda and Zhang, 2009). There exists a function $\psi : \mathcal{T} \rightarrow \Psi$ such that for any process $p$, $p \models t$ iff $\psi(p) \models \psi(t)$. 175 4 CTL IS EQUIVALENT TO FAILURE TRACE TESTING We go now in the opposite direction from Proposition 3 and show that CTL formulae can be converted into failure trace tests. Recall that \( \mathcal{F} \) is the set of processes, \( \mathcal{T} \) the set of failure trace tests, and \( \mathcal{F} \) the set of CTL formulae. By abuse of notation we write \( p \) may \( T \) for some \( T \subseteq \mathcal{T} \) iff \( p \) may \( t \) for all \( t \in T \). **Theorem 4.** There exists a function \( \omega : \mathcal{F} \to 2^\mathcal{T} \) such that for any process \( p \), \( \xi(p) = f \) iff \( p \) may \( \omega(f) \). **Proof.** The proof is done by structural induction over CTL formulae. Let \( \omega(\top) = \{ \text{pass} \} \). Any Kripke structure satisfies \( \top \) and any process passes pass, so \( \xi(p) = f \) iff \( p \) may \( \{ \text{pass} \} = \omega(\top) \). Similarly \( \xi(p) = f \) iff \( p \) may \{stop\} (namely, never!), so we put \( \omega(\bot) = \{ \text{stop} \} \). We then put \( \omega(a) = \{a; \text{pass}\} \), noting that \( \xi(p) = f \) iff \( p \) may \( a; \text{pass} \) by the definition of \( \xi \). For exactly all the tests \( t \in \omega(f) \) we add \( t' \) to \( \omega(\neg f) \), where \( t' \) is generated out of \( t \) using the following algorithm: We force all the successful states to become deadlock states (i.e., we eliminate \( \gamma \) from \( t \)); whenever the test would have reached a successful state, it now reaches a deadlock state and fails. Then we introduce an action \( \theta \) followed by an action \( \gamma \) (success) to all the states except the ones that were success states originally; this way, \( t' \) can succeed in any state other than the original success states. This conversion is very similar to the construction of a finite automaton that accepts the complement of a given language (Lewis and Papadimitriou, 1998), and its correctness can be established using a similar argument. We put \( \omega(f_1 \land f_2) = \omega(f_1) \cup \omega(f_2) \). Indeed, \( \xi(p) = f_1 \land f_2 \) iff \( \xi(p) = f_1 \) and \( \xi(p) = f_2 \) iff \( p \) may \( \omega(f_1) \) and \( p \) may \( \omega(f_2) \) (by induction hypothesis) iff \( p \) may \( \omega(f_1) \cup \omega(f_2) \). Whenever \( \xi(p) = f_1 \lor f_2 \), the process \( p \) should pass all the tests in \( \omega(f_1) \) and \( \omega(f_2) \) (and the other way around). We have \( \omega(f_1 \lor f_2) = \omega(\neg(\neg f_1 \land \neg f_2)) \) by De Morgan rules \((\neg f_1 \lor f_2) = \neg f_1 \land \neg f_2 \) and the previous definitions of \( \omega(\neg f) \) and \( \omega(f_1 \land f_2) \). Now we put \( \omega(\text{EX} f) = \{ \Sigma \{a; t : a \in A \} : t \in \omega(f) \} \). As shown in Figure 1, the test suite combines a choice of action from all the available actions with the tests from \( \omega(f) \). \( p \) may \( \omega(\text{EX} f) \) iff \( p \) passes each all test cases above, equivalent to \( p \) being able to perform an action (any action!) and then pass the tests in \( \omega(f) \). By the inductive assumption that \( \omega(\neg f) \) is equivalent to \( f \), the above is equivalent to \( \xi(p) = \text{EX} f \) (namely, perform any action then satisfy \( f \)). We then have \( \omega(\text{AX} f) = \{a; t \circ \theta : \text{pass} : a \in A, t \in \omega(f) \} \). As shown in Figure 2, the test suite is generated by combining an action and a test from \( \omega(f) \). When the action is not provided, a deadlock detection transition takes place and leads to a pass state (so that particular test does not play any role). The test suite is generated by providing all the possible actions; the system under test however does not necessarily have to perform all the possible actions before going to the point where the tests are from \( \omega(f) \). When the system under test runs in parallel with the test case, we get a deadlock whenever the respective action is not encountered in the system; this leads to a pass state and then we continue to check the results of the other run with the other test cases. We put \( \omega(\text{EF} f) = \{ \Sigma \{a; t : a \in A \} : t \in \omega(f) \} \). A (slightly simplified) way of depicting each test from \( \omega(\text{EF} f) \) graphically is shown in Figure 3(a). The test suite is generated by combining a choice of actions and the tests in \( \omega(f) \). Then, we combine a choice of action followed by another choice of action with the tests in \( \omega(f) \) and so on until the last layer of the the Kripke structure (viewed as a tree). The resulting test suite is highly nondeterministic. \( f \) satisfies \( \text{EF} f \) iff \( p \) passes \( \omega(f) \), or \( p \) performs one action and in the next state passes \( \omega(f) \), or \( p \) can perform two actions and then passes \( \omega(f) \) and so on. Clearly this corresponds to the formula \( \text{EF} f \) given the induction hypothesis that \( \omega(f) \) is equivalent to \( f \). The conversion of the remaining CTL operators is partially based on “unfolding” these operators using the operators considered above, nothing that we have already established the test sets for these operators. We put \( \omega(\text{AF} f) = \{i; t \circ \theta \circ t' : i \in \omega(f), t' \in \omega(\text{AX} f') \} \), with \( f' = f \lor \text{AX} f' \). A recursive definition. Unfolding \( f' \) yields \( f \) or \( \text{AX} (f \lor \text{AX} f') \) or \( \text{AX} (f' \lor \text{AX} (f \lor \text{AX} f')) \), and so on. The process should satisfy any of the unfold formulae in order to satisfy \( AF f \). That is, the root state of a Kripke structure must satisfy \( f \) (the root being common to every path, this satisfies the original formula); otherwise, every next state either satisfies \( f \) (so the respective path is delivered from all its obligations) or has a set of next states that all satisfy (recursively) \( f' \), meaning that they satisfy the same requirement. In terms of LTS, a process either passes \( \omega(f) \) or performs some action to the second layer states; all of these (second layer) states now either satisfy \( \omega(f) \) themselves or have a set of next states that all satisfy (recursively) \( \omega(f') \). These are clearly equivalent. Similarly, we put \( \omega(\text{EG} f) = \omega(f) \cup \omega(\text{EX} f') \), with \( f' = f \lor \text{AX} f' \). When we unfold \( f' \) we get \( f \) and EX (f ∧ EX f') and EX (f ∧ EX (f ∧ EX f')) and so on. The process should satisfy all of the unfolded formulae in order for the the process satisfy the original formula EG f. In a Kripke structure, the states in the first layer need to satisfy f and then some next states (in the second layer) need to satisfy the formula f and also need to have some next states (in the third layer) that satisfy (recursively) f''. In terms of LTS, the process need to pass ω(f) and then perform some action to the next layer states that then pass ω(f) and also (recursively) ω(f'''). Again, these are equivalent. Once more similarly we put ω(AG f) = ω(f) ∪ ω(AX f), f' = f ∧ AX f'. Unfolding f' yields f and AX (f ∧ AX f') and AX (f ∧ AX (f ∧ AX f')) etc. Figure 3(b) illustrates that the test suite is generated by combining a choice of action and the tests in ω(f), then a choice of two actions followed by the tests in ω(f), etc. p satisfies AG f iff p passes the tests in ω(f), i.e., p can perform an action and then in the next states pass the tests in ω(f), and p can perform two actions and then pass the tests from ω(f), etc. Finally, ω(E f1 U f2) = {t1 ⊨ t2 : t1 ∈ ω(f1) ∪ ω(EX f'), t2 ∈ ω(f2) ∪ ω(EX f''), t1 = t0, t1 ⊨ EX f' and t' = f2 ∧ EX f'. This is similar to the EG f case, but now every path is allowed at some point to switch from states satisfying f' to states satisfying f''. Unfolding f' and f'' yield f1 and EX (f1 ∧ EX f') and EX (f2 ∧ EX (f1 ∧ EX f')) and so on, until we change via an internal action to f2 and EX (f2 ∧ EX f') and EX (f2 ∧ EX (f2 ∧ EX f'')), etc. In a Kripke structure, the states in the first layer need to satisfy the formula f1 and then some successive states in the second layer need to satisfy the formula f1, etc. At some point however, some states need to satisfy the formula f2 and from then on some successive states need to satisfy f along the whole path. In terms of LTS, the process need to pass ω(f1) and then perform some action to the second layer of states where some state needs to pass ω(f1) again, and so on until some point where some state passes ω(f2); from then on, some state from every layer needs to pass ω(f2). All the remaining CTL constructs can be rewritten using only the constructs discussed above. Indeed, A f1 R f2 ≡ ¬E (¬f1 ∨ ¬f2), E f1 R f2 ≡ ¬A (¬f1 U ¬f2), and A f1 U f2 ≡ ¬E (¬f2 U (¬f1 ∧ ¬f2)) ∧ ¬EG (¬f2). The proof is thus complete. 5 CONCLUSIONS We defined previously a function ψ that converts any failure trace test into an equivalent CTL formula. Now we defined ω, the function that convert CTL formulae into equivalent failure trace test suites. It is worth mentioning that the function ξ creates a Kripke structure that may have multiple initial states, and so we were forced to use a weaker satisfaction operator. We note however that such an issue manifests itself only when the LTS being converted exhibits initial nondeterminism (Bruda and Zhang, 2009), which can be eliminated by creating a new start state that performs a “start” action and then gives control to the original LTS. Our results are thus without loss of generality: in the absence of initial nondeterminism the proofs of Theorem 4 (and also Propositions 2 and 3) revert to the normal satisfaction operator. This work opens the way toward a combined, logical and algebraic approach to conformance testing. This is extremely important for large systems with components at different level of maturity. The canonic example is a communication protocol: the end points are algorithms that are likely to be amenable to algebraic specification, while the communication medium is something we don’t know much about. It could be a direct link, a local network or something else. However, its properties are ex- pressible using temporal logic formulae. In general, our conversions allow the use of the fastest, most suitable, or even most preferred method of conformance testing, irrespective to the form of the specification. Our results are important first steps toward a unified (logic and algebraic) approach to conformance testing. We believe in particular that this paper opens several directions of future research. The main challenge in the method we introduced is dealing with the infinite-state test cases. Indeed, the test cases produced from CTL temporal logic formulae are infinite. This is fine theoretically, but from a practical perspective it is worthy of future work to eliminate infinite states or to obtain usable algorithms than simulate runs of infinite-state test suites with the system under test and obtain useful results in finite time. The tests developed here can be combined with partial application so that another interesting research direction is to find partial application algorithms that yield total correctness at the limit and have some correctness insurance milestones along the way. On the conversion the other way around (from tests to CTL formulae) we note that the obtained formulae $\varphi(t)$ may not be in their simplest (or more concise) form possible in several respects. More significantly, the formulae may even have an infinite length (this happens for infinite tests), since they don’t really exploit the operators $G$, $F$, $U$, and $R$. We have strong reasons to believe that bringing them to more manageable proportions is possible, and this is one subject of our research. ACKNOWLEDGEMENTS This research was supported by the Natural Sciences and Engineering Research Council of Canada. Part of this research was also supported by Bishop’s University. REFERENCES
{"Source-Url": "http://www.scitepress.org/Papers/2010/30068/30068.pdf", "len_cl100k_base": 8077, "olmocr-version": "0.1.50", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 27920, "total-output-tokens": 9080, "length": "2e12", "weborganizer": {"__label__adult": 0.0005440711975097656, "__label__art_design": 0.0005931854248046875, "__label__crime_law": 0.0007734298706054688, "__label__education_jobs": 0.0013151168823242188, "__label__entertainment": 0.00014066696166992188, "__label__fashion_beauty": 0.00028252601623535156, "__label__finance_business": 0.00042819976806640625, "__label__food_dining": 0.0006704330444335938, "__label__games": 0.001003265380859375, "__label__hardware": 0.00177764892578125, "__label__health": 0.0014629364013671875, "__label__history": 0.0004229545593261719, "__label__home_hobbies": 0.00020372867584228516, "__label__industrial": 0.0010251998901367188, "__label__literature": 0.0007085800170898438, "__label__politics": 0.0004482269287109375, "__label__religion": 0.0008091926574707031, "__label__science_tech": 0.2362060546875, "__label__social_life": 0.0001666545867919922, "__label__software": 0.007232666015625, "__label__software_dev": 0.74169921875, "__label__sports_fitness": 0.0004646778106689453, "__label__transportation": 0.001140594482421875, "__label__travel": 0.0002644062042236328}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 29076, 0.02573]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 29076, 0.5971]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 29076, 0.80078]], "google_gemma-3-12b-it_contains_pii": [[0, 3734, false], [3734, 10023, null], [10023, 15613, null], [15613, 22116, null], [22116, 25869, null], [25869, 29076, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3734, true], [3734, 10023, null], [10023, 15613, null], [15613, 22116, null], [22116, 25869, null], [25869, 29076, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 29076, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 29076, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 29076, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 29076, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 29076, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 29076, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 29076, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 29076, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 29076, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 29076, null]], "pdf_page_numbers": [[0, 3734, 1], [3734, 10023, 2], [10023, 15613, 3], [15613, 22116, 4], [22116, 25869, 5], [25869, 29076, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 29076, 0.0]]}
olmocr_science_pdfs
2024-12-03
2024-12-03
c885183e796e93862995333a69e500ec94a3ade5
Boxed Economy Foundation Model Takashi Iba\(^1\)\(^2\)\(^3\), Yoshihide Chubachi\(^1\)\(^4\), Yohei Takabe\(^1\)\(^4\), Ken Kaiho\(^1\)\(^4\), and Yoshiyasu Takefuji\(^1\)\(^3\) \(^1\)Faculty of Policy Informatics, Chiba University of Commerce \(^2\)Fujita Institute of Future Management Research \(^3\)Graduate School of Media and Governance, Keio University \(^4\)Keio Research Institute at SFC, Keio University Abstract In this paper we propose “Boxed Economy Foundation Model” (BEFM), which is a model framework for agent-based economic/social models. It is the model framework which defines the set of concepts for modeling economy/society, and which supports to recognize, describe, and share the objects in the model, through the modeling process basically for social scientists. BEFM is an abstract of the real society from the viewpoint of economy, and consists of 12 major elements. Their class definitions and the relations between them are described. To execute the simulation based on BEFM, there is a platform called “Boxed Economy Simulation Platform” (BESP) to control the actual execution and manage the results. In addition, there are the tools called “Model Component Builder” and “Model Composer” to support implementation of the models. Introduction We can say that the area of agent-based economic/social modeling and simulation has two natures, one is that it can be declared as a new methodology of modeling in the area of social science, and the other is that it can also be said as one of a practical application of computer science (especially, the idea of autonomous distributed cooperative systems and computer simulations). These two areas had been trying two merge under the area of agent-based economic/social simulation, but they are not enough confluent yet. The problem which the approach from social science has would be that they do not have the well-defined primitive terms to describe the agent-based economic/social models. In each scientific field, there are some primitive terms which are not defined in the system, but some of them become a basic term to define other terms. As an example of the primitive terms, there are the terms “point” and “line” in Euclidean geometry, “position”, “time” and “particle” in classical mechanics, and “goods” in economics. However, when building an agent-based model, it would be necessary to define those terms each time they build the model. Developing an agent-based economic/social model without well-defined primitive terms would cause the following problems: (1) the model builders have to determine which part and how they would model from the real world, (2) the model builders have to define all of the terms used in their models every time, (3) the model builders would need to explain what does they mean by the terms used in their models each time. We can say that the second approach has the problem that the fundamental structure of the pre-given frameworks, such as “Swarm”\(^1\), “MAML”\(^2\), “RePast”\(^3\), and “Ascape”\(^4\), are too abstract to apply it to the field of social science. It is because their designs are aiming at general multi-agent systems so that they would be able to support various agent-based models including a molecular interaction, a traffic system, an ecosystem, and so on. When we try to build a social model by using these frameworks for agent-based simulations, the following problems might occur: (1) due to the generality of the frameworks, to describe the model in these language would be difficult for some model builders and the model has to be defined specific for implementation, (2) share and reuse of the model among model builders are difficult because the level of detail of the model would never be the same without the pre-given rules for modeling the economy/society. Based on these understandings, we will introduce “Boxed Economy Foundation Model” (BEFM), which is a model framework for agent-based economic/social models. The characteristics by which we try to solve the problems defined above would be shown in the next section. In the following section there would be explanations of the actual foundation model itself, and then the description of a platform called “Boxed Economy Simulation Platform” (BESP) which controls the actual execution and manages the results of the execution. The conclusion would summarize the whole document and give a slight image of our goal of this research. Main characteristics of Boxed Economy Foundation Model In this section, two of the main characteristics in Boxed Economy Foundation Model (BEFM) would be discussed. First, BEFM is a framework which has a tight focus to human economy/society than the other frameworks referred in the previous section. Secondly, BEFM gives support from analysis of the target world to implementation, and execution. To realize this, BEFM is analyzed, designed and implemented by object-oriented methodology. Also we pro- Figure 1: Recognizing, describing and sharing the model with a model framework propose “Boxed Economy Simulation Platform” (BESP) as a platform to implement, execute and analyze the simulation based on BEFM so that it will simplify the process after modeling. Domain-focused model framework From the viewpoint of science, BEFM provides, as a model framework, (1) a frame of reference for recognizing the target world, (2) a vocabulary for describing the concepts obtained by recognition, (3) a code for communications among the model builders (Figure 1). A model captures the essential aspects of a target world from a certain point of view. The rest part of the target is always simplified or omitted, so the models are different in each person and each purpose. Therefore something for unifying models are required if we aim at a collaboration and cumulative progress. In the next few paragraphs, we would like to explain more about the three points raised above. (1) Frame of reference for recognizing the target world BEFM can be a frame of reference for recognizing the target world. We humans do not passively receive all the facts from real world but make an active selection through the filter of the recognition scheme [5], due to a restriction of the body and cognition. With using the model framework, the model builder can focus to the part of the target world according to it. (2) Vocabulary for describing the model The classes of BEFM can be a vocabulary for describing the model. Some kind of modeling languages are required in order to describe the concept obtained by recognition, where the language consists of terms that become the units of expressions and the rules of combinations. With using the model framework, the model builder can describe his/her model by the terms of it. (3) Code for communications among the model builders BEFM can be a code for communication and sharing the models among model builders. Specifying the vocabulary and the code for communications would make the communication more smoothly and with more accuracy, because we do not have to transmit the detailed information if such a shared code exists. With the model framework, the sender can describe the model according to the code, and also the receiver can read it with the code. Support from the analysis of target world to the execution of simulations From the viewpoint of software engineering, BEFM provides (1) a bridge to the specific simulation platform, and (2) a design of the software architecture of social simulation. Note that the model representation in object-oriented language can be used on the phase of simulation building as well as model building. (1) Bridge to the specific simulation platform In order to execute the simulation based on BEFM, there is a platform called “Boxed Economy Simulation Platform” (BESP) [6]. BESP is an integrated environment to make, execute, and analyze the agent-based social simulations. There are also the tools called “Model Component Builder” and “Model Composer” on BESP. Many other parts of the programs that are necessary to run agent-based economic/social simulations are already implemented in BESP. These enable us to build the simulation with less knowledge and skill about the software design and programming. It will contribute to remove factors that have been making difficulties for social scientists to participate in and conduct the agent-based simulation study. (2) Design of the software architecture of social simulation BEFM provides the design of the software architecture of social simulation for sharing and reusing of the components among the simulation builders. Frameworks keep the components on track by defining the rule for designing the components developed in the future, although it is usually difficult to combine the components developed by independent groups due to the inconsistency. Note that the frameworks proposed so far, which support to implement the simulation for the simulation builder who has a little (or, no) experience of the computer programming, but do not support to share the simulation models among two or more simulation builders. Here, we would like to emphasize that a modular simulation program is important rather than a large monolithic one for understanding, reusability, and sharing, as well as the design of operating systems (OS). The modular simulation program is the program which can be divided into components (pieces of modules) and but also organized well under the framework. It enables us to reuse the components among the simulation builders, so that it will accelerate the P2P sharing of the models and components. Class Definition of Boxed Economy Foundation Model We here would like to explain some details of “Boxed Economy Foundation Model” (BEFM). BEFM consists of 12 major elements, which are obtained by abstracting the real society from the view point of economy with object-oriented analysis, which is an idea that the target system is caught as the interacting objects. The main architecture of the classes and their relationships in BEFM is shown in Figure 2, which is described in Unified Modeling Language [7]. The main classes of BEFM are World, Location, Clock, Goods, Information, Agent, Individual, SocialGroup, Behavior, Needs, Relation and Channel. In addition there are some classes for managing: InformationManager, GoodsManager, RelationManager, BehaviorManager and NeedsManager. Since there are not enough space to describe the design in full detail so some of them are omitted in this paper. For full details, see the API document of BEFM [8]. World World is defined as an environment in which Entity are placed (Figure 3). Note that the classes defined as Entity are Agent, Goods, Information, Behavior and Needs. Only one instance of World would be created in each simulation model. Location Location is the class to describe a spatial position in the model. The spatial position of Agents and Goods would be described with using Location, and their migration and transportation can be described by changing the values of Location. Direction and Distance are the classes which shows the relationship of two points of Location (Figure 4). In addition, Region is defined to be composed of two or more Locations, and Area is defined as the spatial size of Region. In BEFM, a concrete implementation of Location is not defined yet. Therefore the model builder makes a choice of implementation, such as two-dimensional lattice space, three-dimensional Euclidean space, or even implementing no space in the model at all. Clock Clock is defined as the class to manage the flow of time in the model, during the execution of the simulation. Agent acts by the passage of the time of Clock. Each model, actually each instance of World, holds only one instance of Clock. TimeOfDay is defined to describe a point of time in the model (Figure 5). Clock holds the instance of TimeOfDay as a present time. Time is defined as the difference between two points of TimeOfDay. We can also calculate TimeOfDay by adding Time to TimeOfDay or subtracting Time from TimeOfDay. In BEFM, it is not defined how to implement the model of time yet. Therefore, the model builder will determine in which form time would be implemented such as “year/month/day/hour/minute/second” or discrete integer. Goods Goods can be defined as material/unmaterial thing which is possessed by Agent in order to use by himself/herself, or to exchange with other agents. For instance, the objects modeled as *Goods* can be automobile, oil, corn, financial stock, right of land, books, advertisings, diaries, memorandum, water, voice, noises, garbage, money, and so on. Note that the term “goods” is here used as a concept in the wide sense to indicate various objects in the world, rather than a concept in the narrow sense to indicate the objects to fulfill human desires in economics. This is because the decision whether a certain goods is so-called “economic good” or not should be made by the setting and the situation of the model rather than a priori definition in the model framework. *Goods* can be specified by the kind, the quality, and the amount by using *GoodsKind*, *GoodsQuality*, and *GoodsQuantity* (Figure 6). *Goods* have *Location* in order to describe where it is. In addition, *Goods* often holds *Information* describing various contents. For instance, a newspaper can be modeled as an object that the newspaper article (as *Information*) is printed on a paper (as *Goods*), and a conversation can be modeled as an object which contents (as *Information*) is conveyed on the voice (as unmaterial and transient *Goods*). *Information* which accompanied by *Goods* and stored in the *Agent* are defined as *Information*. *Information* will never exist alone, and be always held by *Goods* or *InformationManager* of *Agent*. *Information* held in *InformationManager* is the information stored in the *Agent* internally, for example it can be described as “memory” and “genetic information” in the real world. *Information* holds *InformationContents* which can be copied (Figure 7). The classes which would be defined as *InformationContents* are *RelationInformationContents*, *ChannelInformationContents*, *NeedsInformationContents*, *GoodsInformationContents*, *BehaviorInformationContents*, *GoodsQuantity*, *GoodsKind*, *GoodsQuality*, *Location*, *NeedsStateDifference*, *Time*, and *TimeOfDay*. **Agent, Individual, Social Group** *Agent* is defined to describe an autonomous actor who does the economic activity. Each individuals and social groups such as corporation, government, family, school, regional community, and country are all dealt as an *Agent* in the model. In BEFM, *Agent* exists as a more specific class: *Individual* or *SocialGroup*. *Individual* and *SocialGroup* inherits all the characteristics of *Agent*. *Agent* possesses more than one *Behavior*, *Information*, *Relation*, and *Goods*. *Agent* holds and manages them by each manager: *BehaviorManager*, *InformationManager*, *RelationManager* and *GoodsManager*. In addition, only *Individual* possesses *Needs*, and manages it by *NeedsManager*. **Behavior** The behavior of the agent is defined as *Behavior*. Various activities such as decision-making, production, trade and communication, are described by *Behavior* of *Agent*. Two or more *Behavior* can be managed in parallel inside an *Agent*. In BEFM, the internal state is given to each behavior, and the internal state is dynamically changed respectively. *Behavior* is defined as a state machine, which is a system that changes the state when the event is received. *Behavior* holds more than one instance of *BehaviorState*, and a present state as *currentState*(Figure 9). *Behavior* changes the state by receiving an event which means the stimulus from outside. There are three kind of Event in BEFM: *ChannelEvent*, *ClockEvent*, and *NeedsEvent*. *ChannelEvent* is an event sent from Channel. It holds Goods and delivers them to the listener behavior. NeedsEvent is an event sent when Needs becomes to a certain state. ClockEvent is an event sent when time passes on Clock. It holds TimeOfDay and delivers it to the listener. Each Event is sent from the object implemented the EventDispacher to the object implemented the EventListener. Needs Needs is hold only by Individual, and activates the Behavior of the Individual. Needs holds two or more NeedsStates. The needs holds the state which becomes a target as targetNeedsState and the state which becomes a present state as currentNeedsState. The difference in two states is NeedsStateDifference, which represents the strength of Needs. Needs is able to dispatch NeedsEvent to Behavior if necessary. Needs is a model element which moves dynamically by the time passage (reception of ClockEvent). Relation An agent in a model usually has some kind of relationship with other agents rather than being isolated. In BEFM, the situation of a fact that a certain agent knows other agents will be described by Relation. By using Relation, for example, friends, family and employment can be described. Relation is an object by which two Agents are connected with the direction. Relation is managed by Agent through RelationManager. Channel When an agent communicates with others, Channel will be established between the Behaviors of the agents based on Relation. Note that Channel does not connect between Agents but connects between Behaviors. In the model based on BEFM, all communications between Behaviors will be abstracted as a deal of Goods through Channel. First, Channel is used to exchange Goods, such as commodities, contents of the conversation, and money, between Behaviors of Agents. Secondly, the cooperation of Behavior inside Agent is also done by exchanging Goods on Channel. By the abstraction, it is possible not only to standardize the model expression but also to raise the independency of the model components of Behavior. Simulation platform for the simulation based on Boxed Economy Foundation Model In this section “Boxed Economy Simulation Platform” (BESP) is introduced as a platform to control the execution of the simulation based on BEFM. Since BESP is designed as component-based architecture, the simulation builder can obtain the simulation program which suits his or her needs, only if he/she implements “model components” which have not been implemented yet, and arranges the necessary model components into the platform. Note that the model component is a software component that implements the model element based on BEFM. In order to support making the behavior component, “Model Component Builder” is provided with BESP. Model Component Builder is the tool to generate the program code just by making the state chart diagram and setting the model with a graphical user interface. Also to support composing and setting the model, “Model Composer” is provided with BESP. The model composer is a tool (presentation component) to compose and set the model which wants to be simulated by graphical user interface. The entities except Behavior can be made by Model Composer, since they are static elements. BESP and these tools realize that the programming to build the simulation is greatly reduced, although a lot of programming is usually required to build simulations. Thus, 1BESP is a multi-platform software which is implemented in object-oriented Java language. BESP is executable on Java Virtual Machine regardless of the operating system. In a word, BESP is executed quite similarly even if the simulation builders are using a different computer environment. Moreover, the simulation builders who are using different computer environments can share the components, because the component for BESP does not depend on the computer environment in which it is made. Boxed Economy Simulation Platform (BESP) is able to be downloaded freely from our web page (http://www.boxed-economy.org/). Or please contact us by E-mail (box-designers@crew.sfc.keto.ac.jp), if you want to obtain the CD-ROM version of BESP. the simulation builder comes to be able to build the simulation as long as they have the basic skills of programming. In addition, model components can be reused, and then the simulation builders can also reduce the amount of the programming if a part of the model which they want to use has already been implemented, so that the simulation builders can make and change their simulation promptly. The component-based development, by which simulations are made only by combining and arranging the components, is expected to become possible in the future after the cumulating the model components is enhanced. Moreover, BEFM has defined the relationship to achieve the cooperation of the components, so that it is possible to make the model work even when components were developed independently. The simulation builders can make the models in parallel as long as they keep on the same framework, and they can concentrate on the objects related to their interesting. Conclusion In this paper we proposed “Boxed Economy Foundation Model” (BEFM), which is a model framework for agent-based economic/social models. BEFM is the model framework which defines the set of the concepts for modeling economy/society, and which supports from the analysis of target world to the execution of the simulations. One point we would like to clarify is that, we do not think that our model framework is the only one, but at least it is one of a choice for us. We also welcome other researchers to propose other frameworks for the same purpose. Our idea is that, by existence of various frameworks as different viewpoints, the quality of each framework would become better by having competitions. As for closing we are thinking that our research program is something that is open-ended and we expect to realize this by collaborating with many researchers in various fields. Acknowledgment This research was partly supported by Fujita Institute of Future Management Research, Japan, since 1997. It was also supported by a grant from the Ministry of Education, Science, Sports and Culture, Grant-in-Aid for Encouragement of Young Scientists, from 1999 to 2001. Thank you also for other members of Boxed Economy Project: J. Tanaka, K. Kamihashi, R. Tsuya, S. Kitano, M. Hirokane, Y. Matsuzawa, K. Asaka, H. Morikubo, Y. Nagami, and Dr. H. Takenaka. References
{"Source-Url": "http://www.aaai.org/Papers/Workshops/2002/WS-02-10/WS02-10-014.pdf", "len_cl100k_base": 4599, "olmocr-version": "0.1.53", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 20083, "total-output-tokens": 5247, "length": "2e12", "weborganizer": {"__label__adult": 0.0005931854248046875, "__label__art_design": 0.000911235809326172, "__label__crime_law": 0.0009937286376953125, "__label__education_jobs": 0.01329803466796875, "__label__entertainment": 0.00018727779388427737, "__label__fashion_beauty": 0.0003390312194824219, "__label__finance_business": 0.01477813720703125, "__label__food_dining": 0.0007076263427734375, "__label__games": 0.004390716552734375, "__label__hardware": 0.0013523101806640625, "__label__health": 0.001140594482421875, "__label__history": 0.0014133453369140625, "__label__home_hobbies": 0.000457763671875, "__label__industrial": 0.001800537109375, "__label__literature": 0.0009145736694335938, "__label__politics": 0.002803802490234375, "__label__religion": 0.0005865097045898438, "__label__science_tech": 0.332763671875, "__label__social_life": 0.0004787445068359375, "__label__software": 0.0295867919921875, "__label__software_dev": 0.58837890625, "__label__sports_fitness": 0.0004410743713378906, "__label__transportation": 0.00128173828125, "__label__travel": 0.00036978721618652344}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 23558, 0.00736]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 23558, 0.6946]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 23558, 0.94273]], "google_gemma-3-12b-it_contains_pii": [[0, 4952, false], [4952, 8971, null], [8971, 12480, null], [12480, 15959, null], [15959, 20068, null], [20068, 23558, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4952, true], [4952, 8971, null], [8971, 12480, null], [12480, 15959, null], [15959, 20068, null], [20068, 23558, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 23558, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 23558, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 23558, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 23558, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 23558, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 23558, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 23558, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 23558, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 23558, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 23558, null]], "pdf_page_numbers": [[0, 4952, 1], [4952, 8971, 2], [8971, 12480, 3], [12480, 15959, 4], [15959, 20068, 5], [20068, 23558, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 23558, 0.0]]}
olmocr_science_pdfs
2024-12-08
2024-12-08
59310840a2e2182af5d8cc96fa4c0cd87755b2f3
Simplifying Parallel Programming with Domain Specific Languages Hassan Chafi, HyoukJoong Lee, Arvind Sujeeth, Kevin Brown, Anand Atreya, Nathan Bronson, Kunle Olukotun Stanford University Pervasive Parallelism Laboratory (PPL) GPU Technology Conference 2010 Era of Power Limited Computing - **Mobile** - Battery operated - Passively cooled - **Data center** - Energy costs - Infrastructure costs Computing System Power \[ Power = Energy_{op} \times \frac{Ops}{\text{second}} \] Heterogeneous Hardware - Heterogeneous HW for energy efficiency - Multi-core, ILP, threads, data-parallel engines, custom engines - H.264 encode study Source: Understanding Sources of Inefficiency in General-Purpose Chips (ISCA’10) DE Shaw Research: Anton Molecular dynamics computer 100 times more power efficient D. E. Shaw et al. SC 2009, Best Paper and Gordon Bell Prize Apple A4 in iP{ad|hone} Contains CPU and GPU and … Heterogeneous Parallel Computing - **Uniprocessor** - Sequential programming - C - **CMP (Multicore)** - Threads and locks - C + (Pthreads, OpenMP) - **GPU** - Data parallel programming - C + (Pthreads, OpenMP) + (CUDA, OpenCL) - **Cluster** - Message passing - C + (Pthreads, OpenMP) + (CUDA, OpenCL) + MPI *Multiple incompatible programming models* IS IT POSSIBLE TO WRITE ONE PROGRAM AND RUN IT ON ALL THESE MACHINES? HYPOTHESIS: YES, BUT NEED DOMAIN-SPECIFIC LIBRARIES AND LANGUAGES A solution for pervasive parallelism - **Domain Specific Languages (DSLs)** - Programming language with restricted expressiveness for a particular domain - OpenGL, MATLAB, SQL, VHDL, .. - **Benefit of using DSLs for parallelism** - **Productivity** - Shield average programmers from the difficulty of parallel programming - **Performance** - Match generic parallel execution patterns to high level domain abstraction - Restrict expressiveness to more easily and fully extract available parallelism - Use domain knowledge for static/dynamic optimizations - **Portability and forward scalability** PPL Goals and Organization - Goal: the parallel computing platform for the masses - Parallel applications without parallel programming - PPL is a collaboration of - Leading Stanford researchers across multiple domains - Applications, languages, software systems, architecture - Leading companies in computer systems and software - NVIDIA, Oracle(Sun), AMD, IBM, Intel, NEC, HP - PPL is open - Any company can join; all results in the public domain The PPL Vision Applications - Scientific Engineering - Virtual Worlds - Personal Robotics - Data informatics Domain Specific Languages - Rendering - Physics (Liszt) - Scripting - Probabilistic (RandomT) - Machine Learning (OptiML) DSL Infrastructure - Domain Embedding Language (Scala) - Polymorphic Embedding - Staging - Static Domain Specific Opt. Parallel Runtime (Delite) - Task & Data Parallelism - Locality Aware Scheduling Hardware Architecture - OOO Cores - Programmable Hierarchies - SIMD Cores - Scalable Coherence - Threaded Cores - Isolation & Atomicity - Specialized Cores - On-chip Networks - Pervasive Monitoring Outline - Introduction - Using DSL for parallel programming - OptiML - An example DSL for machine learning - Delite - Runtime and framework for DSL approach - Delite with GPU - Optimizations and automatic code generation - Experimental Results - Conclusion Machine Learning - Learning patterns from data - Regression - Classification (e.g. SVMs) - Clustering (e.g. K-Means) - Density estimation (e.g. Expectation Maximization) - Inference (e.g. Loopy Belief Propagation) - Adaptive (e.g. Reinforcement Learning) - A good domain for studying parallelism - Many applications and datasets are time-bound in practice - A combination of regular and irregular parallelism at varying granularities - At the core of many emerging applications (speech recognition, robotic control, data mining etc.) - Characteristics of ML applications - Iterative algorithms on fixed structures - Large datasets with potential redundancy - Trade off between accuracy for performance - Large amount of data parallelism with varying granularity Machine Learning Examples Finding movies you'll ❤ just got easier... Rate a few movies you've seen and we can help you find movies you'll enjoy. The more you rate, the smarter Netflix becomes... making it easier to find that hidden gem you may have missed or forgotten about. Continue It just takes 2 minutes... Report Spam OptiML: Motivation - Raise the level of abstraction - Focus on algorithmic description, get parallel performance - Use domain knowledge to identify coarse-grained parallelism - Identify parallel and sequential operations in the domain (e.g. ‘batch gradient descent’) - Single source => Multiple heterogeneous targets - Not possible with today’s MATLAB support - Domain specific optimizations - Optimize data layout and operations using domain-specific semantics - A driving example - Flesh out issues with the common framework, embedding etc. OptiML: Overview - Provides a familiar (MATLAB-like) language and API for writing ML applications - Provide an easy syntax for operations - Ex) val c = a * b (a, b are Matrix[Double]) - Implicitly parallel data structures - General data types: Vector[T], Matrix[T] - Independent from the underlying implementation - Special data types: TrainingSet, TestSet, IndexVector, ... - Encode semantic information - Implicitly parallel control structures - Sum{...}, (0::end) {...} - Allow anonymous functions to be passed as arguments of the control structures Example OptiML / MATLAB code (Gaussian Discriminant Analysis) OptiML code % x : Matrix, y: Vector % mu0, mu1: Vector n = size(x,2); sigma = zeros(n,n); parfor i=1:length(y) if (y(i) == 0) sigma = sigma + (x(i,:) - mu0)'*(x(i,:) - mu0); else sigma = sigma + (x(i,:) - mu1)'*(x(i,:) - mu1); end end (parallel) MATLAB code // x : TrainingSet[Double] // mu0, mu1 : Vector[Double] val sigma = sum(0,x.numSamples) { if (x.labels(_)) == false) { (x(_)-mu0).trans.outer(x(_)-mu0) } else { (x(_)-mu1).trans.outer(x(_)-mu1) } } **OptiML vs. MATLAB** **OptiML** - Statically typed - Implicit parallelization - Automatic GPU data management via run-time support - Inherits Scala features and tool-chain - Still experimenting with: “what, if any, Scala features do we want to disallow, and how should we do that?” **MATLAB** - Dynamically typed - Applications must explicitly choose between vectorization or parallelization - Explicit GPU data management - Widely used, efficient Dynamic Optimizations - Relaxed dependencies - Iterative algorithms with inter-loop dependencies prohibit task parallelism - Dependencies can be relaxed at the cost of a marginal loss in accuracy - Relaxation percentage is run-time configurable - Best effort computations - Some computations can be dropped and still generates acceptable results - Provide data structures with “best effort” semantics, along with policies that can be chosen by DSL users Potential Static Optimizations - **Efficient data representation** - Same abstract data types can have multiple underlying optimized implementations - Matrix[Double] can be implemented as a dense matrix or a sparse matrix - **Transparent compression** - Use knowledge of ML data types (image, video, audio, etc) to automatically insert efficient compression routines before transferring data across address spaces Outline - Introduction - Using DSL for parallel programming - OptiML - An example DSL for machine learning - Delite - Runtime and framework for DSL approach - Delite with GPU - Optimizations and automatic code generation - Experimental Results - Conclusion Delite: A DSL Design Framework - Delite provides a common infrastructure for exposing implicit task and data parallelism - OPs to automate building of execution task graph (task-level parallelism) - Extended to provide implicitly parallelized DSL operations - OP archetypes that simplify exposing data-parallelism - DeliteOP_Map, DeliteOP_Zipwith, DeliteOP_Reduce, etc. - **DSL author free to package work into Delite OPs however they deem best** - Method call mapped to a deferred OP is a good starting point - Sum control structure in OptiML creates two Delite OPs - Generate temp results - Perform final summation protected[optiml] case class OP_subtract[A] (v1: Vector[A], v2: Vector[A]) extends DeliteOP_SingleTask[Vector[A]](v1,v2) { def task = { val result = Vector[A](v1.length) for (k <- 0 until v1.length) result(k) = v1(k) - v2(k) result } } protected[optiml] case class OP_subtract[A] (val collA: Vector[A], val collB: Vector[A], val out: Vector[A]) def func = (a,b) => a - b } Delite Execution Flow Application ```scala def example(a: Matrix[Int], b: Matrix[Int], c: Matrix[Int], d: Matrix[Int]) = { val ab = a * b val cd = c * d return ab + cd } ``` Calls Matrix DSL methods Matrix DSL ```scala def *(m: Matrix[Int]) = delite.defer(OP_mult(this, m)) def +(m: Matrix[Int]) = delite.defer(OP_plus(this, m)) ``` DSL defers OP execution to Delite R.T. Delite Runtime Delite applies generic & domain transformations and generates mapping Hardware Schedule <table> <thead> <tr> <th>Procs</th> <th>Time</th> </tr> </thead> <tbody> <tr> <td>0</td> <td></td> </tr> <tr> <td>1</td> <td></td> </tr> </tbody> </table> Delite: A Heterogeneous Parallel Runtime - Delite schedules OPs to run from the window of currently deferred OPs, honoring the dependencies and anti-dependencies present in the task graph. - OPs are scheduled using a low-cost clustering heuristic in order to minimize communication costs among OPs as well as scheduling overhead. - Data-parallel OPs are submitted to the runtime as a single OP and later split into the desired number of OP chunks. - The number of chunks is chosen at scheduling time based on the size of the collection and the availability of hardware resources in the system. Outline - Introduction - Using DSL for parallel programming - OptiML - An example DSL for machine learning - Delite - Runtime and framework for DSL approach - Delite with GPU - Optimizations and automatic code generation - Experimental Results - Conclusion Using GPUs with MATLAB MATLAB GPU code ```matlab sigma = gpuArray(zeros(n,n)); for i=1:m if (y(i) == 0) sigma = sigma + gpuArray(x(i,:)-mu0)'*gpuArray(x(i,:)-mu0); else sigma = sigma + gpuArray(x(i,:)-mu1)'*gpuArray(x(i,:)-mu1); end end ``` Jacket GPU code ```matlab sigma = gzeros(n,n); y = gdouble(y); x = gdouble(x); for i=1:m if (y(i) == 0) sigma = sigma + (x(i,:)-mu0)'* (x(i,:)-mu0); else sigma = sigma + (x(i,:)-mu1)'* (x(i,:)-mu1); end end ``` Using GPUs with Delite - No change in the application source code - Same application code also runs on systems with GPUs - Runtime and DSL (not DSL user) dynamically make scheduling decisions (CPU or GPU) - Good for portability / productivity - Performance optimizations under the hood - Memory transfers between CPU and GPU - On-chip device memory allocation - Concurrent kernel executions Runtime Implementation - Portion of the task graph (Delite OPs) scheduled on GPU is sent to a dedicated GPU executor - 1 GPU executor thread for 1 GPU device - GPU executor identifies the OP and launches corresponding GPU kernel on GPU device - Use asynchronous calls of CUDA Driver APIs - Transfer input data from main memory to GPU memory - Check timestamps to determine kernel termination - Pinned host memory is allocated for timestamps, and each kernel updates the timestamp value after execution - Copy back the result data when CPU needs it GPU Runtime Diagram Application CPU executor threads CPU devices Main Memory Input/Output Transfer Device Memory GPU executor threads Kernel Call Delite main thread scheduler + optimizer Delite OP Delite OP Delite OP GPU Runtime Optimizations - High communication cost between CPU/GPU - PCI Express 2.0 (x16) bandwidth: 8GB/s max - Reuse data in GPU device memory - Keep input/output data of GPU kernels in GPU memory as long as possible - Likely to reuse recently touched data in subsequent kernels - Evict only when needed - Limited GPU device memory size - Encourage bulk transfer - Transfer entire data structures even when only portions are used GPU Memory Coherency - **Problem**: DSL OPs with side effects - Using GPU device memory as a cache inherently results in the coherency problem between main memory and GPU device memory - **Solution**: Use runtime information (list of true/anti dependencies) of OPs to keep correct order of executions with synchronization - Generates necessary data transfers - When GPU mutates the data - CPU worker asks GPU for the updated data - When CPU mutates the data - GPU invalidates corresponding cache line GPU Code generation - GPU kernels for DSL OPs - DSL OPs have optimized GPU kernels for the task - DSL author provides the GPU kernels - Libraries (CUBLAS, CUFFT, ..) can be used - What about DSL OPs with anonymous functions? - The task behavior is not determined by OP itself - Given by DSL user, not DSL author - Function is passed to the OP as an argument - Ex) map{..}, sum(0,n){..}, (0::n){..} GPU Code generation <Example Code> ```scala val a = Vector.randn(n) val tau = 3.28 val b = (0::n) { i => i * tau / a(i) } ``` - DSL author cannot provide GPU kernels - Automatically generate corresponding GPU kernels at compile time - Use Scala compiler plugin - Traverse the application’s AST and generate CUDA source code - Transform the AST for runtime information GPU Code Generation Flow **Original Application Code** ```scala val a = Vector.randn(n) val tau = 3.28 val b = (0::n) { i => i * tau / a(i) } ``` **Scala compiler plugin (AST traversal / transformation)** ```scala __global__ kernel0(double *input, double *output, int length, double *a, double tau){ int i = blockIdx.x*blockDim.x + threadIdx.x; if(i < length) output[i] = input[i] * tau / a[input[i]]; } ``` **Generated CUDA Code** **Transformed Application Code** ```scala val a = Vector.randn(n) val tau = 3.28 val b = (0::n) { DeliteGPUFunc( { i => i * tau / a(i)}, 0, List(a,tau) ) } ``` Outline - Introduction - Using DSL for parallel programming - OptiML - An example DSL for machine learning - Delite - Runtime and framework for DSL approach - Delite with GPU - Optimizations and automatic code generation - Experimental Results - Conclusion Experiments Setup - 4 Different implementations - OptiML+Delite - MATLAB (Parallel CPU, GPU, Jacket GPU) - System 1: Performance Tests - Intel Xeon X5550 (2.67GHz) - 2 sockets, 8 cores, 16 threads - 24 GB DRAM - GPU: NVIDIA GTX 275 GPU - System 2: Scalability Tests - Sun UltraSPARC T2+ (1.16GHz) - 4 sockets, 32 cores, 256 threads - 128 GB DRAM Applications for Experiments - 6 machine learning domain applications - Gaussian Discriminant Analysis (GDA) - Generative learning algorithm for probability distribution - Loopy Belief Propagation (LBP) - Graph based inference algorithm - Naïve Bayes (NB) - Supervised learning algorithm for classification - K-means Clustering (K-means) - Unsupervised learning algorithm for clustering - Support Vector Machine (SVM) - Optimal margin classifier using SMO algorithm - Restricted Boltzmann Machine (RBM) - Stochastic recurrent neural network Performance Study (CPU) **GDA** <table> <thead> <tr> <th>Normalized Execution Time</th> <th>1 CPU</th> <th>2 CPU</th> <th>4 CPU</th> <th>8 CPU</th> </tr> </thead> <tbody> <tr> <td>1 CPU</td> <td>1.0</td> <td>1.7</td> <td>1.8</td> <td>1.9</td> </tr> <tr> <td>2 CPU</td> <td>1.0</td> <td>1.0</td> <td>1.4</td> <td>1.6</td> </tr> <tr> <td>4 CPU</td> <td>1.4</td> <td>2.0</td> <td>3.4</td> <td>4.6</td> </tr> <tr> <td>8 CPU</td> <td>1.6</td> <td>1.2</td> <td>1.2</td> <td>1.2</td> </tr> </tbody> </table> **Naive Bayes** <table> <thead> <tr> <th>Normalized Execution Time</th> <th>1 CPU</th> <th>2 CPU</th> <th>4 CPU</th> <th>8 CPU</th> </tr> </thead> <tbody> <tr> <td>1 CPU</td> <td>1.0</td> <td>2.0</td> <td>1.0</td> <td>1.1</td> </tr> <tr> <td>2 CPU</td> <td>0.6</td> <td>0.8</td> <td>1.0</td> <td>1.1</td> </tr> <tr> <td>4 CPU</td> <td>0.8</td> <td>1.1</td> <td>0.8</td> <td>0.8</td> </tr> <tr> <td>8 CPU</td> <td>1.1</td> <td>1.1</td> <td>1.1</td> <td>1.1</td> </tr> </tbody> </table> **K-means** <table> <thead> <tr> <th>Normalized Execution Time</th> <th>1 CPU</th> <th>2 CPU</th> <th>4 CPU</th> <th>8 CPU</th> </tr> </thead> <tbody> <tr> <td>1 CPU</td> <td>1.0</td> <td>1.8</td> <td>3.6</td> <td>5.5</td> </tr> <tr> <td>2 CPU</td> <td>1.1</td> <td>1.1</td> <td>3.0</td> <td>1.2</td> </tr> <tr> <td>4 CPU</td> <td>1.2</td> <td>1.2</td> <td>4.7</td> <td>3.0</td> </tr> <tr> <td>8 CPU</td> <td>1.2</td> <td>1.2</td> <td>4.7</td> <td>4.7</td> </tr> </tbody> </table> **SVM** <table> <thead> <tr> <th>Normalized Execution Time</th> <th>1 CPU</th> <th>2 CPU</th> <th>4 CPU</th> <th>8 CPU</th> </tr> </thead> <tbody> <tr> <td>1 CPU</td> <td>1.0</td> <td>3.1</td> <td>4.4</td> <td>5.5</td> </tr> <tr> <td>2 CPU</td> <td>0.7</td> <td>1.6</td> <td>1.8</td> <td>1.9</td> </tr> <tr> <td>4 CPU</td> <td>1.9</td> <td>2.1</td> <td>2.1</td> <td>2.3</td> </tr> <tr> <td>8 CPU</td> <td>2.3</td> <td>2.3</td> <td>2.3</td> <td>2.3</td> </tr> </tbody> </table> **LBP** <table> <thead> <tr> <th>Normalized Execution Time</th> <th>1 CPU</th> <th>2 CPU</th> <th>4 CPU</th> <th>8 CPU</th> </tr> </thead> <tbody> <tr> <td>1 CPU</td> <td>1.0</td> <td>1.0</td> <td>1.0</td> <td>1.0</td> </tr> <tr> <td>2 CPU</td> <td>0.1</td> <td>0.1</td> <td>1.3</td> <td>3.4</td> </tr> <tr> <td>4 CPU</td> <td>0.1</td> <td>0.1</td> <td>1.1</td> <td>5.2</td> </tr> <tr> <td>8 CPU</td> <td>0.1</td> <td>0.1</td> <td>1.1</td> <td>1.1</td> </tr> </tbody> </table> **RBM** <table> <thead> <tr> <th>Normalized Execution Time</th> <th>1 CPU</th> <th>2 CPU</th> <th>4 CPU</th> <th>8 CPU</th> </tr> </thead> <tbody> <tr> <td>1 CPU</td> <td>1.0</td> <td>1.0</td> <td>1.0</td> <td>1.0</td> </tr> <tr> <td>2 CPU</td> <td>1.9</td> <td>1.9</td> <td>3.1</td> <td>3.4</td> </tr> <tr> <td>4 CPU</td> <td>1.9</td> <td>1.9</td> <td>3.4</td> <td>4.7</td> </tr> <tr> <td>8 CPU</td> <td>1.9</td> <td>1.9</td> <td>4.7</td> <td>4.7</td> </tr> </tbody> </table> **Naive Bayes** <table> <thead> <tr> <th>Normalized Execution Time</th> <th>1 CPU</th> <th>2 CPU</th> <th>4 CPU</th> <th>8 CPU</th> </tr> </thead> <tbody> <tr> <td>1 CPU</td> <td>0.1</td> <td>0.1</td> <td>1.3</td> <td>3.4</td> </tr> <tr> <td>2 CPU</td> <td>0.1</td> <td>0.1</td> <td>1.1</td> <td>5.2</td> </tr> <tr> <td>4 CPU</td> <td>0.1</td> <td>0.1</td> <td>1.1</td> <td>1.1</td> </tr> <tr> <td>8 CPU</td> <td>0.1</td> <td>0.1</td> <td>1.1</td> <td>1.1</td> </tr> </tbody> </table> **RBM** <table> <thead> <tr> <th>Normalized Execution Time</th> <th>1 CPU</th> <th>2 CPU</th> <th>4 CPU</th> <th>8 CPU</th> </tr> </thead> <tbody> <tr> <td>1 CPU</td> <td>1.0</td> <td>1.0</td> <td>1.0</td> <td>1.0</td> </tr> <tr> <td>2 CPU</td> <td>1.9</td> <td>1.9</td> <td>3.1</td> <td>3.4</td> </tr> <tr> <td>4 CPU</td> <td>1.9</td> <td>1.9</td> <td>3.4</td> <td>4.7</td> </tr> <tr> <td>8 CPU</td> <td>1.9</td> <td>1.9</td> <td>4.7</td> <td>4.7</td> </tr> </tbody> </table> Performance Study (GPU) Scalability Study ![Graph showing scalability study with different algorithms and threads](image) Domain Specific Optimizations Best Effort Computation Normalized Execution Time 1.0x 1.8x 4.9x 12.7x K-means Best-effort (1.2% error) Best-effort (4.2% error) Best-effort (7.4% error) Relaxed Dependencies 1.0x 1.8x SVM Relaxed SVM (+ 1% error) Conclusion - Using Domain Specific Languages (DSLs) is a potential solution for heterogeneous parallelism - OptiML, an example DSL for ML demonstrates productivity, portability and performance - Delite, as a framework, simplifies developing implicitly parallel DSLs that target heterogeneous platforms - Delite, as a runtime, maximizes performance through dynamic optimizations and scheduling decisions - GPU specific optimizations and automatic CUDA code generation allows efficient use of GPU devices with Delite runtime - Experimental results show that OptiML+Delite outperforms various MATLAB implementations THANK YOU
{"Source-Url": "https://www.nvidia.com/content/GTC-2010/pdfs/2177_GTC2010.pdf", "len_cl100k_base": 6144, "olmocr-version": "0.1.53", "pdf-total-pages": 46, "total-fallback-pages": 0, "total-input-tokens": 70897, "total-output-tokens": 7345, "length": "2e12", "weborganizer": {"__label__adult": 0.0003731250762939453, "__label__art_design": 0.0003457069396972656, "__label__crime_law": 0.00036215782165527344, "__label__education_jobs": 0.0005865097045898438, "__label__entertainment": 8.821487426757812e-05, "__label__fashion_beauty": 0.00016295909881591797, "__label__finance_business": 0.0002582073211669922, "__label__food_dining": 0.00032258033752441406, "__label__games": 0.000698089599609375, "__label__hardware": 0.0029697418212890625, "__label__health": 0.0004954338073730469, "__label__history": 0.0002911090850830078, "__label__home_hobbies": 0.00012493133544921875, "__label__industrial": 0.0007314682006835938, "__label__literature": 0.00017833709716796875, "__label__politics": 0.00026917457580566406, "__label__religion": 0.0005869865417480469, "__label__science_tech": 0.08221435546875, "__label__social_life": 8.922815322875977e-05, "__label__software": 0.00940704345703125, "__label__software_dev": 0.89794921875, "__label__sports_fitness": 0.0003986358642578125, "__label__transportation": 0.0006809234619140625, "__label__travel": 0.0002225637435913086}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 19845, 0.0244]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 19845, 0.45802]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 19845, 0.7139]], "google_gemma-3-12b-it_contains_pii": [[0, 261, false], [261, 409, null], [409, 492, null], [492, 729, null], [729, 875, null], [875, 927, null], [927, 1299, null], [1299, 1371, null], [1371, 1438, null], [1438, 2064, null], [2064, 2531, null], [2531, 3208, null], [3208, 3474, null], [3474, 4265, null], [4265, 4595, null], [4595, 5153, null], [5153, 5729, null], [5729, 6312, null], [6312, 6765, null], [6765, 7231, null], [7231, 7653, null], [7653, 7919, null], [7919, 8562, null], [8562, 9014, null], [9014, 9577, null], [9577, 10176, null], [10176, 10442, null], [10442, 10954, null], [10954, 11359, null], [11359, 11923, null], [11923, 12153, null], [12153, 12606, null], [12606, 12606, null], [12606, 13125, null], [13125, 13543, null], [13543, 13920, null], [13920, 14527, null], [14527, 14793, null], [14793, 15160, null], [15160, 15738, null], [15738, 18838, null], [18838, 18862, null], [18862, 18961, null], [18961, 19212, null], [19212, 19836, null], [19836, 19845, null]], "google_gemma-3-12b-it_is_public_document": [[0, 261, true], [261, 409, null], [409, 492, null], [492, 729, null], [729, 875, null], [875, 927, null], [927, 1299, null], [1299, 1371, null], [1371, 1438, null], [1438, 2064, null], [2064, 2531, null], [2531, 3208, null], [3208, 3474, null], [3474, 4265, null], [4265, 4595, null], [4595, 5153, null], [5153, 5729, null], [5729, 6312, null], [6312, 6765, null], [6765, 7231, null], [7231, 7653, null], [7653, 7919, null], [7919, 8562, null], [8562, 9014, null], [9014, 9577, null], [9577, 10176, null], [10176, 10442, null], [10442, 10954, null], [10954, 11359, null], [11359, 11923, null], [11923, 12153, null], [12153, 12606, null], [12606, 12606, null], [12606, 13125, null], [13125, 13543, null], [13543, 13920, null], [13920, 14527, null], [14527, 14793, null], [14793, 15160, null], [15160, 15738, null], [15738, 18838, null], [18838, 18862, null], [18862, 18961, null], [18961, 19212, null], [19212, 19836, null], [19836, 19845, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 19845, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 19845, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 19845, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 19845, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 19845, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 19845, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 19845, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 19845, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 19845, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 19845, null]], "pdf_page_numbers": [[0, 261, 1], [261, 409, 2], [409, 492, 3], [492, 729, 4], [729, 875, 5], [875, 927, 6], [927, 1299, 7], [1299, 1371, 8], [1371, 1438, 9], [1438, 2064, 10], [2064, 2531, 11], [2531, 3208, 12], [3208, 3474, 13], [3474, 4265, 14], [4265, 4595, 15], [4595, 5153, 16], [5153, 5729, 17], [5729, 6312, 18], [6312, 6765, 19], [6765, 7231, 20], [7231, 7653, 21], [7653, 7919, 22], [7919, 8562, 23], [8562, 9014, 24], [9014, 9577, 25], [9577, 10176, 26], [10176, 10442, 27], [10442, 10954, 28], [10954, 11359, 29], [11359, 11923, 30], [11923, 12153, 31], [12153, 12606, 32], [12606, 12606, 33], [12606, 13125, 34], [13125, 13543, 35], [13543, 13920, 36], [13920, 14527, 37], [14527, 14793, 38], [14793, 15160, 39], [15160, 15738, 40], [15738, 18838, 41], [18838, 18862, 42], [18862, 18961, 43], [18961, 19212, 44], [19212, 19836, 45], [19836, 19845, 46]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 19845, 0.09886]]}
olmocr_science_pdfs
2024-12-09
2024-12-09
8edf6c30883e93be709535e919d1a8eb7671e361
The Design and Case Study of the WSRush Platform Chun-Hsiung Tseng¹, Yung-Hui Chen², Yan-Ru Jiang³, Jia-Rou Lin⁴ ¹ Department of Communications Engineering, Yuan Ze University, Taiwan ² Department of Computer Information and Network Engineering, Lunghwa University of Science and Technology, Taiwan ³ Department of Information Management, Yuan Ze University, Taiwan ⁴ Department of Information Management, Nanhua University, Taiwan lendle_tseng@seed.net.tw, cyh@mail.lhu.edu.tw, treelazy821006@gmail.com, 10325209@nu.edu.tw Abstract The popularity of cloud computing makes developing Web services a trend. In this research, we propose our design of WSRush, a platform that can be used to simplify the development of Web service applications. The platform simplifies the development cycle of Web service applications. The WSRush platform consists of three layers: the core engine and service provider interface, the Web interface, and the Web service utilities. With the platform, developers can reuse or inherit from the provided software modules to prevent re-inventing the wheel. Two types of services: the script-based ones and the static ones are supported by WSRush. Furthermore, developers can even inherit from the core of WSRush and build their own platforms. Keywords: WebService, SOA, Platform 1 Introduction The emerging of cloud computing issues causes wide adoption of Web service technologies, which in turn has demonstrated high impacts on software development cycles. Protocols such as SOAP¹ and Restful² are widely used in Web service applications and they do help develop clear separations among functionalities, data models, and user interfaces. Furthermore, a Web service application is by nature platform independent. Despite of its elegance, Web service technologies are still considered difficult for inexperienced programmers. As a teacher offering programming courses, the researcher has tried several methods to make students understand the concept of Web service, however, only few of them can really get familiar with the technology and even fewer of them can utilize it in real world software projects. We believe that it will be beneficial to help students and inexperienced programmers get acquainted with them as soon as possible, considering the importance of Web service technologies. Therefore, the researchers built WSRush, a Web service ready application platform. Why is it a challenge to get acquainted with the concept of Web service technologies? Perhaps a reason is there are just too many concepts to learn. During the development of Web service applications, usually, developers will face the following issues: (1) Choose an appropriate protocol. Web service applications usually adopt the SOAP or the Restful protocol, but there are numerous related protocols to choose. (2) Deal with the marshalling and unmarshalling of input/output data properly. XML and JSON are two frequently data formats adopted in Web service applications, however, developers must be familiar with a set of tools/technologies to cope with these data formats. (3) Figure out a seamless way to integrate Web service technologies with their development environment. Web service technologies themselves are neutral to development environments, but developers will need adequate integration to reduce the difficulties of using Web service technologies in their projects. But what are the core concepts of Service-Oriented-Architecture (SOA)? According to Endrei et al., “Service-oriented architecture presents an approach for building distributed systems that deliver application functionality as services to either end-user applications or other services.” [1] Therefore, the goal of the proposed platform is to help users focus on wrapping application functionality as services rather than dealing with the above issues. Of course, there are already tools such as NetBeans, Eclipse, and Visual Studio aimed at helping developers handle the above issues. However, the diversities of these tools cause additional burdens for developers, not to mention the vendor-lock-in problem. The goal of this research is to reduce the complexities of adopting Web service technologies by providing a platform that has built-in Web service ¹Corresponding Author: Yung-Hui Chen; E-mail: cyh@mail.lhu.edu.tw DOI: 10.3966/160792642018091005033 ¹ https://en.wikipedia.org/wiki/SOAP ² https://en.wikipedia.org/wiki/Representational_state_transfer natures, requires no further integration, and keep the neutrality. The platform has the following characteristics: 1. The platform does not require developers to handle the protocol part themselves. Instead, developers simply inherit from a provided software module (in the current stage, the platform is implemented in Java, so developers have to extends from a provided Java class) and then the platform will automatically transform developer provided modules into Restful based Web services. 2. All input/output data will follow the JSON data formats and the platform provides libraries to help developers handle the encode and decode of JSON data. Due to the popularity of the JSON-format, this characteristic should not cause limitations. 3. The platform provides tools to manage global resources such as database connections so system resources can be effectively utilized and developers do not have to deal with resource management. 4. The platform itself integrates several industrial-standard technologies such as jQuery, Spring Framework, and Jersey, etc. The popularity and standardization of these technologies will reduce the risk of vendor-lock-in. With these characteristics, the researchers believe the proposed platform will help in-experienced programmers and students manage the Web service technology. Besides, experienced developers will also benefit from the platform with its well integrated set of technologies since they can focus on the business logic part. In this research, we will at first give a detailed introduction to the functionality and architecture of the platform. 2 Related Works The importance of the service oriented architecture (SOA) can never be overestimated. The definition of SOA is explained in detail in [2]. Web service standards are the central idea of SOA. In [3], Web services are defined as the integration technology preferred by organizations implementing service-oriented architectures. The adoption of SOA is extremely wide. Trkman and Kovačič discusses the phases of SOA adoption [4]. The research of Luthria and Rabhi [5] summarized factors influencing the adoption of SOA: the perceived value of SOA to the organization, the organizational strategy, organizational context or culture, organizational structure, potential implementation challenges, and given the current environment of increasingly stringent regulations and accountability requirements, the governance or the management of such technology. Among them, our research focuses on reducing the implementation challenges, especially for inexperienced developers and students. As stated in the work of Lopez, Casallas, and Villalobos, “providing environments where students go beyond learning some concepts and specific technologies to truly apprehend the complexity involved in SOA is a major challenge [6].” The work of Paik, Rabhi, Benatallah, and Davis designed a dedicated virtual teaching and learning space for students to learn SOA [7]. Spillner implemented SPACEflight, which is a versatile live demonstrator and teaching system for advanced service-oriented technologies [8]. Furthermore, it is proved that using Web services in introductory programming classes can enhance students’ learning performance [9]. In [10], a framework for measuring student learning gains and engagement in a Computer Science 1/Information Systems 1 programming course was described. The results of the research showed that adopting Web services is effective in student learning gains. In [11], how and why teaching modern web services is an important part of information systems curriculum, and how they can be introduced at introductory levels were discussed. According to the research result, Knowing the workings of Web APIs is quickly becoming a vital skill of programmers, tech entrepreneurs, and managers of any kind. The work of Jakimoski highlighted that in education systems, SOA can be adopted to reduce the complexity of integrating systems, but there is limited academic research work on the domain [12]. Frameworks such as Spring Framework provide similar functionality with regards to the creation of Web services. The uniqueness of the proposed framework is its simplicity. Most comparative frameworks are full-stack frameworks. For example, Spring Framework covers many aspects of the life cycle of a Web service such as controllers, interceptors, and dependency injection technologies, etc. The proposed framework is much simpler and covers only the execution, management, and input/output of Web services. The characteristic makes it much easier to integrate the proposed framework with other technologies. Note that this does not mean that WSRush lacks important features and imposes huge limitations on applications. WSRush is itself built based on Spring Framework, so it in fact can achieve every thing Spring Framework can achieve. Our point is, for circumstances in which developers don't need advanced functionality such as dependency injection, interceptors, and controllers, adopting WSRush will be a lean solution. A more comparative framework is JAX-WS. The framework is also a lightweight framework and covers only the Web service part. In fact, the current implementation of WSRush is built based on JAX-WS. The issue of JAX-WS is that it exposes too many details and offers too many degree --- 3 https://en.wikipedia.org/wiki/ JQuery 5 https://en.wikipedia.org/wiki/ Jersey 6 https://projects.spring.io/spring-framework/ 7 https://jax-ws.java.net/ of freedom to ordinary developers. For example, JAX-WS allows developers to specify output formats via the @Produce annotation while in most cases the JSON format is assumed. Frameworks such as Zend Framework and Ruby on Rails take a different approach. They focus more on the adoption of the MVC design pattern and they provide some very advanced model construction tools. They are usually regarded as full-stack frameworks that are intended to be used alone while WSRush is designed to allow easy integration with other technologies. Other frameworks, such as DeployR and Shiny, are special purpose frameworks. They are designed for integrating the R technology into Web applications while WSRush is a general purpose framework. Hayes et al. proposed a platform-as-a-service method for building Web services but only focused on healthcare [13]. 3 WSRush Platform The WSRush platform is a framework and tool set to make develop Web service based applications simpler. It has a core library which can be easily extended to address different environments and protocols, a framework which can used for implementing business logic for Web services, and some tools to simplify the design and deploy tasks. The platform consists of three layers: the core engine and service provider interface, the Web interface, and the Web service utilities. The core engine and service provider interface is the kernel of the platform. It handles the life cycle of the platform, manages the execution of services, and provides resource management utilities. Besides, this part includes application interfaces to allow extensions. The Web interface implements the HTTP and HTTPS processing layer. A version of Jersey, which is a widely adopted implementation of the Restful protocol, is deployed in this part. A Web service request will first be intercepted by the Web interface and then dispatched to the corresponding services registered in the core engine. Additionally, a Web service utilities layer is included. The layer provides utilities to be used by developers to configure and access the platform. A set of configuration files such as engines.xml for registering services and global Resources.xml for managing resources are included in this layer. Furthermore, some JavaScript modules are also included to assist developers. The current version of WSRush is packaged as a standard Java Web application. To use it, simply deploy the package file (a standard zip file with the .war file extension) to a Java-enabled environment with JDK 7.0 or higher and a Java application server supporting Servlet 2.4 or higher. The current implementation of WSRush has been tested against Tomcat 7.0 and Glassfish 4.0, which are two certified Java application servers. After copying the WSRush package file to the application directory of the target application server, the file will be automatically unpackaged, and developers can start developing their applications based on the unpackaged Web application structure. Note that despite that WSRush itself is a Web application, this does not impose restrictions on the types of applications based on WSRush. As long as the Restful protocol is adhered, WSRush can be utilized in various types of applications. The directory structure of WSRush is illustrated in the figure below: ![Figure 1. the directory structure of WSRush](image) To deploy a Web service, one has to at first implement the Service interface, and then register the Web service in the engines.xml configuration file. The interface is shown in Figure 2. Note that developers are required to realize the specific application logic of their system only, the Web service protocol itself is handled by the platform. ![Figure 2. the Service interface](image) The code snippets below demonstrates the implementation of a simple echo Web service: ```java public class EchoService extends AbstractService{ public void initServiceContextఈ } @Override public void initServiceContext() } @Override public ExecutionResult execute(ServiceRequestParameter parameter) } @Override public boolean isSessionRequired() } ``` As shown in the code snippets, developers has to extend from `AbstractService`, which handles the fundamental operations such as parameter marshaling and protocol decoding/encoding of a Web service, and then override the `execute` and `isAuthenticated Session Required` methods. In the `execute` method, developers implement the business logic. The `parameter` argument wraps the parameters in HTTP packets. The invocation of the `createExecution` method will create the return value adhering to the format defined by the `Service` interface. In WSRush, executions of Web service instances are managed by engines. A engine is a software module provides the run time execution environment for its registered Web service instances. Three type of engines are pre-bundled in the package file of WSRush: the Simple Unsafe Engine Impl, the Simple Unsafe Scriptable Engine Impl, and the SimpleEngineImpl. Developers can implement engines for their own needs by implementing the `ilab.apprush.core.Engine` interface, but the pre-bundled engines should be enough in most circumstances. The SimpleUnsafeEngineImpl is the most simple one. As its name suggests, the type of engine imposes no security support. Hence, services registered with the type of engine is open to all requests provided that the network settings allows it. The Simple Unsafe Scriptable EngineImpl is similar with the Simple Unsafe Engine Impl with the difference that the type of engine supports script languages. As a result, developers can register script-based Web services with the type of engine. Although the execution of scripts is slower than compiled binaries, scripting-based Web services can be modified on-line and is usually easier to develop. The SimpleEngineImpl accepts both compiled and script based Web services and additionally provides security mechanisms. That is, user name and password can be set to restrict the access to services. To invoke Web services, simply issue HTTP requests to WSRush instances. The endpoint of the requests is in the following form: ``` http://host/ws/dispatcher?namespace=namespace&localName=localName ``` host, namespace, and localName are parameters. Function parameters to be passed to Web services should be encoded as a JSON map and embedded into the POST packet to be sent. If the application relying on WSRush is a Web application, some JavaScript helper functions are shipped with WSRush to simplify the invocation process. In application.js, which is a JavaScript library included in WSRush, an `ApplicationClass` class is defined. The class provides a method ``` callAPI (namespace, localName, parameters, successCallback, failCallback) ``` for Web service invocation. Using the method, developers simply fill the required parameters, and the successCallback and failCallback will automatically be invoked when needed. Additionally, The method will handle the authentication part if the invoked Web service requires authentication. A very simplified example of utilizing the JavaScript method is shown below: ![a JavaScript example](http://example.com/js.png) **Figure 3.** a JavaScript example 4 Design WSRush is composed of three layers: the core engine and service provider interface, the Web interface, and the Web service utilities. The main considerations are extensibility and separation of concerns. The core engine and service provider interface defines most core functionalities. The Web interface layer deals with I/O between WSRush and clients via the HTTP protocol. The Web service utilities layer defines utility classes that can be used by other layers. 4.1 The Core Engine and Service Provider Interface Layer The core engine and service provider interface layer provides the definition and implementation of core components. These core components form the basis of the WSRush platform and make the platform extensible and flexible. At this layer, no communication protocol is assumed. The design focuses on the management of services. To achieve this, two central concepts are `Engine` and `Service`. A `Service` is an implementation of a set of application logics. In most cases, if a developer is using a concrete implementation of WSRush, she/he only focuses on writing services. On the other hand, an `Engine` is responsible for providing an execution environment for services managed by it. Therefore, for developers who are extending WSRush or implementing their own version of WSRush, they have to deal with the engine part. The most fundamental methods of engines are defined in the `Engine` interface: 1. `init`: implement this method to initialize the engine 2. `start`: implement this method to handle the start up of the engine 3. `stop`: implement this method to handle the shutdown procedure of the engine 4. `executeService`: implement this method to handle clients’ requests of executing services Some abstract classes are included to simplify implementation and future extension. Figure 4 shows the class hierarchy of engine classes. As shown in Figure 4, there are various abstract engine classes to simplify the implementation. Among them, AbstractSimpleEngine and AbstractScriptableEngine are two major classes. Developers who want to extend the WSRush platform may want to start from these two classes. AbstractSimpleEngine defines how engine classes interact with service classes. It has an internal service map which maintains a list of registered services. Upon receiving a request, it dispatches the request to corresponding services according to the specified namespace and localName parameters. AbstractScriptableEngine extends AbstractSimpleEngine by incorporating script interpreters, the VMs. Figure 4. the class diagram of engine classes Some additional classes deserve explaining are VM, DaemonTask, and Context. VM implements the concept of a virtual computing machine. Implementations of AbstractScriptableEngine delegate their computation tasks to VMs. A VM wraps one or more scripting interpreters and provides a supporting infrastructure for these interpreters. Currently, JavaScript and Beanshell scripting languages are supported. With the design of VMs, developers can dynamically change the implementation of their services and perform hot deployment, which will further shorten the development cycle. The definition of VM has the following methods: 1. getVMType: return the scripting language supported 2. getRootFolder: return the root folder (the working directory) of the VM 3. executeScriptAsService: execute the service Currently, DefaultJavaScriptVMImpl and DefaultBeanShellVMImpl are provided to support JavaScript and Beanshell respectively. A DaemonTask is a background task that will be automatically managed by WSRush. Unlike traditional java.lang.Thread, which may be left in the system after the termination of the main program and lock some resources, a DaemonTask will automatically be terminated once the main program is finished. To implement a DaemonTask, one simply implements the interface ilab.apprush.core.daemon.DaemonTask or extends from the abstract class ilab.apprush.core.daemon.AbstractDaemonTask. Furthermore, unlike traditional java.lang.Thread, a DaemonTask can be shutdown programmatically. To start a DaemonTask, one has to invoke GlobalContext.requestDaemonExecution. Besides, a convenient function, GlobalContext.terminateDaemons is provided to shutdown all DaemonTask. A Context encapsulates a set of environmental parameters. Services are executed by WSRush, and therefore, they have to acquire environment information such as working directory from WSRush. Three types of Contexts are defined: GlobalContext, EngineContext, and ServiceContext. From the context, it can obtain the directory structure relative to the root path (the deployed path) of the Service. Furthermore, it can acquire the corresponding EngineContext and GlobalContext from the ServiceContext. As their names suggest, EngineContext provides engine-wide information while GlobalContext provides global information. Additionally, by invoking the executeService method defined in all types of Contexts, a Service can even request the execution of other services, which will make code-reuse easier. 4.2 The Web Interface Layer The Web interface layer handles HTTP and HTTPs requests. The current implementation of this layer assumes the adoption of the Java Servlet technology. The popularity of the technology makes the assumption reasonable. The core class in this layer is the ilab.apprush.core.services.system.DispatcherService class, which is a Restful endpoint implemented with Jersey. Jersey is the Java implementation of the Restful protocol and allows users to create Restful style Web services by simply annotating a Java class. In WSRush, Jersey is adopted for implementing the front controller of Services. That is, DispatcherService is responsible for accepting Restful requests and wrap/unwrap parameters in incoming and outgoing packets. For convenience, *DispatcherService* accepts both GET and POST requests. Note that since WSRush is packaged as a software library, developers who need detailed control can simply extend *DispatcherService*. Original request objects will be wrapped into *Wrapped HttpRequest* objects to provide identical access methods for the two types of requests. To allow flexible configurations, this layer also assumes the adoption of the spring framework13. A sample configuration file is listed below: ``` <beans> <import resource="globalResources.xml"/> <import resource="engines.xml"/> <bean id="springConfigurator" class "ilab.apprush.core.configurator.SpringConfigurator"> <property name="engineList"> <list> <ref bean="simpleEngine1"/> <ref bean="simpleScriptableEngine1"/> </list> </property> </bean> </beans> ``` In the configuration file, two engines, the *simpleEngine1* and the *simpleScriptableEngine1*, are loaded. By modifying the list, developers can decide the engines to be loaded into their WSRush instances. Furthermore, two additional configurations, the globalResources.xml and the engines.xml, are included. The former is used for configuring global resources such as connection pools while the latter is for configuring engines. An example of globalResources.xml is shown below: ``` <bean id="defaultdb" class="com.mysql.jdbc.PooledConnection"> <property name="driverClass" value="com.mysql.jdbc.Driver"/> <property name="dbUrl" value="jdbc:mysql://localhost/ihwu?characterEncoding=UTF-8"/> <property name="initialPoolSize" value="5"/> <property name="minPoolSize" value="1"/> <property name="maxPoolSize" value="5"/> <property name="maxIdleTime" value="300"/> <property name="user" value="root"/> <property name="password" value="root"/> </bean> ``` The file declares a connection pool named as *defaultdb* with some pooling configurations. The pool allows 5 concurrent database connections at max and will keep at least 1 connection stay in the pool. 4.3 The Web Service Utilities Layer For developers that do not want to extend or modify the core of WSRush, they can simply deploy the packaged version of WSRush. By default, WSRush is most suitable for Web applications and a Web service utilities layer is implemented to simplify the adoption. In addition to the application.js module mentioned earlier, a dynamic configuration file is included. The file will automatically discover the IP address of WSRush server and thus can be used for obtaining the URL for the endpoint. With the dynamic configuration file, it will be easier to maintain a WSRush instance. The configuration file is only applicable for Web applications. To use the file, simply use the following statement: ``` <script src="/js/config.js.jsp" type="text/javascript"></script> ``` Furthermore, for Web applications, an authentication dialog will be generated automatically when needed. To use the feature, a Keystore instance has to be registered via the globalResource.xml configuration file. The *ilab.apprush.core.security.keystore.Keystore* interface declares methods for implementing a Keystore: 1. getKeay: given a (user name, password) pair, the method returns a temporarily valid key 2. invalidateKey: disable the specified key 3. verifyKey: check whether the specified key is valid or not A simplified implementation of Keystore, the --- 13 https://projects.spring.io/spring-framework/ --- **Figure 5.** The activity diagram ilab.apprush.core.security.keystore.SimpleKeystoreImp is included in WSRush. To use SimpleKeystoreImp, a static user account list is needed. The list can be registered in the globalResource.xml configuration file. An example is shown below: ```xml <bean id="keystore" class="ilab.apprush.core.security.keystore.SimpleKeystoreImp"> <property name="users"> <list> <bean class="ilab.apprush.core.security.keystore.SimpleKeystoreUser"> <property name="userId" value="user1"/> <property name="password" value="password1"/> </bean> <bean class="ilab.apprush.core.security.keystore.SimpleKeystoreUser"> <property name="userId" value="user2"/> <property name="password" value="password2"/> </bean> </list> </property> </bean> ``` Figure 6. A sample configuration file for Keystore within two months Moreover, some Web based tools have been provided for administering a WSRush instance. To enter the administration page, users have to log into the following URL: http://host:port/WSRush/admin Then, the user will be requested to enter the administration username/password. After a successful login, the user will be redirected to an online file manager: ![Online file manager](image) Figure 7. The online file manager of WSRush Note the file manager is extended from an open source project named as jsp File Browser. With the file manager, users can edit script-based services online. The index page of the file manager lists the directory structure of script-based engines. By navigating into the corresponding folder, users can create/modify/delete/show script-based services for specific engines. The online editor is shown below: 4.4 The Composition of Web Services In many cases, developers have to reuse or compose existing Web services to achieve their tasks. The current implementation of WSRush does not support automatic composition. However, manual composition is supported. In ilab.apprush.core.context.Context, a method: ```java ExecutionResult executeService(String namespace, String localName, ServiceRequestParameter parameter) ``` is defined. Developers simply invoke the function to interact with other Web services registered in the same WSRush instance. Note that WSRush itself keeps a very lean design principle, so it can be integrated with other orchestration or choreography technologies such as BPEL. 5 Case Study In this section, a case study is given to demonstrate the adoption of WSRush. The research team adopts WSRush in their own MOST project: “Cloud and Crowd Supported Math Learning in Computer Science.” In the project, we develop a method as well as an e-learning system based on cloud technologies and crowd intelligence to enhance students’ learning performance of math in computer science. As mentioned, we use WSRush to implement Web services to augment the OLAT learning management system. With WSRush, we can prototype the needed services quickly by using the beanshell and javascript scripting languages. Furthermore, team members don’t need to study full-stack Web service frameworks such as JAX-WS in advance. These characteristics result in faster development. First, for version control, we created a brached version of WSRush. Then, to load WSRush related objects, we add the default WSRush listener via the standard web.xml configuration file: ```xml <listener> <listener-class>ilab.apprush.core.listener.DefaultStartupListener</listener-class> </listener> ``` To prevent the need of redeploy the Services, script-based Services were preferred. On the other hand, there were still Services that will not be affected by experiments results, so static Services were used in such cases for performance. Additionally, we added two entries to globalResources.xml: The former entry, the properties bean was used for specifying olat specific environment variables while the latter entry was used for registering a database connection pool to the olat database. Finally, we changed its Web application name to MathWS and deploy the resulting war file to a tomcat server. We totally implemented 7 Web services. Among them, two are script-based and four are static. The following code snippets demonstrate a script-based service: ```java public class EmotionSelectService extends AbstractService { // Constructor public EmotionSelectService() { super(); } @Override public ServiceResult execute(ServiceRequestParameter parameter) { String emotion = parameter.getString İçeren "emotion"; if (emotion != null) { String emotionValue = parameter.getString "emotion"; return new ServiceResult(200, "success", emotionValue); } return new ServiceResult(400, "error", "emotion parameter required"); } @Override public boolean isAuthenticatedSessionRequired() { return false; } } ``` As shown in the code snippets, to implement a script-based service, developers have to complete two functions: execute and is Authenticated Session Required. The former defines the business logic of the service while the latter controls whether an authenticated session is required for accessing the service. In the execute function, VMContext plays a similar role with ServiceContext and Service Request Parameter is a wrapper of parameters passed by the program that invokes the service. On the other hand, implementing a static service takes a very similar approach: ```java public class StaticService extends AbstractService { // Constructor public StaticService() { super(); } @Override public ServiceResult execute(ServiceRequestParameter parameter) { String parameterValue = parameter.getString "parameter"; return new ServiceResult(200, "success", parameterValue); } @Override public boolean isAuthenticatedSessionRequired() { return false; } } ``` In most cases, developers start by extending the AbstractService and override two function: execute and isAuthenticatedSessionRequired. With the help of WSRush, students joining the project created all the needed Web services within two months. Empirically, most students are not good at server-side programming, not to mention Web service programming. For comparison, a course for JAX-WS on udemy takes 12.5 hours\(^1\), which will be mapped to a 3-5 weeks course unit in universities. 6 Conclusions and Future Work In this manuscript, a Web service ready application platform, the WSRush platform, is proposed. The platform provides some ready-to-use infrastructures to simplify the development of Web service applications. With the proposed platform, developers can concentrate on their application logic and simply leave the protocol handling and resource management tasks to WSRush. Furthermore, the platform is highly extensible, developers can customize WSRush to their needs by extending from the core classes. The current implementation of WSRush is stable and usable. In the future, we will improve WSRush in the following ways: 1. Graphical user interface: the current version is packaged as a standard Web application, however, it stills lacks GUI for system configuration and management. In the next step, we will augment it with GUI to enhance its usability. 2. Further extend WSRush to support other usecases. For example, the research teach already has a plan to adopt WSRush to build a wrapper of Cordova, which is a very popular APP development framework. \(1\) https://www.udemy.com/java-web-services/ The Design and Case Study of the WSRush Platform References Biographies Chun-Hsiung Tseng received his B.S. in computer science from National ChengChi University, and received M.S. and Ph.D. in computer science from National Taiwan University. He is a faculty member of Department of Communications Engineering, YuanZe University. His research interests include big data analysis, crowd intelligence, e-learning systems, and Web information extraction. Yung-Hui Chen is an associate professor in Department of Computer Information and Network of LungHwa University of Science and Technology. He received the B.S. degree in Computer Science Information Engineering from TamKang University in 1997, and the M.S. and Ph.D. in Information Engineering from the TamKang University. Yan-Ru Jiang received her bachelor degree from department of information management in Nanhua university. She is specialized in programming and is a member of the IMSofa lab. Jia-Rou Lin is currently studying in Nanhua university and is majored in Information Management. She is specialized in programming and is a member of the IMSofa lab.
{"Source-Url": "https://jit.ndhu.edu.tw/article/download/1783/1789", "len_cl100k_base": 6996, "olmocr-version": "0.1.50", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 27090, "total-output-tokens": 8437, "length": "2e12", "weborganizer": {"__label__adult": 0.00033545494079589844, "__label__art_design": 0.0003361701965332031, "__label__crime_law": 0.0002613067626953125, "__label__education_jobs": 0.0022029876708984375, "__label__entertainment": 5.716085433959961e-05, "__label__fashion_beauty": 0.00014460086822509766, "__label__finance_business": 0.00020062923431396484, "__label__food_dining": 0.00030612945556640625, "__label__games": 0.0003333091735839844, "__label__hardware": 0.0006427764892578125, "__label__health": 0.00039076805114746094, "__label__history": 0.0002276897430419922, "__label__home_hobbies": 8.213520050048828e-05, "__label__industrial": 0.00030422210693359375, "__label__literature": 0.0002269744873046875, "__label__politics": 0.00020015239715576172, "__label__religion": 0.0004017353057861328, "__label__science_tech": 0.0081939697265625, "__label__social_life": 0.00011849403381347656, "__label__software": 0.0049591064453125, "__label__software_dev": 0.97900390625, "__label__sports_fitness": 0.0002205371856689453, "__label__transportation": 0.0005183219909667969, "__label__travel": 0.0002281665802001953}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 37764, 0.0147]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 37764, 0.3346]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 37764, 0.87475]], "google_gemma-3-12b-it_contains_pii": [[0, 4461, false], [4461, 10010, null], [10010, 14142, null], [14142, 18968, null], [18968, 23012, null], [23012, 26604, null], [26604, 30389, null], [30389, 34120, null], [34120, 37764, null], [37764, 37764, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4461, true], [4461, 10010, null], [10010, 14142, null], [14142, 18968, null], [18968, 23012, null], [23012, 26604, null], [26604, 30389, null], [30389, 34120, null], [34120, 37764, null], [37764, 37764, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 37764, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 37764, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 37764, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 37764, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 37764, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 37764, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 37764, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 37764, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 37764, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 37764, null]], "pdf_page_numbers": [[0, 4461, 1], [4461, 10010, 2], [10010, 14142, 3], [14142, 18968, 4], [18968, 23012, 5], [23012, 26604, 6], [26604, 30389, 7], [30389, 34120, 8], [34120, 37764, 9], [37764, 37764, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 37764, 0.0]]}
olmocr_science_pdfs
2024-11-29
2024-11-29
a14c2bd0829449ceeaef7c60457dcf21f030e42f
[REMOVED]
{"Source-Url": "http://www.cse.msstate.edu/~niu/papers/EA07.pdf", "len_cl100k_base": 7867, "olmocr-version": "0.1.53", "pdf-total-pages": 18, "total-fallback-pages": 0, "total-input-tokens": 38792, "total-output-tokens": 10200, "length": "2e12", "weborganizer": {"__label__adult": 0.0003306865692138672, "__label__art_design": 0.0005102157592773438, "__label__crime_law": 0.0002646446228027344, "__label__education_jobs": 0.0012111663818359375, "__label__entertainment": 5.167722702026367e-05, "__label__fashion_beauty": 0.0001741647720336914, "__label__finance_business": 0.00030612945556640625, "__label__food_dining": 0.00029969215393066406, "__label__games": 0.0005025863647460938, "__label__hardware": 0.0004270076751708984, "__label__health": 0.0003304481506347656, "__label__history": 0.00022780895233154297, "__label__home_hobbies": 7.402896881103516e-05, "__label__industrial": 0.0002903938293457031, "__label__literature": 0.0003342628479003906, "__label__politics": 0.0002036094665527344, "__label__religion": 0.0003795623779296875, "__label__science_tech": 0.00872039794921875, "__label__social_life": 8.243322372436523e-05, "__label__software": 0.005279541015625, "__label__software_dev": 0.97900390625, "__label__sports_fitness": 0.00024390220642089844, "__label__transportation": 0.0003719329833984375, "__label__travel": 0.00016450881958007812}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 46927, 0.02289]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 46927, 0.43023]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 46927, 0.90797]], "google_gemma-3-12b-it_contains_pii": [[0, 2412, false], [2412, 5525, null], [5525, 8425, null], [8425, 11393, null], [11393, 12954, null], [12954, 16066, null], [16066, 19119, null], [19119, 21151, null], [21151, 24547, null], [24547, 27691, null], [27691, 30546, null], [30546, 31352, null], [31352, 33572, null], [33572, 36729, null], [36729, 39824, null], [39824, 42785, null], [42785, 46122, null], [46122, 46927, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2412, true], [2412, 5525, null], [5525, 8425, null], [8425, 11393, null], [11393, 12954, null], [12954, 16066, null], [16066, 19119, null], [19119, 21151, null], [21151, 24547, null], [24547, 27691, null], [27691, 30546, null], [30546, 31352, null], [31352, 33572, null], [33572, 36729, null], [36729, 39824, null], [39824, 42785, null], [42785, 46122, null], [46122, 46927, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 46927, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 46927, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 46927, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 46927, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 46927, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 46927, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 46927, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 46927, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 46927, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 46927, null]], "pdf_page_numbers": [[0, 2412, 1], [2412, 5525, 2], [5525, 8425, 3], [8425, 11393, 4], [11393, 12954, 5], [12954, 16066, 6], [16066, 19119, 7], [19119, 21151, 8], [21151, 24547, 9], [24547, 27691, 10], [27691, 30546, 11], [30546, 31352, 12], [31352, 33572, 13], [33572, 36729, 14], [36729, 39824, 15], [39824, 42785, 16], [42785, 46122, 17], [46122, 46927, 18]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 46927, 0.05208]]}
olmocr_science_pdfs
2024-12-09
2024-12-09
5bc59859196cd31e3b012113b91d0cbfbd9c0ddb
ARCHITECTURE-ADAPTIVE COMPUTING ENVIRONMENT: A TOOL FOR TEACHING PARALLEL PROGRAMMING John E. Dorband\textsuperscript{1} and Maurice F. Aburdene\textsuperscript{2} Abstract Recently, networked and cluster computation have become very popular. This paper is an introduction to a new C based parallel language for architecture-adaptive programming, aCe C. The primary purpose of aCe (Architecture-adaptive Computing Environment) is to encourage programmers to implement applications on parallel architectures by providing them the assurance that future architectures will be able to run their applications with a minimum of modification. A secondary purpose is to encourage computer architects to develop new types of architectures by providing an easily implemented software development environment and a library of test applications. This new language should be an ideal tool to teach parallel programming. In this paper, we will focus on some fundamental features of aCe C. Index terms— Network Programming, Parallel Compiler, Parallel Programming Language Introduction Parallel and networked computer programming techniques have become popular and important computational tools taught in first year courses [1]. This paper provides an introduction to a new parallel programming language aCe C, a superset of ANS C [2]. We believe aCe C is ideally suited for teaching parallel programming once students have been taught C. In this paper, we assume that the reader is knowledgeable of ANS C. The concepts designed into aCe C have incorporated features found in parallel languages such APL[3], DAP Fortran [4], Parallel Pascal[5], Parallel Forth[6], C* [7], CM lisp [8], FGPC [9], and MPL[10]. aCe has been implemented on top of native C compilers such as gcc and Maspar MPL and on top of message passing libraries such as Cray SHMEM, PVM [11], and MPI [12]. In this paper, we will focus on particular features of aCe C (from now on will refer to it as aCe) with examples. For more details on the language we refer the readers to see the language reference manual [2]. aCe is based on the concept of structured parallel execution. First the programmer designs a virtual architecture that reflects the spatial organization of an algorithm. A virtual architecture may consist of groups or bundles of threads of execution. Code is written reflecting the temporal organization of the algorithm. The code defines what each thread performs, which together with the virtual architecture, defines the algorithm’s execution. aCe is both data-parallel and task-parallel: data parallel in that threads of a bundle execute the same code, and task parallel in that threads of different bundles execute different code. aCe is architecture-adaptive, because different virtual architectures may be used for different physical architectures, to improve architecture dependent performance with minor changes to the code. Typically, a C program has one thread of execution. This is the path that a computer takes through a program while executing it. More sophisticated compilers and run time environments may be able to infer from the code which portions of the execution thread may be performed concurrently without conflict. However, it is very difficult to perform this task automatically. The aCe language allows the programmer to explicitly express that which can be performed concurrently, i.e. the parallelism, thus eliminating the need for a compiler to second-guess the intents of the programmer. The purpose of aCe [2] is to facilitate the development of parallel programs by allowing programmers to explicitly describe the parallelism of an algorithm. The goals of aCe are: - to allow easy expression of algorithms in an architecture independent manner. - to facilitate the programmer’s ability to port and implement algorithms on diverse computer architectures. - to facilitate the programmer’s ability to adapt and implement algorithms on diverse computing architectures. - to facilitate the optimization of algorithms on diverse computing architectures. - to facilitate development of applications on heterogeneous computing environments and programming environments for new computer architectures. Basics The following is an aCe program. Note that it looks no different from a standard C program. \textsuperscript{1} John E. Dorband, NASA Goddard Space Flight Center, Greenbelt, MD 20771, dorband@gsc.nasa.gov \textsuperscript{2} Bucknell University, Electrical Engineering Department, Lewisburg, PA 17837, aburdene@bucknell.edu /* * Bundle of Hello Worlds * aCe program */ #include <stdio.aHr> threads A[10]; int main () { A. { printf("Hello aCe World\n"); } } This program will print "Hello aCe World" 10 times because the printf command is performed by each of the 10 threads of A. The difference between aCe and C is that while C has only one thread of execution, aCe, may have many threads of execution. Each thread may be referenced by name and index. The 'Hello World' program's primary thread is implicitly named 'MAIN'. This is important when it is necessary to communicate between the 'MAIN' thread and other threads executing concurrently with the 'MAIN'. Note that 'main' (lower case) is the name of a function. Parallelism in aCe is expressed by first defining a set of concurrently executable threads. A group of parallel threads can be viewed as a bundle of executing threads, a bundle of processes, or an array of processors. These three views will be treated synonymously. In aCe, a bundle of threads is defined with the 'threads' statement. The statement "threads A[10]" only declares the intent of the programmer to use 10 concurrent threads of executions named 'A' at some later point in the code. These threads must be assigned storage before they can execute any code. Each thread will have its own private storage. Variables of a thread can not be accessed directly by any other thread. In aCe, there is no global storage, only storage local to each thread. Storage is declared for a thread by a standard C declaration preceded by the thread's name. All threads of a bundle will be allocated space for any given declaration. The following statement allocates an integer 'aval' for each of the 10 threads of bundle 'A'. A. int aval; Once storage has been assigned to a thread, then code may be written that will be executed by the thread. The following is a simple piece of code that adds the ten values of val2 to the ten values of val3 and stores the ten results in the ten locations of val1. threads A[10]; A. int val1,val2,val3; int main () { A. { val1 = val2 + val3 ; } } Granted, the values of val2 or val3 were never initialized, but that is a different issue. The important point here is that execution started with the function 'main' by the lone thread 'MAIN', which transferred control to (forks) the 10 threads of 'A' to add the values of val2 to the values val3 before returning control to 'MAIN'. For parallelism to be useful, the storage of each thread must contain different values. This can be done by different means: 1) read different values into the storage of each thread, 2) copy a built-in value that is unique to each thread into the storage of the thread, or 3) obtain a unique value from another thread. In the first case the, function 'fread' may be used to read values into the storage of a thread. A. { fread(&val2,sizeof(val2),1,file); } The fread statement in the context of the threads of A will read 10 values from the input file and put them in the 10 locations of val2 of the 10 threads of A. The second way of putting a unique value into each of the 10 locations of val2 would be to assign a built-in value to val2. A. { val2 = $$i ; } The statement will assign the value of the built-in value '$$i' to val2. The value of '$$i' is the index of the thread. In the case of A, each thread will have a unique index from 0 to 9. Previously, it was pointed out that a thread only has direct access to storage local to itself. A thread, however, can access storage of another thread indirectly through communication operations. There are two basic communication operations. In other parallel programming paradigms, these are referred to as 'get' and 'put' operations. The following is an example of an aCe 'get' operation: A. { int a,b; a = A[($$i+1)%$$N].b ; } In this example, the value of 'b' is fetch from one thread of A to another thread of A. Remember that the value of $$i is the index of the executing thread and that $$N is the number of threads in the bundle A. Thus the value of (($$i+1)%$$N) is the index of a thread other than the thread performing the 'get' operation. The communication operation uses this value to determine which thread to fetch the value of 'b' from. The following statement is an example of an aCe 'put' operation: A. { int a,b; A[($$i+l)%$$N].b = a; } In this example, the value of ‘a’ of the current thread is stored into ‘b’ of a different thread of A. In summary, aCe allows the programmer to declare a bundle of parallel threads of execution, allocate the storage of each thread, define code to execute on threads concurrently, and move values between threads. These are the four essential concepts of aCe: execution, storage, code, and communication. **Bundles of threads** In the previous section, the bundle A was declared as a one-dimensional array of threads. A bundle may actually be declared with any number of dimensions. The statement threads B[2][7][20]; declares the bundle B to have three dimensions of sizes 2, 7, and 20 respectively and contain 280 threads. One may also declare bundles of bundles of threads. In the statement threads { c[10], d[20] } e[100]; ‘e’ is a bundle of bundles of threads. ‘e’ consists of 100 bundles, each containing 2 bundles, one with 10 threads and the other with 20 threads. One should view each bundle of ‘e’ as 1 e-thread, 10 c-threads, and 20 d-threads, where the e-thread is the parent thread of the 10 c-threads and 20 d-threads. Thus, there are a total of 3,100 threads defined by the statement. Since the definition of a bundle is recursive, a bundle can contain any number of sub-bundles. Note that all bundles are ‘descendents’ of the bundle ‘MAIN’. The primary bundle of a bundle declaration, such as ‘e’, is an immediate child bundle of ‘MAIN’. The statement threads { s[11], { { u[34], v[3] } w[102] } t[7] } z[100]; demonstrates the recursive nature of a bundle declaration. **Execution** All operations that can be performed by the thread, ‘MAIN’ (i.e., any C code), may be performed by any bundle of threads concurrently. The only operation supported by ANS C, but not by aCe C is ‘goto’. All code that is not labeled with the name of a bundle will by default be executed by the lone thread ‘MAIN’. The program entry point routine ‘main’ is run by the thread ‘MAIN’. To start code running on a bundle of threads other than ‘MAIN’, a compound statement must be labeled with the name of that bundle. A compound statement is code enclosed in braces, {}. A compound statement can contain any valid aCe code. The compound statement labeled with the bundle name B, B int a,b; B. { a=b; } copies the value at location ‘b’ to the location ‘a’. However, if a conditional statement is executed from within the labeled compound statement, B int a, b, z; B. { if(z) { a=b; } } Some threads of ‘B’ will copy ‘b’ to ‘a’ while some will not, depending on whether ‘z’ was true or not, respectively. During the copy operation, all threads for which ‘z’ is true are said to be ‘active’ and all threads for which ‘z’ is false are said to be ‘inactive’. Within the context of a segment of code for bundle ‘B’ all active threads of ‘B’ will execute the code, while all inactive threads will remain idle. Initially, all threads of all bundles are active, and each bundle will only execute code explicitly designated for that bundle. Conditional statements are used to make some threads of a bundle inactive for a portion of code. A labeled compound statement creates an execution context in which a bundle of threads may execute code. These execution contexts may be nested. For example, in the statement B. { a=b; A. { d=c; } x=y; } all threads of B will copy ‘b’ to ‘a’, then all threads of A will copy ‘c’ to ‘d’, and finally all threads of ‘B’ will copy ‘y’ to ‘x’. This would be equivalent to the statement B. { a=b; } A. { d=c; } B. { x=y; } Then why would it be necessary for contexts to be nested? It is only necessary for contexts to be nested if the execution of one context can implicitly affect the execution of the other. This can happen if the contained context is contained within a condition statement of the containing context, as in the statement B. { if(a) { A. { x=y; } } } In this example, if ‘a’ is true for any thread of B, then ‘y’ is copied to ‘x’ for all threads of A. Otherwise, if ‘a’ is false for all threads of B, then ‘y’ will not be copied to ‘x’ for any thread of A. The next example is a little more complicated. B. { if (a) { A. { x = y; } } else { C. { s = t; } } } As with the previous example, ‘x’ is copied to ‘y’ only if ‘a’ is true for at least one thread of B. And ‘t’ is copied to ‘s’ if ‘a’ is false for at least one thread of B. An interesting side effect of this statement is that ‘x’ will be copied to ‘y’ for all threads of A and ‘t’ will be copied to ‘s’ for all threads of C as long as ‘a’ is true for some threads and false for others. Putting it another way, if any thread of B is active within the context of A, then all threads of A will be active. Functions in aCe must be declared as to which bundle may call them. This is done by preceding the routine’s declaration with the name of the bundle. B int aroutine(int c, int b) { ... The function, aroutine, may be called from within the context of any code executed by B. Communication A conditional expression can also affect communications. Only active threads can initiate a ‘get’ or ‘put’ operation. In the statement B. { if (a) { b = A[idx].x; } } only threads of B for which ‘a’ is true actually fetch a value from the storage location ‘x’ of a thread of A. And in the statement B. { if (a) { A[idx].y = b; } } only active threads of B will store (or put) values into threads of A. Threads of A need not be active to be fetched from or have their storage modified. For example, in the statement A. { if (!$si) { B. { if (a) { A[idx].y = b; } } } } all but one thread of A are made inactive; yet, any active thread of B may store (or put) values into any thread of A whether the thread of A is active or not. Element Identification Threads within a bundle are identified by system-defined constants. There are two categories under which a thread can be identified: 1) globally among all threads of a bundle and 2) within a dimension of a sub-bundle. There are three variables for each of these categories: 1) the number of threads within the category, 2) the log of the number of threads within the category (if the number is a power of 2), and 3) the sequential identifier of the thread within the category. The definitions of the system constants are: $\text{Name}$ - the name of the bundle of threads (char*). $\text{D}$ - the number of dimensions of the bundle. $\text{N}$ - the total number of threads in the bundle (over all sub-bundles). $\text{L}$ - the log base 2 of the total number of threads in the bundle (equals -1 if $\text{N}$ is not a power of 2). $\text{i}$ - the thread identifier of the thread with respect to all the threads of the bundle. $\text{ii}$ - the physical thread identifier (where the thread is executing within an architecture). $\text{Nx[d]}$ - the number of threads of d-th dimension of the bundle/sub-bundle. $\text{Lx[d]}$ - the log base 2 of the number of threads of d-th dimension of the subbundle (equals -1 if $\text{Nx[d]}$ is not a power of 2). $\text{ix[d]}$ - the thread identifier of the thread in d-th dimension of the bundle/subbundle. The following example uses the bundle description: Threads { B[2][2] } A[2]; <table> <thead> <tr> <th>A</th> <th>A</th> </tr> </thead> <tbody> <tr> <td>0</td> <td>0</td> </tr> <tr> <td>1</td> <td>1</td> </tr> </tbody> </table> <table> <thead> <tr> <th>B</th> <th>B</th> <th>B</th> </tr> </thead> <tbody> <tr> <td>0</td> <td>0</td> <td>1</td> </tr> <tr> <td>0</td> <td>1</td> <td>0</td> </tr> <tr> <td>B</td> <td>B</td> <td>B</td> </tr> <tr> <td>2</td> <td>1</td> <td>0</td> </tr> <tr> <td>3</td> <td>1</td> <td>1</td> </tr> <tr> <td>6</td> <td>1</td> <td>0</td> </tr> <tr> <td>5</td> <td>0</td> <td>1</td> </tr> </tbody> </table> Figure 1: Bundle of Threads A has 2 threads. In Figure 1, there is a pair of numbers under each A. The first number is its value for $\text{i}$, and the second is its value for $\text{ix}[0]$. There is a triplet under each thread of B. The first number is its value of $\text{i}$, the second is its value of $\text{ix}[1]$, and the third is its value of $\text{ix}[0]$. Note that the threads of ‘B’ form two sub-bundles, one under A[0] and another under A[1]. A sub-bundle consists of all the threads of a bundle that have the same parent thread (contained in the parent bundle.) For example, ‘A’ is the parent bundle of ‘B’ and $\text{B}[4]$, $\text{B}[5]$, $\text{B}[6]$, and $\text{B}[7]$ make up a sub-bundle of ‘B’ whose parent thread is $\text{A}[1]$ of bundle ‘A’. The values of the other system constants of A are: $\text{Name} = \"A\", \text{D} = 1, \text{N} = 2, \text{L} = 1, \text{Nx}[0] = 2, \text{Nx}[1] = \text{Lx}[1] = \text{undefined}, \text{and Lx}[0] = 1$. The values of the other system constants of B are: $\text{NAME} = "B", \text{SD} = 2, \text{SN}=8, \text{SL}=3, \text{SNx}[0]=2, \text{SNx}[1]=2, \text{SLx}[0]=1, \text{and SLx}[1]=1.$ **Input & Output (I/O)** I/O is defined as an order sequence of data that is to be placed in a file. The data can be placed in the file concurrently, but the order within the file will be ordered sequentially. I/O in aCe is in order of thread identifier. For example, threads CLX3[1000] CLX3.{ int buff; buff = $\text{i}$; fwrite( &buff, sizeof(int), 1, FILEptr ) ; } The thousand values of ‘buff’ will be written to the file whose descriptor is located at FILEptr. If the above code is contained within a conditional statement, only a subset of the values of ‘buff’, corresponding to the active threads, will be written to the file. And in, threads C[1000] C.{ int a; a=$\text{i}$; if ($\text{i}<$4 || $\text{i}$$>$995) fwrite(&a,sizeof(int),1,FILEptr); } The code segment will write eight values into the file, four from the first four threads of C and four from the last four threads of C in that order. aCe has another form of I/O, it is called fast I/O. The fast I/O routines fopen, fread, fwrite, and fclose correspond to the standard I/O routines fopen, fread, fwrite, and fclose, except that their use is very machine dependent. Files written by fast I/O must be read by fast I/O. Also, files written with fast I/O must be read by a bundle with exactly the same geometry as the bundle that wrote. Fast I/O is intended to be implemented with the fastest form of I/O available on the architecture, which may differ from architecture to architecture. **Communications Path Descriptions** Communication between two threads is defined by a communication expression. A communication expression consists of two parts: the communication path description or router expression, and the remotely evaluated numeric expression. In the case of a fetch or get, the evaluated numeric expression must evaluate to a value, while in the case of a send or put operation, it must evaluate a remote address. The router expression is used to define many concurrent communication paths from threads of one bundle to the threads of another, or even to the same bundle. In threads A[1]; threads B[1]; A.{ int t; B int s; t = B[0].(s+1); } B[0] is the router expression, (s+1) is the remote expression that is executed on the threads of B, and t is the variable in each of the threads of type A to which the values received from the threads of type B are stored. The threads of B need not be currently active to evaluate the expression (s+1). However, a thread of B does need to be a thread which can be fetched from for the expression to be evaluated. Though a thread may have many threads fetching from it, the expression will only be evaluated once. In effect, this technique can be used to temporarily reactivate threads. The router expression describes the path between the remote execution context and the local execution context. If the router expression is the source of a value (a gather or fetch operation), the remote context computes a value, and that value is fetched by the local context from the remote thread that is described by the router expression. The previous example demonstrates communications between two single-thread bundles. For more details on path descriptions see[2]. **Scatter and Gather** Data is fetched from or sent to the threads of a remote bundle depending on whether the router expression is on the right or left side of an assignment. If the router expression is on the right side of an assignment, it is a ‘gather’ from the remote threads. If the expression is on the left side of an assignment, it is a ‘scatter’ to the remote threads. The following is an example of a gather operation: H.{ int a,x,y; B int b; a = .A.C[x].B[y].b ; } Reversing the sides of assignment makes it a scatter operation: H.{ int a,x,y; B int b; .A.C[x].B[y].b = a ; } The value of ‘a’ in H is sent to the specified remote variable ‘b’ of thread B. If a scatter add operation such as, H.{ int a, x, y; B int b; .A.C[x].B[y].b += a; } is performed and multiple values are sent to the same thread, they are summed together. Since more than one thread can send to the same thread, the data will either have to be combined, or some will be lost. Therefore, when data is sent to another thread, there are several options for combination into the remote location, such as addition (+=), subtraction (-=), multiplication (*=), division (/=), and (&=), or (|=), exclusive-or ( ^=), minimum (=?=), and maximum (?>=). A scatter operation returns a flag to the expression in which it is contained, rather than a value. This flag indicates whether or not the value being sent actually was received at the destination thread. H.{ int a, x, y; B int b; flag=(.A.C[x].B[y].b = a) ; } In the above example, the values of 'a' in bundle H are being sent to the variables 'b' in bundle B. The value of the flag, after the values have been sent, is TRUE if the specific value of 'a' actually reached the requested instance of 'b' and FALSE if it did not. There are two reasons a value may not reach its destination: 1) the address of the destination thread is not a valid one, or 2) the scatter operation is '='. If the scatter operation is '=' at most one value will be received by any destination thread. Therefore, only one of the source threads that send to the same destination thread will have its value received and its receive flag set to TRUE. Pre-computed Paths A fair amount of time in a communications operation may be spent computing the identifiers of the remote threads involved in the communications. The ability to define a path description as a variable that is computed at run time allows a path description to be pre-computed and optimized once, and yet used many times. This amortizes the cost of computing a path descriptor across multiple uses of the descriptor. A path is declared as follows: H.{ path(B) toB; int a0, a1, a2, x, y; B int b0, b1, b2; toB = C[x].B[y].; @toB.b0 = a0 ; @toB.b1 = a1 ; @toB.b2 = a2 ; } The path toB is a path from the local context of H to the remote context of B. Note in the above example, toB was computed once but was used in three communications operations. Pointers to or arrays of paths may also be declared. H.{ path(B) toB[4]; @toB[1].b1 = a1 ; } H.{ path(B) *toB; (*toB).b1 = a1 ; } An array element from a path array need not be enclosed in parentheses when used, but a pointer to a path or any address expression that points to a path does. Generic Routines Most routines are specific to only one bundle. Some, however, are useful to many bundles. These are referred to as generic routines. A generic routine is declared by preceding it with the key word generic in place of a specific bundle name. Trigonometric functions are examples of such routines. There is nothing about a sine function, for example, that makes it inherently specific to any bundle. A sine function can be applied to all threads of a bundle and is trivially parallel (i.e., requires no communication between threads.) This makes it a simple generic routine, and allows it to be executed within the context of any bundle. An example of a simple generic routine is: generic double sin (double x) { ... C code ... } Generic routines can also include inter-processor communication. These are complex generic routines. A complex generic routine also can have a bundle as an argument. Summary We have introduced a new computer language, aCe C, that is ideally suited to parallel, networked, and cluster computing. We have presented the basics of the language, the concept of threads and bundles of threads, execution of programs, communication, element identification, input and output (I/O), communications path description, scatter and gather, pre-computed paths, and generic routines. These tools and the aCe C language greatly enhance the teaching of parallel programming. References
{"Source-Url": "https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/20030025348.pdf", "len_cl100k_base": 6353, "olmocr-version": "0.1.53", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 21643, "total-output-tokens": 7218, "length": "2e12", "weborganizer": {"__label__adult": 0.00034356117248535156, "__label__art_design": 0.0003120899200439453, "__label__crime_law": 0.0003066062927246094, "__label__education_jobs": 0.0012388229370117188, "__label__entertainment": 7.081031799316406e-05, "__label__fashion_beauty": 0.00013875961303710938, "__label__finance_business": 0.0001976490020751953, "__label__food_dining": 0.00041747093200683594, "__label__games": 0.0005578994750976562, "__label__hardware": 0.001839637756347656, "__label__health": 0.0005412101745605469, "__label__history": 0.0002422332763671875, "__label__home_hobbies": 0.00012624263763427734, "__label__industrial": 0.0005807876586914062, "__label__literature": 0.00024962425231933594, "__label__politics": 0.0002701282501220703, "__label__religion": 0.0005731582641601562, "__label__science_tech": 0.032379150390625, "__label__social_life": 8.392333984375e-05, "__label__software": 0.004413604736328125, "__label__software_dev": 0.95361328125, "__label__sports_fitness": 0.0003719329833984375, "__label__transportation": 0.000797271728515625, "__label__travel": 0.0002319812774658203}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 26922, 0.03084]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 26922, 0.78001]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 26922, 0.90459]], "google_gemma-3-12b-it_contains_pii": [[0, 4541, false], [4541, 8852, null], [8852, 12929, null], [12929, 17310, null], [17310, 21901, null], [21901, 26922, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4541, true], [4541, 8852, null], [8852, 12929, null], [12929, 17310, null], [17310, 21901, null], [21901, 26922, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 26922, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 26922, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 26922, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 26922, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 26922, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 26922, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 26922, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 26922, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 26922, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 26922, null]], "pdf_page_numbers": [[0, 4541, 1], [4541, 8852, 2], [8852, 12929, 3], [12929, 17310, 4], [17310, 21901, 5], [21901, 26922, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 26922, 0.06566]]}
olmocr_science_pdfs
2024-12-08
2024-12-08
0a7d2795f7d2b1fd7a17130a89f42c20689b78e6
Collaborative Summarization: When Collaborative Filtering Meets Document Summarization* Yang Qu and Qunxiu Chen Department of Computer Science, Tsinghua University, FIT 4-506 Tsinghua University, Haidian District, Beijing 100084, China dcatcher.qu@gmail.com, cqx@s1000e.cs.tsinghua.edu.cn Abstract. We propose a new way of generating personalized single document summary by combining two complementary methods: collaborative filtering for tag recommendation and graph-based affinity propagation. The proposed method, named by Collaborative Summarization, consists of two steps iteratively repeated until convergence. In the first step, the possible tags of one user on a new document are predicted using collaborative filtering which bases on tagging histories of all users. The predicted tags of the new document are supposed to represent both the key idea of the document itself and the special content of interest to that specific user. In the second step, the predicted tags are used to guide graph-based affinity propagation algorithm to generate personalized summarization. The generated summary is in turn used to fine tune the prediction of tags in the first step. The most intriguing advantage of collaborative summarization is that it harvests human intelligence which is in the form of existing tag annotations of webpages, such as delicious.com bookmark tags, to tackle a complex NLP task which is very difficult for artificial intelligence alone. Experiment on summarization of wikipedia documents based on delicious.com bookmark tags shows the potential of this method. Keywords: Collaborative Filtering, Single Document Summarization, Personalized Summarization, Tag Recommendation 1 Introduction In this paper, we confine personalized document summarization to the extraction from a given document a few sentence which can best represent the whole content of the document in the point of view of a given user. While generic document summarization without personalization has been extensively researched, the trend of personalization is attracting more and more focus since the outgrowth of the technology of Web 2.0. For example, personalized search engine and personalized e-commerce(movies, commodities) recommendation are two successful applications. Collaborative filtering is a widely used technology for personalized recommendation. Suppose some users have rated a set of books, the key idea of collaborative filtering is that similar users should share similar rating behaviours in the future, where the similarity between users itself is defined by the similarity of their past rating behaviours. The advantage of collaborative filtering is that it harvests the computing power of individuals in a population to process the large amount of complex information. Taking the example of book recommendation, there is no model competitive with a human brain with regards to understanding a book. We can treat each individual reader as a super computational power which is reluctant to give feedback. Then the task of collaborative filtering is to harvest these human power with the least workload on each individual. Fortunately, due to the growth of internet and web 2.0 technology, a large amount of tags data on webpages have been generated by human users. For example, people can tag their favourite * Thanks for all the people who help collecting the dataset. Copyright 2009 by Yang Qu and Qunxiu Chen webpages using the bookmark service of delicious.com and many alike. However, current usage of tags data is limited to classification of webpages or recommendation of new pages to users. As far as we know, no attempt has been made to automatically generate a personalized short summary for a tagged webpage. Instead, users are optionally requested to provide a personal description of the tagged webpage by hands, which is too much a burden and often leads to copy-and-paste a whole paragraph in the webpage. In this paper, we focus on automatically generating personalized summary of a single document for a given user, which has a nature application aforementioned. Note that multi-document summarization can also benefit from our method with little modification. Our method, called Collaborative Summarization, seamlessly combines the state-of-art affinity propagation based document summarization (Wan and Xiao, 2007) with collaborative filtering based tag recommendation (Hotho et al., 2006). The combined result is three-fold. First, by collaborative filtering, we can utilize existing tag information to predict the possible tags of a new document for a given user, even if the user has not tagged the document. This eliminates the necessity to annotate a document before summarization, which is a requisite for most existing summarization methods using side information. Secondly, the predicted tags are a compromise on the document between community’s view and personal view. Thus it is suitable as a guidance for generating personalized summarization which is supposed to capture both the main content of the document and the special point of interest of given user. Finally, due to the iterative nature of collaborative summarization, the generated summary is used to fine tune the predicted tags. This complements collaborative filtering by incorporating content information into tag prediction, as collaborative filtering alone only consider the user-tag-document tannery relationship without considering the actual content of the document. In the following sections, we will first introduce the key ideas and notations underlying collaborative filtering based tag recommendation and affinity propagation based document summarization. Then we will discuss the detailed algorithms used in our collaborative summarization method. After that, an experiment on summarize wikipedia articles using delicious.com bookmarks tags is conducted to show the potential of our method. Finally, we will compare some related work regarding document summarization with side information and conclude our work. 2 Affinity Propagation for Document Summarization In the work of (Wan and Xiao, 2007), An affinity graph is built for single or multi-document summarization, and has shown significant improvement over other graph-based document summarization methods. We will briefly review the key ideas and notations while focusing on single document summarization. Suppose we have a document consisting of \( n \) sentences \( \{S_1, S_2, \cdots, S_n\} \). Each sentence is presented by a vector \( \vec{s} \) of tf \( \times \) isf value of each term \( t \), where \( tf_t \) is the number of term \( t \) in that sentence and \( isf_t \) is inverse sentence frequency calculated by \[ isf_t = 1 + \log \frac{N}{n_t} \] where \( N \) is the total number of sentences in the background corpus and \( n_t \) is the total number of sentence containing term \( t \). We can construct a directed graph on all the sentences by defining a similarity measurement of each pair of sentences, namely sentence affinity: \[ \text{Aff}(s_i, s_j) = \frac{\vec{s}_i \cdot \vec{s}_j}{\|\vec{s}_i\|} \] Sentence affinity is a measurement of semantic similarity between sentences and it’s not symmetric as opposed to cosine similarity. The affinity graph can be constructed by linking two sentence nodes whenever the affinity value between them is not zero. Usually the affinity scores associated with each sentence are normalized, however, it’s not always a necessity. After the affinity graphed is built, a page-rank like algorithm is applied to the graph to calculate a score for each sentence node, which is called information richness of that sentence. The justification is intuitive: The more neighbours a sentence has, the more informative it is; and the more informative a sentence’s neighbours are, the more informative it is. Thus a iterative update is straightforward: \[ \text{info}(s_i) = \text{dampfactor} \cdot \sum_{j \neq i \in S} \text{info}(s_j) \cdot \text{aff}(s_j, s_i) + \frac{1 - \text{dampfactor}}{N} \] where a damp factor is used to speed up the convergence. Finally, when converged, the information richness scores of all sentences are sorted, and sentences with the largest scores are picked as summarization for the document. Some redundancy removal methods can be used for post-processing. 3 Collaborative Filtering based Tag Recommendation Recently, tag recommendation in online social network has attracted increasing attention, and even a new word named folksonomy is dedicated to the concept. In this section, we will focus on collaborative filtering based tag recommendation since it has a natural relationship with affinity propagation based document summarization, as will be discussed below. Suppose we have a set of users \( U \) assigning various tags \( T \) onto a set of documents \( D \). All the useful information can be described by a ternary relationship \((U, T, D)\). For example, an instantiation from the relationship \((u, t, d)\) means that user \( u \) assigned tag \( t \) to document \( d \). We denote the set of tag assignments to be \( Y \). A widely referenced collaborative filtering based tag recommendation, called FolkRank (Hotho et al., 2006), makes recommendations based on a tripartite graph built from such ternary relationship. We denote the tripartite graph by \( G = (V, E) \). The graph nodes \( V \) are combination of all users, tags and documents, i.e. \( V = U \cup T \cup D \). The edge in the tripartite graph connects two entities(user, tag or document) if both entities occur in a tag assignment and the weight of the edge amounts to the count of their co-occurrences. More specifically, the weight of an edge connecting tag \( t \) and document \( d \) is defined by \[ w(t, d) = |\{u \in U : (u, t, d) \in Y\}| \] And similarly, \[ w(t, u) = |\{d \in D : (u, t, d) \in Y\}| \] \[ w(u, d) = |\{t \in T : (u, t, d) \in Y\}| \] FolkRank applies personalized pagerank on the constructed graph \( G \) twice: \[ \vec{w} = \lambda G \vec{w} + (1 - \lambda) \vec{p} \] where \( \vec{w} \) is a score vector over all graph nodes, corresponding to the information richness vector in affinity graph. \( \vec{p} \) is the personalization vector over all graph nodes(usually only the tag nodes) per user. The value of \( \vec{p} \) can be chosen at will as long as higher value at a node indicates higher importance. We will formulate this vector latter in equation 10. \( \lambda \) is a tradeoff parameter determining the influence of personalization vector. In the first step, \( \lambda \) is set to 1; while in the second step, \( \lambda \) is set to a value in \([0, 1]\). The final score vector is \[ \vec{w} = \vec{w}_{\lambda<1} - \vec{w}_{\lambda=1} \] Tags with the highest scores are selected for recommendations. Note that many improvement and variations (Abel et al., 2008; Abel et al., 2009a; Abel et al., 2009b) have been proposed since the publication of FolkRank. However, we’ll focus on the naive FolkRank for the sake of simplicity since our main concern is the fusion of the two methods. After all, various improvement can also be applied to our method to achieve even better result. 4 Collaborative Summarization As we can see from section 2 and section 3, the key ideas underlying Affinity Propagation based document summarization and Collaborative Filtering based tag recommendation are quite similar. This motivates our method to seamlessly fuse them together. 4.1 A Real Motivating Example Before diving into the details of our method, let’s first show an example on why we need to fuse the two methods mentioned above. Here is a random bookmark\(^1\) selected from www.delicious.com. It is a wikipedia article about Satisficing, which is decision-making strategy taking account of human limitations to pursue a near-optimal result. Three different users who have tagged at least three tags are listed below\(^2\). - **User A** economics, theory, psychology, wikipedia, language, reference, work - **User B** psychology, strategy, usability, decisionmaking, satisficing, herbertsimon - **User C** article, economics, markets, theory As we can see, user A makes a fairly comprehensive tagging of the article with three different emphases such as economics, psychology and language. Meanwhile, user B seems more concerned with psychology issue of this article while user C cares more about its economics implication. Clearly, a summary of this article taking account of tags made by all users, as in the case of naive tag oriented document summarization, totally ignores these different interest of users. On the other hands, collaborative filtering based tag recommendation can provide a personalized tag prediction. That is to say, even if a user makes no tag on this article at all, we can still predict his/her interest point on this article by using the tagging history of that user and all others users. However, collaborative filtering totally ignores the actual content of this article(only uses tags information), which is the very concern of document summarization. Thus, it’s a natural thought that we can use collaborative filtering based tag recommendation to introduce personalized side information into document summarization. In retrospect, we can also improve collaborative filtering based tag recommendation by utilizing the summary information of an article. 4.2 Fusion of the Two Methods Fortunately, the similar principle underlying both collaborative filtering based tag recommendation and affinity propagation based document summarization provides a natural basis to build a hyper algorithm. The idea is to build a hyper graph combining four factors: users, tags, documents and sentences. With affinity propagation, we already have an affinity graph on all sentences of an article. With collaborative filtering, we already have a tripartite graph between users, tags and documents. The missing part is a graph connecting tags and sentences in a given article. As seen in Figure 1. Here we first define a similarity between a tag \(t\) and a sentence \(s\) by mutual information: \[ \text{sim}(t, s) = \sum_{\forall \text{term } w \in s} P(t, w) \log \frac{P(t, w)}{P(t)P(w)} \tag{9} \] \(^2\) The emphasized tags are the most frequent tags on this article where $P(t, w)$ is the probability that tag $t$ and term $w$ occurs together in one article in the background corpus. $P(t)$ is the probability of observing tag $t$, which can be calculated by dividing the count of tag $t$ by the total count of all tags. $P(w)$ is the probability of observing term $w$ in the background corpus, which can be calculated by dividing the count of sentence containing term $w$ by the total count of sentences in the background corpus. A similar definition can be found in the work of (Markines et al., 2009). Now we can draw an undirected edge between each pair of tag and sentence. Note that we can normalize the similarity per tag or per sentence, which will make the similarity not symmetric. Moreover, we can threshold the similarity and only connect a pair of tag and sentence only if the similarity between them is above a certain value. The remaining problem is how to incorporate the new edge into two original graphs. As for the tripartite graph of collaborative filtering, we can achieve this by adjusting the personalization vector in equation 7. Suppose the information richness scores of sentences are already known, the personalization vector can be constructed by $$\vec{p}(t) = d \times \sum_{s \in S} \text{info}(s) \times \text{sim}(t,s) + (1 - d) \times \vec{p}^*(t)$$ (10) where $\vec{p}^*(t)$ is the initial value for $\vec{p}(t)$. $d$ is damp-factor controlling the influence of initial values. It has no influence on the final result except the convergence rate. We will use the same damp-factor throughout the paper. From the equation, we can see that, the more informative sentences a tag connects to, the more informative the tag is. An importance issue with equation 10 is how to decide the values of \( \vec{p}^* (t) \). As our candidate set of tags for a pair of user and document is the set of all tags, if the user has not assigned any tag to the document, we assign an equally large weight to the most possible tags and a small weight to all other tags. Following (Ho Tho et al., 2006), we assign a weight of \( |T| \) to all the tags used by the user and all the tags associated to the document, and assign 1 to all other tags, then normalize the weights to sum to 1. If the user has already tagged the document, we further multiply a factor of \( |T| \) to user’s tags then normalize. Generally, this will lead to different initial values of \( \vec{p} \) for different users, in the hope to represent the users’ taste. Next, turning to sentence affinity graph, we can incorporate tag information by attaching a personalization value \( \vec{q}(s) \) to each sentence \( s \). This personalization vector can be updated similarly to \( \vec{p} \) \[ \vec{q}(s) = d \sum_{t \in T} \vec{w}(t) \cdot \text{sim}(t, s) + (1 - d) \vec{q}^*(s) \] where \( \vec{w} \) is the score vector from equation 8. ### Algorithm 1: Collaborative Summarization Algorithm **Input:** A background corpus consisting of \( D \) documents with \( T \) tags assigned by \( U \) users. A user \( u \) and a document \( d \) on which a summarization is to be generated. The user’s tags on the document is optional. **Output:** 1. A ranking of sentences of which the first \( k \) can be used as a summarization. 2. A collection of tags recommended to the user. **% Initialization** - build affinity graph \( G_A \) by equation 2 - build tripartite graph \( G_{CF} \) by equation 4 - initialize the personalization vector \( \vec{q} \) of \( G_A \) to be equal to \( \frac{1}{|S|} \) - initialize the personalization vector \( \vec{p} \) of \( G_{CF} \) following the strategy described above. - initialize \( \text{sim}(t, s) \) by equation 9 while the procedure is not convergent do **% Affinity Propagation** while not convergent do - update \( G_A \) using equation 12 end while update \( \vec{p} \) using equation 10 **% Collaborative Filtering** while not convergent do - update \( G_{CF} \) using equation 7 and equation 8 end while update \( \vec{q} \) using equation 11 end while sort the information richness scores of all sentences of \( d \) and the \( \vec{w} \) score vector from large to small Accordingly, we need to substitute \( \vec{q} \) for the original \( \frac{1}{N} \) when updating information richness of sentence in equation 3. \[ \text{info}(s_i) = d \cdot \sum_{\forall j \neq i \in S} \text{info}(s_j) \cdot \text{aff}(s_j, s_i) + (1 - d) \cdot \vec{q}(s_i) \] (12) With modified affinity updating equation, the more important tags a sentence associated with, the more informative it becomes. Until now, two sub-graphs induced by collaborative filtering and affinity propagation are connected together. A pagerank like algorithm can be applied to this hyper graph. To summarize, collaborative summarization following the procedure above to generate summarization. We emphasize that this algorithm is based on naive FolkRank for tag recommendation, and various improvement over FolkRank can also be applied here to get a better $\hat{\rho}$ which we leave for practical implementation. 5 Experimentation In this section, we design an experiment to demonstrate the effectiveness of collaborative summarization (CS) method. Two questions are addressed: (1) How much advantage does CS have compared with tag-based and content-based document summarization. (2) Can CS improve tag recommendation as well? Although there are large amount of social tagging and bookmark resource on the internet, no standard summarization result for them exists, let alone personalized summary for a given document. Thus, we download a total of 100 English wikipedia articles from en.wikipedia.com as our document summarization dataset. Then we collect 1084 users’ tagging data on 5000 wikipedia articles and a total of 8396 different tags from online bookmark site www.delicious.com. We select 10 active delicious.com users from the 1084 users, and let them extract the top-5 sentences from the 100 wikipedia articles dataset as the personalized summarization for the articles. Note that we don’t require the selected users to tag the articles. ROUGE-1 is used to evaluate the effectiveness of the proposed method. We compare Collaborative Summarization (CS) to three other summarization methods: (1) Open Text Summarizer (OTS) which only scores each sentence without considering tags. (2) Affinity Propagation based summarization (AP) which is a graph-based method not considering tags. (3) EigenTag which uses all the tags assigned to a document without personalization. The result is shown in Table 1, which indicates significant improvement over all measurements. All the dampfactor in Collaborative Summarization is set to 0.5, as it has nothing to do with final result. We set $\lambda = 0.8$ in the second step of FolkRank. The influence parameter in equation 7 is set to 0.95. The parameter $d$ in equation 10 is set to 0.2. As for EigenTag, the parameter $\lambda$ is set to 0.95 as the author advised. For Affinity Propagation and Collaborative Summarization methods, redundancy removal is conducted in the post-process stage. Since the AP and CS share the same affinity measurement between sentences, we adopt the same redundancy removal technology as in Affinity Propagation. The idea is that we pick the most information-rich sentence out and penalize its neighbours to promote diversity, then repeat this process to generate a list of sentences. Readers are referred to (Wan and Xiao, 2007) for more details. <table> <thead> <tr> <th></th> <th>OST</th> <th>AP</th> <th>EigenTag</th> <th>CS</th> </tr> </thead> <tbody> <tr> <td>Precision</td> <td>0.424824</td> <td>0.451688</td> <td>0.484586</td> <td><strong>0.524037</strong></td> </tr> <tr> <td>Recall</td> <td>0.4280267</td> <td>0.437867</td> <td>0.463866</td> <td><strong>0.508515</strong></td> </tr> <tr> <td>F-measure</td> <td>0.426419</td> <td>0.444670</td> <td>0.474000</td> <td><strong>0.516159</strong></td> </tr> </tbody> </table> Although it’s not our main concern in this paper, we also compare Collaborative Summarization on its performance of tag recommendation with naive FolkRank. Not surprisingly, CS outperforms --- 3 http://libots.sourceforge.net Folkrank because the summary of document provides useful side information for picking tags. The result is evaluated using standard precision and recall as shown in Table 2. It indicates that the fusion of both methods benefit each other. Table 2: Comparison of Collaborative Summarization and Folkrank on tag recommendation <table> <thead> <tr> <th></th> <th>FolkRank</th> <th>CS</th> </tr> </thead> <tbody> <tr> <td>Precision</td> <td>0.362330</td> <td>0.499431</td> </tr> <tr> <td>Recall</td> <td>0.181965</td> <td>0.233019</td> </tr> <tr> <td>F-measure</td> <td>0.242264</td> <td>0.317774</td> </tr> </tbody> </table> 6 Related Work In this section, we describe the relationship between our method and other approaches in both graph-based document summarization and tag recommendation. The contexts of these two topics are too rich to cover up here, so we only focus on graph-based approaches. 6.1 Graph based Document Summarization Graph based document summarization methods have been proposed for both single and mult-document summarization (Erkan and Radev, 2004; Mani and Bloedorn, 2000; Mihalcea and Tarau, 2005). Many of them are based on PageRank (Brin and Page, 1998) or HITS (Kleinberg, 1999). One advantage of graph-based document summarization methods is that it can easily incorporate various side information, such as user profile, user query (Saggion et al., 2003; Ge et al., 2003; Conroy and Schlesinger, 2005) and specific topic (Farzindar et al., 2005). However, there are two issues with most existing user/query/topic-oriented document summarization. First, current graph-based methods usually focus on given single or multiple documents to generate summarization while ignoring all other documents in the corpus, which seems rather reasonable at the first glance. However, the information or regularity contained in the whole corpus of document can serve as a common sense for the summarization of specific documents. It has been shown in (Wan and Xiao, 2008a; Wan and Xiao, 2008b) that incorporating these information significantly improves the performance. Our method is also along this line of thinking but following a different direction, i.e. by incorporating the wisdom of the population of people rather than documents. Secondly, most existing document summarization methods using side information post a heavy burden on users. A user either has to specify his/her profile or topic of interest (Zhang et al., 2003), or has to first tag a document (Zhu et al., 2009) in order to receive a personalized summarization. The issue is most obvious in the scenario that a user needs personalized summarization of a totally new document, which is often the case in real life. As far as we know, no effort has been made to passively mining user's point of interest to provide a personalized summarization. Our work, using ideas from collaborative filtering, may shed some light in this direction of research. 6.2 Tag Recommendation Tag recommendation embraces a broad range of objects including document, image, video and so on. Since the content to be tagged varies a lot across different applications, collaborative filtering based tag recommendation has an appealing advantage that it is content independent. After Folkrank was proposed for solving the problem, a lot of refinement (Wu et al., 2006) is made to incorporate more useful information, such as the concept of groups of tags (Abel et al., 2008). However, when facing the problem of document summarization, we need to further incorporate the information from document content. Our method provides one seamless way to do so while some related work (Tso-Sutter et al., 2008) follows other directions. 7 Conclusion In this paper, we argue that single document summarization can be significantly improved by harvesting human computing power made available by the rapid out-growth of internet technology. There is no surprise that population of human brains can and will complement most existing language models and algorithms in complex NLP tasks for a long time. The philosophy implied here definitely has a larger range of application than document summarization. For example, active learning in machine learning literature shares the same characteristics involving an optimal collaboration between machines and users. More specifically, by combining collaborative filtering and affinity propagation together, we show that we can make personalized summarization for a given user even on a totally new document for that user. Thus, the proposed method reduces the burden of user in a personalized summarization system. Moreover, the side information contained in tags presents both the general meaning and personal interest of the document. Incorporating such side information is shown to boost the performance significantly. References 482 483
{"Source-Url": "http://dspace.wul.waseda.ac.jp/dspace/bitstream/2065/34247/1/PACLIC23-474-483.pdf", "len_cl100k_base": 6222, "olmocr-version": "0.1.50", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 27283, "total-output-tokens": 8040, "length": "2e12", "weborganizer": {"__label__adult": 0.0004696846008300781, "__label__art_design": 0.0011129379272460938, "__label__crime_law": 0.0005636215209960938, "__label__education_jobs": 0.006237030029296875, "__label__entertainment": 0.0005855560302734375, "__label__fashion_beauty": 0.0003662109375, "__label__finance_business": 0.0009775161743164062, "__label__food_dining": 0.0005393028259277344, "__label__games": 0.0015211105346679688, "__label__hardware": 0.0009279251098632812, "__label__health": 0.00116729736328125, "__label__history": 0.0005626678466796875, "__label__home_hobbies": 0.0001842975616455078, "__label__industrial": 0.0003826618194580078, "__label__literature": 0.003618240356445313, "__label__politics": 0.000537872314453125, "__label__religion": 0.0005755424499511719, "__label__science_tech": 0.330078125, "__label__social_life": 0.0006289482116699219, "__label__software": 0.17529296875, "__label__software_dev": 0.47265625, "__label__sports_fitness": 0.0003266334533691406, "__label__transportation": 0.0004417896270751953, "__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, 30996, 0.04445]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 30996, 0.37548]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 30996, 0.87126]], "google_gemma-3-12b-it_contains_pii": [[0, 3436, false], [3436, 7309, null], [7309, 10774, null], [10774, 14423, null], [14423, 16067, null], [16067, 18887, null], [18887, 22462, null], [22462, 26029, null], [26029, 29255, null], [29255, 30996, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3436, true], [3436, 7309, null], [7309, 10774, null], [10774, 14423, null], [14423, 16067, null], [16067, 18887, null], [18887, 22462, null], [22462, 26029, null], [26029, 29255, null], [29255, 30996, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 30996, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 30996, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 30996, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 30996, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 30996, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 30996, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 30996, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 30996, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 30996, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 30996, null]], "pdf_page_numbers": [[0, 3436, 1], [3436, 7309, 2], [7309, 10774, 3], [10774, 14423, 4], [14423, 16067, 5], [16067, 18887, 6], [18887, 22462, 7], [22462, 26029, 8], [26029, 29255, 9], [29255, 30996, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 30996, 0.05525]]}
olmocr_science_pdfs
2024-11-30
2024-11-30
3192c0098aba2a31f3ec884e0901e136d6b00b8c
QuickChecking Refactoring Tools Dániel Drienyovszky Dániel Horpácsi University of Kent and Eötvös Loránd University {dd210, dh254}@kent.ac.uk Simon Thompson University of Kent S.J.Thompson@kent.ac.uk Abstract Refactoring is the transformation of program source code in a way that preserves the behaviour of the program. Many tools exist for automating a number of refactoring steps, but these tools are often poorly tested. We present an automated testing framework based on QuickCheck for testing refactoring tools written for the Erlang programming language. Categories and Subject Descriptors D. Software [D.2 SOFTWARE ENGINEERING]: D.2.5 Testing and Debugging: Testing tools General Terms Verification Keywords refactoring, Wrangler, RefactorErl, Erlang, random program generation, QuickCheck, attribute grammar, yecc, property 1. Introduction Refactoring [10, 15] is a process of rewriting program source code without changing its meaning whilst improving properties such as maintainability, clarity or performance. Refactorings range from simple ones, like renaming a variable, to more complex ones, like generalising a function. Refactoring transformations may affect large parts of the code base for a project and in particular may require modifications of more several different modules from a project. Applying such code-to-code transformations are common practice among software developers, consequently tool support for refactoring is widespread in mainstream programming languages. Refactoring tools/engines help to automate the routine aspects of certain code transformations. For Erlang there are three refactoring tools available: Wrangler [3] from the University of Kent, RefactorErl [2] from Eötvös Loránd University and last but not least, Tidier [6, 18], a completely automatic code cleaning tool from the National Technical University of Athens. These tools are hard to test, as they require manually written test cases aiming to cover every corner case of the language being refactored. Evidently, by using only such case-based testing we never can provide a comprehensive check of the refactoring engines. To increase confidence in these tools, a more efficient testing approach has to be applied. We investigate automated testing of refactoring tools by generating random programs and verifying whether the refactorings preserve the meaning of these randomly-generated programs. We have chosen QuickCheck as our testing tool and two Erlang refactoring tools, Wrangler and RefactorErl as the tools to be tested. In this paper we describe the difficulties of the testing of refactoring tools (Section 2) and we also present our contribution, which is to make the entire testing process fully automated. The method is composed of two separate parts. - First, we have created a QuickCheck-based random generator for producing Erlang programs which are used as the input of the refactoring transformations. More precisely, we have formalised the programming language to be refactored (namely, Erlang) with a proper grammar class and then based on this description we have derived a corresponding QuickCheck generator for the syntactically and semantically correct programs of the language (see Section 3). - Second, we have created a definition of equivalence between Erlang modules, which leans on the dynamic behaviour of the programs. Furthermore, we have formalised this equivalence relation by means of QuickCheck properties (see Section 4). Using these two ideas together, we have built a fully automated testing framework for Erlang code-to-code transformation tools. The final sections of the paper comment on the results we have derived, on related work, and our conclusions, where we note that the tool we have built here is applicable to all the refactoring tools for Erlang, and that the approach we outline could equally well be applied to testing refactoring tools for other languages. 2. Validating refactoring tools There are many ways of establishing program correctness, including formal proof mechanisms as well as several testing strategies. While developing software, evidently, we would like to be sure of our program’s correctness. Since formal methods are mostly too difficult to apply, despite some preliminary work reported in [20], we focus on testing as a mechanism for validating and improving the quality of our programs. 2.1 Case-based testing There are many testing approaches, which aim to check as many program parts as possible, as assessed in different ways. With testing, basically, we are not able to prove the program’s correctness, but we can establish that in numerous cases the program does what we expect from it, and this can give us a degree of confidence that it indeed satisfies its requirements. Commonly, programmers apply simple use-case based testing to check fundamental requirements. However, in the case of complex software it is impossible to cover all the most common and most interesting cases just by test cases written by hand. For instance, in our specific case, there may be many unusual instances that are valid source code but that would seldom be writ- Property-based testing makes a generalisation of usual test cases by eliminating the concrete input from the test case and replacing it with randomly generated test data. So then, the test cases describe only the properties (the main points) of the specified case rather than describing a concrete input-output pair. The properties can be efficiently checked on a large number of randomly generated test inputs. Such testing methods may be regarded as a fusion of the formal proof methods and the traditional test case based testing. When using property based testing, we do not define specific input-output pairs that describe the requirements, but we specify a logical property the expected behaviour on inputs satisfying the specified conditions. The expected behaviour is then described in terms of specification properties. During the test, these properties are checked in a large number of test cases. Usually, the test input is randomly generated by the framework, based on special data generators. The data generators describe the structure and the essential properties of the input data to be used for testing. Also, the distribution of the random data can also be controlled through the generators. QuickCheck is a well-designed implementation of the property-based testing method for functional programs, including the Erlang programming language. QuviQ QuickCheck [1, 4, 5], the commercial QuickCheck implementation for Erlang, is a tool for automatic testing of Erlang programs against a user-written specification. The testing method known as ‘QuickChecking’ means the checking of specification properties (that is the expected functionality) in a large number of randomly generated cases. QuickCheck properties are expressed in standard Erlang code, using the macros and functions defined in the QuickCheck library. As we mentioned already, property-based testing involves two kinds of activity. - The first is the description of the testing data used as input for the program being tested. Data generators describe the way that the test data is generated, as well as the expected probability distribution of the randomly generated data. - The other is the specification of the properties expected of the program. These are typically universally-quantified properties, and the data produced by the generators are used as the actual values of the universal variables. Property-based testing can provide comprehensive testing of several kinds of software. In this paper we present property-based testing of Erlang refactoring tools, which involves a definition of a data generator for Erlang module source code as well as a property for determining whether two modules, namely a module before and after refactoring, are equivalent. 3. Random program generation While creating data generators we can use built-in data generators and in addition, QuickCheck allows the programmers to define their own data generators to create more complex random values. Generators for the built-in types are defined by the framework, so we have to create generators only for our own types by combining the built-in generators by using generator combinators. In this paper, the term 'first-order generator' means simple data generators that are not parameterised with any other generators. On the other hand, the term 'higher-order generator' stands for the so-called generator combinators, which are generators that may take one or more generators as their arguments. First-order generators only take simple Erlang terms as parameters. They are the core of the generation (since they do not combine other generators but indeed create data values). On the other hand, higher-order generators combine other data generators and may result in arbitrarily complex data generators. Despite the fact that QuickCheck generators provide a powerful toolkit for defining test data, in the case of larger programs operating on complex input, writing generators by hand is tedious and results in complicated source code, containing substantial ‘boiler plate’, that is hard to maintain. With a more general notation, that is, with a metalanguage more powerful than the QuickCheck generators, we can reduce the complexity of the description and the amount of the wasted coding time. In this approach QuickCheck generators are a low-level formalism and our meta-notation is a high-level formalism that eases the description of the test data. Attribute grammars A formal grammar is a set of rules, which describes a formal language [8], for example, the syntax of a programming language. Usually programming language syntax is formalised with EBNF (Extended Backus-Naur Form) [7], which is a meta-syntax notation used to express context-free grammars (CFG). However, also to describe the static semantics of a language – such as the binding structure of variables and other identifiers – a more expressive formalism is needed. Attribute grammars (AG) [12, 16] are generalisations of context-free grammars, where the grammar rules are extended with semantic computation rules to calculate associated values or attributes. With attribute grammars both the syntax and the semantics are representable together. The attributes are divided into two groups: synthesised attributes and inherited attributes. The former are computed from constants and attributes attached to the children, the latter depend only on constants and the parents or siblings. Synthesised attributes are used to calculate and store results like the value of an expression, whereas inherited attributes are used to carry the context of a node, such as an environment of variable bindings in scope at that point. In some approaches, synthesised attributes are used to pass semantic information up the parse tree, while inherited attributes help pass semantic information down and across it. There are important subclasses of attribute grammars, which have some restrictions on the form of the attribute computation rules [13]. S-Attributed grammars involve synthesised attributes only, L-Attributed grammars allow attribute inheritance with the restriction that dependencies from a child to the child itself or to the child’s right are not allowed. Formally, given a rule $A \rightarrow X_1 X_2 \ldots X_n$ in the L-Attributed grammar, each inherited attribute of $X_j$ ($1 \leq j \leq n$) depends only on attributes of $X_1, X_2, \ldots, X_{j-1}$ and on inherited attributes of $A$. Furthermore, synthesised attributes of $X_j$ may depend on its own inherited attributes. Synthesised attributes of $A$ depend on inherited attributes of $A$ and on any attributes of the right hand side symbols. This definition of $L$-attribute effectively means that there are no cycles in the attribute calculation, and that calculation can conclude in a single pass. ### Grammars and testing Test data may be defined by means of formal grammars. This kind of testing is usually called grammar-based testing [19]. In this concept, a test datum is a word of the language defining the domain of the tested function and this language can be given by means of formal grammars. We have created a grammar-based meta-notation for QuickCheck data generators and in our experience, data described in our notation usually is about 5 times more compact than writing the same data with standard QuickCheck generators. For example, in the case of a simple language $(a|b|c)^*$, compiling some 10 lines of description results in about 55 lines of Erlang code containing the QuickCheck generators. In QuickCheck for Erlang there is already a module with similar capabilities: eqc_grammar [1] is a library module of the QuviQ QuickCheck distribution. This tool is able to create QuickCheck generators from a yecc-like grammar description, but in contrast to our tool, it does not support attributes, EBNF notations and many other features that are covered in detail in Dániel Horpácsi’s master’s thesis [11]. The most significant difference from already available generator generators is that in our work the data generators are generated not from context-free grammars, but from L-attributed grammars. The latter formal grammar class is much more expressive than the former one. The notation of the eqc_grammar is based on context-free grammars and cannot be used to describe context-dependent data. Since the Erlang language is in the latter group, a more expressive metalinguage is needed. The Erlang syntax and static semantics can be conveniently described by using L-Attributed grammars, so we decided to design a QuickCheck generator generator for such grammars. #### 3.1 Generator metalanguage A grammar-based generator generator takes a proper grammar description and produces data generators according to the grammar rules, or in other words, to the grammar nonterminals. Then, the generator belonging to the root symbol generates strings of the language described by the grammar. We have to create a metalinguage that can describe L-attributed grammars and can be efficiently compiled into data generators. As already noted, the notation aims to express L-Attributed grammars, which are able to describe inheritance in the grammar. For those who are familiar with the usual attribute grammar notation, we present a very simple attribute grammar in both the usual notation and the new notation to illustrate the difference. The example description describes the $a^nb^nc^n$ language, which is one of the simplest non-context-free languages. Figure 1 shows it in usual notation and Figure 2 shows it in our EBNF-like notation. The main structure of the both descriptions are similar. The grammar is written as a group of rules and inside the rules there may be alternatives. The main difference lies in the place where the attribute computations are written. In the usual notation the semantic rules are separated from the common grammar rules. In contrast, in our notation the attribute computation rules are written on the spot, just after the entity to which the attributes belong. This kind of formalism fits well with the constraints of L-Attributed grammars, where, due to the restrictions of the inheritance, attribute computations may refer only to their left. In our notation, the attribute computation section can refer only to symbols being on its left. This approach is similar to the sequential programming style, in which a statement may only refer already declared variables. Due to the fact that attribute computations are written just after the symbol that they affect, the nonterminals do not have to be indexed on the right hand side, since the position of the attribute computation rule determines on which symbol it is defined. Synthesised attributes are given separately at the end of the rule. In line 7 (Figure 2) in comparison with the usual formalism we can see a useful simplification, that is, one can use repetition (lists) instead of primitive recursion, which will be shorter and easier to understand. In yecc (and therefore in eqc_grammar) rule alternatives and repetition are not supported, so with our formalism it is easier to express grammars, because it is closer to EBNF rather than to BNF. Moreover, as can be seen in line 9, in order to make the notation express conditions based on attribute values, we added support for guards in rule alternatives. In line 2 and line 7 the setting of the inherited attributes is shown, and then in line 11 and line 13 it can be seen how the attributes can be accessed. To ease the attribute computation, one can use any kind of Erlang expression to compute the attribute value. As should be evident, the notation is concise and is similar to the usual AG formalisms. --- 1 Yecc is an LALR-1 parser generator for Erlang, similar to yacc. Special grammar rules: embedded rules Generating the right hand side belonging to a grammar rule theoretically is a single atomic step. That is, every value belonging to the symbols on the rule’s right-hand side are generated simultaneously. While generating, for example, an Erlang function clause, apparently the generation of the clause patterns and of the clause body may not be simultaneous, since the body may well depend on the patterns, or formal parameters, in the function head. In such cases the right hand side values of the grammar rule may not be generated together in a single round. To denote this, we use a special arrow symbol in the grammar description, which separates the different parts of the rule. In other words, productions may be regarded as symbol in the grammar description, which separates the different parts of the rule. After every such (possibly empty) group one can write any Erlang code and can manipulate the current attributes. Consider a simple definition of Erlang clauses, in which a clause consists of a formal parameter list (patterns) and a body (expressions). Obviously, the formal parameters and the body of a clause are semantically interdependent, since the variables bound in the patterns might be used inside the clause body. Therefore, the generation of the expressions is embedded into the generation of the patterns. In other words, the two generation steps are performed in sequence. After generating the proper pattern and expression lists, a subterm is synthesised that accords to the function clause, like this: ``` function_clause -> {~ N, pattern} -> {~ M, bodyexpr} ::= create_clause='{$1}', '2'). ``` The embedded rules are compiled into applications of the `bind` built-in QuickCheck generator combinator. By using this combinator, we get a monadic-style execution of the value generators (in Haskell QuickCheck this feature is implemented with monads). Special grammar rules: recursive rules As explained, earlier, formal grammars mainly consist of grammar rules. Basically, a grammar rule has a nonterminal on its left hand side and a list of either terminals or nonterminals on its right hand side. The rule defines the meaning, the way of production of the nonterminal being on the left. If that symbol also appears on the right, the rule is said to be recursive. Recursion might be indirect as well, that is, the rule’s right contains a nonterminal whose definition refers to the current rule. Some of the recursive rules can be eliminated by using repetition, the others have to be handled or modified properly in order to avoid infinite recursions. **Repetition** By applying EBNF-style repetition, many primitive recursive rules can be eliminated from grammar descriptions. Usually, when generating lists of entities, in BNF one has to create a primitive recursive rule, which has both a ‘productive’ and a ‘base’ alternative. Consider the following example which may generate lists of expressions. You can see that the recursion can be eliminated by using repetition. The recursive description: ``` exprs -> expr exprs | expr ``` And the same rule by using repetition: ``` exprs -> (expr) ``` According to the actual context, one can use repetition in two different ways depending on the way of handling the attributes. Also, lists of entities may be generated with a given (fixed) size or else a randomly generated size. The generation of repeated parts is basically implemented by using QuickCheck’s `list` and `vector` generator combinators, the former for variable sized lists and the latter for lists with a given size (the size parameter can be either a variable name, a constant or a macro/function call). However, if the generation of the list elements may be interdependent, that is, certain list elements may depend semantically upon each other, then the generation gets more difficult. In the latter case, special auxiliary generator combinators are included into the resulting source code, which help the generation of dependent lists. While independent list elements are generated simultaneously and all elements inherit the same attribute list from their parent (in other words, every list element is generated over the same attribute list and cannot affect each other), in dependent list generation, elements are generated one after the other and each one inherits the attributes from the previous one. That is, the generated attributes flow through the list and the currently generated elements can affect the following siblings. The method and the notation is quite similar to rule embedding. In this case, we would say that all sublists are embedded. Dependent repetition symbols and embedded rules can be seen in the following example. ``` module -> {attribute} {~ M, function}. function -> {?N, clause}. clause -> {~ pattern} {~ expr}. ``` **Controlling recursion** While using a grammar description for parser generation, the alternatives are equivalent in the respect of applicability, since the input string determines which alternatives have to be used for reduction. During a random generation, in the case of rules built up from many alternatives the framework should somehow choose one of them. In our solution, the generator randomly makes a choice among the alternatives and the selected one is going to be used for generating the current subtree. Obviously, if the alternatives are equivalent, the mentioned choice is totally random, all the alternatives have the same chance to be chosen. However, in some cases it is expected to make a kind of priority order among the rule alternatives in order to control the structure and the properties of the randomly generated data. In a rule, all rule alternatives may be associated with a frequency (or weight), based on which they will be chosen. Obviously, by adjusting the probability of the different alternatives the generated data structure accordingly changes. An alternative’s weight can mean its relevance as well as the complexity of the subtree that may be generated by its application. In the case of primitive recursive rules (for example, generating list data structures) the weight of the rule alternatives may affect the size of the generated data. Theoretically, recursive generation should terminate by a proper setting of probabilities. However, in practice, structurally recursive generation processes may not terminate, instead, infinitely enlarge the generated structure. To avoid infinitely recursive application chains, a recursion depth limit was injected into the generation process. The current depth of the recursion is registered during the rule applications, more precisely, a counter registers the number of the available recursive calls before hitting the limit. The counter is decreased every time when a recursive call is performed. If the limit is hit (in other words, the counter becomes zero), then only simple (usually non-recursive) alternatives can be applied. Thus, the generation terminates on the current subtree. This integer expression generator shows this in action: ``` intexpr (0) -> int::erl_syntax:integer('1'). intexpr (N) -> int::erl_syntax:integer('1'). | intexpr (decr (N)) infixop intexpr (decr (N)) ::= erl_syntax:infix_expr('1'), '2'), '3'). ``` Where the groups are separated by sequences of separately generated right hand side element groups, parts of the rule. In other words, productions may be regarded as symbol in the grammar description, which separates the different parts of the rule. The 'simple' rule alternatives could be found by analysing the recursiveness of the right hand side, but in our metalanguage the programmer has to mark the non-recursive, simple cases. In our formalism the rules are written in a function-like format and in particular they can have arguments. The mentioned counter registering the depth of the recursion is manually decreased and passed to the (directly or indirectly) recursive symbols. This solution gives the programmer full control over the recursive generation. 3.2 An Erlang grammar definition The generator generator framework is applicable to produce any kind of data that can be described using formal grammars. In our case, we have used the framework to generate Erlang programs. Consequently, we have created a grammar definition of the Erlang language, more precisely, a definition of the sequential programming language elements. First of all, we had to decide, at what abstraction level to generate programs, since source code can have many kinds of representation, such as the well-known textual representation, token stream, or abstract syntax tree (AST). This decision will in turn determine the further difficulties of the description, because different representations may introduce different problems during the generation process. We decided to use the latter representation, namely Erlang Syntax Trees. Such trees can easily be represented and handled using the Erlang Syntax Tools library, which is included in the standard Erlang distribution and includes modules declaring useful types and functions helping in construction and pretty-printing such syntax trees. With the functions of the erl_syntax module it is simple to create ASTs in a bottom-up strategy. By using the Syntax Tools application we only have to focus on the generation of abstract syntax trees instead of the textual program code. Compiling the grammar description we can get a QuickCheck generator that can produce random, compilable Erlang source code. In the background, the generation method creates an Erlang syntax tree which is then pretty-printed. Using the current language definition we can generate any number of modules containing random function definitions that may refer functions from another generated module. Functions may have randomly one or more function clauses, which do not shadow each other and have randomly generated patterns. The function bodies may contain many kinds of Erlang expressions, including IO statements, case expressions and match expressions as well. Moreover, generated code may invoke library functions. Match expressions can bind variables, and other expressions may refer those variables (but cannot re-bind them) afterwards. Every generated language element is well-typed, since types are managed by storing related informations in attributes. The types used during the generation are randomly generated as well. Finally, many properties of the generated code can be parameterised, such as the number of the generated functions, the difficulty of the generated expressions and the maximum level of nested case expressions. By adjusting the grammar and the parameters we can make the generated code quite similar to real-world programs. 3.3 Transformation We have implemented a compiler (a generator generator) for our grammar definition, which produces a single Erlang module containing functions returning QuickCheck generators for each production rule preserving its meaning. The compiler uses the standard Erlang scanner (with some extensions) and a yacc-generated parser. After scanning and parsing the grammar definition, firstly it checks some constraints on the grammar (for example, every declared non-terminal is defined as a rule, the are no symbol duplications, every right hand side symbol is defined in the file), then generates the ``` -module(prop). -export([prop/0]). -import("erl/include/erl.hrl"). -prop() -> test:prop_beh_eqv(rename_mod, fun gen_rename_mod_args/1). gen_rename_mod_args(Filename) -> ?LET(Atom, test:gen_atom(), [Filename, Atom, [], 8]). ``` Figure 3. Example of rename module property output Erlang module: if the input file is abc.eyrl, then the output file will be abc.erl, which is constructed of the generator functions belonging to the grammar rules, the attached Erlang code cut from the grammar definition file (without any changes) and further essential function and macro definitions being for the notation features. The generated output file is checked whether it compiles or not (using the Erlang compiler strong validation). If the module is compilable, with the erl_tidy module (included in Erlang Syntax Tools) it is tidied (unused functions are removed from the code, some syntax constructs are rewritten in a more readable form) and then compiled again, for reasons of optimisation. Despite the fact that in the generated Erlang module every function can be called from the outside (that is, they all are exported), only the function belonging to the root symbol can be used without any parameters (the others require parameters carrying information about the attributes). The return value of this function is a valid QuickCheck generator and passing this generator to QuickCheck results in the expected random data. 4. Properties If a refactoring was performed correctly, the behaviour of the program should not have changed: it should return the same output for the same input, throw the same exceptions, send the same messages in the same order. We say that the original and refactored versions are behaviourally equivalent. To test behavioural equivalency we follow these steps: generate random programs, perform the refactoring, pick a function, generate random arguments guided by type information, evaluate the function and then compare the result of the two versions. Since Erlang programs contain many functions, and a refactoring may only modify a single function we could pick an irrelevant function to test and miss an error. This is natural, and the solution is to run many tests to minimize the chance that we miss the erroneous function. A similar thing happens with arguments when the function has multiple clauses, which is fairly typical. To minimize the chance of missing an error, we have to run a large number of test, so test execution speed matters. The two slowest phases are program generation and the refactoring itself. By running the later phases more than once after every refactoring we can reduce the chance of missing errors without having to execute the slower steps repeatedly as many times. Erlang is a dynamically typed language, which means that we can supply any term as argument to a function, and at the worst case we get a runtime exception. Arguably this doesn’t help with catching real bugs. The dialyzer tool [17] can infer type information for functions from a codebase. This makes it possible to generate proper arguments for the function under test, so that we can avoid programs under test failing for reasons of data being ill-typed. In Erlang I/O uses message passing under the hood, hidden from the user. The messages are in a certain format and are sent to an I/O device, which is a separate process. The format of the messages is well documented, and any process that can handle them can be used as an I/O device. The testing framework uses an I/O device which behaves like a ram file that is initially empty. This I/O device additionally keeps track of the messages received. To test behavioural equivalence we evaluate both the old and the new version of a function, and compare the outputs and I/O traces. This can be done concurrently, saving us time. This is particularly true when the functions are non terminating due to the random nature of them. In this case we halt the evaluation after a given time. Concurrent execution means we only have to wait for this timeout only once, halving the time needed to test. 4.1 Example property In order to define a behavioural equivalence property for a refactoring, the user has to call test:prop_beh_eqv/2 with the appropriate arguments. The first argument is an atom, which is the name of the function in the wrangler module that implements the refactoring. The second parameter is a callback function, that given a filepath should return suitable arguments for the refactoring function. In the simplest case the callback returns a list containing the arguments. If the testing should be restricted to a specific function, the return value should be a three-tuple with the function name and arity for the said function and the argument list for the refactoring function. There is another version of test:prop_beh_eqv, which takes an additional third argument. This is a callback function that receives the result of the previous callback function and returns a boolean indicating whether to proceed with the test or not. The simplest property is for the rename module refactoring, the whole code is given in Figure 3. 5. Results We have designed and implemented a notation for L-Attributed grammars and created a compiler for it. So far we have formalised a subset of the Erlang language with it and got promising results. Moreover, by using random generation we have implemented the testing of four refactoring steps provided by Wrangler: rename variable, rename function, generalise function and tuple function arguments. We have found two bugs, one in rename variable regarding incorrectly handling patterns in function parameters, and one in generalise function regarding incorrectly transforming the function leading to compiler errors. Both of these errors are fixed in the latest release of Wrangler. 6. Related work [9] is a similar study done for refactoring engines integrated in IDEs for mainstream languages. The program generator described is specific to the language they use and it can be parametrized by code fragments, so it would be difficult to adapt to other domains. They test the results of refactorings in a different way too: they test hand written structural properties as opposed to behavioural equivalence, and do this by testing the results of two different refactoring engines against each other, rather than testing the old and new code directly. [14] describes previous work using QuickCheck for testing Wrangler. They did not use random program generation, refactoring a static codebase instead, and the only property formulated is successful compilation of the refactored program. 7. Conclusions and future work We have demonstrated that automated, property-based random testing of refactoring tools is able to discover new bugs, and therefore it is a useful addition to the testing processes of tool developers. How to check behavioural equivalence of arbitrary message passing programs, or refactorings which have wider ranging effects is still an open question. Our main contribution is random program generation and behavioural equivalence testing, which together give much wider coverage, scalability and maintainability to the testing of refactoring engines. References
{"Source-Url": "https://kar.kent.ac.uk/30636/1/content.pdf", "len_cl100k_base": 6997, "olmocr-version": "0.1.53", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 21668, "total-output-tokens": 8301, "length": "2e12", "weborganizer": {"__label__adult": 0.0003514289855957031, "__label__art_design": 0.0002315044403076172, "__label__crime_law": 0.0002689361572265625, "__label__education_jobs": 0.0005364418029785156, "__label__entertainment": 4.51207160949707e-05, "__label__fashion_beauty": 0.00013518333435058594, "__label__finance_business": 0.00011539459228515624, "__label__food_dining": 0.00030112266540527344, "__label__games": 0.0004916191101074219, "__label__hardware": 0.0004732608795166016, "__label__health": 0.0003592967987060547, "__label__history": 0.00014853477478027344, "__label__home_hobbies": 6.514787673950195e-05, "__label__industrial": 0.0002510547637939453, "__label__literature": 0.0002269744873046875, "__label__politics": 0.00018787384033203125, "__label__religion": 0.00039124488830566406, "__label__science_tech": 0.003631591796875, "__label__social_life": 7.480382919311523e-05, "__label__software": 0.003391265869140625, "__label__software_dev": 0.9873046875, "__label__sports_fitness": 0.0002987384796142578, "__label__transportation": 0.0003299713134765625, "__label__travel": 0.00018453598022460935}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 37990, 0.02088]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 37990, 0.81233]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 37990, 0.88961]], "google_gemma-3-12b-it_contains_pii": [[0, 0, null], [0, 5152, false], [5152, 11378, null], [11378, 16915, null], [16915, 24444, null], [24444, 31504, null], [31504, 37990, null]], "google_gemma-3-12b-it_is_public_document": [[0, 0, null], [0, 5152, true], [5152, 11378, null], [11378, 16915, null], [16915, 24444, null], [24444, 31504, null], [31504, 37990, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 37990, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 37990, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 37990, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 37990, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 37990, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 37990, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 37990, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 37990, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 37990, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 37990, null]], "pdf_page_numbers": [[0, 0, 1], [0, 5152, 2], [5152, 11378, 3], [11378, 16915, 4], [16915, 24444, 5], [24444, 31504, 6], [31504, 37990, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 37990, 0.0]]}
olmocr_science_pdfs
2024-12-04
2024-12-04
65bd1a1bab00df3be1eb718090fae89796969e5b
Model Driven Architecture - Issues, Challenges and Future Directions Amna Noureen*, Anam Amjad, Farooque Azam Department of Computer Engineering, College of EME, National University of Sciences and Technology (NUST), H-12, Islamabad, Pakistan. * Corresponding author. Tel: +923365119708; email: Amna_noureen@yahoo.com Manuscript submitted December 31, 2015; accepted July 22, 2016 doi: 10.17706/jsw.11.9.924-933 Abstract: Model driven architecture provides the models written in well-defined language. They consist of multiple components including model, transformation and meta-model. This architecture is improvement of software development life cycle but it also comprises of several issues, challenges which needs to be addressed. Our focus in this paper is to elaborate the issues and challenges of MDA. Furthermore, we will propose some future directions. Key words: Model driven architecture (MDA), meta object facility(MOF), object management group(OMG), unified modeling language(UML). 1. Introduction OMG proposed model driven architecture for the large software system. It consists of model transformations and model refinements. MDA are carried out until system is executed and produced having abstract models which are the result of transformation of concrete models by adding details of technical sort. In Fig. 1 it is also mentioned that within the OMG, the MOF is the standard M3 language. All modelling languages (like UML, CWM) are used as instances of the MOF. ![Fig. 1. Model driven architecture.](image) 1.1. Components of MDA The components involved in MDA are as following. 1.1.1 Model Models are used to build the large-scale solutions. Notations are used to represent the models. Four types of models are introduced in model driven architecture named as: Computational Independent Model (CIM), in which business model does not depend on the system model and implementation details are not present in it. Platform Independent Model (PIM), the name indicates that it is independent of any platform or operating system detail. Platform Specific Model (PSM), the PIM can be transformed in multiple PSM which are dependent on a particular platform or operating system. Implementation Specific Model (ISM), in which all details of implementation are specified [1]. 1.1.2 Model transformation Different models can be transformed through some sequential steps in order to develop the system [1]. 1.1.3 Meta-model Models are written in a well-defined language which comprises of another model used to integrate and transform the model called Meta models. Tools are used for this purpose OMG is using four layer of architecture known as M0, M1, M2 and M3 [1]. In this paper, we have described some issues and challenges of MDA. MDA is widely used methodology thus problem regarding to it should be processed and solved for its effective use and reliability. The paper is organized as follow, section 2 provides the brief analysis of MDA which are further categorized into issues and challenges, section 3 contains the literature review of several papers related to MDA, section 4 we have presented the proposed solution and show how this proposed solution can be augmented with this model driven architecture technology. In last, section 5 provides the conclusion along with opportunity to enhance the work. 2. Analysis MDA is emerging field in software engineering. It has several advantages which are - It provides long term flexibility through PIM - New PSM are developed and updated - Complex system can be views from different perspectives by using MDA - MDA is used to keep the investment of both types; intellectual and financial which is very helpful for the developer - MDA supports the application at multi-platforms - Integration of applications is easier with MDA. It also facilitates the middleware boundary problems. - Interoperability between two or more platforms is also present in MDA. The mean reason behind is the construction of PIM which is transformed in PSM. - With MDA, cost of developing a software application is reduced as compare to the cost of developing software by traditional SDLC. - Quality is not compromised in MDA, as it is clear that code is generated from the models created. - MDA ensures that if technology framework is changed then existing applications do not become useless. - MDA is wide scope methodology and due to its benefits to the developer it will be used in future too. Despite of all these advantages, MDA is also facing several issues and challenges. Some of the issues and challenges are discussed. 2.1. Issues of MDA In Fig. 2 some common issues regarding MDA are highlighted and these are explained as follow. 2.1.1. MDA model types Different methodologies of MDA support different idea, doctrines and methods. In this instance, C3 uses MDA standards which include UML and XMI then transformation is performed in the planned process, but model types are not integrated, i.e. PIM, PSM [1]. 2.1.2. Concrete process inclusion Various methodologies claim to be MDA-based do not proceed towards concrete process. Although they satisfy the process needs. [1] 2.1.3. Coverage of the generic lifecycle In coverage of the generic life cycle, the whole issue resides to what extend phases and activities of the general SDLC is cover by the methodology [1]. 2.1.4. Process precision While developing the software, it should define the process efficiently and effectively by the experts involved in the development process Model driven architecture methodologies are responsible to describe the process but not in an effective and efficient manner. For example, MIDAS and MASTER do not fit into the behavior of their processes [1]. 2.1.5. Application scope Some MDA methodologies are not general-purpose and they are not applicable to the all domain. For example, MIDAS is application of web information systems and MODA-TEL focus on distributed applications [1]. 2.1.6. Security A software product can be secured enough if this factor is considered from the very beginning. When security is handled then security protocols scheme are occurred at minimum level. A MDA (model-driven approach) for the development of security vital applications is helpful in producing an execution and official model, from the identical PIM. They are required to guarantee correctness and security. [2] 2.1.7. Real time systems Developing real-time system based on MDA is also significant. Some efforts have been made but it is partial, it can solve the rambling difficulty associated with function of RTS, this is not available in traditional SDLC methodologies. [3] 2.1.8. Non-functional requirements There is variety of issues in satisfying the non-functional requirements in MDA such as modeling of non-functional requirements and their relationships, level of satisfaction of NFRs at run time. To deal with such issues, system needs to be monitored during runtime and if there is any violation, system requires reconfiguration by introducing new functional properties. The example of this scenario can be seen at security level where security calls for fingerprint or multilevel authentication. In this case multi-level authentication might conflict with usability requirement in terms of time consuming process to attain security. An adaptive approach is needed for usability requirements at runtime by keeping a record of timing behaviors of encryption algorithms used for multilevel authentication and using a stronger one-level authentication with less time consumed when timing violation are supposed to occurs[4]. 2.1.9. Absence of software architecture artifact The development of any software architecture can be complex if standardized way of generating software architecture artifact is missing. To some extent, software architecture based on analysis model is made. [5] 2.2. Challenges of Model Driven Architecture In today's time, our software industry has become very challenging. Due to this our software are very complex. Developers always try to maintain the quality of the software by meeting the customer's expectations. A study conducted by Standish group has shown that only 29% of the projects were successful in 2004. Moreover, in typical SDLC used in companies or organizations; it can be easily observed that routines are repeated in terms of same steps, same tools, and tests. To improve these routines, the model-based approaches are vastly used. [6]. Figure 3 illustrate the challenges of MDA these are explained below: ![Fig. 3. MDA challenges.](image) 2.2.1. Time and budget MDA development is designed to reduce the cost and delays at each stage of SDLC. It is fundamental if we want to make our software profitable. As many tools and transformation took place in MDA so it is considered a challenge. 2.2.2. Formal method In software development, MDA explains the solution to the problem by providing only formal methods. No other method is used. 2.2.3. Improvement of traditional SDLC MDA is a further step to improve the traditional SDLC methods in each step starting from requirement analysis, specification, design, coding, and maintenance. MDA is a set of frameworks developed by OMG. Some of the challenges of MDA are to identify application of transformations to abstract descriptions, further it involves refining that description and make an alteration among dissimilar representations. [6] 2.2.4. Automation To develop an architectural design, it is an important step in MDA which depends on architect's experience and resource constraint. Due to this purpose, automated methods are unachievable yet. [7] 2.2.5. Multi model consistency Another important challenge in MDA is to understand the relationship between these models that they should maintain a multi-model consistency as changes in one model affect other models in the multi-model. 2.2.6. Separation of manufacturing system functionality from implementation It is important to manufacture the system functionality from the specification from which it is implemented on any particular technology platform. It is considered a challenge because it makes the reconfiguration of the system by using the manufacturing progress through the model transformation and transmission of information. [9] 2.2.7. Enhanced MDA The existing MDA does not handle the enhanced MDA. Enhanced MDA is basically an architecture which exists in order to increase its efficiency and applicability. Also this enhancement phase cope with changes which are required time to time without getting interrupt in present architecture. In this case the overall efficiency is not compromised. [10] 3. Literature Review In this section we are providing the literature review to highlight the work that had been done on MDA and to identify where new contribution could be achieved. For real time systems Junli Gao Di Li et al [3] presented an OOMDRDP (object oriented model driven rapid development process). This approach comprises four phase’s analysis, design, implementation and testing here all phase has micro recursive process based on model driven architecture. UML is used to erect the model. Object oriented model on the computer numerical controller is applied. From program codes to UML models they have endorsed the non-concrete layer of SD (software development), which perform code associability and testing the functions of computer numerical controller on the UML model. And lastly they have validated the CNC schedule ability against the real time system. Nourchene Elleuch et al [5] proposed a technique in which through analysis of model architecture of any system can be generated. To achieve this they have added one more layer in in MDA which is software architecture layer. Analysis model is treated as AIM (architecture independent model) while they treated the software architecture layer ASM (Architecture specific model). They have concluded that through architecture specific model many benefits can be avail like design pattern different styles of architectures and important decision about design can also be taken. In 2009 Oksana Nikiforova et al [6] proposed a research in which they have analyzed the different CASE tools that are deployed under the MDA process. They have discussed transformations among MDA and MDD (model driven development) in perspective of instinctive competencies for SDLC. The vital impact of this research is CM (component model) for Model Driven Architecture and Model Driven Development which stipulates activities that are supported by the MDA tool chain to mechanize the Model Driven Development process. They have also deliberated how development of the model driven software can be defined by the diverse tool chain. They have also generated the class diagram as well as source code form the application of two models which are hemisphere in nature. Daniel Perovich et al [7] apply the model driven engineering techniques to achieve the architecture design that enables the methodical and aided erection of the Software Architecture applicable of enterprise applications. The describe architecture is cured as a mega model. To complete SA (software architecture) from scratch the architectural basis is unequivocally enumerated as the set of alterations. Their proposed approach consider mega model then comprehend it transform it to system that is well structure and independent and further more express it in a specific language. Claudia Szabo [8] conducted a research in which they have presented the architecture which is based on multi modeling. Relationship of model at different level is internment through this architecture. In order to analyze the change impact on diverse environment taxonomy has been defined. This taxonomy is based on RCMM (relationship correspondence... meta-model). Through this, stakeholders are notified against any change. Their proposed architecture is validated through the case study and they have also emphasized on the challenges that are faced by their proposed approach. Hailong Huang et al. [9] conducted a research in which they have presented a framework for dynamic reconfigurable process especially for manufacturing enterprises. In order to resolve complications of movability, evidence in corporation and interoperability Dynamic reconfigurable manufacturing process model can be construct with Model Driven Architecture methodology. Specific technology platform implementation can be separated from its manufacturing system functionality specification through the dynamic reconfigurable process, and creates the system reconfigure the industrial advancement over the alteration of models and communication of information. To support the dynamic reconfiguration manufacturing process PIM was erected with UML which is based on the MDA methodology. Many PSMs was transformed though PIM. Hence they prove that the system is applied and operative using the MDA. In order to enhance the efficiency and applicability of the already existing MDA architecture the research is conducted by Atika Qazi et al. [10]. Yashwant Singh and Manu Sood[11] elaborated different issues of software development and they are addressed using MDA technologies using separation of concerns through the model, mapping and transformation. These issues include changing technology, multiple platform environment, interoperability, serviceability and changing requirements. Many challenges issues are found in MDA. 4. Results 4.1. Proposed Solution for Issues More interest is gained by model driven architecture now days. We can solve many problems creatively using MDA. MDA is not work in detail and it is still at high level of vision. Models are used to build the large-scale solutions. A lot of issues are faced by MDA. Some of those factors are highlighted in the aforementioned table which were found in research papers [1]-[5]. In Table 1, we are intended to endow with a beneficial analysis that will emphasize on the fundamentals issues associated with the MDA testing and their possible solution. Fist issue is MDA model types PIM and PSM which is not integrated in the MDA, as MDA supports different platforms, ides and methodology it must address this issue of model type. Second issue is concrete process inclusion. Most of methodologies claimed to be MDA based but they only support only generic process needs not MDA concrete process. MDA development process is different from the traditional software development process this needs to incorporate in the MDA architecture. Third issue is coverage of life cycle. MDA development life cycle is different from the traditional development life cycle. Traditional software development life cycle involve different phases like requirement election, software specification, design, coding, testing and maintenance. Which of these phases should be converged in the MDA is crucial issue. Fourth issue is application scope. Development process should be defined effectively and efficiently by the people involved in the development process. If the development process is not precise and clear then a lot of issues can occur and different interpretation can be made by the people involved in the development process. MDA define development process but not in effective way. Fifth issue is Application scope. Application scope defines the domain of the particular application. Different applications have different scope. Some MDA methodologies are not general purpose and they are not applicable to all domain. Sixth issue is security. Software security assurance is a procedure that assistances design and implements software that defends the data and resources enclosed in and controlled by that software. Seventh issue is real time system support and development. As MDA support development of real time systems but it is partial. All functions of real time systems are not supported by the MDA. Eighth issue is non-functional requirements. It is difficult to represent NFR. There is variety of issues in satisfying the non-functional requirements in MDA such as modeling of non-functional requirements and their relationships, level of satisfaction of NFRs at run time. To deal with such issues, system needs to be monitored during runtime and if there is any violation, system requires reconfiguration by introducing new functional properties. Ninth issue is absence of software architecture artifacts. As MDA is architecture. We might face difficult in development of software architecture is consistent way of generating software architecture artifact is missing. In Fig. 4, we have proposed a plug-in throw which all of the above mentioned issues can be resolved and incorporated in the existing MDA architecture. Our purposed plug-in identify the root cause behind any issue and reduces chances of issues occurrences. Issues plugin check and validate the each step of software development life cycle to assure that right each of the above mention issue is correct before the implementation of MDA application. Working of our purposed plugin is described throw the following diagram. In this diagram project initialization phases basically encompass the MDA support Phases. These phases consists of platform and model identification and specification, process identification & specification, modeling languages identification & specification, transformation identification & specification, tool selection, application scope identification & specification, security level & real time system identification & support and NFR requirements specification. Under MDA architecture when we start project initialization MDA support phases sustenance our proposed MDA issues plug-in by mapping our MDA issues with the MDA support phases and enabling those issues to be reduced efficiently and effectively. Our proposed MDA plug-in not only resolve those issues throughout the software development and also increase the efficiency of the MDA existing architecture. <table> <thead> <tr> <th>Reference No</th> <th>MDA model types</th> <th>Process inclusion</th> <th>Coverage of lifecycle</th> <th>Process Precision</th> <th>Application scope</th> <th>Security</th> <th>Real time system</th> <th>Non-function requirements</th> <th>SW architecture artifact</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>✓</td> <td>✓</td> <td>✓</td> <td>✓</td> <td>✓</td> <td>✓</td> <td>✓</td> <td>✓</td> <td>✓</td> </tr> <tr> <td>2</td> <td>×</td> <td>×</td> <td>×</td> <td>×</td> <td>✓</td> <td>✓</td> <td>×</td> <td>×</td> <td>×</td> </tr> <tr> <td>3</td> <td>×</td> <td>×</td> <td>×</td> <td>×</td> <td>×</td> <td>✓</td> <td>×</td> <td>×</td> <td>×</td> </tr> <tr> <td>4</td> <td>×</td> <td>×</td> <td>×</td> <td>×</td> <td>×</td> <td>✓</td> <td>×</td> <td>✓</td> <td>×</td> </tr> <tr> <td>5</td> <td>×</td> <td>✓</td> <td>✓</td> <td>✓</td> <td>✓</td> <td>×</td> <td>×</td> <td>×</td> <td>×</td> </tr> </tbody> </table> Our proposed plug-in is not feasibly for the MDA products in term of its applicability on different MDA projects also this plug-in is cost effective in prevention of maintenance cost after the deployment of specific MDA product which could be increase due to presences of those issues. This plug-in is best suited for large scales projects as it increase the overall performance of the MDA architectures by not only resolving those issues also enhancing the incentives of MDA architecture. 4.2. Proposed Solution for Challenges In Table 2, we have analyzed the papers [6]-[10] and discovered the challenges facing MDA technology, although lot of work is done on these to cater but these challenges are still problematic. If we consider time and budget, it is the most important factor in any framework. It indirectly affects the performance. So, it should be less time and cost consuming but MDA composed of many phases which take time and cost. Formal method should be adopted in order to remove ambiguity in any phase of the products being developed but in some cases informal methods should be supported as it can be requirement of the system. Automation is an important parameter considered here and it is not achieved yet by using MDA. As it is clearly defined above the structure of MDA that it consist of multiple models which need to be consistent. If consistency is not found then interface and interaction problems can be observed. Separation of system functionality from the implementation is a challenge to achieve due to the reconfiguration involved by the transformation. Enhanced MDA’s technology should be adopted it would be helpful in achieving the efficiency and applicability of MDA process. However, it is necessarily to note that MDA itself is a relatively new approach. Therefore, there should be clearance in appropriate techniques, tools, and methods, which of them are working, which are not and why. In Fig. 5, solution to all these problems can be provided in the form of plug-in provided with the software architecture tool. Many software architecture tools exist which include MODA-TEL, MIDAS, MASTER, C3, ODAC and many more. These tools have different features such as MDA support, process inclusion, coverage of generic life cycle, process precision and application scope. ![Fig. 4. MDA issues plug-in architecture.](image) **Table 2. MDA Challenges** <table> <thead> <tr> <th>Reference No</th> <th>Time and budget</th> <th>Formal Methods</th> <th>Improvement in SDL</th> <th>Automation</th> <th>Multi-model consistency</th> <th>Separation of system functionality from implementation</th> <th>Enhanced MDA</th> </tr> </thead> <tbody> <tr> <td>6</td> <td>✓</td> <td>✓</td> <td>✓</td> <td>✓</td> <td>✓</td> <td>×</td> <td>×</td> </tr> <tr> <td>7</td> <td>×</td> <td>×</td> <td>×</td> <td>✓</td> <td>×</td> <td>×</td> <td>×</td> </tr> <tr> <td>8</td> <td>×</td> <td>×</td> <td>×</td> <td>✓</td> <td>×</td> <td>×</td> <td>×</td> </tr> <tr> <td>9</td> <td>×</td> <td>×</td> <td>×</td> <td>×</td> <td>✓</td> <td>×</td> <td>×</td> </tr> <tr> <td>10</td> <td>×</td> <td>×</td> <td>×</td> <td>×</td> <td>×</td> <td>✓</td> <td>✓</td> </tr> </tbody> </table> Different plug-in are widely used for many software and serve for different purpose. Here, in our case some plug-in should be provided as well. In this diagram, when MDA project is initialized developer seeks for functions provided in the MDA support phase. And these functions are basically challenges of the MDA and not provided yet. In the next step, software development phase needs to install these plug-in for the required functionality. Mapping through lines depicts that which functionality should be supported by which plug-in. These plug-in would be very useful in development area due to number of reasons. These would be easy to find as they will be provided with the software architecture. They are install and feasible to use. They fulfill the functionality required to the developer for the user hence in other words can increase performance. In order to satisfy the customers with the overall functionality prototype can be built using Eclipse and ATL. Some other solution can also be proposed in the form of utility and another framework but MDA is itself a framework so it would not be effective to build another framework. Finally, we can say that the plug-in approach is better than other approaches. 5. Conclusion and Future Work More interest is gained by model driven architecture now days. We can solve many problems creatively using MDA. MDA is not work in detail and it is still at high level of vision. Models are used to build the large-scale solutions. In this paper we have identified some of the most vital issues and challenges faced MDA existing architecture. We have proposed two novel plug-ins for MDA architecture. These plug-ins are capable of handling all those issues and challenges in effective and efficient way. Thus are proposed solution can is best suited for large scales projects as it increase the overall performance of the MDA architectures by not only resolving those issues also enhancing the incentives of MDA architecture. Another enhancement in MDA is to develop a computer-aided software architecture design environment that is helpful in dealing with architecture representation. Usability framework to other MDA tools can be introduced. It will evaluate and extend the usability model which can improve the application development. References Amna Noureen is a research scholar at College of Electrical and Mechanical Engineering, NUST, Rawalpindi, Pakistan Anam Amjad is a research scholar at College of Electrical and Mechanical Engineering, NUST, Rawalpindi, Pakistan Farooque Azam is a research supervisor at College of Electrical and Mechanical Engineering, NUST, Rawalpindi, Pakistan
{"Source-Url": "http://www.jsoftware.us/vol11/193-IT110.pdf", "len_cl100k_base": 5614, "olmocr-version": "0.1.50", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 22325, "total-output-tokens": 6302, "length": "2e12", "weborganizer": {"__label__adult": 0.00038313865661621094, "__label__art_design": 0.0004563331604003906, "__label__crime_law": 0.0003211498260498047, "__label__education_jobs": 0.0011548995971679688, "__label__entertainment": 5.704164505004883e-05, "__label__fashion_beauty": 0.0001761913299560547, "__label__finance_business": 0.0002205371856689453, "__label__food_dining": 0.00034117698669433594, "__label__games": 0.0004954338073730469, "__label__hardware": 0.00080108642578125, "__label__health": 0.0005478858947753906, "__label__history": 0.0002644062042236328, "__label__home_hobbies": 7.68899917602539e-05, "__label__industrial": 0.0003840923309326172, "__label__literature": 0.000274658203125, "__label__politics": 0.00024509429931640625, "__label__religion": 0.0005483627319335938, "__label__science_tech": 0.0177001953125, "__label__social_life": 9.41753387451172e-05, "__label__software": 0.0038852691650390625, "__label__software_dev": 0.970703125, "__label__sports_fitness": 0.0003399848937988281, "__label__transportation": 0.0005464553833007812, "__label__travel": 0.0002124309539794922}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 29921, 0.03715]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 29921, 0.23019]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 29921, 0.93861]], "google_gemma-3-12b-it_contains_pii": [[0, 1606, false], [1606, 4610, null], [4610, 7098, null], [7098, 9882, null], [9882, 13818, null], [13818, 18129, null], [18129, 22616, null], [22616, 25012, null], [25012, 27198, null], [27198, 29921, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1606, true], [1606, 4610, null], [4610, 7098, null], [7098, 9882, null], [9882, 13818, null], [13818, 18129, null], [18129, 22616, null], [22616, 25012, null], [25012, 27198, null], [27198, 29921, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 29921, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 29921, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 29921, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 29921, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 29921, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 29921, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 29921, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 29921, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 29921, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 29921, null]], "pdf_page_numbers": [[0, 1606, 1], [1606, 4610, 2], [4610, 7098, 3], [7098, 9882, 4], [9882, 13818, 5], [13818, 18129, 6], [18129, 22616, 7], [22616, 25012, 8], [25012, 27198, 9], [27198, 29921, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 29921, 0.11111]]}
olmocr_science_pdfs
2024-11-30
2024-11-30
4face65a4fa7a230e6c00b4ddae843af1ee035d3
Testing Expert Systems C. L. Chang and R.A. Stachowitz Lockheed Missiles & Space Company, Inc. Lockheed Artificial Intelligence Center, O/90-06, B/30E 2100 East St. Elmo Road Austin, Texas 78744 Abstract Software quality is of primary concern in all large-scale expert system development efforts. Building appropriate validation and test tools for ensuring software reliability of expert systems is therefore required. The Expert Systems Validation Associate (EVA) is a validation system under development at the Lockheed Artificial Intelligence Center. EVA provides a wide range of validation and test tools to check the correctness, consistency, and completeness of an expert system. Testing is a major function of EVA. It means executing an expert system with test cases with the intent of finding errors. In this paper, we describe many different types of testing such as function-based testing, structure-based testing, and data-based testing. We describe how appropriate test cases may be selected in order to perform good and thorough testing of an expert system. INTRODUCTION It has been repeatedly shown that the expert system technology in artificial intelligence can be used to implement many different applications such as diagnostic systems, battle management systems, machine and robot control systems, monitoring systems, design systems, manufacturing systems, etc. Regardless of whether the expert systems are stand-alone or real-time embedded systems, we need to be ensured that they are reliable, correct, consistent and complete. For this purpose, the Lockheed Artificial Intelligence Center started in 1986 the Expert Systems Validation Associate (EVA) project [Stachowitz et al. 1987a, 1987b, 1987c]. EVA provides a wide range of validation and test tools to check the correctness, consistency and completeness of an expert system. Testing is a major function of EVA. It means executing an expert system with test cases with the intent of finding errors. A very good example is the Target Generation Facility (TGF) which provides simulated, real-time controllable aircraft targets to Air Traffic Control Systems under test at the FAA Technical Center. In this paper, we consider many different types of testing such as function-based testing, structure-based testing and data-based testing. We describe how appropriate test cases may be selected in order to perform good and thorough testing of an expert system. BACKGROUND Expert systems are usually developed incrementally. The initial requirements for an expert system may be clearly stated. However, as the expert system evolves and is evaluated, the requirements may be changed or new requirements may be added. In many cases, even if the requirements are not changed, there are no known algorithms for solving the problem. For example, there are no algorithms for performing parallel parking even though the initial and final positions of a car can be specified precisely. Therefore, an expert system may have to be developed in repeated cycles of implementation, evaluation and modification steps. In the parallel parking example, a fuzzy (approximate) algorithm, represented by rules, may be tried first. The algorithm continues to be modified until a satisfactory performance is achieved. The goal of the test case generator is to generate "appropriate" test cases from the requirements specifications or the expert system itself for users, expert collaborators, or system builders to perform the thorough evaluations during the development or acceptance phase of the system production cycle. Testing of conventional software [DeMillo et al. 1981, 1987, Hetzel 1984, Miller and Howden 1984, Zeil and White 1980] has been known for a long time. As stated in [Hetzel 1984], software testing is a creative and difficult task. It requires very good knowledge about the system being tested. Typically, the requirements cannot be processed automatically, or knowledge is buried inside the codes of the system. Therefore, test cases are conventionally generated manually. This is certainly tedious and error-prone. On the other hand, an expert system is usually implemented in a high-level language that supports high-level concepts such as objects, relations, categories, functional mappings, data types and data constraints. This knowledge can be used to generate test cases automatically. TYPES OF TEST CASES In this paper, we consider three types of test cases, namely, function-based test cases, structure-based test cases, and data-based test cases. To generate function-based test cases for an expert system, one requires knowledge about the system's functions. Function-based testing is usually regarded as black box testing because it tests the external input-output behavior (specifications) of the system. In order to generate function-based test cases automatically, the generator must be provided with knowledge about the input-output specifications. Structure-based test cases explore the relations between rules. An expert system can be represented by a knowledge base consisting of facts and rules, which can be connected to make a connection graph. An arc in the connection graph denotes a match between a literal in the left hand side (LHS) of a rule and a literal in the right hand side (RHS) of a rule. Note that a fact can be considered as a rule without a RHS. Structure-based test cases are based upon the structure of the connection graph. The idea is to generate a set of test cases to exercise every rule in the connection graph at least once. The difference between function-based and structure-based testing can be illustrated by using an electrical circuit. Function-based testing means checking whether the light goes on when we throw the switch, while structure-based testing means inspecting whether all parts are connected properly into the circuit. To perform function-based testing, we do not need to look inside the circuit box. Therefore, it is called black box testing. On the other hand, since we need to look inside the circuit box to see how parts are connected, structure-based testing is called white box testing. Data-based test cases are based upon data definitions for the expert system. The data definitions consist of data declarations and data constraints. The data declarations are schema statements for data domains, relations and objects. A data constraint is specified by a logic formula using object-level and/or meta-level predicates. **FUNCTION-BASED TESTING** Input data to an expert system are usually represented by facts that are instances of schemas. Let us call these schemas input schemas. Each test case contains a set of facts of the input schemas. For each set of input facts, the expert system will produce a set of output facts (data), which are instances of output schemas. The input and output schemas may not be declared explicitly. They may be implicitly contained in the connection graph of the expert system. In this case, we consider only the rule part of the connection graph. In a connection graph, there are two kinds of leaf nodes, namely, input nodes and output nodes. An input node is a LHS-literal of a rule that is not connected to other RHS-literals. An output node is a node representing a RHS-literal that is not connected to any LHS-literals. The schemas of input and output nodes will be considered as the input and output schemas, respectively. In order to thoroughly cover all different types of input test cases, we must systematically categorize input and output data by explicit declarations. For each set of input facts in certain categories, we specify the expected output facts, or the data constraints that the expected output facts have to satisfy. Consider the airline inquiry system in [Hetzel 1984]. The specifications of the system are given as follows: The inputs are 1) a transaction identifying departure and destination cities and travel date, and 2) tables of flight information showing flights available and seats remaining. The system checks the flight tables for the desired city. If there is no flight to that city, it prints message 1 “No flight”. If there is a flight, but seats are not available, it prints message 2 “Sold out”. If there is a flight and seats are available, it displays that fact. Therefore, the expected output is either a flight display, or message 1, or message 2. For this example, the relational schema is: ``` flight(flight#, from_city, to_city, date, seats_reserved, capacity) ``` where flight# is a key. The data base contains a collection of ground instances (facts) of the flight relation. To generate test cases, we specify the following categories of flights: ``` category(flight_no_flight(X,Y,D)):- ~/. flight F# from X to Y */ A=[F# | flight(F#,X,Y,D,_,_0,_,_0)], count(A)=0. category(flight_single(X,Y,D)):- ~/. single flight from X to Y */ A=[F# | flight(F#,X,Y,D,_,_0,_,_0)], count(A)=1. category(flight_multiple(X,Y,D)):- ~/. multiple_of_1 */ A=[F# | flight(F#,X,Y,D,_,_0,_,_0)], count(A) > 1. ``` Similarly, the categories of the output on a computer display are: ``` category(output_message_1). category(output_multiple_lines). category(output_message_2). ``` (Note that we use the Prolog syntax for representing facts and rules, where a variable is written as a string beginning either with a capital letter or "_".) For each set of input facts (data) belonging to a certain combination of categories, we specify the expected output. For this example, the input-output relationships specified in terms of categories are given as follows: 1. single & available --> one_line. 2. multiple & available --> multiple_lines. 3. no_flight --> message_1. 4. single & full --> message_2. 5. multiple & full --> message_2. Based upon these functional specifications, the test case generator can generate the following test cases to cover different input scenarios: **CASE 1A**: Flight available (only flight to the city). **EXPECTED RESULT**: Display one line. **CASE 1B**: Flight available (multiple flights to the city). **EXPECTED RESULT**: Display multiple lines. **CASE 2**: No flight. **EXPECTED RESULT**: Message 1. **CASE 3A**: No seats (only flight to the city). **EXPECTED RESULT**: Message 2. **CASE 3B**: No seats (multiple flights, all full). **EXPECTED RESULT**: Message 2. **CASE 4**: Flight available (one flight full, but another open). **EXPECTED RESULT**: Display lines and Message 2. Note that each of CASE 1A through 3B corresponds to one of the input-output relationships specified above. However, CASE 4 is generated by using the input-output relationships (2) and (4). This is possible because the conditions in the input-output relationships (2) and (4) are not mutually exclusive. **STRUCTURE-BASED TESTING** Another important source of test cases derives from the structure of a knowledge base, namely, the connection graph. The advantage of structure-based testing is that the generation of test cases... depends upon only the connection graph. It does not have to rely upon other information such as input-output specification of the system represented by the knowledge base. The basic concept in structure-based testing is one of complete coverage. The assumption is that every rule in the connection graph in some way serves some purpose for handling certain situations. Therefore, all the rules must be useful, i.e., used some time, and the goal of structure-based testing is to generate a set of test cases to exercise every rule at least once. An algorithm for generating such test cases follows: 1. Generate the connection graph of the knowledge base. 2. Generate the rule flow diagram from the connection graph. Note that a rule flow diagram is a directed graph where nodes denote rules, and arcs denote rule execution sequences. 3. Create a set of paths in the flow diagram such that each node (rule) is covered by at least one path in the set. 4. Generate test cases to traverse these paths. Consider a rule-based system that computes the grade of a student from his answers to a quiz. The system compares his answers with the expected answers, counts the number of right answers, computes a numerical score, and then records the grade. The rules for this system are given as follows: (1) \text{grade}(\text{Name}, \text{Grade}) :- \text{student}(\text{Name}, \text{Answers}), \text{expect}(\text{N-questions}, \text{Correct-answers}), \text{right-answers}(\text{Answers}, \text{Correct-answers}, \text{N-rights}), \text{Ratio is N-rights/N-questions}, \text{Score is Ratio*100}, \text{compute-grade}(\text{Score}, \text{Grade}). (2) \text{right-answers}([],[],0). (3) \text{right-answers}([X|Y], [X|Z], R1):- \text{right-answers}(Y,Z,R), R1 is R+1. (4) \text{right-answers}([L|Y], [L|Z], R):- \text{right-answers}(Y,Z,R). (5) \text{compute-grade}(\text{Score},a):- \text{Score} \geq 90. (6) \text{compute-grade}(\text{Score},b):- \text{Score} > 90, \text{Score} \geq 80. (7) \text{compute-grade}(\text{Score},c):- \text{Score} < 80, \text{Score} > 70. (8) \text{compute-grade}(\text{Score},f):- \text{Score} < 70. We now consider test cases that are derived from data definitions. Such test cases are called data-based test cases. Data definitions include data declarations and data constraints. In an expert system shell, data declarations are specified by data schema state-ments. Since maintaining the integrity of facts and rules in a knowledge base is important, we need also to specify the data constraints that the facts and rules must satisfy. Any fact or rule that violates the data constraint will not be inserted into the knowledge base. We can use logical formulas to represent the data constraints. By means of the data declarations and data constraints in the expert system, we can generate good and bad test cases. A good test case satisfies the data declarations and data constraints and should be accepted by the expert system, while a bad test case violates them and should be rejected by the expert system. Because the goal is to test the expert system with difficult examples, we should generate some extreme cases that barely satisfy or violate the data constraints, or contain large or small values. Consider input data on triangles specified by \text{RELATIONAL SCHEMA:} \text{triangle(side1: number, side2: number, side3: number)}. \text{DATA CONSTRAINT:} \text{triangle(X,Y,Z) \land X + Y > Z \land X + Z > Y \land Y + Z > X.} The data constraint says that the sum of any two sides of a triangle is greater than the remaining side. From the above data declaration and data constraint, we can generate the following extreme test cases. (Note that the first five test cases are bad, while the last two are good.) <table> <thead> <tr> <th>EXTREME TEST CASES</th> <th>COMMENTS</th> </tr> </thead> <tbody> <tr> <td>triangle(1, 1, 2)</td> <td>A straight line</td> </tr> <tr> <td>triangle(0, 0, 0)</td> <td>A point</td> </tr> <tr> <td>triangle(4, 0, 3)</td> <td>A zero side</td> </tr> <tr> <td>triangle(1, 2, 3.00001)</td> <td>Close to a triangle</td> </tr> <tr> <td>triangle(9170, 8942, 1)</td> <td>Very small angle</td> </tr> <tr> <td>triangle(.0001, .0001, .0001)</td> <td>Very small triangle</td> </tr> <tr> <td>triangle(83127, 74326, 96652)</td> <td>Very large triangle</td> </tr> </tbody> </table> For an applicative system which takes an input and produces an output, a test case means a simulated instance of input and its expected output. However, for an imperative system that may alter data structures or produce side effects, just generating test cases of input is not enough. An imperative system can be represented by a state machine. There are a number of states. For each state, there are a certain number of actions that take the state into other states. For the state machine, a test case will be actually a test scenario that consists of an initial state, and a sequence of specific actions. The goal is to check if bad states will be encountered when we run the state machine with the test scenario. We note that a bad state means that the state violates integrity constraints or a situation where no actions are available. Consider the following example: Container A can hold 5 gallons of water and container B 2 gallons of water. Initially, A is full and B is empty. Assume that water can be poured from A to B, and B to the drain. We would like to get to a final state where A is empty and B is half-full. The initial and final states are shown in Figure 2. ![Initial State](image1) ![Final State](image2) Figure 2. Initial and Final States We use \(\text{state}(X,Y)\) to denote a state where \(X\) and \(Y\) are the amounts of water in containers A and B, respectively, and use \(\text{pour}(X,Y,Q)\) to denote an operation to pour \(Q\) gallons of water from \(X\) into \(Y\). Let \(\text{transition}(\text{Op},X,Y)\) denote that the operation \(\text{Op}\) changes state \(X\) to state \(Y\), and let \(\text{reach}(\text{Seq},X,Y)\) denote that the sequence of operations, \(\text{Seq}\), changes state \(X\) to state \(Y\). The constraints on states and operations are specified as follows: - \(\text{pour}(a,b,X) \land 0 < X \leq 2\) - \(\text{pour}(b,\text{drain},X) \land 0 < X \leq 2\) - \(\text{state}(X,Y) \land 0 \leq X \leq 5 \land 0 \leq Y \leq 2\) From the constraints, we can generate the following test scenario: \[ \text{initial state} \quad \text{pour}(a,b,2), \text{pour}(a,b,2) \quad \text{input sequence} \quad \text{state}(5,0) \] This is a bad test scenario because the second operation in the input sequence will cause container B to overflow. If we had the following knowledge base, \[ \begin{align*} (1) & \quad \text{transition}(\text{pour}(a,b,Z), \text{state}(X,Y), \text{state}(U,V)) \quad Z > 0 \\ & \quad \text{U} = X-Z \\ & \quad V = Y+Z \end{align*} \] \[ (2) & \quad \text{transition}(\text{pour}(b,\text{drain},Y), \text{state}(X,Y), \text{state}(X,0)) \quad Y > 0 \] \[ (3) & \quad \text{reach}(\text{Seq},S1,S2) \quad \text{transition}(\text{Op},S1,S2) \] \[ (4) & \quad \text{reach}(\text{Seq},S1,S3) \quad \text{transition}(\text{Op},S1,S2), \text{reach}(\text{Seq},S2,S3) \] the bad scenario would be "successfully" processed, because Rule (1) is wrong. The correct version of the rule should be \[ (1') & \quad \text{transition}(\text{pour}(a,b,Z), \text{state}(X,Y), \text{state}(U,V)) \quad Z > 0 \\ & \quad \text{U} = X-Z \\ & \quad V = Y+Z \\ & \quad X > Z \\ & \quad V \leq 2 \] The correct rule does make sure that container B will not overflow. **CONCLUSION** Test cases of input values to an expert system can be generated automatically. However, the expected output and performance for each test case may not be known, or not clearly defined, or stated in qualitative or narrative statements. In this case, the system's output and performance for the generated (simulated) test cases may have to be evaluated by independent human experts. The experts' evaluation results can be stored and used with the test cases again when the expert system is modified. We have described systematic ways for automatic test case generation. For large expert systems, this is essential because manual approaches are tedious and possibly biased. We have started work on implementing components of the test case generator. First, we will generate structure-based test cases because they do not depend upon specifications and metaknowledge. Then, we will consider data-based and finally function-based test cases. REFERENCES THE AUTHORS Dr. Chang received his Ph.D. in Electrical Engineering from the University of California, Berkeley, CA in 1967. His background includes design and development of large-scale knowledge-based systems, and research in program generation, very high level languages, compilers, rapid prototyping, relational data bases, natural language query systems, mechanical theorem proving, and pattern recognition. He wrote two books "Symbolic Logic and Mechanical Theorem Proving" (with Dr. Richard Lee), and "Introduction to Artificial Intelligence Techniques", and published more than 50 papers. He is currently a co-principal investigator of the Knowledge-Based Systems Validation project at the Lockheed AI Center. Dr. Stachowitz received his Ph.D. in Linguistics from the University of Texas at Austin in 1969. His background includes design and development of a large-scale knowledge-based mechanical translation system, computer hardware and software performance evaluation, and research in applicative programming languages, semantic data models, and analytic modeling and performance evaluation of data base machine architectures. He also has performed research in logic and functional knowledge base manipulation and query languages. He is a Senior Research Scientist at Lockheed's Artificial Intelligence Center and co-principal investigator of the Knowledge-Based Systems Validation project.
{"Source-Url": "https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19890010463.pdf", "len_cl100k_base": 4849, "olmocr-version": "0.1.50", "pdf-total-pages": 5, "total-fallback-pages": 0, "total-input-tokens": 17091, "total-output-tokens": 6548, "length": "2e12", "weborganizer": {"__label__adult": 0.00033164024353027344, "__label__art_design": 0.0003285408020019531, "__label__crime_law": 0.00041413307189941406, "__label__education_jobs": 0.001868247985839844, "__label__entertainment": 7.236003875732422e-05, "__label__fashion_beauty": 0.00017893314361572266, "__label__finance_business": 0.00039267539978027344, "__label__food_dining": 0.0003955364227294922, "__label__games": 0.0006227493286132812, "__label__hardware": 0.0015850067138671875, "__label__health": 0.0005869865417480469, "__label__history": 0.0002582073211669922, "__label__home_hobbies": 0.00011444091796875, "__label__industrial": 0.000621795654296875, "__label__literature": 0.00035762786865234375, "__label__politics": 0.00022780895233154297, "__label__religion": 0.0004167556762695313, "__label__science_tech": 0.09442138671875, "__label__social_life": 9.66191291809082e-05, "__label__software": 0.0134735107421875, "__label__software_dev": 0.88232421875, "__label__sports_fitness": 0.00023949146270751953, "__label__transportation": 0.0005555152893066406, "__label__travel": 0.0001722574234008789}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 25042, 0.02887]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 25042, 0.62992]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 25042, 0.868]], "google_gemma-3-12b-it_contains_pii": [[0, 5276, false], [5276, 10990, null], [10990, 14458, null], [14458, 19321, null], [19321, 25042, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5276, true], [5276, 10990, null], [10990, 14458, null], [14458, 19321, null], [19321, 25042, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 25042, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 25042, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 25042, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 25042, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 25042, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 25042, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 25042, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 25042, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 25042, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 25042, null]], "pdf_page_numbers": [[0, 5276, 1], [5276, 10990, 2], [10990, 14458, 3], [14458, 19321, 4], [19321, 25042, 5]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 25042, 0.05143]]}
olmocr_science_pdfs
2024-11-29
2024-11-29
bb35f958502f248e7edbc7815039b64af51d926d
The GCC Quad-Precision Math Library Copyright © 2010-2019 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover Texts being “A GNU Manual,” and with the Back-Cover Texts as in (a) below. A copy of the license is included in the section entitled “GNU Free Documentation License.” (a) The FSF’s Back-Cover Text is: “You have the freedom to copy and modify this GNU manual.” # Short Contents <table> <thead> <tr> <th>Section</th> <th>Page</th> </tr> </thead> <tbody> <tr> <td>Introduction</td> <td>1</td> </tr> <tr> <td>1 Typedef and constants</td> <td>3</td> </tr> <tr> <td>2 Math Library Routines</td> <td>5</td> </tr> <tr> <td>3 I/O Library Routines</td> <td>9</td> </tr> <tr> <td>GNU Free Documentation License</td> <td>11</td> </tr> <tr> <td>4 Reporting Bugs</td> <td>19</td> </tr> </tbody> </table> Table of Contents Introduction .................................................. 1 1 Typedef and constants ................................. 3 2 Math Library Routines ................................. 5 3 I/O Library Routines ................................. 9 3.1 strtoflt128 — Convert from string ................. 9 3.2 quadmath_snprintf — Convert to string ......... 9 GNU Free Documentation License .................... 11 ADDENDUM: How to use this License for your documents . 18 4 Reporting Bugs ........................................ 19 Introduction This manual documents the usage of libquadmath, the GCC Quad-Precision Math Library Application Programming Interface (API). 1 Typedef and constants The following data type has been defined via \texttt{typedef}. \texttt{__complex128}: \texttt{__float128}-based complex number The following macros are defined, which give the numeric limits of the \texttt{__float128} data type. \texttt{FLT128\_MAX}: largest finite number \texttt{FLT128\_MIN}: smallest positive number with full precision \texttt{FLT128\_EPSILON}: difference between 1 and the next larger representable number \texttt{FLT128\_DENORM\_MIN}: smallest positive denormalized number \texttt{FLT128\_MANT\_DIG}: number of digits in the mantissa (bit precision) \texttt{FLT128\_MIN\_EXP}: maximal negative exponent \texttt{FLT128\_MAX\_EXP}: maximal positive exponent \texttt{FLT128\_DIG}: number of decimal digits in the mantissa \texttt{FLT128\_MIN\_10\_EXP}: maximal negative decimal exponent \texttt{FLT128\_MAX\_10\_EXP}: maximal positive decimal exponent The following mathematical constants of type \texttt{__float128} are defined. \texttt{M\_Eq}: the constant e (Euler’s number) \texttt{M\_LOG2Eq}: binary logarithm of 2 \texttt{M\_LOG10Eq}: common, decimal logarithm of 2 \texttt{M\_LN2q}: natural logarithm of 2 \texttt{M\_LN10q}: natural logarithm of 10 \texttt{M\_PIq}: pi \texttt{M\_PI\_2q}: pi divided by two \texttt{M\_PI\_4q}: pi divided by four \texttt{M\_1\_PIq}: one over pi \texttt{M\_2\_PIq}: one over two pi \texttt{M\_2\_SQRTPIQ}: two over square root of pi \texttt{M\_SQRT2q}: square root of 2 \texttt{M\_SQRT1\_2q}: one over square root of 2 2 Math Library Routines The following mathematical functions are available: - acosq: arc cosine function - acoshq: inverse hyperbolic cosine function - asinq: arc sine function - asinhq: inverse hyperbolic sine function - atanq: arc tangent function - atanhq: inverse hyperbolic tangent function - atan2q: arc tangent function - cbrtq: cube root function - ceilq: ceiling value function - copiesignq: copy sign of a number - coshq: hyperbolic cosine function - cosq: cosine function - erfq: error function - erfq: complementary error function - exp2q: base 2 exponential function - expq: exponential function - expmlq: exponential minus 1 function fabsq: absolute value function fdimq: positive difference function finiteq: check finiteness of value floorq: floor value function fmaq: fused multiply and add fmaxq: determine maximum of two values fminq: determine minimum of two values fmodq: remainder value function frexpq: extract mantissa and exponent hypotq: Euclidean distance function ilogbq: get exponent of the value isinfq: check for infinity isnanq: check for not a number issignalingq: check for signaling not a number j0q: Bessel function of the first kind, first order j1q: Bessel function of the first kind, second order jnq: Bessel function of the first kind, n-th order ldexpq: load exponent of the value lgammaq: logarithmic gamma function lrintq: round to nearest integer value llrintq: round to nearest integer value away from zero logbq: get exponent of the value logq: natural logarithm function log10q: base 10 logarithm function log1pq: compute natural logarithm of the value plus one log2q: base 2 logarithm function lrintq: round to nearest integer value lroundq: round to nearest integer value away from zero modf: decompose the floating-point number nan: return quiet NaN nearbyintq: round to nearest integer nextafterq: next representable floating-point number powq: power function remainderq: remainder function remquoq: remainder and part of quotient rintq: round-to-nearest integral value roundq: round-to-nearest integral value, return __float128 scalblnq: compute exponent using FLT_RADIX scalbnq: compute exponent using FLT_RADIX signbitq: return sign bit sincosq: calculate sine and cosine simultaneously sinh: hyperbolic sine function sin: sine function sqrtq: square root function tanq: tangent function tanhq: hyperbolic tangent function tgammaq: true gamma function truncq: round to integer, towards zero y0: Bessel function of the second kind, first order y1: Bessel function of the second kind, second order yn: Bessel function of the second kind, n-th order cabsq complex absolute value function cargq: calculate the argument ccimagq imaginary part of complex number crealq: real part of complex number cacoshq: complex arc hyperbolic cosine function ccosq: complex arc cosine function csinhq: complex arc hyperbolic sine function csinq: complex arc sine function ccatanhq: complex arc hyperbolic tangent function ccatanq: complex arc tangent function ccosq complex cosine function: ccoshq: complex hyperbolic cosine function cexpq: complex exponential function cexpqiq: computes the exponential function of “i” times a real value clogq: complex natural logarithm clog10q: complex base 10 logarithm conj: complex conjugate function cpowq: complex power function cprojq: project into Riemann Sphere csink: complex sine function csinhq: complex hyperbolic sine function csqrtq: complex square root ctanq: complex tangent function cthanhq: complex hyperbolic tangent function 3 I/O Library Routines 3.1 strtoflt128 — Convert from string The function `strtoflt128` converts a string into a `__float128` number. **Syntax** ``` __float128 strtoflt128 (const char *s, char **sp) ``` **Arguments:** - `s` : input string - `sp` : the address of the next character in the string The argument `sp` contains, if not NULL, the address of the next character following the parts of the string, which have been read. **Example** ``` #include <quadmath.h> int main () { __float128 r; r = strtoflt128 ("1.2345678", NULL); return 0; } ``` 3.2 quadmath_snprintf — Convert to string The function `quadmath_snprintf` converts a `__float128` floating-point number into a string. It is a specialized alternative to `snprintf`, where the format string is restricted to a single conversion specifier with Q modifier and conversion specifier e, E, f, F, g, G, a or A, with no extra characters before or after the conversion specifier. The %m$ or *m$ style must not be used in the format. **Syntax** ``` int quadmath_snprintf (char *s, size_t size, const char *format, ...) ``` **Arguments:** - `s` : output string - `size` : byte size of the string, including tailing NUL - `format` : conversion specifier string **Note** On some targets when supported by the C library hooks are installed for `printf` family of functions, so that `printf ("%Qe", 1.2Q);` etc. works too. **Example** ``` #include <quadmath.h> #include <stdlib.h> #include <stdio.h> int main () { __float128 r; __float128 r; int prec = 20; ``` int width = 46; char buf[128]; r = 2.0q; r = sqrtq (r); int n = quadmath_snprintf (buf, sizeof buf, "%+-#*.20Qe", width, r); if ((size_t) n < sizeof buf) printf ("%s\n", buf); /* Prints: +1.41421356237309504880e+00 */ quadmath_snprintf (buf, sizeof buf, "%Qa", r); if ((size_t) n < sizeof buf) printf ("%s\n", buf); /* Prints: 0x1.6a09e667f3bcc908b2fb1366ea96p+0 */ n = quadmath_snprintf (NULL, 0, "%+-#46.*Qe", prec, r); if (n > -1) { char *str = malloc (n + 1); if (str) { quadmath_snprintf (str, n + 1, "%+-#46.*Qe", prec, r); printf ("%s\n", str); /* Prints: +1.41421356237309504880e+00 */ } free (str); } return 0; GNU Free Documentation License Version 1.3, 3 November 2008 http://fsf.org/ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. 0. PREAMBLE The purpose of this License is to make a manual, textbook, or other functional and useful document free in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or non-commercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others. This License is a kind of “copyleft”, which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software. We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference. 1. APPLICABILITY AND DEFINITIONS This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The “Document”, below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as “you”. You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law. A “Modified Version” of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language. A “Secondary Section” is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document’s overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them. The “Invariant Sections” are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none. The “Cover Texts” are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words. A “Transparent” copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images com- posed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not “Transparent” is called “Opaque”. Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only. The “Title Page” means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, “Title Page” means the text near the most prominent appearance of the work’s title, preceding the beginning of the body of the text. The “publisher” means any person or entity that distributes copies of the Document to the public. A section “Entitled XYZ” means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as “Acknowledgements”, “Dedications”, “Endorsements”, or “History”.) To “Preserve the Title” of such a section when you modify the Document means that it remains a section “Entitled XYZ” according to this definition. The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License. 2. VERBATIM COPYING You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3. You may also lend copies, under the same conditions stated above, and you may publicly display copies. 3. COPYING IN QUANTITY If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document’s license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects. If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages. If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public. It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document. 4. MODIFICATIONS You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version: A. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission. B. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement. C. State on the Title page the name of the publisher of the Modified Version, as the publisher. D. Preserve all the copyright notices of the Document. E. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices. F. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below. G. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document’s license notice. H. Include an unaltered copy of this License. I. Preserve the section Entitled “History”, Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled “History” in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence. J. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the “History” section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission. K. For any section Entitled “Acknowledgements” or “Dedications”, Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein. L. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles. M. Delete any section Entitled “Endorsements”. Such a section may not be included in the Modified Version. N. Do not retitle any existing section to be Entitled “Endorsements” or to conflict in title with any Invariant Section. O. Preserve any Warranty Disclaimers. If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version’s license notice. These titles must be distinct from any other section titles. You may add a section Entitled “Endorsements”, provided it contains nothing but endorsements of your Modified Version by various parties—for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard. You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one. The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version. 5. COMBINING DOCUMENTS You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers. The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work. In the combination, you must combine any sections Entitled “History” in the various original documents, forming one section Entitled “History”; likewise combine any sections Entitled “Acknowledgements”, and any sections Entitled “Dedications”. You must delete all sections Entitled “Endorsements.” 6. COLLECTIONS OF DOCUMENTS You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects. You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document. 7. AGGREGATION WITH INDEPENDENT WORKS A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an “aggregate” if the copyright resulting from the compilation is not used to limit the legal rights of the compilation’s users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document. If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document’s Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate. 8. TRANSLATION Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail. If a section in the Document is Entitled “Acknowledgements”, “Dedications”, or “History”, the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title. 9. TERMINATION You may not copy, modify, sublicense, or distribute the Document except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automatically terminate your rights under this License. However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, receipt of a copy of some or all of the same material does not give you any rights to use it. 10. FUTURE REVISIONS OF THIS LICENSE The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See http://www.gnu.org/copyleft/. Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License “or any later version” applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. If the Document specifies that a proxy can decide which future versions of this License can be used, that proxy’s public statement of acceptance of a version permanently authorizes you to choose that version for the Document. 11. RELICENSING “Massive Multiauthor Collaboration Site” (or “MMC Site”) means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works. A public wiki that anybody can edit is an example of such a server. A “Massive Multiauthor Collaboration” (or “MMC”) contained in the site means any set of copyrightable works thus published on the MMC site. “CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0 license published by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco, California, as well as future copyleft versions of that license published by that same organization. “Incorporate” means to publish or republish a Document, in whole or in part, as part of another Document. An MMC is “eligible for relicensing” if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections, and (2) were thus incorporated prior to November 1, 2008. The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing. ADDENDUM: How to use this License for your documents To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page: Copyright (C) year your name. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ‘‘GNU Free Documentation License’’. If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the “with...Texts.” line with this: with the Invariant Sections being list their titles, with the Front-Cover Texts being list, and with the Back-Cover Texts being list. If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation. If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software. 4 Reporting Bugs Bugs in the GCC Quad-Precision Math Library implementation should be reported via
{"Source-Url": "https://gcc.gnu.org/onlinedocs/libquadmath.pdf", "len_cl100k_base": 7147, "olmocr-version": "0.1.50", "pdf-total-pages": 26, "total-fallback-pages": 0, "total-input-tokens": 44222, "total-output-tokens": 8364, "length": "2e12", "weborganizer": {"__label__adult": 0.0002677440643310547, "__label__art_design": 0.000469207763671875, "__label__crime_law": 0.0006814002990722656, "__label__education_jobs": 0.0009560585021972656, "__label__entertainment": 9.375810623168944e-05, "__label__fashion_beauty": 8.881092071533203e-05, "__label__finance_business": 0.0006442070007324219, "__label__food_dining": 0.000316619873046875, "__label__games": 0.0007691383361816406, "__label__hardware": 0.0007772445678710938, "__label__health": 0.00024008750915527344, "__label__history": 0.00016641616821289062, "__label__home_hobbies": 8.040666580200195e-05, "__label__industrial": 0.00032019615173339844, "__label__literature": 0.00029754638671875, "__label__politics": 0.0002161264419555664, "__label__religion": 0.00032067298889160156, "__label__science_tech": 0.0267181396484375, "__label__social_life": 7.134675979614258e-05, "__label__software": 0.02386474609375, "__label__software_dev": 0.94189453125, "__label__sports_fitness": 0.0001481771469116211, "__label__transportation": 0.00025582313537597656, "__label__travel": 0.00012135505676269533}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 31775, 0.02374]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 31775, 0.32704]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 31775, 0.85062]], "google_gemma-3-12b-it_contains_pii": [[0, 36, false], [36, 601, null], [601, 971, null], [971, 971, null], [971, 1535, null], [1535, 1535, null], [1535, 1674, null], [1674, 1674, null], [1674, 3182, null], [3182, 3182, null], [3182, 3832, null], [3832, 4826, null], [4826, 6358, null], [6358, 6700, null], [6700, 8248, null], [8248, 8921, null], [8921, 11926, null], [11926, 15253, null], [15253, 18571, null], [18571, 21535, null], [21535, 24664, null], [24664, 27950, null], [27950, 30384, null], [30384, 31649, null], [31649, 31775, null], [31775, 31775, null]], "google_gemma-3-12b-it_is_public_document": [[0, 36, true], [36, 601, null], [601, 971, null], [971, 971, null], [971, 1535, null], [1535, 1535, null], [1535, 1674, null], [1674, 1674, null], [1674, 3182, null], [3182, 3182, null], [3182, 3832, null], [3832, 4826, null], [4826, 6358, null], [6358, 6700, null], [6700, 8248, null], [8248, 8921, null], [8921, 11926, null], [11926, 15253, null], [15253, 18571, null], [18571, 21535, null], [21535, 24664, null], [24664, 27950, null], [27950, 30384, null], [30384, 31649, null], [31649, 31775, null], [31775, 31775, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 31775, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 31775, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 31775, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 31775, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 31775, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 31775, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 31775, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 31775, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 31775, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 31775, null]], "pdf_page_numbers": [[0, 36, 1], [36, 601, 2], [601, 971, 3], [971, 971, 4], [971, 1535, 5], [1535, 1535, 6], [1535, 1674, 7], [1674, 1674, 8], [1674, 3182, 9], [3182, 3182, 10], [3182, 3832, 11], [3832, 4826, 12], [4826, 6358, 13], [6358, 6700, 14], [6700, 8248, 15], [8248, 8921, 16], [8921, 11926, 17], [11926, 15253, 18], [15253, 18571, 19], [18571, 21535, 20], [21535, 24664, 21], [24664, 27950, 22], [27950, 30384, 23], [30384, 31649, 24], [31649, 31775, 25], [31775, 31775, 26]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 31775, 0.02353]]}
olmocr_science_pdfs
2024-11-30
2024-11-30
26e6c8ab03c2464b4e8e78f09f29f6ed35d0b9bf
Package ‘RSQLite’ July 17, 2022 Title SQLite Interface for R Version 2.2.15 Date 2022-07-15 Description Embeds the SQLite database engine in R and provides an interface compliant with the DBI package. The source for the SQLite engine and for various extensions in a recent version is included. System libraries will never be consulted because this package relies on static linking for the plugins it includes; this also ensures a consistent experience across all installations. License LGPL (>= 2.1) BugReports https://github.com/r-dbi/RSQLite/issues Depends R (>= 3.1.0) Imports bit64, blob (>= 1.2.0), DBI (>= 1.1.0), memoise, methods, pkgconfig, Rcpp (>= 1.0.7) Suggests callr, DBItest (>= 1.7.0), gert, gh, knitr, rmarkdown, hms, rvest, testthat, xml2 LinkingTo plogr (>= 0.2.0), Rcpp VignetteBuilder knitr Encoding UTF-8 RoxygenNote 7.2.0 Collate 'RcppExports.R' 'SQLiteConnection.R' 'SQLKeywords_SQLiteConnection.R' 'SQLiteDriver.R' 'SQLite.R' 'SQLiteResult.R' 'coerce.R' 'compatRowNames.R' 'copy.R' 'datasetsDb.R' 'dbAppendTable_SQLiteConnection.R' 'dbBeginTransaction.R' 'dbBegin_SQLiteConnection.R' 'dbBind_SQLiteResult.R' 'dbClearResult_SQLiteResult.R' 'dbColumnInfo_SQLiteResult.R' 'dbCommit_SQLiteConnection.R' 'dbConnect_SQLiteConnection.R' 'dbConnect_SQLiteDriver.R' 'dbDataType_SQLiteConnection.R' 'dbData_type_SQLiteDriver.R' 'dbDisconnect_SQLiteConnection.R' 1 'dbExistsTable_SQLiteConnection_character.R' 'dbFetch_SQLiteResult.R' 'dbGetException_SQLiteConnection.R' 'dbGetInfo_SQLiteConnection.R' 'dbGetInfo_SQLiteDriver.R' 'dbGetPreparedQuery.R' 'dbGetPreparedQuery_SQLiteConnection_character_data.frame.R' 'dbGetRowCount_SQLiteResult.R' 'dbGetRowsAffected_SQLiteResult.R' 'dbGetStatement_SQLiteResult.R' 'dbHasCompleted_SQLiteResult.R' 'dbIsValid_SQLiteConnection.R' 'dbIsValid_SQLiteDriver.R' 'dbIsValid_SQLiteResult.R' 'dbListResults_SQLiteConnection.R' ' dbListTables_SQLiteConnection.R' 'dbListTables_SQLiteConnection_SQL.R' 'dbQuoteIdentifier_SQLiteConnection_character.R' 'dbReadTable_SQLiteConnection_character.R' 'dbRemoveTable_SQLiteConnection_character.R' 'dbRollback_SQLiteConnection.R' 'dbSendPreparedQuery.R' 'dbSendPreparedQuery_SQLiteConnection_character_data.frame.R' 'dbSendQuery_SQLiteConnection_character.R' 'dbUnloadDriver_SQLiteDriver.R' 'dbUnquoteIdentifier_SQLiteConnection_SQL.R' 'dbWriteTable_SQLiteConnection_character_character.R' 'dbWriteTable_SQLiteConnection_character_data.frame.R' 'db_bind.R' 'deprecated.R' 'export.R' 'fetch_SQLiteResult.R' 'initExtension.R' 'initRegExp.R' 'isSQLKeyword_SQLiteConnection_character.R' 'make.db.names_SQLiteConnection_character.R' 'names.R' 'pkgconfig.R' 'show_SQLiteConnection.R' 'sqlData_SQLiteConnection.R' 'table.R' 'transactions.R' 'utils.R' 'zzz.R' Config/autostyle/scope line_breaks Config/autostyle/strict false NeedsCompilation yes Author Kirill Müller [aut, cre] (<https://orcid.org/0000-0002-1416-3412>), Hadley Wickham [aut], David A. James [aut], Seth Falcon [aut], D. Richard Hipp [ctb] (for the included SQLite sources), Dan Kennedy [ctb] (for the included SQLite sources), Joe Mistachkin [ctb] (for the included SQLite sources), SQLite Authors [ctb] (for the included SQLite sources), Liam Healy [ctb] (for the included SQLite sources), R Consortium [fnd], RStudio [cph] Maintainer Kirill Müller <krlmr+r@mailbox.org> Repository CRAN Date/Publication 2022-07-17 20:50:05 UTC **datasetsDb** A sample sqlite database **Description** This database is bundled with the package, and contains all data frames in the datasets package. **Usage** ```r datasetsDb() ``` **Examples** ```r library(DBI) db <- RSQLite::datasetsDb() dbListTables(db) dbBegin(db, "CO2") dbGetQuery(db, "SELECT * FROM CO2 WHERE conc < 100") dbDisconnect(db) ``` **dbBegin_SQLiteConnection** *SQLite transaction management* **Description** By default, SQLite is in auto-commit mode. `dbBegin()` starts a SQLite transaction and turns auto-commit off. `dbCommit()` and `dbRollback()` commit and rollback the transaction, respectively and turn auto-commit on. `DBI::dbWithTransaction()` is a convenient wrapper that makes sure that `dbCommit()` or `dbRollback()` is called. Usage ## S4 method for signature 'SQLiteConnection' \[\text{dbBegin}(\text{conn}, \ .name = \text{NULL}, \ldots, \ .name = \text{NULL})\] ## S4 method for signature 'SQLiteConnection' \[\text{dbCommit}(\text{conn}, \ .name = \text{NULL}, \ldots, \ .name = \text{NULL})\] ## S4 method for signature 'SQLiteConnection' \[\text{dbRollback}(\text{conn}, \ .name = \text{NULL}, \ldots, \ .name = \text{NULL})\] Arguments - **conn** - a `SQLiteConnection` object, produced by `DBI::dbConnect()` - **.name** - For backward compatibility, do not use. - **...** - Needed for compatibility with generic. Otherwise ignored. - **name** - Supply a name to use a named savepoint. This allows you to nest multiple transactions. See Also The corresponding generic functions `DBI::dbBegin()` , `DBI::dbCommit()` , and `DBI::dbRollback()`. Examples ```r library(DBI) con <- dbConnect(SQLite(), ":memory:") dbWriteTable(con, "arrests", datasets::USArrests) dbGetQuery(con, "select count(*) from arrests") rs <- dbSendStatement(con, "DELETE from arrests WHERE Murder > 1") dbGetRowsAffected(rs) dbClearResult(rs) dbGetQuery(con, "select count(*) from arrests") dbRollback(con) dbGetQuery(con, "select count(*) from arrests")[[1], ] rs <- dbSendStatement(con, "DELETE FROM arrests WHERE Murder > 5") dbClearResult(rs) dbCommit(con) dbGetQuery(con, "SELECT count(*) FROM arrests")[[1], ] # Named savepoints can be nested dbBegin(con, name = "a") dbBegin(con, name = "b") dbRollback(con, name = "b") dbCommit(con, name = "a") ``` dbDisconnect(con) --- **Description** Returns the contents of a database table given by name as a data frame. **Usage** ```r ## S4 method for signature 'SQLiteConnection,character' dbReadTable( conn, name, ..., row.names = pkgconfig::get_config("RSQLite::row.names.table", FALSE), check.names = TRUE, select.cols = NULL ) ``` **Arguments** - `conn`: a `SQLiteConnection` object, produced by `DBI::dbConnect()`. - `name`: a character string specifying a table name. SQLite table names are *not* case sensitive, e.g., table names `ABC` and `abc` are considered equal. - `...`: Needed for compatibility with generic. Otherwise ignored. - `row.names`: Either TRUE, FALSE, NA or a string. If TRUE, always translate row names to a column called "row_names". If FALSE, never translate row names. If NA, translate rownames only if they’re a character vector. A string is equivalent to TRUE, but allows you to override the default name. For backward compatibility, NULL is equivalent to FALSE. - `check.names`: If TRUE, the default, column names will be converted to valid R identifiers. - `select.cols`: Deprecated, do not use. **Details** Note that the data frame returned by `dbReadTable()` only has primitive data, e.g., it does not coerce character data to factors. **Value** A data frame. See Also The corresponding generic function DBI::dbReadTable(). Examples library(DBI) db <- RSQLite::datasetsDb() dbReadTable(db, "mtcars") dbReadTable(db, "mtcars", row.names = FALSE) dbDisconnect(db) Description Functions for writing data frames or delimiter-separated files to database tables. Usage ``` ## S4 method for signature 'SQLiteConnection,character,character' dbWriteTable( conn, name, value, ... field.types = NULL, overwrite = FALSE, append = FALSE, header = TRUE, colClasses = NA, row.names = FALSE, nrows = 50, sep = ",", eol = "\n", skip = 0, temporary = FALSE ) ``` ``` ## S4 method for signature 'SQLiteConnection,character,data.frame' dbWriteTable( conn, name, value, ... row.names = pkgconfig::get_config("RSQLite::row.names.table", FALSE), ``` overwrite = FALSE, append = FALSE, field.types = NULL, temporary = FALSE ) Arguments conn a SQLiteConnection object, produced by DBI::dbConnect() name a character string specifying a table name. SQLite table names are not case sensitive, e.g., table names ABC and abc are considered equal. value a data.frame (or coercible to data.frame) object or a file name (character). In the first case, the data.frame is written to a temporary file and then imported to SQLite; when value is a character, it is interpreted as a file name and its contents imported to SQLite. ... Needed for compatibility with generic. Otherwise ignored. field.types character vector of named SQL field types where the names are the names of new table's columns. If missing, types inferred with DBI::dbDataType()). overwrite a logical specifying whether to overwrite an existing table or not. Its default is FALSE. append a logical specifying whether to append to an existing table in the DBMS. Its default is FALSE. header is a logical indicating whether the first data line (but see skip) has a header or not. If missing, it value is determined following read.table() convention, namely, it is set to TRUE if and only if the first row has one fewer field that the number of columns. colClasses Character vector of R type names, used to override defaults when imputing classes from on-disk file. row.names A logical specifying whether the row.names should be output to the output DBMS table; if TRUE, an extra field whose name will be whatever the R identifier "row.names" maps to the DBMS (see DBI::make.db.names()). If NA will add rows names if they are characters, otherwise will ignore. nrows Number of rows to read to determine types. sep The field separator, defaults to ",". eol The end-of-line delimiter, defaults to '\n'. skip number of lines to skip before reading the data. Defaults to 0. temporary a logical specifying whether the new table should be temporary. Its default is FALSE. Details In a primary key column qualified with AUTOINCREMENT, missing values will be assigned the next largest positive integer, while nonmissing elements/cells retain their value. If the autoincrement column exists in the data frame passed to the value argument, the NA elements are overwritten. Similarly, if the key column is not present in the data frame, all elements are automatically assigned a value. initExtension Add useful extension functions Description Several extension functions are included in the RSQLite package. When enabled via initExtension(), these extension functions can be used in SQL queries. Extensions must be enabled separately for each connection. Usage initExtension(db, extension = c("math", "regexp", "series", "csv")) Arguments db A SQLiteConnection object to load these extensions into. extension The extension to load. Details The "math" extension functions are written by Liam Healy and made available through the SQLite website (https://www.sqlite.org/contrib). This package contains a slightly modified version of the original code. See the section "Available functions in the math extension" for details. The "regexp" extension provides a regular-expression matcher for POSIX extended regular expressions, as available through the SQLite source code repository (https://sqlite.org/src/file?filename=ext/misc/regexp.c). SQLite will then implement the A regexp B operator, where A is the string to be matched and B is the regular expression. The "series" extension loads the table-valued function generate_series(), as available through the SQLite source code repository (https://sqlite.org/src/file?filename=ext/misc/series.c). The "csv" extension loads the function csv() that can be used to create virtual tables, as available through the SQLite source code repository (https://sqlite.org/src/file?filename=ext/misc/csv.c). See Also The corresponding generic function DBI::dbWriteTable(). Examples con <- dbConnect(SQLite()) dbWriteTable(con, "mtcars", mtcars) dbReadTable(con, "mtcars") # A zero row data frame just creates a table definition. dbWriteTable(con, "mtcars2", mtcars[0, ]) dbReadTable(con, "mtcars2") dbDisconnect(con) Available functions in the math extension Math functions: acos, acosh, asin, asinh, atan, atan2, atanh, atn2, ceil, cos, cosh, cot, coth, degrees, difference, exp, floor, log, log10, pi, power, radians, sign, sin, sinh, sqrt, square, tan, tanh String functions: charindex, leftstr, ltrim, padc, padl, padr, proper, replace, replicate, reverse, rightstr, rtrim, strfilter, trim Aggregate functions: stdev, variance, mode, median, lower_quartile, upper_quartile Examples ```r library(DBI) db <- RSQLite::datasetsDb() # math RSQLite::initExtension(db) dbGetQuery(db, "SELECT stdev(mpg) FROM mtcars") sd(mtcars$mpg) # regexp RSQLite::initExtension(db, "regexp") dbGetQuery(db, "SELECT * FROM mtcars WHERE carb REGEXP '^[12]'") # series RSQLite::initExtension(db, "series") dbGetQuery(db, "SELECT value FROM generate_series(0, 20, 5);") dbDisconnect(db) # csv db <- dbConnect(RSQLite::SQLite()) RSQLite::initExtension(db, "csv") # use the filename argument to mount CSV files from disk sql <- paste0("CREATE VIRTUAL TABLE tbl USING ", "csv(data='1,2', schema='CREATE TABLE x(a INT, b INT)')") dbExecute(db, sql) dbGetQuery(db, "SELECT * FROM tbl") ``` <table> <thead> <tr> <th>rssqliteVersion</th> <th>RSQLite version</th> </tr> </thead> </table> Description RSQLite version Usage rssqliteVersion() Value A character vector containing header and library versions of RSQLite. Examples RSQLite::sqliteVersion() --- SQLite Connect to an SQLite database Description Together, SQLite() and dbConnect() allow you to connect to a SQLite database file. See DBI::dbSendQuery() for how to issue queries and receive results. Usage SQLite(...) ## S4 method for signature 'SQLiteConnection' dbConnect(drv, ...) ## S4 method for signature 'SQLiteDriver' dbConnect( drv, dbname = "", ..., loadable.extensions = TRUE, default.extensions = loadable.extensions, cache_size = NULL, synchronous = "off", flags = SQLITE_RWC, vfs = NULL, bigint = c("integer64", "integer", "numeric", "character"), extended_types = FALSE ) ## S4 method for signature 'SQLiteConnection' dbDisconnect(conn, ...) Arguments ... In previous versions, SQLite() took arguments. These have now all been moved to dbConnect(), and any arguments here will be ignored with a warning. drv, conn An objected generated by SQLite(), or an existing SQLiteConnection. If an connection, the connection will be cloned. dbname The path to the database file. SQLite keeps each database instance in one single file. The name of the database is the file name, thus database names should be legal file names in the running platform. There are two exceptions: - "" will create a temporary on-disk database. The file will be deleted when the connection is closed. - "-memory:" or "file::memory:" will create a temporary in-memory database. loadable.extensions When TRUE (default) SQLite3 loadable extensions are enabled. Setting this value to FALSE prevents extensions from being loaded. default.extensions When TRUE (default) the initExtension() function will be called on the new connection. Setting this value to FALSE requires calling initExtension() manu- ally. cache_size Advanced option. A positive integer to change the maximum number of disk pages that SQLite holds in memory (SQLite's default is 2000 pages). See https://www.sqlite.org/pragmas.html#pragma_cache_size for details. synchronous Advanced options. Possible values for synchronous are "off" (the default), "normal", or "full". Users have reported significant speed ups using synchronous = "off", and the SQLite documentation itself implies considerable improved performance at the very modest risk of database corruption in the unlikely case of the operating system (not the R application) crashing. See https://www. sqlite.org/pragmas.html#pragma_synchronous for details. flags SQLITE_RWC: open the database in read/write mode and create the database file if it does not already exist; SQLITE_RW: open the database in read/write mode. Raise an error if the file does not already exist; SQLITE_RO: open the database in read only mode. Raise an error if the file does not already exist vfs Select the SQLite3 OS interface. See https://www.sqlite.org/vfs.html for details. Allowed values are "unix-posix", "unix-unix-afp", "unix-unix-flock", "unix-dotfile", and "unix-none". bigint The R type that 64-bit integer types should be mapped to, default is bit64::integer64, which allows the full range of 64 bit integers. extended_types When TRUE columns of type DATE, DATETIME / TIMESTAMP, and TIME are mapped to corresponding R-classes, c.f. below for details. Defaults to FALSE. Details Connections are automatically cleaned-up after they’re deleted and reclaimed by the GC. You can use DBI::dbDisconnect() to terminate the connection early, but it will not actually close until all open result sets have been closed (and you’ll get a warning message to this effect). Value SQLite() returns an object of class SQLiteDriver. dbConnect() returns an object of class SQLiteConnection. Extended Types When parameter `extended_types = TRUE` date and time columns are directly mapped to corresponding R-types. How exactly depends on whether the actual value is a number or a string: <table> <thead> <tr> <th>Column type</th> <th>Value is numeric</th> <th>Value is Text</th> </tr> </thead> <tbody> <tr> <td>DATE</td> <td>Count of days since 1970-01-01</td> <td>YMD formatted string (e.g. 2020-01-23)</td> </tr> <tr> <td>TIME</td> <td>Count of (fractional) seconds</td> <td>HMS formatted string (e.g. 12:34:56)</td> </tr> <tr> <td>DATETIME / TIMESTAMP</td> <td>Count of (fractional) seconds since midnight 1970-01-01 UTC</td> <td>DATE and TIME as above separated by a space</td> </tr> </tbody> </table> If a value cannot be mapped an NA is returned in its place with a warning. See Also The corresponding generic functions `DBI::dbConnect()` and `DBI::dbDisconnect()`. Examples ```r library(DBI) # Initialize a temporary in memory database and copy a data.frame into it con <- dbConnect(RSQLite::SQLite(), "::memory:" data(USArrests) dbWriteTable(con, "USArrests", USArrests) dbListTables(con) # Fetch all query results into a data frame: dbGetQuery(con, "SELECT * FROM USArrests") # Or do it in batches rs <- dbSendQuery(con, "SELECT * FROM USArrests") d1 <- dbFetch(rs, n = 10) # extract data in chunks of 10 rows d2 <- dbFetch(rs, n = -1) # extract all remaining data dbHasCompleted(rs) # clean up dbDisconnect(con) ``` sqliteCopyDatabase Copy a SQLite database Description Copies a database connection to a file or to another database connection. It can be used to save an in-memory database (created using `dbname = "::memory:"` or `dbname = "file::memory:"`) to a file or to create an in-memory database a copy of another database. sqliteSetBusyHandler Usage sqliteCopyDatabase(from, to) Arguments from A SQLiteConnection object. The main database in from will be copied to to. to A SQLiteConnection object pointing to an empty database. Author(s) Seth Falcon References https://www.sqlite.org/backup.html Examples library(DBI) # Copy the built in databaseDb() to an in-memory database con <- dbConnect(RSQLite::SQLite(), "::memory:" dbListTables(con) db <- RSQLite::datasetsDb() RSQLite::sqliteCopyDatabase(db, con) dbDisconnect(db) dbListTables(con) dbDisconnect(con) sqliteSetBusyHandler Configure what SQLite should do when the database is locked Description When a transaction cannot lock the database, because it is already locked by another one, SQLite by default throws an error: database is locked. This behavior is usually not appropriate when concurrent access is needed, typically when multiple processes write to the same database. sqliteSetBusyHandler() lets you set a timeout or a handler for these events. When setting a timeout, SQLite will try the transaction multiple times within this timeout. To set a timeout, pass an integer scalar to sqliteSetBusyHandler(). Another way to set a timeout is to use a PRAGMA, e.g. the SQL query PRAGMA busy_timeout=3000 sets the busy timeout to three seconds. Usage sqliteSetBusyHandler(dbObj, handler) Arguments dbObj A SQLiteConnection object. handler Specifies what to do when the database is locked by another transaction. It can be: • NULL: fail immediately, • an integer scalar: this is a timeout in milliseconds that corresponds to PRAGMA busy_timeout, • an R function: this function is called with one argument, see details below. Details Note that SQLite currently does not schedule concurrent transactions fairly. If multiple transactions are waiting on the same database, any one of them can be granted access next. Moreover, SQLite does not currently ensure that access is granted as soon as the database is available. Make sure that you set the busy timeout to a high enough value for applications with high concurrency and many writes. If the handler argument is a function, then it is used as a callback function. When the database is locked, this will be called with a single integer, which is the number of calls for same locking event. The callback function must return an integer scalar. If it returns 0L, then no additional attempts are made to access the database, and an error is thrown. Otherwise another attempt is made to access the database and the cycle repeats. Handler callbacks are useful for debugging concurrent behavior, or to implement a more sophisticated busy algorithm. The latter is currently considered experimental in RSQLite. If the callback function fails, then RSQLite will print a warning, and the transaction is aborted with a "database is locked" error. Note that every database connection has its own busy timeout or handler function. Calling sqliteSetBusyHandler() on a connection that is not connected is an error. Value Invisible NULL. See Also https://www.sqlite.org/c3ref/busy_handler.html Index bit64::integer64, 11 datasetsDb, 3 dbBegin, SQLiteConnection-method (dbBegin_SQLiteConnection), 3 dbBegin_SQLiteConnection, 3 dbCommit, SQLiteConnection-method (dbBegin_SQLiteConnection), 3 dbCommit_SQLiteConnection (dbBegin_SQLiteConnection), 3 dbConnect(), 10 dbConnect, SQLiteConnection-method (SQLite), 10 dbConnect, SQLiteDriver-method (SQLite), 10 dbConnect_SQLiteConnection (SQLite), 10 dbConnect_SQLiteDriver (SQLite), 10 dbDisconnect, SQLiteConnection-method (SQLite), 10 dbDisconnect_SQLiteConnection (SQLite), 10 DBI::dbBegin(), 4 DBI::dbCommit(), 4 DBI::dbConnect(), 4, 5, 7, 12 DBI::dbDataType(), 7 DBI::dbDisconnect(), 11, 12 DBI::dbReadTable(), 6 DBI::dbRollback(), 4 DBI::dbSendQuery(), 10 DBI::dbWithTransaction(), 3 DBI::dbWriteTable(), 8 DBI::make.db.names(), 7 dbReadTable, SQLiteConnection, character-method (dbReadTable_SQLiteConnection_character), 5 dbReadTable_SQLiteConnection_character, 5 dbRollback, SQLiteConnection-method (dbBegin_SQLiteConnection), 3 dbRollback_SQLiteConnection (dbBegin_SQLiteConnection), 3 dbWriteTable, SQLiteConnection, character, character-method (dbWriteTable_SQLiteConnection_character_character), 6 dbWriteTable, SQLiteConnection, character, data.frame-method (dbWriteTable_SQLiteConnection_character_character), 6 dbWriteTable_SQLiteConnection_character_character, 6 dbWriteTable_SQLiteConnection_character_data.frame (dbWriteTable_SQLiteConnection_character_character), 6 initExtension, 8 initExtension(), 11 read.table(), 7 RSQLite (SQLite), 10 RSQLite-package (SQLite), 10 rsqLiteVersion, 9 SQLite, 10 SQLite(), 10 sqlite-transaction (dbBegin_SQLiteConnection), 3 SQLITE_RO (SQLite), 10 SQLITE_RW (SQLite), 10 SQLITE_RWC (SQLite), 10 SQLiteConnection, 4, 5, 7, 8, 10, 11, 14 sqliteCopyDatabase, 12 SQLiteDriver, 11 sqliteSetBusyHandler, 13
{"Source-Url": "https://cran.r-project.org/web/packages/RSQLite/RSQLite.pdf", "len_cl100k_base": 6112, "olmocr-version": "0.1.50", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 33201, "total-output-tokens": 7148, "length": "2e12", "weborganizer": {"__label__adult": 0.00023794174194335935, "__label__art_design": 0.00019025802612304688, "__label__crime_law": 0.00022041797637939453, "__label__education_jobs": 0.00024080276489257812, "__label__entertainment": 7.31348991394043e-05, "__label__fashion_beauty": 7.396936416625977e-05, "__label__finance_business": 0.00011223554611206056, "__label__food_dining": 0.0002343654632568359, "__label__games": 0.0004684925079345703, "__label__hardware": 0.0006966590881347656, "__label__health": 0.00016963481903076172, "__label__history": 0.0001437664031982422, "__label__home_hobbies": 5.066394805908203e-05, "__label__industrial": 0.00020885467529296875, "__label__literature": 0.00011605024337768556, "__label__politics": 0.00011235475540161131, "__label__religion": 0.0002484321594238281, "__label__science_tech": 0.00824737548828125, "__label__social_life": 7.402896881103516e-05, "__label__software": 0.037994384765625, "__label__software_dev": 0.94970703125, "__label__sports_fitness": 0.0001786947250366211, "__label__transportation": 0.00017118453979492188, "__label__travel": 0.0001404285430908203}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 24112, 0.01738]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 24112, 0.51252]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 24112, 0.68154]], "google_gemma-3-12b-it_contains_pii": [[0, 1646, false], [1646, 3650, null], [3650, 4426, null], [4426, 5959, null], [5959, 7269, null], [7269, 8092, null], [8092, 10505, null], [10505, 12288, null], [12288, 13576, null], [13576, 14686, null], [14686, 17321, null], [17321, 19121, null], [19121, 20423, null], [20423, 22281, null], [22281, 24112, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1646, true], [1646, 3650, null], [3650, 4426, null], [4426, 5959, null], [5959, 7269, null], [7269, 8092, null], [8092, 10505, null], [10505, 12288, null], [12288, 13576, null], [13576, 14686, null], [14686, 17321, null], [17321, 19121, null], [19121, 20423, null], [20423, 22281, null], [22281, 24112, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 24112, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 24112, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 24112, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 24112, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 24112, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 24112, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 24112, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 24112, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 24112, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 24112, null]], "pdf_page_numbers": [[0, 1646, 1], [1646, 3650, 2], [3650, 4426, 3], [4426, 5959, 4], [5959, 7269, 5], [7269, 8092, 6], [8092, 10505, 7], [10505, 12288, 8], [12288, 13576, 9], [13576, 14686, 10], [14686, 17321, 11], [17321, 19121, 12], [19121, 20423, 13], [20423, 22281, 14], [22281, 24112, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 24112, 0.01341]]}
olmocr_science_pdfs
2024-12-01
2024-12-01
f00cd68593e8b9d0f06465e5fea107ea736d8446
[REMOVED]
{"Source-Url": "https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/20040082055.pdf", "len_cl100k_base": 7977, "olmocr-version": "0.1.53", "pdf-total-pages": 17, "total-fallback-pages": 0, "total-input-tokens": 43111, "total-output-tokens": 10135, "length": "2e12", "weborganizer": {"__label__adult": 0.0003190040588378906, "__label__art_design": 0.0002894401550292969, "__label__crime_law": 0.0002524852752685547, "__label__education_jobs": 0.0006351470947265625, "__label__entertainment": 5.716085433959961e-05, "__label__fashion_beauty": 0.0001347064971923828, "__label__finance_business": 0.00019156932830810547, "__label__food_dining": 0.00032067298889160156, "__label__games": 0.0003790855407714844, "__label__hardware": 0.0006165504455566406, "__label__health": 0.0004146099090576172, "__label__history": 0.0001875162124633789, "__label__home_hobbies": 8.428096771240234e-05, "__label__industrial": 0.00037217140197753906, "__label__literature": 0.0002620220184326172, "__label__politics": 0.00024580955505371094, "__label__religion": 0.0004444122314453125, "__label__science_tech": 0.01318359375, "__label__social_life": 8.177757263183594e-05, "__label__software": 0.004215240478515625, "__label__software_dev": 0.9765625, "__label__sports_fitness": 0.0002601146697998047, "__label__transportation": 0.000461578369140625, "__label__travel": 0.0001595020294189453}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 39828, 0.02084]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 39828, 0.52229]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 39828, 0.84016]], "google_gemma-3-12b-it_contains_pii": [[0, 215, false], [215, 848, null], [848, 3554, null], [3554, 7239, null], [7239, 7950, null], [7950, 11530, null], [11530, 14852, null], [14852, 16924, null], [16924, 20112, null], [20112, 22350, null], [22350, 24969, null], [24969, 26730, null], [26730, 28859, null], [28859, 30865, null], [30865, 33581, null], [33581, 36531, null], [36531, 39828, null]], "google_gemma-3-12b-it_is_public_document": [[0, 215, true], [215, 848, null], [848, 3554, null], [3554, 7239, null], [7239, 7950, null], [7950, 11530, null], [11530, 14852, null], [14852, 16924, null], [16924, 20112, null], [20112, 22350, null], [22350, 24969, null], [24969, 26730, null], [26730, 28859, null], [28859, 30865, null], [30865, 33581, null], [33581, 36531, null], [36531, 39828, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 39828, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 39828, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 39828, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 39828, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 39828, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 39828, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 39828, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 39828, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 39828, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 39828, null]], "pdf_page_numbers": [[0, 215, 1], [215, 848, 2], [848, 3554, 3], [3554, 7239, 4], [7239, 7950, 5], [7950, 11530, 6], [11530, 14852, 7], [14852, 16924, 8], [16924, 20112, 9], [20112, 22350, 10], [22350, 24969, 11], [24969, 26730, 12], [26730, 28859, 13], [28859, 30865, 14], [30865, 33581, 15], [33581, 36531, 16], [36531, 39828, 17]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 39828, 0.0]]}
olmocr_science_pdfs
2024-12-08
2024-12-08
d0b3646e97b7bae608e44a4923755184e7185788
[REMOVED]
{"len_cl100k_base": 8020, "olmocr-version": "0.1.53", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 37041, "total-output-tokens": 8758, "length": "2e12", "weborganizer": {"__label__adult": 0.0004718303680419922, "__label__art_design": 0.00305938720703125, "__label__crime_law": 0.0002474784851074219, "__label__education_jobs": 0.0013561248779296875, "__label__entertainment": 0.000354766845703125, "__label__fashion_beauty": 0.0002722740173339844, "__label__finance_business": 0.0003387928009033203, "__label__food_dining": 0.00045561790466308594, "__label__games": 0.0010881423950195312, "__label__hardware": 0.0191650390625, "__label__health": 0.00044655799865722656, "__label__history": 0.0003364086151123047, "__label__home_hobbies": 0.0007433891296386719, "__label__industrial": 0.0021953582763671875, "__label__literature": 0.00025010108947753906, "__label__politics": 0.0002263784408569336, "__label__religion": 0.0009279251098632812, "__label__science_tech": 0.302734375, "__label__social_life": 0.00015544891357421875, "__label__software": 0.05511474609375, "__label__software_dev": 0.60888671875, "__label__sports_fitness": 0.0003509521484375, "__label__transportation": 0.0004715919494628906, "__label__travel": 0.000247955322265625}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 29045, 0.0065]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 29045, 0.11182]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 29045, 0.82727]], "google_gemma-3-12b-it_contains_pii": [[0, 6219, false], [6219, 8207, null], [8207, 9451, null], [9451, 11814, null], [11814, 13369, null], [13369, 14226, null], [14226, 16128, null], [16128, 17471, null], [17471, 19513, null], [19513, 20461, null], [20461, 22326, null], [22326, 24033, null], [24033, 24986, null], [24986, 27713, null], [27713, 29045, null]], "google_gemma-3-12b-it_is_public_document": [[0, 6219, true], [6219, 8207, null], [8207, 9451, null], [9451, 11814, null], [11814, 13369, null], [13369, 14226, null], [14226, 16128, null], [16128, 17471, null], [17471, 19513, null], [19513, 20461, null], [20461, 22326, null], [22326, 24033, null], [24033, 24986, null], [24986, 27713, null], [27713, 29045, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 29045, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 29045, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 29045, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 29045, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 29045, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 29045, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 29045, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 29045, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 29045, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 29045, null]], "pdf_page_numbers": [[0, 6219, 1], [6219, 8207, 2], [8207, 9451, 3], [9451, 11814, 4], [11814, 13369, 5], [13369, 14226, 6], [14226, 16128, 7], [16128, 17471, 8], [17471, 19513, 9], [19513, 20461, 10], [20461, 22326, 11], [22326, 24033, 12], [24033, 24986, 13], [24986, 27713, 14], [27713, 29045, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 29045, 0.07857]]}
olmocr_science_pdfs
2024-12-10
2024-12-10
72a0ecc83cc9c52aefe495b34a0270fa6e23339f
mod_com_amd About mod_com_amd is a FreeSWITCH™ commercial module used to analyze call progress and identify if it was answered by a human or a machine. Introduction FreeSWITCH™ provides a licensed commercial Answering Machine Detection module. A key technology for autodialers is the ability to detect live human pickup and answering machine. Since there is no indication/hardware signal when a call is answered by an answering machine or voicemail system, autodialer systems have to analyze incoming audio in order to make a prediction. Currently, there is no algorithm that can achieve 100% accuracy. Getting Licenses All FreeSWITCH™ purchases must be done through our billing system. Go to http://freeswitch.com, click on the top right menu called Account and then on Register. After registering, go to login page at https://freeswitch.com/clientarea.php and provide your credentials. Once logged in the system, you'll see a menu on top of the page called Products, click and then click on Order New Products. Direct link is https://freeswitch.com/cart.php. On the cart page, scroll down your screen and you'll see AMD product description. Click on the Order Now button. Direct link is https://freeswitch.com/cart.php?a=confproduct&i=1 On the next screen you need to type how many licenses you need. A license is needed for each created channel that you need to activate the detection. If you have 5 simultaneous calls and want to detect who’s answering you’ll need 5 ports/channels. Click on Add to Cart after selecting the number of licenses. Now you can proceed to payment, and the end of the page there’s a Complete Order button. The payment method is PayPal, if you don’t have paypal account please proceed to PayPal’s registration page and follow the instructions. If you need to activate licenses for different servers you need to buy them separately. For example, if you need 5 licenses to server A and more 10 to server B, add 5 licenses to the cart and then add 10 more again, you’ll receive two activation codes, one for each server. After the payment, PayPal will notify FreeSWITCH™ billing system about the new payment and the license(s) will be sent to your email. This process takes a few minutes, if you do not receive the email in a few minutes please contact us at consulting@freeswitch.org or at #freeswitch at irc.freenode.net. For more information on how to contact us please visit IRC page. Installing Updated Instructions for FreeSWITCH 1.8 Install the package ```bash apt-get install freeswitch-mod-com-amd ``` Uncomment or create in autoload_configs/modules.conf.xml ```xml <load module="mod_com_amd"/> ``` Validate license freeswitch-license-validator freeswitch product licencing tool You will require one or more sales codes to activate licences Enter a sales code, or a blank line to end: 0abd19753bf28fbb88a5d74 Enter a sales code, or a blank line to end: Sales codes to be activated: 0abd19753bf28fbb88a5d74 OK (Y/N)? y Success. The file licences.zip contains valid licences. Unzip this to /etc/freeswitch/ Unzip the key unzip licences.zip Archive: licences.zip inflating: 0abd19753bf28fbb88a5d74.conf Copy key to /etc/freeswitch (do not put the zip file in there) cp 0abd19753bf28fbb88a5d74.conf /etc/freeswitch Shutdown freeswitch systemctl stop freeswitch Start license server freeswitch-license-server Scanning /etc/freeswitch/0abd19753bf28fbb88a5d74.conf for licences Purchase code 0abd19753bf28fbb88a5d74 10 channels of AMD Start freeswitch again systemctl start freeswitch Check that amd is communicating with license server fs_cli -x amd_info Success checking AMD/0 AMD license available => 10 AMD license allocated => 0 Do some testing in dialplan. Download test wav file Answering_Machine.wav. Checking for available license notice how we check if license are available by checking a regex against zero using the amd_info api <condition field="$expand regex $[amd_info]|available => 0" expression="false"> if regex is false, then proceed with amd usage, else if true, do anti actions to notify customer with a custom sound file <anti-action application="playback" data="${sounds_dir}/All_Circuits_Busy.mp3"/> <anti-action application="hangup"/> Older Instructions for Freeswitch 1.6 We have packaged our commercial modules into a single installer. All products currently offered (mod_com_amd, mod_com_g729, mod_com_g719, mod_com_g728) are all installed and take up very little space. ### Downloading and Running Installer ```bash cd /tmp wget http://files.freeswitch.org/amd/fs-latest-installer chmod +x fs-latest-installer ./fs-latest-installer ``` This will guide you thru some installation steps. We try to detect the most common places your FreeSWITCH™ installation may be located. If we can't detect it then we will prompt for information about where your FreeSWITCH™ is installed. You can optionally you can provide the data as arguments to the fs-latest-installer binary: ### Installer arguments ``` ./fs-latest-installer <bin_path> <mods_path> <config_path> ``` Once you accept the EULA, you'll see output similar to this: ### Installing ``` Thank You! Running Installer Stopping license server Installing new license server Installing new FreeSWITCH module Installing activation utility Creating license directory Running ldconfig... Cleaning up... Now you can activate your product license(s) by running /usr/local/freeswitch/bin/validator Thank you Done. ``` Once complete you'll need to activate your licenses using the validator outlined in the installation completion/thank you message. You'll use the same validator application for any of our commercial products that are available from our online store. Once you start the validator you'll see output similar to this: Licencing tool - Installing new licence. freeswitch product licencing tool You will require one or more sales codes to activate licences Enter a sales code, or a blank line to end: 8c87ca579c46258a5e2ee9f98ca3f93ca4752d26 Enter a sales code, or a blank line to end: Sales codes to be activated: 8c87ca579c46258a5e2ee9f98ca3f93ca4752d26 OK (Y/N)? Y Success. The file licences.zip contains valid licences. Unzip this to /etc/freeswitch/ The resulting licences.zip will be in the current working directory, Unzip and copy the .conf files into /etc/freeswitch: Unzip Licenses unzip licences.zip Archive: licences.zip inflating: 8c87ca579c46258a5e2ee9f98ca3f93ca4752d26.conf cp 8c87ca579c46258a5e2ee9f98ca3f93ca4752d26.conf /etc/freeswitch Hardcode Path Here /etc/freeswitch is a hard coded path the freeswitch_license_server will auto-scan up restart... You MUST put your <HEX>.conf file in /etc/freeswitch regardless of where you've installed FreeSWITCH. To make the license process aware of your new licenses please run: Reloading licence server pkill -HUP freeswitch_license_server This will make the license server rescan the directory adding any additional licenses to your list of resources its capable of licensing. We just activated a license for mod_com_amd which when loading the module will look like this: Loading mod_com_amd freeswitch@internal> amd_info AMD license available => 20 AMD license allocated => 0 freeswitch@internal> amd_available true freeswitch@internal> amd_count 20 As you can see its seeing the licenses that were just installed, you can use the various api calls registered to manage your licenses. Default Configuration The default mod_com_amd configuration will be suitable in most cases, but if you need to tweak the configuration go to /usr/local/freeswitch/conf/autoload_configs and open amd.conf.xml: ``` <configuration name="amd.conf" description="AMD Configuration"> <!-- AMD --> <settings> <!-- silent_threshold: The level of volume to consider talking or not talking, same scale as used in mod_conference --> <param name="silent_threshold" value="256"/> <!-- silent_initial: Time in ms for there to be silence after answer in order to result in "silent-initial" with status of person --> <param name="silent_initial" value="4500"/> <!-- silent_after_intro: Time in ms after an initial non silent greeting in order to result in silent-after-intro with status of person --> <param name="silent_after_intro" value="1000"/> <!-- silent_max_session: Time in ms of total silence before we allow detection to complete --> <param name="silent_max_session" value="200"/> <!-- noise_max_intro: Time in ms length of initial intro over which in order to result in max-intro with status of person --> <param name="noise_max_intro" value="1250"/> <!-- noise_min_length: Time in ms minimum to be considered a word --> <param name="noise_min_length" value="120"/> <!-- noise_inter_silence: Time in ms of silence to be considered a word break --> <param name="noise_inter_silence" value="30"/> <!-- noise_max_count: If we have more than this many noise hits (words) result will be "max-count" with status of machine --> <param name="noise_max_count" value="6"/> <!-- total_analysis_time: total time in ms that we will try to analyze a call --> <param name="total_analysis_time" value="5000"/> <!-- debug: set to 1 to get more debug information --> <param name="debug" value="1"/> </settings> </configuration> ``` Overriding Config Values via Dialplan ``` <action application="voice_start" data="silent_threshold=96, silent_initial=3500, silent_after_intro=1500, silent_max_session=200, noise_max_intro=2250, noise_min_length=175, noise_inter_silence=50, noise_max_count=10, total_analysis_time=5000, debug=1"/> ``` Examples Let's figure out how can we use the mod_com_amd. XML Dialplan Example The first way you can use mod_com_amd is from the xml dialplan. When the module is loaded, three application are created: Let's build a dialplan that when the call gets answered by a machine one message gets delivered to the voicemail: **AMD Dialplan XML Example** ```xml <extension name="amd_example" continue="false"> <condition field="destination_number" expression="^5551212$"> <action application="set" data="media_bug_answer_req=true"/> <action application="set" data="amd_execute_on_machine=transfer machine_detected XML default"/> <action application="voice_start"/> <action application="playback" data="/usr/local/freeswitch/sounds/en/us/callie/ivr/8000/ivr-welcome_to_freeswitch.wav"/> <action application="playback" data="/usr/local/freeswitch/sounds/en/us/callie/ivr/8000/ivr-welcome_to_freeswitch.wav"/> <action application="playback" data="/usr/local/freeswitch/sounds/en/us/callie/ivr/8000/ivr-welcome_to_freeswitch.wav"/> <action application="playback" data="/usr/local/freeswitch/sounds/en/us/callie/ivr/8000/ivr-welcome_to_freeswitch.wav"/> </condition> </extension> <extension name="Found machine"> <condition field="destination_number" expression="^(machine_detected)$"> <action application="wait_for_silence" data="300 30 5 25000"/> <action application="sleep" data="8000"/> <action application="playback" data="/usr/local/freeswitch/sounds/en/us/callie/ivr/8000/ivr-welcome_to_freeswitch.wav"/> <action application="info"/> <action application="hangup"/> </condition> </extension> ``` Pay attention to the variable `amd_execute_on_machine` and the application `voice_start`. When the call gets answered, FreeSWITCH™ will route it to extension "amd_example". This extension will set the variable `amd_execute_on_machine`, which will transfer the call to destination "machine_detected" at context "default" if the call gets answered by a machine, otherwise the playback actions will get executed (dialplan lines 6, 7, 8 and 9). If a machine answers this call, it'll be transferred to our next extension, `machine_detected`, which can be useful when you want to leave message in the customer voicemail, in this case you can use the application `wait_for_silence` to wait the end of voicemail initial greeting and then leave your message. `mod_com_amd` sets a variable called "amd_status" and his value can be "human" or "machine". You can see the value with the "info" application (dialplan line 20). In this first example, you can originate a call to 5551212 using: ### Originating call ``` bgapi originate {ignore_early_media=true}sofia/profile/number 5551212 ``` This will make a call to `sofia/profile/number` and when answered FreeSWITCH™ will look for extension that matches 5551212 in your dialplan. ### Lua Example If you're building your routing logic with Lua, you can use the same application and variables used earlier in the xml dialplan. Example: dialer.lua local dst_number = argv[1] -- Connecting to the freeswitch API. api = freeswitch.API() use_amd = api:executeString("amd_available") subscriber_session = freeswitch.Session("{ignore_early_media=true}sofia/gateway/mygw/ .. dst_number") while (subscriber_session:ready() and not subscriber_session:answered()) do -- Waiting for answer. freeswitch.msleep(500) end if subscriber_session:ready() and subscriber_session:answered() then freeswitch.consoleLog("INFO", string.format("Number answered call %s.", dst_number)) if use_amd == "true" then subscriber_session:execute("voice_start") -- Giving some time to AMD to work on the call. subscriber_session:sleep(3000) subscriber_session:execute("voice_stop") amd_detect = subscriber_session:getVariable("amd_status") if amd_detect == "machine" then freeswitch.consoleLog("INFO", "amd_status: machine") subscriber_session:execute("wait_for_silence", "300 30 5 25000") subscriber_session:hangup() return end -- Do your actions if human answered. Ex. Transfer to operator/user 100. subscriber_session:execute("bridge", "user/100") end else freeswitch.consoleLog("INFO", string.format("Cannot call %s", dst_number)) return end Call this lua script using: luarun dialer.lua 55552222 Testing Dialplan XML for self testing the config setting... be sure to download the Answering_Machine.wav file and put in your sounds directory. With this setup, you should be able to tweak settings and get a feel for their values beyond the default. <extension name="amd_test" continue="false"> <condition field="destination_number" expression="^(amd_test|263)$"> <action application="set" data="amd_execute_on_machine=transfer machine_found XML default"/> <action application="set" data="amd_execute_on_person=transfer person_found XML default"/> <action application="set" data="amd_execute_on Unsure=transfer amd Unsure XML default"/> <action application="voice_start"/> <action application="set" data="api_on_answer=uuid_displace ${uuid} start ${sounds_dir} /Answering_Machine.wav 0 mr"/> <action application="answer"/> <action application="waitforresult" data="ivr/ivr-one_moment_please.wav"/> <action application="sleep" data="200"/> <action application="playback" data="tone_stream://%(200,100,500,400,300,50,25);loops=2"/> <action application="sleep" data="200"/> <action application="log" data="CRIT AMD Result is => ${amd_status} => ${amd_result}"/> <action application="hangup"/> </condition> </extension> <extension name="Found Machine"> <condition field="destination_number" expression="^(machine_found)$"> <action application="playback" data="ivr/ivr-welcome_to_freeswitch.wav"/> <action application="log" data="CRIT AMD result Machine Found is => ${amd_status} => ${amd_result}"/> <action application="voice_stop"/> <action application="hangup"/> </condition> </extension> <extension name="Found Person"> <condition field="destination_number" expression="^(person_found)$"> <action application="playback" data="misc/if_you_are_this_person.wav"/> <action application="log" data="CRIT AMD result Machine Found is => ${amd_status} => ${amd_result}"/> <action application="voice_stop"/> <action application="hangup"/> </condition> </extension> <extension name="AMD Unsure"> <condition field="destination_number" expression="^(amd_unsure)$"> <action application="playback" data="misc/error.wav"/> <action application="log" data="CRIT AMD result Machine Found is => ${amd_status} => ${amd_result}"/> <action application="voice_stop"/> <action application="hangup"/> </condition> </extension> more technical info about mod_com_amd uuid_displace have options [m]ux and [r]ead, so you can hear the ensuing found extension audio, and also induce the answering machine file onto the read channel so amd can operate on it. mod_amd - Answering Machine Detection for FreeSWITCH mod_amd supplies three different dialplan apps and several channel variables. It also fires events during the detection process. They are listed here for reference. Apps: voice_start - starts the answering machine detection on a channel voice_stop - stops the answering machine detection on a channel waitforresult [<file to play while waiting>] - waits for AMD to return a result, and optionally playback a file Channel variables, results: amd_status - Contains whatever was detected: 'person', 'machine', 'unsure' Basically, anything other than 'machine' should be assumed to be a human amd_result - Contains more information about what was detected: 'too-long' - detection process took longer than total_analysis_time (amd.conf.xml) 'max-count' - max noisy frames detected, probably a machine speaking 'max-intro' - max noisy frames detected during intro, probably a machine speaking 'silent-initial' - nothing heard on line, assume human 'silent-after-intro' - short burst of noisy frames followed by silence - probably human Channel variables, control: execute_on_machine_app - application to execute if machine detected execute_on_machine_arg - argument to application to execute if machine detected Events: CUSTOM::AMD::EVENT - Action: Start Talking CUSTOM::AMD::EVENT - Action: Stop Talking SWITCH_MEDIA_BUG_ADD - Fired at start of detection process SWITCH_MEDIA_BUG_REMOVE - Fired at stop of detection process Look for variable amd_status header USAGE mod_amd can be used three ways: via event socket, where an event-based script watches for AMD events and acts accordingly via the supplied JavaScript file via the dialplan by setting "execute_on_machine_app" and "execute_on_machine_arg" See default.xml for simple examples
{"Source-Url": "https://freeswitch.org/confluence/download/temp/pdfexport-20190623-230619-1202-9438/FREESWITCH-mod_com_amd-230619-1202-9439.pdf?contentType=application/pdf", "len_cl100k_base": 4434, "olmocr-version": "0.1.50", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 27300, "total-output-tokens": 5952, "length": "2e12", "weborganizer": {"__label__adult": 0.00043582916259765625, "__label__art_design": 0.0002779960632324219, "__label__crime_law": 0.0004780292510986328, "__label__education_jobs": 0.00021970272064208984, "__label__entertainment": 0.0001583099365234375, "__label__fashion_beauty": 0.0001894235610961914, "__label__finance_business": 0.0017518997192382812, "__label__food_dining": 0.00023818016052246096, "__label__games": 0.000919818878173828, "__label__hardware": 0.00994873046875, "__label__health": 0.0001852512359619141, "__label__history": 8.803606033325195e-05, "__label__home_hobbies": 0.00012755393981933594, "__label__industrial": 0.0005698204040527344, "__label__literature": 0.00010967254638671876, "__label__politics": 0.0001761913299560547, "__label__religion": 0.0002779960632324219, "__label__science_tech": 0.00824737548828125, "__label__social_life": 6.890296936035156e-05, "__label__software": 0.358154296875, "__label__software_dev": 0.61669921875, "__label__sports_fitness": 0.0001786947250366211, "__label__transportation": 0.00033211708068847656, "__label__travel": 0.0001418590545654297}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 19607, 0.03666]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 19607, 0.11244]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 19607, 0.69644]], "google_gemma-3-12b-it_contains_pii": [[0, 787, false], [787, 1067, null], [1067, 1245, null], [1245, 1554, null], [1554, 2055, null], [2055, 2666, null], [2666, 3772, null], [3772, 4227, null], [4227, 5780, null], [5780, 8204, null], [8204, 10830, null], [10830, 13656, null], [13656, 15418, null], [15418, 17810, null], [17810, 19607, null]], "google_gemma-3-12b-it_is_public_document": [[0, 787, true], [787, 1067, null], [1067, 1245, null], [1245, 1554, null], [1554, 2055, null], [2055, 2666, null], [2666, 3772, null], [3772, 4227, null], [4227, 5780, null], [5780, 8204, null], [8204, 10830, null], [10830, 13656, null], [13656, 15418, null], [15418, 17810, null], [17810, 19607, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 19607, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 19607, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 19607, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 19607, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 19607, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 19607, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 19607, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 19607, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 19607, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 19607, null]], "pdf_page_numbers": [[0, 787, 1], [787, 1067, 2], [1067, 1245, 3], [1245, 1554, 4], [1554, 2055, 5], [2055, 2666, 6], [2666, 3772, 7], [3772, 4227, 8], [4227, 5780, 9], [5780, 8204, 10], [8204, 10830, 11], [10830, 13656, 12], [13656, 15418, 13], [15418, 17810, 14], [17810, 19607, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 19607, 0.0]]}
olmocr_science_pdfs
2024-11-28
2024-11-28
6b06bc9b9123092bcadaa65e28d0b80977e64c7a
[REMOVED]
{"Source-Url": "http://www.ntu.edu.sg/home/assourav/papers/DEXA-14-Keynote.pdf", "len_cl100k_base": 5713, "olmocr-version": "0.1.50", "pdf-total-pages": 11, "total-fallback-pages": 0, "total-input-tokens": 26250, "total-output-tokens": 7487, "length": "2e12", "weborganizer": {"__label__adult": 0.0005064010620117188, "__label__art_design": 0.0023632049560546875, "__label__crime_law": 0.00038552284240722656, "__label__education_jobs": 0.0032024383544921875, "__label__entertainment": 0.00027680397033691406, "__label__fashion_beauty": 0.0003132820129394531, "__label__finance_business": 0.00033664703369140625, "__label__food_dining": 0.0005292892456054688, "__label__games": 0.0007162094116210938, "__label__hardware": 0.0011930465698242188, "__label__health": 0.0011234283447265625, "__label__history": 0.0007081031799316406, "__label__home_hobbies": 0.00010830163955688477, "__label__industrial": 0.0005116462707519531, "__label__literature": 0.0010690689086914062, "__label__politics": 0.0003046989440917969, "__label__religion": 0.0007333755493164062, "__label__science_tech": 0.24658203125, "__label__social_life": 0.00017583370208740234, "__label__software": 0.035247802734375, "__label__software_dev": 0.70263671875, "__label__sports_fitness": 0.00030231475830078125, "__label__transportation": 0.0006394386291503906, "__label__travel": 0.0002913475036621094}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 34077, 0.02806]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 34077, 0.35233]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 34077, 0.91374]], "google_gemma-3-12b-it_contains_pii": [[0, 2320, false], [2320, 6110, null], [6110, 8520, null], [8520, 10502, null], [10502, 13769, null], [13769, 17469, null], [17469, 21153, null], [21153, 24562, null], [24562, 27818, null], [27818, 30848, null], [30848, 34077, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2320, true], [2320, 6110, null], [6110, 8520, null], [8520, 10502, null], [10502, 13769, null], [13769, 17469, null], [17469, 21153, null], [21153, 24562, null], [24562, 27818, null], [27818, 30848, null], [30848, 34077, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 34077, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 34077, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 34077, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 34077, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 34077, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 34077, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 34077, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 34077, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 34077, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 34077, null]], "pdf_page_numbers": [[0, 2320, 1], [2320, 6110, 2], [6110, 8520, 3], [8520, 10502, 4], [10502, 13769, 5], [13769, 17469, 6], [17469, 21153, 7], [21153, 24562, 8], [24562, 27818, 9], [27818, 30848, 10], [30848, 34077, 11]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 34077, 0.0]]}
olmocr_science_pdfs
2024-12-03
2024-12-03
6134ed319356910ec6b4d4ac6ee945a33e0de451
[REMOVED]
{"Source-Url": "https://hal.archives-ouvertes.fr/hal-01339152/file/978-3-642-36796-0_8_Chapter.pdf", "len_cl100k_base": 5957, "olmocr-version": "0.1.53", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 33111, "total-output-tokens": 8165, "length": "2e12", "weborganizer": {"__label__adult": 0.00041556358337402344, "__label__art_design": 0.0009522438049316406, "__label__crime_law": 0.000514984130859375, "__label__education_jobs": 0.0017452239990234375, "__label__entertainment": 0.00011771917343139648, "__label__fashion_beauty": 0.00023365020751953125, "__label__finance_business": 0.003337860107421875, "__label__food_dining": 0.0004982948303222656, "__label__games": 0.0007634162902832031, "__label__hardware": 0.0010080337524414062, "__label__health": 0.0006914138793945312, "__label__history": 0.0005030632019042969, "__label__home_hobbies": 0.00014483928680419922, "__label__industrial": 0.0018434524536132812, "__label__literature": 0.0004372596740722656, "__label__politics": 0.00043392181396484375, "__label__religion": 0.0005006790161132812, "__label__science_tech": 0.1588134765625, "__label__social_life": 0.00014340877532958984, "__label__software": 0.0207061767578125, "__label__software_dev": 0.80322265625, "__label__sports_fitness": 0.0004122257232666016, "__label__transportation": 0.0021533966064453125, "__label__travel": 0.0003056526184082031}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 35082, 0.02969]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 35082, 0.36917]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 35082, 0.90073]], "google_gemma-3-12b-it_contains_pii": [[0, 1477, false], [1477, 3991, null], [3991, 7457, null], [7457, 9310, null], [9310, 11762, null], [11762, 14111, null], [14111, 15892, null], [15892, 17043, null], [17043, 20032, null], [20032, 22728, null], [22728, 24306, null], [24306, 25938, null], [25938, 28971, null], [28971, 31668, null], [31668, 35082, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1477, true], [1477, 3991, null], [3991, 7457, null], [7457, 9310, null], [9310, 11762, null], [11762, 14111, null], [14111, 15892, null], [15892, 17043, null], [17043, 20032, null], [20032, 22728, null], [22728, 24306, null], [24306, 25938, null], [25938, 28971, null], [28971, 31668, null], [31668, 35082, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 35082, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 35082, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 35082, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 35082, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 35082, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 35082, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 35082, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 35082, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 35082, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 35082, null]], "pdf_page_numbers": [[0, 1477, 1], [1477, 3991, 2], [3991, 7457, 3], [7457, 9310, 4], [9310, 11762, 5], [11762, 14111, 6], [14111, 15892, 7], [15892, 17043, 8], [17043, 20032, 9], [20032, 22728, 10], [22728, 24306, 11], [24306, 25938, 12], [25938, 28971, 13], [28971, 31668, 14], [31668, 35082, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 35082, 0.04698]]}
olmocr_science_pdfs
2024-12-06
2024-12-06
65dd7cc0930308e7aef9e3a9e280ff66e405bcf6
Very Fast Decision Table Execution of Propositional Expert Systems Robert M. Colomb Charles Y.C. Chung CSIRO Division of Information Technology Box 1599 North Ryde NSW 2113 Australia colomb@syd.dit.csiro.au Abstract A formal equivalence between propositional expert systems and decision tables is proved, and a practicable procedure given to perform the transformation between propositional expert systems and decision tables. The method gave an order of magnitude speed increase for a well-known expert system in routine use. The method is very general: adaptations are shown for forward and backward chaining inexact reasoning engines, and systems where some facts have high cost and must be determined only if necessary. A particular application for the decision table representation is in real-time expert systems, since a simple hardware implementation is available which gives further orders of magnitude increase in performance. Finally, the decision table representation greatly simplifies the problem of completeness and consistency checking. Introduction Expert systems which rely on the propositional calculus are very common, and the standard implementations are very computationally expensive, both in time and memory. For example, the COLOSSUS system (Beinat & Smart 1989) has 6500 rules, and runs on a very large mainframe computer. It requires 20 megabytes of real memory per user, and has a response time measured in minutes. In this paper, we show that a propositional expert system can be mechanically transformed into a decision table. Decision tables are very simple computational structures which can be executed very quickly and require little memory. With very simple hardware assist, it is possible to build systems with hundreds of rules with execution times of a few tens of microseconds, which could greatly expand the useful domain of expert system technology, especially in real time applications. In addition, the decision table representation greatly simplifies the problem of checking rules for completeness and consistency. After a few definitions, we present a general proof of the equivalence of propositional expert systems and decision tables. We then describe a computationally practicable algorithm for performing the transformation, and describe its application to a real system. The algorithm can be easily adapted to a much more space efficient product, shown in the next section. We describe generalizations to inexact reasoning systems and systems where some facts have a high cost and must be obtained only if necessary. We show how the decision table form is particularly adapted to real time applications, and finally consider consistency and completeness checking in the decision table representation. The paper completes with a conclusion section. This restriction to propositional systems differs from the main stream of parallel production system research (Gupta et al. 1986, Stolfo 1985), which concentrates on systems like OPS-5, which are based on the first order predicate calculus. Definitions A propositional expert system is a set of propositions in Horn clause form. Each clause consists of an antecedent, which is a conjunction of elementary propositions, and a consequent, consisting of a single elementary proposition. A clause will be called a rule in the following. Note that a proposition with disjunctions in its antecedent or conclusions in its conclusion can be easily transformed into clausal form. Elementary propositions can be classified into three mutually exclusive groups: facts, which appear only in antecedents; conclusions, which appear only as consequences; and assertions, which appear both in antecedents and conclusions. We designate the set of facts as \( P = \{ f_i \} \), conclusions as \( C = \{ c_j \} \), assertions \( A = \{ a_i \} \) and rules as \( R = \{ r_j \} \). It is convenient to consider a fact as an assignment to a variable of one of a small number of possible values. We thus obtain a set \( X \) of variables \( x_j \) each of which has a set of possible values \( V_i \), and every fact is a proposition of the form \( x_j = v \) for \( v \) in \( V_i \). An input \( I \) is a conjunction of assignments to a subset of the variables. The assignment is incomplete if the subset is proper. (An incomplete input corresponds to the values of some of the variables being unknown.) In applying an expert system \( R \) to an input \( I \), we obtain a propositional system \( P \) consisting of the conjunction of \( I \) with the disjunction of the rules in \( R \), and consider the conclusions \( C \). A conclusion is determined by the input if it is a logical consequence of \( P \); inconsistent with the input if its negation is a logical consequence of \( P \); and consistent with the input if its negation is not a logical consequence of \( P \). A conclusion consistent with an input may be determined by it, but not necessarily. A decision table is a table with one column for each variable and an additional column for an action. Each row of the table contains an assignment of values to variables and an associated action. An incomplete assignment is equivalent to a don't care condition for the variables without values. A decision table is executed by presenting it with an assignment I. If any row is a subset of I, its action is executed. Equivalence Between Propositional Expert Systems and Decision Tables A decision table is a propositional expert system. The assignment in a row is a conjunction of propositions, which is the antecedent of a rule. The action of a row is a conclusion. A row is therefore equivalent to a rule, and a collection of rules is a propositional expert system by definition. Note that the propositional system has only facts and conclusions, but no assertions. Such a system will be called a flat expert system and is clearly equivalent to a decision table. A propositional expert system is a decision table. Consider an expert system R with an input I. Associate with I the subset of conclusions determined from the propositional system P given by the conjunction of I with the disjunction of rules in R. Call this subset R(I). R(I) can always be computed since the propositional calculus is decidable. R can thereby be seen as a function mapping the set of assignments into the set of subsets of conclusions. The number of possible assignments is finite. The function can in principle be expressed in an extensional form by writing down each assignment I as a row in a table and appending to it the subset of conclusions R(I). This form is by definition a decision table. This proof is constructive, but unfortunately not practicable, since the number of assignments is exponential in the number of variables. It is, however, general. In particular, it is independent of the inference engine used and of the details of any rules involving assertions. A Practicable Transformation Algorithm This section presents a practicable transformation algorithm, first by making some restrictive assumptions. It is then shown how the algorithm can be modified to remove many of the restrictions. The restrictive assumptions are that the system uses a forward chaining inference engine, and that no assertion is negated in either an antecedent or consequent of a rule. We consider the rules ri in the expert system R as nodes in a graph. An arc is drawn between ri and rj if there is an assertion a which appears as the consequent of ri and in the antecedent of rj. We assume that this graph is acyclic: no proposition is a consequent of a rule of which it is an antecedent, or more generally, no proposition is a consequent of a rule which has an antecedent necessarily logically dependent on it. This graph is essentially the We partition the set of rules into B, those all of whose antecedents are facts; K, those whose consequents are conclusions; and M, the others. (B and K are assumed disjoint. Any rules in B intersect K are flat by definition, so can be removed and added to the flat expert system produced by the algorithm after its completion.) A node r can be labelled by the maximum number of arcs between it and a member of B, as shown in Figure 1. B is the set with label 0, and M can be partitioned into M1, M2, etc. each Mi consisting of the nodes with label i. The label of K is defined as the maximum depth of reasoning of the system R. As shown in the figure, we also label each arc with the assertion from which the arc is derived and each assertion with the maximum label of a node with that assertion as a consequent. This labelling can be done in the course of verifying that the graph has no cycles using an algorithm successively removing nodes with no input arcs. Figure 1 Graphical Representation of Rules Labelled by Distance From Base Lemma 1: Every assertion in an antecedent of a rule of label i must have a label less than i. Proof follows directly from the definitions. Lemma 2: There is at least one rule with every label up to the maximum depth of reasoning. Proof: if a level i were missing, then in the acyclic verification process when stop i were reached there would be no nodes without input arcs and the graph would therefore be cyclic. The algorithm proceeds by replacing each assertion a in the antecedents of rules labelled i with the disjunction of the antecedents of rules in labelled i-1 of which assertion a is a consequent, beginning with label 1. This process in effect collapses the rules onto the conclusions by successively replacing intermediate assertions with expressions which imply them. The resulting propositions have only facts in their antecedents and only conclusions as consequents, can be expressed in clausal form, therefore form a flat expert system and therefore are equivalent to a decision table. A detailed presentation of the algorithm with a worked example is given in Colomb (1989). The assumptions can be relaxed. Analysis of Algorithm The algorithm can be divided into two parts: construction of a labelled dependency graph, and production of the decision table from the labelled graph. We begin with a table of rules. An auxiliary data structure is required: an alternative count, which will contain for each assertion the number of rules having that assertion as consequent. The dimensions of the problem will be: - \( r \) the number of rules - \( a \) the average number of assertions per rule - \( d \) the maximum depth of reasoning To construct the dependency graph, we first count the number of alternatives for each assertion. This requires one step per rule, therefore is \( O(r) \). Facts will be taken as having zero alternatives. We then proceed to identify the rules with label \( I \), which are those rules all of whose antecedents have zero alternatives. When a rule is labelled, we decrement the number of alternatives for its consequent assertion, and also record a pointer to the rule in a data structure associated with the assertion. This step requires examination of each antecedent in each rule, and is therefore \( O(ar) \). At the end of the step, additional assertions have a zero alternative count (follows from Lemma 2). The graph can be completely constructed and labelled in one step for each possible label, bounded by the maximum depth of reasoning. Construction of the labelled dependency graph is therefore \( O(ard) \). Production of the decision table is done by repeated traversal of sections of the dependency graph. The cost of a single traversal is highly dependent on the details of data representation, but requires at most examination of each antecedent in each rule, therefore is at most \( O(ar) \). One traversal is required for each row in the resulting decision table. It is therefore necessary to estimate the number of rows. There will certainly be one row in the decision table for each rule whose consequent is a conclusion. Additional rows will arise from alternative paths for satisfying the antecedents of one of these terminal rules. An alternative arises if one of its antecedents is the consequent of more than one rule. It follows that the number of rows is equal to the number of terminal rules if the alternative count is \( I \) for each assertion, and that the number of rows increases in a complex multiplicative way as the alternative counts become greater than \( I \). The problem is the same as converting an arbitrary boolean expression into disjunctive normal form. For example \[(a + b \& (c + d)) \& (e + f)\] converts to \[a \& e + b \& c \& e + b \& d \& e + a \& f + b \& c \& f + b \& d \& f\] We can compute the number of rows during the construction and labelling of the dependency graph. We need an additional data structure full alternative counts paralleling the alternative counts, having one entry for each assertion, and also for each conclusion. For a particular assertion, the latter is the number of rules having that assertion as consequent, while the former will be the number of disjuncts in the disjunctive normal form expression which implies that assertion starting from facts only. Full alternative count is a sort of transitive closure of alternative count, and is initially 0. A fact has full alternative count of \( I \). When a rule is labelled, the full alternative count associated with its consequent is increased by the product of the full alternative counts of its antecedents. The total number of rows in the decision table is the total of the full alternative counts of all the conclusions. If \( N \) is the number of rows, then the production of the decision table at most \( O(Nar) \). This step will tend to dominate the computation time. Backward Chaining The basic algorithm given above is based on a forward chaining inference engine, which starts with known facts and derives conclusions as the antecedents of rules become known. If the rules labelled \( n \) are identified as layer \( n \), this corresponds to a traversal of the dependency graph starting from layer \( I \). This traversal will tend to be layer by layer, necessarily so if negation by failure is employed. We will call the labels and layers obtained in the forward chaining approach as forward labels and layers, respectively. An alternative way to inference is to start from the rules with conclusions as consequents and work backwards, called backward chaining. If the inference engine is backward chaining, we note that a graph can be verified acyclic by successively removing nodes with no output arc. The dependency graph can therefore be labelled with minimum distance from \( K \) rather than from maximum distance from \( B \), and the algorithm modified accordingly. The maximum depth of reasoning \( d \) is clearly unchanged. These labels will be called backward labels. Note that if a node has backward label \( i \) it must have forward label less than \( d - i \). This follows from the observation that step \( d \) of the backward algorithm removes nodes with no input arc. The backward collapse therefore has the same result as the forward collapse since it can be performed by the forward collapse algorithm on the graph with the backward labelling. Under the assumptions made so far, forward and backward chaining have exactly the same result, obtained in the forward chaining case by collapsing the dependency graph from the facts onto the conclusions through the assertions. In the backward chaining case, the assertions are subgoals, and the algorithm collapses the graph from the conclusions onto the facts through the subgoals. The two strategies can We assume that the inference engine does not evaluate a rule with a negated assertion in its antecedent until it has evaluated all rules with that assertion as consequent. Since no rule has a negated assertion as a consequent, the inferencing must rely on the closed world assumption for negation. Let \( r \) be such a rule and let \( i \) be the maximum forward label of any negated assertion in its antecedent. Rule \( r \) is labelled with the maximum of \( i \) and the label of any un-negated assertion in its antecedent. When rule \( r \) is reached in the forward collapse algorithm, any negated assertion is replaced by the negation of the expression implying that assertion. ### Negated Assertions as Consequents In a system where negated assertions are allowed as consequents, the closed world assumption is not needed. An assertion and its negation are in most respects separate propositions and can be treated as such, with two exceptions. First, the negation of an assertion can not label any arc leading from the base set to a rule for which that assertion is a consequent. Second, any input which would imply both the assertion and its negation is forbidden. The algorithm in its course identifies an expression in facts which implies each proposition. If we have for assertion \( E_1 \rightarrow a; E_2 \rightarrow \neg a \); then a valid input must be consistent with \( \neg (E_1 \ and \ E_2) \). ### Test Case The algorithm has been successfully applied to the Garvan ES1 thyroid assay system (Buchanan 1986), which has been in routine use since 1984. It has 600 rules, and an average depth of reasoning of about 4. Some of the rules have negated assertions in their premises, but no rule asserts a negation. The system normally runs on a PDP-11 with a specialized inference engine. For purposes of comparison, it was translated into OPS-5 and run on a Microvax II, where it operates at about 18 rule firings per second, taking about 220 milliseconds to generate a conclusion. It was transformed into a decision table with 5300 rows. There are 34 variables with a total of 93 possible values, so the decision table requires 5300 x 93 bits, or about 62k bytes of memory. There are a number of ways to process a decision table. One is to convert it into a decision tree, using methods like ID3 (Quinlan 1982). This approach is presently under investigation. A balanced decision tree with \( N \) leaves identifies a particular leaf in \( \log_2(N) \) decisions, so that a table with 4096 rows would be computed in 12 decisions, each of which is a simple if...then statement. This approach would clearly be extremely fast on standard hardware. In addition, there is evidence that the decision table can be considerably reduced, also the subject of continuing research. Execution results presented here are from a method using an inexpensive bit-serial content-addressable memory (Colomb & Allen 1989) acting as a co-processor on a Sun 3/160. It is capable of processing a decision table at a rate of about 100 million bits per second, and can compute a decision from the transformed Garvan ES1 in about 2 milliseconds. The processor used has a programming model similar to the MasPar, Distributed Array Processor, and the Connection Machine, all of which are commercially available fine-grained parallel machines. The MasPar, for example, would be able to execute the system in about 20 microseconds. We can conclude from this that it is possible to transform a general propositional expert system into a form that is capable of execution in a time sufficiently short that it opens many possibilities for the use of expert systems in real time applications. ### Generalizations There are a number of practical issues in expert systems engineering which are not addressed by the preceding results. These include explanation capability, obtaining expensive facts only when necessary, and inexact reasoning. The results can be generalized to deal with all of these issues. ### Explanation Capability An important feature of expert systems is the ability to explain a conclusion or the reasons for asking a particular question. Most approaches to explanation follow the chain of assertions between the base facts and the conclusion, so are derived from the trace of the traversal of the dependency graph. In practice, many expert systems do not use explanations in their normal execution. (Garvan ES1, for example, is a batch program.) Jansen & Compton (1988) make a strong case for the separation of the normal execution environment where explanations are not available from a maintenance environment where a very complete explanation environment is provided. In any case, it is possible to adapt the main results to give an efficient computation structure which permits a complete explanation capability. Rather than a decision table, this approach relies on executing the rules in sequence in a single pass. Recall that the algorithm labels each rule with the maximum number of inference steps between it and the base facts. From lemma 1, all antecedents of rules at level \( i \) are determined by rules of level less than \( i \). In addition, rules at the same level can be evaluated in any order. Clearly, if the rules are sorted by level, it is possible to execute them in a single pass. It is only necessary to keep a table of the value of each of the assertions (initialized to false if the closed world assumption is used) which is updated by any rule firing whose consequent makes that assertion. Since no assertion found in the antecedent of a rule can be changed by any subsequent rule, a complete explanation capability is available. For example, if the question is "why did a particular rule not fire?", the table of assertions will contain the values of all the antecedents of that rule at the time it was considered. A further explanation can be obtained in a similar way be examining the rules in earlier layers which have a particular assertion as consequent. One way to represent this system is as a decision table with one row per rule and one column for each possible value of each fact augmented by one column for each possible value for each assertion. The Garvan system noted above can be represented as a decision table with 600 rows. There are 52 assertions, so 104 columns are needed besides the 93 required for the 34 fact variables, so that 600 x (104 + 93) bits or about 15k bytes are needed for its storage, considerably less than the 62k bytes needed for the fully expanded decision table. The Knowledge Dictionary of Jansen & Compton (1988) has been re-implemented with an inference engine employing the method of this section (Lee, 1990). Note that the Garvan ES1 inference engine (Horn et al. 1985) takes essentially this approach to get fast execution on a PDP-11 with limited memory. Their approach can now be seen to be quite general. Expensive Facts The previous results make the implicit assumption that all facts are available at the beginning of inference, and all facts have equal cost. In practice, some facts may have a high cost, perhaps because they require database access or questioning the user. In this case, it is usual to first make use of the inexpensive facts available at the beginning, obtaining the expensive facts only if necessary. There will usually be rules whose consequent is not an assertion, but a command to assign values to a group of variables. The set of facts can be labelled in the same way as the assertions, with facts available immediately labelled zero. In the decision table representation, the row headings can be sorted in increasing order of label. If the table is processed left to right, by the time a column labelled one or more is reached, the conditions under which that column is needed would be able to be evaluated. In the single-pass representation, the rule whose consequent is to obtain these facts will be in its correct place in the sequence. Note that in this case the choice of forward or backward chaining affects the sequence in which expensive facts are obtained, since the dependency graph is traversed in a different order. This order is preserved in the sequence of column headings in the resulting decision table or in the sequence of rules in the single pass version. Inexact Reasoning Some expert systems use one or another form of inexact reasoning. The result can be adapted to this situation, although insufficient research has been conducted to determine the practicality of the method. First, an uncertainty measure can be appended to each proposition. An assignment of values to variables would also assign an uncertainty measure. The subset of conclusions would also have uncertainty measures. The main theorem still holds. Second, in the forward chaining algorithm, the uncertainty measure can be propagated as a tree of function composition. For example, if $u(x)$ is the uncertainty of proposition $x$, we might have: - $a \& b \rightarrow c \quad u(c) = f(u(a), u(b))$ - $c \& d \rightarrow e \quad u(e) = f(u(c), u(d))$ then we would have: $u(e) = f(f(u(a), u(b)), u(d))$ If the uncertainty propagation function is associative, it is not necessary to record the tree of inferences by which the assertions are eliminated, and the uncertainty of a conclusion can be computed directly from the uncertainties of the base facts in its antecedent. In particular, the commonly employed Bayesian measure of uncertainty is a priori independent of the intermediate assertions, since the joint probability of conclusions and base facts is known in principle independently of the reasoning system. Advantages of Decision Table Representation Representation of an expert system as a decision table has advantages apart from the possibility of faster execution. Real Time The main impact of these results on real-time systems is that execution time is not only much faster than conventional implementations, but it is also bounded. If the decision table is converted into a decision tree, the maximum number of decisions is known. If the decision table is processed directly by a fine-grained parallel processor, the maximum number of column operations needed is known. A secondary benefit, particularly when the decision table is processed directly using a fine-grained parallel processor, comes from the fact that in real-time situations facts are sometimes available asynchronously. In the decision table representation, it is very simple to compute the set of conclusions consistent with any assignment, no matter how incomplete. If we collect facts as they become available into what can be called a current assignment, we can always associate with the current assignment the set of conclusions consistent with it. Of course, we can in particular note the conclusions determined by the current assignment. There might be a subset of conclusions considered to be important for some reason. It would be easy to monitor whether any important conclusions were consistent with the current assignment, for example. The possibility of one of these might trigger some additional measurements. When a measurement is made which conflicts with a fact in the current assignment, the associated conclusions of the new current assignment can be computed quickly, perhaps making complex truth maintenance algorithms less necessary. Rule Induction Since propositional expert systems are equivalent to decision tables, it is more plausible that rule induction methods which build decision trees from examples (e.g. Quinlan 1986), are generally applicable. Consistency and Completeness The decision table representation is much easier to test for consistency and completeness. The methods advocated by e.g. Cragun & Steudel (1987) are seen to be generally applicable. Conclusion The equivalence of propositional expert systems and decision tables has been shown, and a practicable algorithm presented for transforming an expert system into a decision table. The algorithm has been successfully tested on a substantial system of real utility. The method is capable of generalization to accommodate many of the practical problems encountered in practice, and makes consistency and completeness checking much easier. A particular consequence is that the computation time for these systems can be reduced by orders of magnitude, potentially greatly increasing the applicability of expert systems technology especially for real time problems. Acknowledgements Thanks to the referees for their helpful suggestions. References
{"Source-Url": "http://www.aaai.org/Papers/AAAI/1990/AAAI90-101.pdf", "len_cl100k_base": 5840, "olmocr-version": "0.1.49", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 19389, "total-output-tokens": 6930, "length": "2e12", "weborganizer": {"__label__adult": 0.0003235340118408203, "__label__art_design": 0.0004153251647949219, "__label__crime_law": 0.0006537437438964844, "__label__education_jobs": 0.0013952255249023438, "__label__entertainment": 0.0001017451286315918, "__label__fashion_beauty": 0.0002086162567138672, "__label__finance_business": 0.0006704330444335938, "__label__food_dining": 0.00047397613525390625, "__label__games": 0.00067138671875, "__label__hardware": 0.0020732879638671875, "__label__health": 0.000873565673828125, "__label__history": 0.00031447410583496094, "__label__home_hobbies": 0.00014078617095947266, "__label__industrial": 0.0013418197631835938, "__label__literature": 0.00041294097900390625, "__label__politics": 0.00033783912658691406, "__label__religion": 0.000537872314453125, "__label__science_tech": 0.442138671875, "__label__social_life": 0.00010895729064941406, "__label__software": 0.024566650390625, "__label__software_dev": 0.52099609375, "__label__sports_fitness": 0.00025010108947753906, "__label__transportation": 0.000675201416015625, "__label__travel": 0.00017559528350830078}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 30438, 0.00882]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 30438, 0.50269]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 30438, 0.93748]], "google_gemma-3-12b-it_contains_pii": [[0, 5066, false], [5066, 9521, null], [9521, 15663, null], [15663, 21134, null], [21134, 26806, null], [26806, 30438, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5066, true], [5066, 9521, null], [9521, 15663, null], [15663, 21134, null], [21134, 26806, null], [26806, 30438, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 30438, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 30438, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 30438, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 30438, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 30438, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 30438, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 30438, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 30438, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 30438, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 30438, null]], "pdf_page_numbers": [[0, 5066, 1], [5066, 9521, 2], [9521, 15663, 3], [15663, 21134, 4], [21134, 26806, 5], [26806, 30438, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 30438, 0.0]]}
olmocr_science_pdfs
2024-11-25
2024-11-25
30196074fdfea07781c3f948f78cf35c8dca64ba
[REMOVED]
{"Source-Url": "http://www.cs.umd.edu/class/spring2009/cmsc433/Lectures/SWArch.pdf", "len_cl100k_base": 6684, "olmocr-version": "0.1.50", "pdf-total-pages": 59, "total-fallback-pages": 0, "total-input-tokens": 88655, "total-output-tokens": 8002, "length": "2e12", "weborganizer": {"__label__adult": 0.0003659725189208984, "__label__art_design": 0.0010986328125, "__label__crime_law": 0.000278472900390625, "__label__education_jobs": 0.0006971359252929688, "__label__entertainment": 6.181001663208008e-05, "__label__fashion_beauty": 0.000125885009765625, "__label__finance_business": 0.0001518726348876953, "__label__food_dining": 0.0002884864807128906, "__label__games": 0.00044846534729003906, "__label__hardware": 0.0007143020629882812, "__label__health": 0.00023937225341796875, "__label__history": 0.0002560615539550781, "__label__home_hobbies": 6.890296936035156e-05, "__label__industrial": 0.00032258033752441406, "__label__literature": 0.00026702880859375, "__label__politics": 0.00019633769989013672, "__label__religion": 0.00048661231994628906, "__label__science_tech": 0.006847381591796875, "__label__social_life": 6.836652755737305e-05, "__label__software": 0.005069732666015625, "__label__software_dev": 0.98095703125, "__label__sports_fitness": 0.0002562999725341797, "__label__transportation": 0.0003964900970458984, "__label__travel": 0.00018930435180664065}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27620, 0.00172]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27620, 0.55764]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27620, 0.83904]], "google_gemma-3-12b-it_contains_pii": [[0, 254, false], [254, 655, null], [655, 1365, null], [1365, 2058, null], [2058, 2542, null], [2542, 3262, null], [3262, 3747, null], [3747, 4276, null], [4276, 4755, null], [4755, 5108, null], [5108, 5257, null], [5257, 5595, null], [5595, 6342, null], [6342, 7414, null], [7414, 8483, null], [8483, 8689, null], [8689, 8983, null], [8983, 9698, null], [9698, 11046, null], [11046, 11119, null], [11119, 11202, null], [11202, 11671, null], [11671, 12238, null], [12238, 12727, null], [12727, 13409, null], [13409, 13805, null], [13805, 14164, null], [14164, 15141, null], [15141, 15586, null], [15586, 15637, null], [15637, 16172, null], [16172, 16657, null], [16657, 17322, null], [17322, 17647, null], [17647, 18496, null], [18496, 18652, null], [18652, 19139, null], [19139, 19515, null], [19515, 19810, null], [19810, 19993, null], [19993, 20653, null], [20653, 21084, null], [21084, 21464, null], [21464, 21991, null], [21991, 22059, null], [22059, 22326, null], [22326, 22875, null], [22875, 23076, null], [23076, 23419, null], [23419, 23729, null], [23729, 24187, null], [24187, 24694, null], [24694, 25179, null], [25179, 25525, null], [25525, 26107, null], [26107, 26377, null], [26377, 26770, null], [26770, 27255, null], [27255, 27620, null]], "google_gemma-3-12b-it_is_public_document": [[0, 254, true], [254, 655, null], [655, 1365, null], [1365, 2058, null], [2058, 2542, null], [2542, 3262, null], [3262, 3747, null], [3747, 4276, null], [4276, 4755, null], [4755, 5108, null], [5108, 5257, null], [5257, 5595, null], [5595, 6342, null], [6342, 7414, null], [7414, 8483, null], [8483, 8689, null], [8689, 8983, null], [8983, 9698, null], [9698, 11046, null], [11046, 11119, null], [11119, 11202, null], [11202, 11671, null], [11671, 12238, null], [12238, 12727, null], [12727, 13409, null], [13409, 13805, null], [13805, 14164, null], [14164, 15141, null], [15141, 15586, null], [15586, 15637, null], [15637, 16172, null], [16172, 16657, null], [16657, 17322, null], [17322, 17647, null], [17647, 18496, null], [18496, 18652, null], [18652, 19139, null], [19139, 19515, null], [19515, 19810, null], [19810, 19993, null], [19993, 20653, null], [20653, 21084, null], [21084, 21464, null], [21464, 21991, null], [21991, 22059, null], [22059, 22326, null], [22326, 22875, null], [22875, 23076, null], [23076, 23419, null], [23419, 23729, null], [23729, 24187, null], [24187, 24694, null], [24694, 25179, null], [25179, 25525, null], [25525, 26107, null], [26107, 26377, null], [26377, 26770, null], [26770, 27255, null], [27255, 27620, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 27620, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27620, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27620, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27620, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27620, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27620, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27620, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27620, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27620, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27620, null]], "pdf_page_numbers": [[0, 254, 1], [254, 655, 2], [655, 1365, 3], [1365, 2058, 4], [2058, 2542, 5], [2542, 3262, 6], [3262, 3747, 7], [3747, 4276, 8], [4276, 4755, 9], [4755, 5108, 10], [5108, 5257, 11], [5257, 5595, 12], [5595, 6342, 13], [6342, 7414, 14], [7414, 8483, 15], [8483, 8689, 16], [8689, 8983, 17], [8983, 9698, 18], [9698, 11046, 19], [11046, 11119, 20], [11119, 11202, 21], [11202, 11671, 22], [11671, 12238, 23], [12238, 12727, 24], [12727, 13409, 25], [13409, 13805, 26], [13805, 14164, 27], [14164, 15141, 28], [15141, 15586, 29], [15586, 15637, 30], [15637, 16172, 31], [16172, 16657, 32], [16657, 17322, 33], [17322, 17647, 34], [17647, 18496, 35], [18496, 18652, 36], [18652, 19139, 37], [19139, 19515, 38], [19515, 19810, 39], [19810, 19993, 40], [19993, 20653, 41], [20653, 21084, 42], [21084, 21464, 43], [21464, 21991, 44], [21991, 22059, 45], [22059, 22326, 46], [22326, 22875, 47], [22875, 23076, 48], [23076, 23419, 49], [23419, 23729, 50], [23729, 24187, 51], [24187, 24694, 52], [24694, 25179, 53], [25179, 25525, 54], [25525, 26107, 55], [26107, 26377, 56], [26377, 26770, 57], [26770, 27255, 58], [27255, 27620, 59]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27620, 0.10301]]}
olmocr_science_pdfs
2024-12-01
2024-12-01
f3c46ea1bd329bc0194a45fa30a2e204a9a877e2
[REMOVED]
{"Source-Url": "https://portal.research.lu.se/portal/files/1848483/5050913.pdf", "len_cl100k_base": 6022, "olmocr-version": "0.1.50", "pdf-total-pages": 14, "total-fallback-pages": 0, "total-input-tokens": 28793, "total-output-tokens": 7517, "length": "2e12", "weborganizer": {"__label__adult": 0.00026798248291015625, "__label__art_design": 0.0003018379211425781, "__label__crime_law": 0.000324249267578125, "__label__education_jobs": 0.0013675689697265625, "__label__entertainment": 3.6656856536865234e-05, "__label__fashion_beauty": 0.00010162591934204102, "__label__finance_business": 0.0005621910095214844, "__label__food_dining": 0.0002567768096923828, "__label__games": 0.0004107952117919922, "__label__hardware": 0.0003614425659179687, "__label__health": 0.0002605915069580078, "__label__history": 0.0001068115234375, "__label__home_hobbies": 5.316734313964844e-05, "__label__industrial": 0.0001908540725708008, "__label__literature": 0.0001659393310546875, "__label__politics": 0.00022780895233154297, "__label__religion": 0.0002593994140625, "__label__science_tech": 0.002285003662109375, "__label__social_life": 7.283687591552734e-05, "__label__software": 0.006435394287109375, "__label__software_dev": 0.9853515625, "__label__sports_fitness": 0.0001766681671142578, "__label__transportation": 0.0002772808074951172, "__label__travel": 0.00012123584747314452}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 33955, 0.02563]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 33955, 0.60334]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 33955, 0.96201]], "google_gemma-3-12b-it_contains_pii": [[0, 1478, false], [1478, 3520, null], [3520, 6274, null], [6274, 9071, null], [9071, 10124, null], [10124, 13160, null], [13160, 15515, null], [15515, 18470, null], [18470, 20905, null], [20905, 22527, null], [22527, 25570, null], [25570, 28699, null], [28699, 31344, null], [31344, 33955, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1478, true], [1478, 3520, null], [3520, 6274, null], [6274, 9071, null], [9071, 10124, null], [10124, 13160, null], [13160, 15515, null], [15515, 18470, null], [18470, 20905, null], [20905, 22527, null], [22527, 25570, null], [25570, 28699, null], [28699, 31344, null], [31344, 33955, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 33955, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 33955, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 33955, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 33955, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 33955, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 33955, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 33955, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 33955, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 33955, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 33955, null]], "pdf_page_numbers": [[0, 1478, 1], [1478, 3520, 2], [3520, 6274, 3], [6274, 9071, 4], [9071, 10124, 5], [10124, 13160, 6], [13160, 15515, 7], [15515, 18470, 8], [18470, 20905, 9], [20905, 22527, 10], [22527, 25570, 11], [25570, 28699, 12], [28699, 31344, 13], [31344, 33955, 14]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 33955, 0.0]]}
olmocr_science_pdfs
2024-11-30
2024-11-30
8ad80540744ec6b27c50b9a90e9f4f8d0df87732
Citation for published version DOI Link to record in KAR http://kar.kent.ac.uk/14430/ Document Version UNSPECIFIED Copyright & reuse Content in the Kent Academic Repository is made available for research purposes. Unless otherwise stated all content is protected by copyright and in the absence of an open licence (eg Creative Commons), permissions for further reuse of content should be sought from the publisher, author or other copyright holder. Versions of research The version in the Kent Academic Repository may differ from the final published version. Users are advised to check http://kar.kent.ac.uk for the status of the paper. Users should always cite the published version of record. Enquiries For any further enquiries regarding the licence status of this document, please contact: researchsupport@kent.ac.uk If you believe this document infringes copyright then please contact the KAR admin team with the take-down information provided at http://kar.kent.ac.uk/contact.html Building a Modular Authorization Infrastructure David Chadwick, Gansen Zhao, Sassa Otenko, Romain Laborde, Linying Su, Tuan Anh Nguyen University of Kent Abstract Authorization infrastructures manage privileges and render access control decisions, allowing applications to adjust their behavior according to the privileges allocated to users. This paper describes the PERMIS role based authorization infrastructure along with its conceptual authorisation, access control, and trust models. PERMIS has the novel concept of a credential validation service, which verifies a user’s credentials prior to access control decision making and enables the distributed management of credentials. Details of the design and the implementation of PERMIS are presented along with details of its integration with Globus Toolkit, Shibboleth and GridShib. A comparison of PERMIS with other authorization and access control implementations is given, along with our plans for the future. 1. Introduction Authorization infrastructures provide facilities to manage privileges, render access control decisions, and process the related information. Normally, an authorization infrastructure will follow a certain set of authorization policies to make decisions, such as Credential Issuing Policies, Access Control Policies, Delegation Policies, and Credential Validation Policies. These policies contain the rules and criteria that specify how privileges (or credentials) are managed and access control decisions are made. Following these policies, an authorization infrastructure issues credentials to users, who might belong to one domain, whilst the credentials are then presented and validated by the authorization infrastructure of the resource which might belong to a different domain. Once the credentials are validated, the authorization infrastructure then renders an access control decision, and returns this to the application for enforcement. When enforcing the access control decisions, the application should only grant those requests that are authorized by the authorization infrastructure, and should forbid all others. The authorization infrastructure that we have built is called PERMIS [1]. This paper describes the various components of the PERMIS authorization infrastructure, the conceptual models that are behind them, and the standards that we have used. We also describe some of our plans for future enhancements and work that still needs to be done. We also compare our work to that of others. The rest of this paper is structured as follows. Section 2 provides the conceptual models of our authorization infrastructure. Section 3 describes the design and implementation of PERMIS. Section 4 presents PERMIS’s integration with Globus Toolkit, Shibboleth and GridShib. Section 5 compares PERMIS to other related research. Section 6 concludes and indicates our plans for the future. 2. Conceptual Models 2.1 The Authorisation Model The authorization model paradigm adopted is the “Subject – Action – Target” paradigm and the Role Based Access Control model [18], where roles are presented as credentials issued to the subjects. In our model, a role is not restricted to an organizational role, but can be any attribute of the subject, such as a professional qualification or their current level of authentication [23]. Each subject represents a real world principal, which is the action performer. Action is the operation that is requested to be performed on the target. It can be either a simple operation, or a bundle of complex operations that is provided as an integrated set. Target is the object of the action, over which the action is to be performed. A target represents one or more critical resources that need to be protected from unauthorized access. Figure 1: High Level Conceptual Model of an Authorisation Infrastructure Figure 1 shows our high level conceptual model for an authorization infrastructure. Step 0 is the initialization step for the infrastructure, when the policies are created and stored in the various components. Each subject may possess a set of credentials from many different Attribute Authorities (AAs), that may be pre-issued, long lived and stored in a repository or short lived and issued on demand, according to their Credential Issuing Policies. The Subject Source of Authority (SOA) dictates which of these credentials can leave the subject domain for each target domain. When a subject issues an application request (step 1), the policy decision point (PDP) informs the application’s policy enforcement point (PEP) which credentials to include with the user’s request (steps 3-4). These are then collected from the Credential Issuing Service (CIS) or Attribute Repository by the PEP (steps 5-6). The user’s request is transferred to the target site (step 7) where the target SOA has already initialized the Credential Validation Policy that says which credentials from which issuing AAs are trusted by the target site, and the Access Control policy that says which privileges are given to which attributes. The user’s credentials are first validated (steps 8-9) and then the validated attributes, along with any environmental information, such as current date and time (step 10), are passed to the PDP for an access control decision (steps 11-12). If the decision is granted the user’s request is allowed by the PEP, otherwise it is rejected. In more sophisticated systems there may be a chain of PDPs called by the PEP, in which case each PDP may return granted, denied or don’t know; the latter response allowing the PEP to call the next PDP in the chain. Figure 2: Example User-Role-Privilege Assignments PERMIS uses the Role Based Access Control Model [18]. Roles are used to model organization roles, user groups, or any attribute of the user. Subjects are assigned attributes, or role memberships. A subject can be the member of zero, one or multiple roles at the same time. Conversely, a role can have zero, one or more subject occupants at the same time. Privileges are directly allocated to roles or assigned attributes. Thus each role (or assigned attribute) is associated with a set of privileges, representing the authorised rights the role/attribute has been given by the system administrator. These are rights to perform operations on target objects. Thus a subject is authorised to perform the operations corresponding to his role memberships (or attribute assignments). Changing the privileges allocated to a role/attribute will affect all subjects who are members of the role or who have the assigned attribute. Figure 2 shows that UserA is a member of both RoleA and RoleB, and UserB is a member of RoleB. RoleA has been granted privileges P1 and P3, whilst RoleB has been granted privilege P2. With Role Based Access Controls this means that UserA is granted privileges P1, P2 and P3 whilst UserB only has privilege P2. PERMIS supports hierarchical RBAC in which roles (or attributes) are organized in a hierarchy, with some being superior to others. A superior role inherits all the privileges allocated to its subordinate roles. For example, if the role Staff is subordinate to Manager, the Manager role will inherit the privileges allocated to the Staff role. A member of the Manager role can perform operations explicitly authorized to Managers as well as operations authorised to Staff. The inheritance of privileges from subordinate roles is recursive, thus a role $r_s$ will inherit privileges from all its direct subordinate roles $r_d$, and indirect subordinate roles which are direct or indirect subordinate roles of $r_s$. 2.2 The Trust Model Credentials are the format used to securely transfer a subject’s attributes/roles from the Attribute Authority to the recipient. They are also known as attribute assertions [20]. PERMIS only trusts valid credentials. A valid credential is one that has been issued by a trusted AA or his delegate in accordance with the current authorization policies (Issuing, Validation and Delegation policies). It is important to recognize the difference between an authentic credential and a valid credential. An authentic credential is one that has been received exactly as it was originally issued by the AA. It has not been tampered with or modified. Its digital signature, if present, is intact and validates as trustworthy by the underlying PKI, meaning that the AA’s signing key has not been compromised, i.e. his public key (certificate) is still valid. A valid credential on the other hand is an authentic credential that has been issued according to the prevailing authorization policies. In order to clarify the difference, an example is the paper money issued by the makers of the game Monopoly. This money is authentic, since it has been issued by the makers of Monopoly. The money is also valid for buying houses on Mayfair in the game of Monopoly. However, the money is not valid if taken to the local supermarket because their policy does not recognize the makers of Monopoly as a trusted AA for issuing money. Recognition of trusted AAs is part of PERMIS’s Credential Validation Policy. PERMIS checks that the AA is mentioned in this policy directly, or that the credential issuer has been delegated a privilege by a trusted issuer, recursively (i.e. a recursive chain of trusted issuers is established controlled by the Delegation Policies of the Target SOA and the intermediate AAs in the chain). The PERMIS Credential Validation Policy contains rules that govern which attributes different AAs are trusted to issue, along with a Delegation Policy for each AA. These rules separate AAs into different groups and assign them different rights to issue different attributes to different sets of subjects. Further each AA will have its own Credential Issuing Policy and Delegation Policy. PERMIS assumes that if a credential has been issued and signed by an AA, then it must be conformant to the AA’s Issuing Policy, so this need not be checked any further. However, if the credential was subsequently delegated this may or may not have conformed to the original AA’s Delegation Policy. Therefore when PERMIS validates a credential it checks that it conforms to the AA’s delegation policy as well as the Target SOA’s delegation policy. PERMIS also makes sure that all credentials conform to the delegation paradigm that an issuer cannot delegate more privileges than he has himself, to ensure constrained propagation of privileges from issuers to subjects. The net result of this trust model is that PERMIS can support multiple AAs issuing different sets of attributes to different groups of users, in which each AA can have different delegation policies, yet the target SOA can specify an overall Credential Validation Policy that constrains which of these (delegated) credentials are trusted to be used to access the resources under his control. 3. PERMIS: A Modular Authorization Infrastructure The PERMIS authorization infrastructure is shown in Figure 3. The PERMIS authorisation infrastructure provides facilities for policy management, credential management, credential validation and access control decision making. 3.1 Policy Management PERMIS Policies are rules and criteria that the decision making process uses to render decisions. It mainly contains two categories of rules, trust related rules (Credential Validation Policy) and privilege related rules (Access Control Policy). Trust related rules specify the system’s trust in the distributed Attribute Authorities. Only credentials issued by trusted AAs within their authority will be accepted. Privilege related rules specify the domains of targets, the role hierarchies, the privileges assigned to each role and the conditions under which these privileges may be used, for example, the times of day or the maximum amount of a resource that may be requested. PERMIS provides a policy composing tool, the Policy Editor [13], which users can use to compose and edit PERMIS policies. The GUI interface of the Policy Editor comprises: the subject (user) policy window, the trusted AA policy window, the role assignment policy window, the role hierarchy policy window, the target resource policy window, the action policy window and the role-privilege policy window. These windows provide forms for users to fill in, then the tool generates the corresponding PERMIS policy. Policies can be saved in pure XML format, or the XML can be embedded in an X.509 Attribute Certificate (AC) [3] and signed with the policy author’s private key. The Policy Editor is capable of retrieving information from LDAP directories, such as subject names, and writing policy ACs back to the author’s entry in the LDAP directory. Authors can use the Policy Editor to browse the directories and select existing policies to update them. 3.2 Credential Management The Credential Management system is responsible for issuing and revoking subject credentials. The Attribute Certificate Manager (ACM) tool is used by administrators to allocate attributes to users in the form of X.509 ACs. These bind the issued attributes with the subject’s and issuer’s identities in a tamper-proof manner. The ACM has a GUI interface that guides the manager through the process of AC creation, modification and revocation. The manager can search for a user in an attached LDAP directory, or enter the DN of the user directly. There is then a picking list of attribute types (e.g. role, affiliation etc.), to which the manager can add his own value (e.g. project manager, University of Kent). There is a pop up calendar allowing the manager to select the dates between which the AC is valid, plus the option of adding appropriate times of day to these. Finally the manager can add a few standard selected extensions to the AC, to say whether the holder is allowed to further delegate or not, and if so, how long the delegation chain can be (“basic attribute constraints” extension [3]), or if the holder may assert the attributes or only delegate them to others (“no assertion” extension [4]). Finally, the manager must add his digital signature to the AC, so the GUI prompts him for the PKCS#12 file holding his private key and his password to unlock it. Once the AC is signed, the manager has the option of storing it in an LDAP directory or local filestore. Besides creating ACs, the ACM allows the manager to edit existing ACs and to revoke existing ACs by deleting them from their storage location. Note that at present revocation lists have not been implemented, because short validity times or deletion from storage have been sufficient to satisfy our current user requirements. The Delegation Issuing Service is a web service that dynamically issues X.509 ACs on demand. It may be... called directly by an application’s PEP after a user has invoked the application, to issue short lived ACs for the duration of the user’s task. Alternatively there is a http interface that lets users invoke it via their web browsers. This enables users to dynamically delegate their existing longer lived credentials to other users, to enable them to act on their behalf. This is especially powerful, as it empowers users to delegate (a subset of) their privileges to others without any administrative involvement. Because the DIS is controlled by its own PERMIS policy, written by the Subject SOA, an organization can tightly control who is allowed to delegate what to whom, and then leave its subjects to delegate as they see fit. More details of the DIS can be found in [2]. 3.3 Authorization Decision Engine The PERMIS Authorization Decision Engine is responsible for credential validation and access control decision making. Credential validation is the process that enforces the trust model of PERMIS described in Section 2.2. Access control decision making is the process that implements the Role Based Access Control Model described in Section 2.1. The CVS extracts the subset of valid attributes from the set of available credentials, according to the Target SOA’s Credential Validation Policy. The PDP makes access control decisions based on the Target SOA’s access control policy and the valid attributes passed from the CVS. The PERMIS authorization decision engine is superior to conventional PDPs since it has the ability to validate credentials and delegation chains, which is not a common capability of conventional PDPs e.g. the XACML PDP [15]. 3.4 The PDP The PDP component is responsible for making access control decisions based on the valid attributes of the user and the Target SOA’s access control policy. As stated before, this is based on the Role Based Access Control (RBAC) Model, with support for attribute/role hierarchies. At initialization time the Target SOA’s access control policy is read in and parsed by the Policy Parser so that the PDP is ready to make decisions. Both plain XML policies and digitally signed and protected policies can be read in. The former are stored as files in a local directory whilst the latter are stored as X.509 policy ACs in the LDAP entry of the Target SOA. The latter are tamper resistant and integrity protected, whereas the former have to be protected by the operating system. Each time the user makes a request to the application to perform a task, the PEP passes this request to the PERMIS PDP along with user’s valid attributes and any required environmental attributes such as the time of day. The PEP needs to know which environmental attributes are needed by the access control policy, and since the PEP is software, then it is more likely that the access control policies will be restricted to constraints based on the environmental attributes that the PEP is capable of passing to the PDP. 3.5 The CVS As described in Section 2.2, all credentials allocated to subjects will be validated by the PERMIS CVS according to the Target SOA’s credential validation policy. Figure 5 illustrates the detailed architecture of the CVS, along with the internal data flows. Figure 4: The PERMIS Authorization Decision Engine As an authorisation infrastructure, PERMIS is not responsible for the actual enforcement of the authorisation decision. This responsibility lies with the application dependent PEP. Figure 4 depicts the overall architecture of the PERMIS Authorization Decision Engine. It comprises five main components: the PDP, the CVS, the Credential Retriever, the Credential Decoder, and the Policy Parser. In Figure 5 we can see the general flow of information and sequence of events. First of all the service is initialised by giving it the credential validation policy. The policy parsing module is responsible for this (see Section 3.4). When the user activates the application, the target PEP requests the valid attributes of the subject (step 1). Between the request for attributes and returning them (in step 6) the following events may occur a number of times, as necessary i.e. the CVS is capable of recursively calling itself as it determines the path in a delegation tree from a given credential to a trusted AA specified in the policy. The Credential Validation Policy Enforcer requests credentials from the Credential Retriever (step 2). PERMIS can operate in either credential pull mode or credential push mode. In credential push mode the application passes the user’s credentials along with his request to the target PEP (Step 7 in Figure 3) and the PEP passes them to the CVS (Step 8a in Figure 3). In credential pull mode, the credentials are dynamically pulled from one or more remote credential providers (these could be AA servers, LDAP repositories etc.) by the CVS (step 8b in Figure 3). The actual attribute request protocol (e.g. SAML or LDAP) is handled by the Credential Retriever module. When operating in credential push mode, the PEP stores the already obtained credentials in a local Credential Provider repository and pushes the repository to the CVS, so that the CVS can operate in logically the same way for both push and pull modes. After credential retrieval, the Credential Retriever module passes the credentials to the Credential Decoding module (step 3). From here they undergo the first stage of validation -- credential authentication (step 4). Because only the Credential Decoder is aware of the actual format of the credentials, it has to be responsible for authenticating the credentials using an appropriate Credential Authenticator module. Consequently, both the Credential Decoder and Credential Authenticator modules are encoding specific modules. For example, if the credentials are digitally signed X.509 ACs, the Credential Authenticator uses the configured X.509 PKI to validate the signatures. If the credentials are XML signed SAML attribute assertions, then the Credential Authenticator uses the public key in the SAML assertion to validate the signature. The Credential Decoder subsequently discards all unauthentic credentials – these are ones whose digital signatures are invalid. Authentic credentials are decoded and transformed into an implementation specific local format that the Policy Enforcer is able to handle (step 5). The task of the Policy Enforcer is to decide if each authentic credential is valid (i.e. trusted) or not. It does this by referring to its Credential Validation Policy to see if the credential has been issued by a trusted AA or not. If it has, it is valid. If it has not, the Policy Enforcer has to work its way up the delegation tree from the current credential to its issuer and from there to its issuer, recursively, until a trusted AA is located, or no further issuers can be found (in which case the credential is not trusted and is discarded). Consequently steps 2-5 are recursively repeated until closure is reached (which, in the case of a loop in the credential chain, will be if the same credential is encountered again). Remember that in the general case there are multiple trusted credential issuers, who each may have their own Delegation Policies, which must be enforced by the Policy Enforcer in the same way that it enforces the Target SOA’s Delegation Policy. The CVS can be customized by PERMIS implementers, by either enabling or disabling the credential services built-in with the PERMIS Authorisation Decision Engine, or by implementing their own credential decoding services and plugging them into PERMIS. The latter enables implementers to adopt credential formats that are not implemented by PERMIS, such as local proprietary formats. PERMIS can theoretically be customized to support most application specific credential validation requirements. 4. Integrating PERMIS 4.1 Integration with GT4 Globus Toolkit (GT) is an implementation of Grid software, which has a number of tools that make development and deployment of Grid Services easier [9]. One of the key features of this toolkit is secure communications. However, Globus Toolkit has limited authorisation capabilities based on simple access control lists. To improve its authorization capabilities a Security Assertions Markup Language (SAML) authorization callout has been added. SAML [20] is a standard designed by the Organization for the Advancement of Structured Information Standards (OASIS) to provide a universal mechanism for conveying security related information between the various parts of an access control system. The Global Grid Forum has produced a profile of SAML for use in Grid authorisation [19]. The important consequence of this is that it is now possible to deploy an authorisation service that GT will contact to make authorisation decisions about what methods can be executed by a given subject. A PERMIS Authorisation Service has been developed to provide authorisation decisions for the Globus Toolkit through the SAML callout [8] 4.2 Integration with Shibboleth Shibboleth [21] is a cross-institutional authentication and authorisation architecture for single sign on and access control of web resources. Shibboleth defines a protocol for carrying authentication information and user attributes from the user’s home site to the resource site. The resource site can then use the user attributes to make access control decisions about the user’s request. A user only needs to be authenticated once by the home site in order to visit other Shibboleth protected resource sites in the federation, as the resulting authentication token is recognized by any member of the federation. In addition to this, protection of the user’s privacy can be achieved, since the user is able to restrict what attributes will be released to the resource providers from his/her home site. However Shibboleth’s built-in access control decision making based on the user’s attributes, is simplistic in its functionality, and the management of the access controls is performed together with web server administration at the resource site. Furthermore, distributed management of credentials and dynamic delegation of authority are not supported. To rectify these deficiencies, a Shibboleth-Apache Authorisation Module (SAAM) has been developed which integrates PERMIS with Shibboleth. SAAM plugs into Apache and replaces the Shibboleth authorization functionality with calls to the PERMIS authorization decision engine. A full description is provided in [5]. PERMIS extends the access control model used in Shibboleth by introducing hierarchies of roles, distributed management of attributes, and policy controlled decisions based on dynamically evaluated conditions. PERMIS supports the existing semantics of Shibboleth attributes, but also allows X.509 ACs to be used instead, where more secure credentials are needed. 4.3 Integration with GridShib GridShib [10] provides interoperability between Globus Toolkit [9] and Shibboleth [21]. The GridShib Policy Information Point (PIP) retrieves a user’s attributes from the Shibboleth Identity Provider (Idp). These attributes are parsed and passed to the GT4 PEP. The GT4 PEP then feeds these attributes to the corresponding PDP to request an authorisation decision. GridShib integrates Shibboleth’s attribute management functionality with GT4’s authorisation decision making for Grid jobs. However, like GT4, GridShib provides only limited PDP functionality, which is based on access control lists and is not capable of coping with dynamically changing conditions, which a policy based engine is. Figure 6: GridShibPERMIS Integration Scheme Figure 6 shows the GridShibPERMIS integration scheme. GridShibPERMIS provides a GridShibPERMIS Context Handler that can be integrated with GT4 as a callable PDP. The Context Handler is invoked by GT4 when an authorisation decision is to be made. The Context Handler is fed with the user’s attributes that have been retrieved from the Shibboleth Idp. They are parsed and stored in a local Credential Provider Repository, ready to be accessed by the PERMIS CVS as described in Section 3.5. The Context Handler calls the PERMIS CVS followed by the PDP, which renders an access control decision based on the Target SOA’s policy, and returns it to GT4. In the case of multiple PDPs being configured into GT4, the final authorisation decision is made based on combining all the decisions returned by all the different PDPs. The combining algorithm currently adopted by GT4 is “Deny-Overide”, which means that the user’s request is authorised if and only if no PDP denies the request and at least one PDP grants it. 5. Related Work Manandhar et al. [12] present an application infrastructure in which a data portal allows users to discover and access data over Grid systems. They propose an authorization framework that allows the data portal to act as a proxy and exercise the user’s privileges. When a user authenticates to the data portal, a credential is generated stating that the data portal is authorized to exercise the user’s privileges for a specific period. The credential is then used by the data portal to retrieve the user’s authorization tokens from various providers. When requesting a service from a service provider, the data portal presents both the credential and the authorization tokens. The authorization decision is then made by the service provider. The proposed infrastructure mainly focuses on the interaction between different systems in the Grid environment, with no in depth discussion about the access control model or the trust model. Credential verification is also missing from the discussion. XACML [14] defines a standard for expressing access control policies, authorization requests, and authorization responses in XML format. The policy language allows users to define application specific data types, functions, and combining logic algorithms, for the purpose of constructing complex policies. Sun’s open source XACML implementation [15] is a java implementation of the XACML 2.0 standard and provides most of the feature in the standard. The XACML policy language is richer than that of PERMIS’s PDP policy, but XACML has not yet addressed the issue of credential validation and is only now working on dynamic delegation of authority [22]. The Community Authorisation Service (CAS) [11] was developed by the Globus team to improve upon the manageability of user authorisation. CAS allows a resource owner to grant access to a portion of his/her resource to a VO (or community – hence the name CAS), and then let the community determine who can use this allocation. The resource owner thus partially delegates the allocation of authorisation rights to the community. This is achieved by having a CAS server, which acts as a trusted intermediary between VO users and resources. Users first contact the CAS asking for permission to use a Grid resource. The CAS consults its policy (which specifies who has permission to do what on which resources) and if granted, returns a digitally self-signed capability to the user optionally containing policy details about what the user is allowed to do (as an opaque string). The user then contacts the resource and presents this capability. The resource checks that the capability is signed by a known and trusted CAS and if so maps the CAS’s distinguished name into a local user account name via the Gridmap file. Consequently the Gridmap file now only needs to contain the name of the trusted CAS servers and not all the VO users. This substantially reduces the work of the resource administrator. Further, determining who should be granted capabilities by the CAS server is the task of other managers in the VO community, so this again relieves the burden of resource managers. For finer grained access control, the resource can additionally call a further routine, passing to it the opaque policy string from the capability, and using the returned value to refine the access rights of the user. Unfortunately this part of the CAS implementation (policy definition and evaluation routine) were never fully explored and developed by the Globus team. This is precisely the functionality that PERMIS has addressed. The main purpose of SPKI [16] is to provide public key infrastructures based on digital certificates without depending upon global naming authorities. SPKI binds local names and authorizations to public keys (or the hash values of public keys). Names are allocated locally by certificate issuers, and are only of meaning to them. SPKI allows authorizations to be bound directly to public keys, removing the process of mapping from authorization to names and then to public keys. SPKI supports dynamic delegation of authorizations between key holders, and allocation of authorizations to groups. Though SPKI can convey authorization information, it does not cover authorization decision making or access control policy issues. One can thus regards SPKI as an alternative format to X.509 ACs or SAML attribute assertions for carrying credentials, and PERMIS could easily be enhanced to support this format of credential if it were required. The EU DataGrid and DataTAG projects have developed the Virtual Organisation Membership Service (VOMS) [6] as a way of delegating the authorisation of users to managers in the VO. VOMS is a credential push system in which the VOMS server digitally signs a short lived X.509 role AC for the VO user to present to the resource. The AC contains role and group membership details, and the Local Centre Authorisation Service (LCAS) [7] makes its authorisation decision based upon the user’s AC and the job specification, which is written in job description language (JDL) format. This design is similar in concept to the CAS, but differs in message format and syntax. However what neither VOMS nor CAS nor LCAS provide is the ability for the resource administrator to set the policy for access to his/her resource and then let the authorisation infrastructure enforce this policy on his/her behalf. This is what systems such as PERMIS and Keynote [17] provide. It would therefore be relatively easy to replace LCAS with the PERMIS decision engine, so that VOMS allocates role ACs and pushes them to the resource site, whilst PERMIS makes the policy controlled authorization decisions. KeyNote [17] is a trust management system that provides a general-purpose mechanism for defining security policies and credentials, and rendering authorization decisions based on security policies and credentials. KeyNote provides a language for defining both policies and assertions, where policies state the rules for security control, and assertions contain predicates that specify the granted privileges of users. KeyNote has been implemented and released as an open source toolkit. But KeyNote is not without its limitations. Keynotes policies and credentials are in their own proprietary format. KeyNote credentials have no time limit, and KeyNote has no concept of revocation of credentials. Further, policies define the roots of trust, but the policies themselves are not signed and therefore have to be stored securely and are only locally trusted. ### 6. Conclusions This paper presents our work on building a modular authorization infrastructure, PERMIS. We have explained the conceptual models of PERMIS by describing the authorization model, the access control model, and the trust model of PERMIS. The design and the implementation of PERMIS have also been presented, with details of the architecture and an explanation of the facilities PERMIS provides to support policy management, attribute management, and decision making. Details of the decision making process and the credential validation service are also given, showing how PERMIS implements hierarchical RBAC decision making based on user credentials and various authorization policies. Finally, we have presented a comparison of related work, pointing out their relative advantages and disadvantages as compared to PERMIS. ### 6.1 Future Work In an application, sometimes coordination is needed between access control decisions. For example, in order to support mutually exclusive tasks (Separation of Duties), the PDP needs to know if the same user is trying to perform a second task in a set of mutually exclusive ones. Alternatively, if multiple resources are available but their use is to be restricted, for example a maximum of 30GB of storage throughout a grid, then enforcing this becomes more difficult. The use of a stateful PDP allows coordination between successive access control decisions, whilst passing coordination data between PDPs allows coordination over the use of restricted multiple resources. In order to achieve the latter, the access control policies should state what coordination between decision making is needed, which coordination data is used to facilitate this, and how this coordination data is updated afterwards. We have already implemented Separation of Duties in a prototype stateful PDP and we are currently working on more sophisticated distributed coordination between PDPs. Obligations are actions that are required to be fulfilled on the enforcement of access control decisions. Existing authorization infrastructures are mainly concerned with access control decision making, but this is not sufficient in scenarios where obligations are needed. XACML policies already support obligations and we are currently incorporating these into PERMIS. We are building an obligation engine that will evaluate the obligations that are embedded in a policy e.g. Add the amount requested to the amount already consumed, and will return the obligated action to the PEP for enforcement, since it is the PEP that ultimately has to interpret and fulfill the obligations. Acknowledgements We would like to thank the UK JISC for funding part of this work under the DyCOM, DyVOSE, SIPS and GridAPI projects, and the EC for funding part of this work under the TrustCoM project (FP6 project number 001945). References
{"Source-Url": "https://kar.kent.ac.uk/14430/1/677.pdf", "len_cl100k_base": 7460, "olmocr-version": "0.1.48", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 28501, "total-output-tokens": 9260, "length": "2e12", "weborganizer": {"__label__adult": 0.00038242340087890625, "__label__art_design": 0.0005412101745605469, "__label__crime_law": 0.00128173828125, "__label__education_jobs": 0.001781463623046875, "__label__entertainment": 0.0001118779182434082, "__label__fashion_beauty": 0.00021564960479736328, "__label__finance_business": 0.0012340545654296875, "__label__food_dining": 0.0003287792205810547, "__label__games": 0.00046896934509277344, "__label__hardware": 0.0015344619750976562, "__label__health": 0.0008230209350585938, "__label__history": 0.0004229545593261719, "__label__home_hobbies": 0.00015211105346679688, "__label__industrial": 0.0007691383361816406, "__label__literature": 0.0003337860107421875, "__label__politics": 0.0006012916564941406, "__label__religion": 0.0004668235778808594, "__label__science_tech": 0.2919921875, "__label__social_life": 0.00022709369659423828, "__label__software": 0.0574951171875, "__label__software_dev": 0.6376953125, "__label__sports_fitness": 0.00022268295288085935, "__label__transportation": 0.0005245208740234375, "__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, 42066, 0.02978]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 42066, 0.2992]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 42066, 0.91084]], "google_gemma-3-12b-it_contains_pii": [[0, 1189, false], [1189, 5036, null], [5036, 10804, null], [10804, 15949, null], [15949, 19642, null], [19642, 25945, null], [25945, 31414, null], [31414, 37627, null], [37627, 42066, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1189, true], [1189, 5036, null], [5036, 10804, null], [10804, 15949, null], [15949, 19642, null], [19642, 25945, null], [25945, 31414, null], [31414, 37627, null], [37627, 42066, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 42066, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 42066, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 42066, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 42066, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 42066, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 42066, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 42066, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 42066, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 42066, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 42066, null]], "pdf_page_numbers": [[0, 1189, 1], [1189, 5036, 2], [5036, 10804, 3], [10804, 15949, 4], [15949, 19642, 5], [19642, 25945, 6], [25945, 31414, 7], [31414, 37627, 8], [37627, 42066, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 42066, 0.0]]}
olmocr_science_pdfs
2024-11-24
2024-11-24
6d0aa9139c065e6c8b7a32743a664878d98ef46c
Abstract To solve real-world discrete optimization problems approximately metaheuristics such as simulated annealing and other local search methods are commonly used. For large instances of these problems or those with a lot of hard constraints even fast heuristics require a considerable amount of computational time. At the same time, especially for sensitivity analyses, fast response times are necessary in real-world applications. Therefore, to speed up the computation a parallelization of metaheuristics is very desirable. We present parSA, an object-oriented simulated annealing library based on C++ and using the MPI message passing interface. It provides an automatic, transparent way of parallelizing simulated annealing. The efficient communication in parSA is the main reason for its success in several real-world applications. To demonstrate performance of parSA we address the weekly fleet assignment problem (FAP) as a real-world application. It is one of the optimization problems which occur in the process of operating an airline. Given a flight schedule and aircraft of different types (subfleets), to each flight leg a subfleet has to be assigned. Large real-world instances have been provided by internationally operating airlines. We show that our heuristic approach using our library parSA is very competitive to the commonly used integer program (IP) approach. Once implemented, complex algorithms and parallel software components are supposed to be reused in several applications. Thus the effort to set up an optimization system is reduced. In this report, we present a general applicable parallel simulated annealing library. It contains a lot of algorithmic and parallel software elements and can easily be extended. The fleet assignment problem is one of a series of optimization problems that occur in airline industry operations[7]. The range starts off with market modeling and flight scheduling followed by fleet assignment, crew pairing and crew rostering. The fleet assignment problem is defined as follows. Given a flight schedule and aircraft of different types (subfleets), to each flight leg a subfleet has to be assigned. Large real-world instances have been provided by internationally operating airlines. We show that our heuristic approach is very competitive to the commonly used linear program (LP) or integer program (IP) approaches. IP-based tools usually try to solve the FAP optimally, but have difficulties to handle additional constraints, such as homogeneity and time windows. The short computation time of our approach of less than half hour on large instances offers the possibility for sensitivity analysis. We parallelize our algorithm with the parallel simulated annealing library (parSA) and are able to reduce the computation time significantly. This paper is organized as follows: In section 2 we present the main ideas of simulated annealing and its parallelization. Next we introduce in 3 the parallel simulated annealing library parSA. We describe the user-interface, the internal structure and communication protocols used in parSA. Furthermore, we show how to solve a complex real-world problem - the airline fleet assignment problem (FAP). We define in 4 an integer programming (IP) model for the FAP and show how local search can be applied to that problem. We illustrate in section 5 the efficiency of the library by applying it to the FAP. 2 Simulated Annealing Simulated Annealing (SA) is a heuristic algorithm for solving combinatorial optimization problems. Simulated annealing is based on a local search procedure, and can be viewed as a control strategy for the underlying heuristic search. SA has been shown to be a powerful stochastic search method applicable to a wide range of problems. We refer to Osman and Laporte for a comprehensive review of application reports of simulated annealing [13]. The basic idea in SA is to track a path in the feasible solution space of the given optimization problem. Starting with a valid solution, SA repeatedly generates succeeding solutions using the local search procedure. Some of them are accepted and some will be rejected, according to a pre-defined acceptance rule. The acceptance rule is motivated by an analogy with annealing processes in metallurgy. For a description of this analogy see for example [2]. In the beginning of the optimization process the main control parameter - the temperature - is high and decreases until no improvement of the current solution is attainable. Starting with an arbitrary solution, every improvement is accepted. Deteriorations of the objective function are accepted according to the Boltzmann probability $e^{-\Delta C/T}$. An outline of the basic SA algorithm is given in Figure 1. After some iterations of the local search procedure, the temperature is decreased and the optimization continues on a new temperature level. The best solution found during the optimization is the output of the algorithm after the system is frozen, i.e. no improvements can be found. 2.1 Strategies of Parallelizing the SA Algorithm Several approaches have been proposed to implement the simulated annealing algorithm on parallel machines. Recent classification schemes in [3, 5] distinguish between single and multiple-walks (see figure 2), i.e. the number of paths which are evaluated in the search space of the optimization problem. In a single-walk algorithm only a single path in the search space is carried out, whereas in a multiple-walk approach several different paths are evaluated simultaneously. In single-walk algorithms after evaluating a part of the neighborhood of the current solution either only one step is carried out (single-step parallelism) or a sequence starting at the current solution (multiple-step parallelism). In multiple-walk algorithms the parallel walks can be independent or may interact according to a communication pattern. The parSA library offers two different parallelization approaches: the independent walks parallelization is represented in the Multiple Independent Runs (MIR) parallelization. The clustering parallelization can be classified as both single- and multiple-walk parallelization due to the dynamic structure of the clusters. 3 parSA: A Parallel Library for Simulated Annealing Our intention was to design a comfortable and efficient parallel simulated annealing framework, which can be applied to many different optimization problems. The use of MPI message passing standard ensures a wide portability to different parallel platforms without redesigning code. The library is designed in an object-oriented way and is implemented in C++. It can easily be extended by implementing new SA features such as new cooling schedules or different acceptance criteria. Because of a general user-interface many different parallelization schemes of simulated annealing can be implemented. Another important point is the possibility of reusing existing module functionalities. The parallelization of the simulated annealing algorithm is transparent to the user. The parSA library adapts itself... to platforms and problems. This behavior ensures high efficiency on different parallel platforms. Applications on real-world problem instances have shown the implemented parallel software library to be highly efficient (see Section 5). 3.1 User-interface of the parSA Library For the purpose of simulated annealing, the optimization problem should be described in the following way: - search space $S$: set of all feasible solutions, - objective function $Obj: S \rightarrow \mathbb{R}^+$, - local search procedure $Neighbor: S \rightarrow S$ After providing this functionality by the user it is possible to implement a local search based metaheuristic (like SA). Different metaheuristic strategies are implemented in parSA, e.g. sequential or parallel approaches. The user has to implement three classes with the following functionality: - **SA_Problem**: input and output of problem data, solution creation and evaluation, searching for a neighbor, - **SA_Solution**: represents one solution instance, - **SA_Move**: represents one neighborhood operation. Each time the parSA has to generate a new neighbor of the current solution, it calls the `GetNeighbor()` function of the user-defined class `SA_Problem` and evaluates this new solution via the function `GetCost()`. After the acceptance decision, either the function `ResetSolution()` or `UpdateSolution()` is called. Solution exchange functions must be implemented if the the clustering parallelization is used. The user can use an `ostream` to send an solution instance by the library to another processor. But usually, an entire `solution` is too large to be sent when the processors want to communicate. An incremental exchange of `moves` provides a much faster possibility than the above mentioned method. A `move` represents the difference between two consecutive solutions, which are computed by a processor. If possible, `move` exchange functions should be preferred due to performance reasons. With the basic functionality implemented the user can apply the sequential version of the simulated annealing algorithm, and the Multiple Independent Runs (MIR) parallelization. Solution or move exchange functions are necessary for the clustering parallelization. Details of the Multiple Independent Runs (MIR) parallelization were first presented by Lee in [12]. Basic ideas for the clustering parallelization were introduced by Aarts et.al. in [1] and by Diekmann et.al. in [6]. For the detailed description of the methods implemented in parSA we refer to [11]. 3.2 The Structure of the parSA Library **Searching for a neighbor solution.** The basic task in simulated annealing is the search for a new acceptable solution for the given problem in the neighborhood of the current solution. In the sequential and in the parallel case, this function is implemented in classes which are derived from the basic class `SA_Solver`. The class `SA_Solver` provides functionality which is common for all solvers. In the sequential case, one path in the search space is evaluated, in the parallel case the calculation of several paths is more complex and must be coordinated very carefully. This task belongs to the class `SA_ClusteringSolver` or `SA_MIRSolver`. The solver uses an instance of `SA_Scheduler` to coordinate the acceptance decision during the optimization. The solver also stores the best solution found, which is the final result of the optimization. **Cooling control.** The main task of the cooling control is the handling of the temperature, which determines the acceptance probability for worther solutions during the optimization. In the beginning of the optimization, a start temperature must be chosen. This calculation is fully adaptive and can be carried out in different ways. After the start temperature is determined, the cooling strategy is applied after each temperature level. A temperature level is completed if an equilibrium in the SA-chain is reached. The computation is aborted if the changes of the objective function are small and larger improvements can not be achieved any more. Each of the classes in the parSA library can easily be extended if any new features have to be incorporated into the algorithms or parallelization strategies. 3.3 Communication in parSA In the beginning of the optimization, the temperature is high and therefore the acceptance ratio is high, too (about 90%). Near to the end of the computation the acceptance ratio on processors are low. The processors generate many new solutions which cannot be accepted due to the low temperature. Only 2-5% of generated solutions are accepted in this stage of the algorithm. This causes long `idle times` which can be avoided when generating the solutions in parallel. Clustering parallelization starts with every processor evaluating its individual path in the search space. As the acceptance ratio decreases parallel processors are grouped into clusters. One cluster works on a single subchain in the simulated annealing algorithm. The whole system consists of many clusters which communicate after each temperature level is finished. In the last phase all processors can be grouped together in one large cluster. This motivates the following definitions: Definition 1 (Cluster) A cluster is a processor group, which has one common actual solution in each SA-step. Definition 2 (SA-subchain) A SA-subchain is a sequence of actual solutions, evaluated during one temperature level. Whereas in a sequential SA algorithm a SA-subchain is evaluated by one processor, a cluster evaluates a SA-subchain in the following way: \begin{align*} \text{Setup Cluster } (p_1, p_2, \ldots, p_n) \\ L := \text{Actual Solution}() \\ do \text{Neighbor}(L) := \\ \{\text{Neighbor}(p_1, L), \ldots, \text{Neighbor}(p_n, L)\} \\ \text{Decide about acceptance of } \\ \text{Neighbor}(p_1, L), \ldots, \text{Neighbor}(p_n, L) \\ \text{Choose } L_{\text{new}} \in \text{Neighbor}(L) \text{ as new actual solution} \\ L := L_{\text{new}} \text{ on processors } p_1, p_2, \ldots, p_n \\ \text{until} \text{Equilibrium()} \\ \end{align*} Figure 3. A simulated annealing subchain, computed by a cluster \begin{align*} \text{WarmingUp()} \\ \text{Setup clusters } (C_1, C_2, \ldots, C_m) \\ L := \text{GetInitial Solution}() \\ do \text{in parallel} \\ \text{Compute SA-subchains} \\ in clusters (C_1, C_2, \ldots, C_m) \\ \text{Synchronize all clusters} \\ \text{Choose one actual solution for all clusters} \\ \text{Make clustering decision} \\ \text{Setup new clusters } (C_1, C_2, \ldots, C_k) \\ \text{DecrementT()} \\ \text{until} \text{Frozen()} \\ \end{align*} Figure 4. Outline of the clustering algorithm Communication within a cluster. All processors of a cluster search for an acceptable solution in parallel. If one or more acceptable solutions are found, this event must be communicated between the processors and this new solution must be broadcasted to all processors in the cluster. This can be done using group communication functionality in MPI. In current MPI versions, asynchronous group communication functionality is not available. Therefore asynchronous communication protocols were implemented using basic MPI functions. The performance of the implemented communication protocols is presented in Section 5. The efficiency of the parallel simulated annealing will clearly increase if asynchronous communication is chosen. Communication between the clusters. After a temperature level is completed, the clusters communicate and one solution is chosen to proceed in all clusters. The clusters communicate and decide whether new clusters should be build or not. In the current implementation, two clusters are always grouped into a larger one. The sizes of the clusters needs not be equal for all clusters. parSA is efficient even if the number of processors in various clusters is different. The communication between the clusters is asynchronous, as well. Clustering decision. The decision about forming new clusters is based on real-time measurements of the communication and computation speed of the communication platform and processors. parSA adapts its behavior to the given environment. For this reason it is efficient on several tested platforms. A detailed explanation of the methods used for the clustering decision is given in [11]. 3.4 Parameter which can be defined by the User of the parSA Library Users of the parSA library can specify the behavior of the parallel simulated annealing algorithms in several ways. First of all, an appropriate scheduler can be chosen. There is a geometric scheduler with a relatively simple strategy for cooling. A fully adaptive scheduler is provided as well. A sequential optimization algorithm or two different parallelization approaches can be chosen. The most important parameters for the performance of the parallel optimization are the following: - clustering decision strategy, - communication mode: synchronous or asynchronous, - communication of full solutions or only neighborhood moves. - the rate of SA-chain shortening, which is essential for the attainable solution quality in the parallel case. After presenting the parSA library, we show an application of parSA on one of the optimization problems from the airline industry. We also present experimental results for different parallel machines and networks on that problem. 4 Application: Fleet Assignment For operating an airline different optimization problems have to be solved. These include, e.g., market modeling, aircraft and crew scheduling. In this paper, we address the fleet assignment problem (FAP) which turns up in the midterm planning of an airline. Briefly, in an FAP a flight schedule is given, consisting of a list of flight legs with departure and arrival airport, departure time and block/ground time for every subfleet. A type of aircraft (subfleet) has to be assigned to each flight leg while maximizing the profit. Usually in an FAP a time interval of fixed length is planned and then operated rotationally. An often suggested interval length is one day which applies to many large U.S. domestic airlines [9]. For a more irregular schedule the FAP is solved on a weekly basis like by European or international operating airlines which is true for our problems. The FAP has attracted researchers for many years since operating aircraft is one of the largest expense factors in airlines [4, 8, 9, 14, 15]. A common approach for solving the FAP is to model the FAP as an integer program (IP). 4.1 FAP Model The FAP is solved for a standard period of a predefined length of $T$ minutes, in our case a week ($T=10080$). An FAP can be viewed as a multi-commodity network flow problem in which the subflights are the different commodities. The network is called time-space network [9]. The vertices of the network are the flight events on the stations (arrivals and departures) dependent on the subflight. A direct flight connection between two airports with its departure time is called a leg. The arrival time of a leg for a certain subflight is defined by adding block and ground time for this subflight to the departure time of the leg. The edges of the network are comprised of the flight arcs and the ground arcs. A flight arc connects a departure and an arrival event of one leg flown by one subflight. The ground arcs connect two subsequent (modulo $T$) flight events on one airport. The set of legs is denoted by $L$ and the set of available subflights by $F$. The profit of each leg $l$ when flown by subflight $f$ is $p_{l,f}$. The set of flight events $V$ are the vertices of the network. $v \in V$ is described by a triple $(t, s, f)$ where $t \in [0, \ldots, T-1]$ is the time of arrival (or departure), $s$ is the airport of arrival (or departure), and $f$ is a subflight that can fly the leg corresponding to this flight event. The set of edges is comprised by the flight arcs $E_F$ and the ground arcs $E_G$. A flight arc represents a leg $l$ that is flown by subflight $f$. For $v = (t, s, f) \in V$ the subsequent (preceding) modulo $T$ flight event on the same airport of the same subflight is denoted by $v^+$ ($v^-$). A ground arc $(v, v^+)$ combines the flight events $v$ and $v^+$ and $y_{v,v^+}$ counts the number of aircraft of subflight $f$ between $v$ and $v^+$ residing on airport $s$. The decision variable $x_{l,f}$ is set to 1, if subflight $f$ is assigned to leg $l$, and to 0 otherwise. The (arrival) event of leg $l$ flown by subflight $f$ is denoted by $l_{f}^{arr}$ ($l_{f}^{dep}$). $size_f$ denotes the maximal number of aircraft available for each subflight $f \in F$. The set of flight arcs that cut the count time ($t = 0$, w.l.o.g.) are denoted by $E_{F0}$ and the set of ground arcs which cut the count time are $E_{G0}$. Now, the Fleet Assignment Problem can be described as: \[ \text{maximize} \sum_{i \in L} \sum_{f \in F} p_{l,f} \cdot x_{l,f} \\ \text{subject to} \sum_{f \in F} x_{l,f} = 1 \quad \forall l \in L \quad (1) \\ \sum_{i \in V} y_{v,v^+} \cdot x_{l,f} = 0 \quad \forall v \in V \quad (2) \\ \sum_{(i,l) \in E_F} x_{l,f} \leq size_f \quad \forall f \in F \quad (3) \\ x_{l,f} \in \{0,1\} \quad \forall l \in L; \forall f \in F \quad (4) \\ y_{v,v^+} \geq 0 \quad \forall (v,v^+) \in E_G \quad (5) \] The first set of constraints (1) ensure that exactly one subflight is assigned to each leg. The constraints described in (2) guarantee the flow conservation in the network and the constraints denoted under (3) restrict the number of aircraft per subflight to be used. Since the decision variables $x_{l,f}$ are in $\{0, 1\}$ (4) and because of (2), the variables $y_{v,v^+}$ are integral and therefore only constraints (5) are needed. Since flight schedules evolve over time, solving the FAP does not have to start from scratch. Changes to a flight schedule are integrated into the old schedule by the airline experts, so that for a real-world fleet assignment instance an initial solution is given which can be used by the SA. The local search procedure generating neighbored solutions for a given FAP solution is the problem specific part of the optimization system based on parSA. The details about the neighborhood structure are out the scope of this paper. Briefly, we call $(l_0, \ldots, l_k)$ a leg sequence $S$, if the arrival airport of $l_i$ is the departure airport of leg $l_{i+1}$ for all $i = 0, \ldots, k-1$ and all legs $l_0, \ldots, l_k$ are assigned the same subflight. Leg sequences are generated by a limited depth first search. The neighborhood transition alters the assigned subflight for one or more leg sequences. 5 Experimental Results In this section we present the performance of the sequential version of the FAP algorithm and the performance of the parSA library applied to the fleet assignment problem. The experimental results were obtained on parallel systems of the Paderborn Center for Parallel Computing and on the workstation cluster of the Department of Computer Science of University of Paderborn. The instances we solved are weekly problems of recent summer and winter schedules provided by two large internationally operating airlines. The problem sizes are shown in Table 1. The objective function is composed of the expected revenues, the fixed costs per flown leg, and the expected passenger-related costs. <table> <thead> <tr> <th>FAP</th> <th>legs</th> <th>subfleets</th> <th>airports</th> <th>SA average solution time</th> </tr> </thead> <tbody> <tr> <td>A</td> <td>3337</td> <td>4</td> <td>68</td> <td>3m20s</td> </tr> <tr> <td>B</td> <td>3911</td> <td>10</td> <td>63</td> <td>12m40s</td> </tr> <tr> <td>C</td> <td>4558</td> <td>8</td> <td>75</td> <td>17m20s</td> </tr> <tr> <td>D</td> <td>4616</td> <td>11</td> <td>75</td> <td>25m30s</td> </tr> <tr> <td>E</td> <td>4311</td> <td>11</td> <td>74</td> <td>24m40s</td> </tr> <tr> <td>F</td> <td>3389</td> <td>9</td> <td>73</td> <td>16m10s</td> </tr> </tbody> </table> Table 1. FA problem sizes and initial solution provided by the airlines, results of the SA algorithm, upper bound (UB) with the reduced number of aircraft used by the SA solution, upper bound (UB') with the number of aircraft used by the initial solution. Due to confidentiality only percentage results on the objective (profit) can be shown. For measuring the solution quality of our algorithm we computed an upper bound on the objective function by relaxing the integrality of the decision variables $x_{i,j}$. Solving the linear program was carried out by CPLEX 6.0. Since our SA algorithm tries to reduce the number of subfleets where possible, the upper bound is also computed for the same number of subfleets used by the SA algorithm. Objective values of the SA algorithm and the upper bounds are listed in Table 1. The upper bound UB (linear program solution) cannot directly be used for generating a valid integer solution. A full integer programming approach for the instances mentioned in Table 1 will run for several hours which is significantly more than 10–30 minutes as in our approach. Moreover we can even solve larger instances in a reasonable amount of time (up to 30000 legs). ### 5.1 Parallel Results: Speedup & Solution Quality The SCI cluster used in parallel tests with parSA is a Siemens hpcLine system. The system utilizes 96 double-processor Intel Pentium II (450 MHz) boards. The cluster uses the Scalable Coherent Interface (SCI) interconnect standard. The implementation of the MPI standard is realized through the global shared space provided by the SCI. The implementation is high performant with a latency of 6 micro seconds and a bandwidth of 70 Mbytes/sec. The parallel results for the fleet assignment problem are presented in Figure 5. The two first plots show the efficiency of the parallelization and the third one the obtained solution quality (the 1 in the plot represents the value of the upper bound on the objective function calculated by an LP solver). The application scales well up to 16 processors. Further improvement is not easy to achieve because of very short computation times: It was reduced from 30 minutes in the sequential case to 2-5 minutes on 16 processors. The efficiency of parSA will be even higher if the computation times are considerable greater, i.e. in the case of the fully dated fleet assignment problem. This extension from a weekly model to a period of six weeks brings a substantial increase in the complexity of the problem. That is where the parSA comes into its own. Extending the FA model to the fully dated FAP is a part of the ongoing work. In the first setting three different clustering strategies are compared. The standard strategy maximizes the product of cluster speedup and cluster efficiency. The other strategies maximize only the cluster speedup (speedup) or decide to cluster when the cluster efficiency is at least 1/2 (efficiency). One can observe that the standard clustering strategy balances the both values in a reasonable way and achieves the best results in this experiment. The second experiment compares different communication modes in the parallel version of the simulated annealing algorithm: full solutions or only neighborhood moves (standard setting). The communication of moves is slightly more efficient because of smaller amount of data which is communicated between the nodes. The long chains setting results in a lower efficiency but significant higher solution quality in the parallel case. The reason for this effect is the better convergence of SA in this case. Note that modeling the real-world FAP involves some inaccuracies, e.g., estimated number of passengers which is again dependent on the assigned subfleets. In practice, an optimal solution to an FAP is not necessarily of more value than a high quality approximative solution. The solution quality in the parallel case is not always as high as in the sequential case. But for the mentioned reasons the gain in the running time outweighs the loss in the solution quality. ### 6 Conclusion We have presented a general parallel simulated annealing library parSA which is publicly available [10] for research purposes. The user-interface of the library is clear and flexible. The generality of the metaheuristic simulated annealing was kept. The interface is rather intuitive and easy to implement. The clear distinction between problem-independent and problem-specific constructions of the SA-algorithm makes the library generally applicable. Because of the exactly modeled structure of the simulated algorithm existing implementation of the algorithm can be eas- As an application we presented a parSA-based heuristic algorithm to solve the airline fleet assignment problem. This module is now in use in a production planning system of a large internationally operating airline. In real-world applications like this the library provides the possibility to reduce the problem solution times significantly by the use of parallel system power. Moreover we can even solve larger instances in a reasonable amount of time. This leads to an interactive decision support tool for optimization problems which used to take hours to compute. References
{"Source-Url": "https://www2.cs.sfu.ca/CourseCentral/417/havens/papers/geokl.IPDPS2000.pdf", "len_cl100k_base": 6116, "olmocr-version": "0.1.49", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 26641, "total-output-tokens": 7131, "length": "2e12", "weborganizer": {"__label__adult": 0.0012464523315429688, "__label__art_design": 0.0005140304565429688, "__label__crime_law": 0.00125885009765625, "__label__education_jobs": 0.0018405914306640625, "__label__entertainment": 0.0002713203430175781, "__label__fashion_beauty": 0.0004684925079345703, "__label__finance_business": 0.001262664794921875, "__label__food_dining": 0.0011396408081054688, "__label__games": 0.0032749176025390625, "__label__hardware": 0.0033855438232421875, "__label__health": 0.0018367767333984375, "__label__history": 0.0014591217041015625, "__label__home_hobbies": 0.00027251243591308594, "__label__industrial": 0.003644943237304687, "__label__literature": 0.0006194114685058594, "__label__politics": 0.0011768341064453125, "__label__religion": 0.0011110305786132812, "__label__science_tech": 0.423828125, "__label__social_life": 0.0002789497375488281, "__label__software": 0.0274658203125, "__label__software_dev": 0.465576171875, "__label__sports_fitness": 0.0013761520385742188, "__label__transportation": 0.055389404296875, "__label__travel": 0.0013675689697265625}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 30275, 0.02428]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 30275, 0.37065]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 30275, 0.89759]], "google_gemma-3-12b-it_contains_pii": [[0, 3417, false], [3417, 7100, null], [7100, 12330, null], [12330, 16468, null], [16468, 22117, null], [22117, 27596, null], [27596, 30275, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3417, true], [3417, 7100, null], [7100, 12330, null], [12330, 16468, null], [16468, 22117, null], [22117, 27596, null], [27596, 30275, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 30275, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 30275, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 30275, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 30275, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 30275, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 30275, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 30275, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 30275, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 30275, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 30275, null]], "pdf_page_numbers": [[0, 3417, 1], [3417, 7100, 2], [7100, 12330, 3], [12330, 16468, 4], [16468, 22117, 5], [22117, 27596, 6], [27596, 30275, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 30275, 0.05882]]}
olmocr_science_pdfs
2024-11-25
2024-11-25
73526bceec2b96e5603a7b054f741f353c8a416b
A Multidimensional View of Critical Web Application Security Risks: A Novel ‘Attacker-Defender’ PoV By assessing specific functional attributes across the application and IT architecture, security and remediation teams can more effectively anticipate and plug vulnerabilities exploited by hackers and other cybercriminals. EXECUTIVE SUMMARY Web applications have evolved to meet a wide range of business requirements. The increasing complexity of these applications significantly augments the attack surface of the infrastructure and thus leaves an organization open to potential security threats. With the various user-interactive functionalities such as login, registration, payment, etc. that deal with underlying components such as databases, lightweight directory access protocol (LDAP) repositories greatly increase the attack surface area and become prime areas of focus for hackers. These functionalities act as entry and exit points to the application and underlying infrastructure. Successful penetration through the application layer leads to attacks that may cause remote code execution with web server privileges, unauthorized access to information stored in a web server, website content defacement, deletion of files in the web server and denial of service. Any of these outcomes can damage the organization’s reputation. The fundamental security problem with web applications is that all user input is considered untrusted; this requires the implementation of a number of security mechanisms to enable applications to defend themselves against attack. Figure 1 (see next page) depicts vulnerability distribution for 2016 across different verticals. This white paper illuminates various defense mechanisms that can be applied to key functionalities of a web application to secure them from being attacked. Based on our project engagements in the year 2016, the vulnerability distribution across the different functionalities are highlighted in Figure 2 (see next page). Our attacker-defender approach considers common functionalities in any web application from an attacker’s perspective and then presents the defense techniques to be employed in order to secure the application. The following sections elucidate the attacker and defender approach for different functionalities commonly found in a web application. **LOGIN/LOGOUT** User authenticity has become a necessity in almost every web application and is typically managed through the login and logout functionalities. These functionalities are the front line of defense for an application and are seen in every small to complex web application owned by different industry sectors such as banking, healthcare and retail. Authentication services limit unauthorized users in conjunction with certain other protected features of the application. Authentication functionalities such as login and logout, in our view, are more often subject to design weaknesses than any other security mechanisms employed in web applications. Authentication technologies vary from HTML form-based authentication, multifactorial mechanisms such as combining passwords and physical tokens, client secure socket layer (SSL) certifications and smartcards, HTTP basic and digest authentication, and Windows integrated authentication using NTLM or Kerberos protocols. **Attacker-Defender Approach** To gain a cohesive understanding of application security issues, a slightly modified attack tree can be deployed. The tree will represent several possible attacks that are targeted at a specific functionality, along with the corresponding... mitigation techniques to hamper the attack. Figure 3 (see next page) depicts such an attack tree for login/logout functionality, which includes attack methods and attacks that aim to gain user credentials. The tree also enlists the remediation methods to defend against the attacks. Injection - **Attacker**: Injection flaws - such as SQL, SQLi, bSQLi, NoSQLi, HQL injection and LDAP injection - occur when untrusted data is sent to an interpreter as part of a command or query. The attacker usually sends simple text-based messages that exploit the syntax of the targeted interpreter. Almost any source of data can be an injection vector, including internal sources. - **Defender**: The most effective way to prevent injection attacks is to use parameterized queries (prepared statements) for all database access. This two-step method incorporates potentially tainted data into all types of SQL queries: first, the application specifies the structure of the query, leaving placeholders for each item of user input; second, the application specifies the contents of each placeholder. Because the structure of the query has already been defined in the first step, it is not possible for malformed data in the second step to interfere with the query structure. One of the most powerful controls, if done well, is validation of the input that an application receives. It can be as simple as strictly typing a parameter and as complex as using regular expressions or business logic to validate input. There are two different types of input validation approaches: whitelist validation (inclusion or positive validation) and blacklist validation (exclusion or negative validation). Phishing Through Frames - **Attacker**: Phishing is a scenario which involves an e-mail message that asks users to update their personal information with a link to a spoofed website. Frames are a popular method of hiding attack content due to their uniform browser support and easy coding style. The page linked to within the hidden frame can be used to deliver additional content, retrieve confidential information such as session IDs, or do something more elaborate such as executing screen-grabbing and key-logging while the user is exchanging **Attack Tree with Mitigations for Login/Logout Functionality Vulnerabilities** - **FUNCTIONALITY** - Login/Logout Functionality - Gaining User Credentials Information - **ATTACK METHODS** - Attacks Related to User Interface - Password replay - Browser refresh attack - Click-jacking - SQL injection - Attacks Related to N/W Channel - Getting the username/password value from history (get method enabled) - Enabling the browser configuration to get sensitive user data (Autocomplete set=ON) - Retrieving sensitive data from temp file (Http page enabled the cache/store) - Sniffing the unencrypted data channel - Weak SSL ciphers would permit decrypting and intercepting a particular SSL - Forgery of the self-signed certificate - **ATTACKS** - Application should redirect to generic error page. - Hash the password before the data is sent to the server. - Embed click-jacking defensive code in the UI window. - Username/password should be passed on the POST request. - Enable the no-cache/no-store flag. - Proper SSL certification should be enabled with standard cryptographic algorithms. - Standard cryptographic algorithms (NIST/local policy) should be used to encrypt the sensitive data. - **MITIGATION** **Figure 3** confidential information over the Internet. Through this attack, an adversary can trick the user into entering the login credentials to a spoofed website and capture the content in a hidden frame. **Defender:** There are two modes of defending mechanism for this attack: - **Browser perspective:** Browser pop-ups are a common attack technique used by attackers to make it appear that the requests are coming from a victim domain. Disabling pop-ups will make it much more difficult for attackers to take over the user’s session without being detected. - **Application coding perspective:** As attackers use frames to host malicious content, they can discover the confidential information in the application. The best practice here is to use a Target directive to create a new window that will usually break out of an iframe and other JavaScript jails. **Attacker-Defender Approach** The two major attack methods for stealing payment information are UI-related and network-related attacks. Attacks that are executed through the user interface include injection, accessing clipboard data, cross-site scripting, cross-site request forgery (CSRF), etc. Network-related attacks, however, are accomplished over the network channel - e.g., sniffing, decrypted weak ciphers and self-signed SSL certificate forgery. **Cross-Site Scripting** - **Attacker:** Cross-site scripting (XSS) is a type of injection problem in which malicious scripts are injected into a trusted website. XSS flaws occur whenever an application sends untrusted data without validation or encoding to a web browser or stores it in the target servers. - **Defender:** XSS can be prevented by performing proper input validation and output encoding on both the client and server sides such that the scripts are not executable. Filter out the hazardous characters from the user input into the web application. **CSRF** - **Attacker:** The attacker can force the user to send unintended requests to the application server and perform malicious actions on behalf of the web application user who has already logged into the application. - **Defender:** Insert custom random tokens into every form and URL that will not be automatically submitted by the browser. Every request should contain a unique identifier, Do not use GET requests (URLs); instead, use POST when processing sensitive data requests. **Attack Tree with Mitigations for Payment-Related Functionality Vulnerabilities** **Payment Functionality** **Gaining Sensitive User Payment Information** **ATTACK METHODS** - Attacks Related to User Interface - Cross-site scripting - SQL injection - CSRF - Attacks Related to N/W Channel - Bypass the nonstandard cryptographic algorithm using known plain text, cipher text attack - Session-based attacks (session hijacking/session fixation) - Retrieving sensitive data from temp file (Https page enabled the cache/store) - Sniffing the unencrypted data channel - Decrypt the SSL certificate if weak cipher enabled in the application - Forgery of the self-signed certificate **MITIGATION** - White list validation should apply to all the user-controlled data. - Output encoding should apply to the server response. - Escape the malicious characters. - White list validation should apply to all the user-controlled data. - Parameterized data passed to the application. Application should not display the detailed error message. - Pass the unique token value to each request. - Enable the no-cache/no-store flag. - Standard cryptographic algorithms (NIST/local policy) should be used to encrypt the sensitive data. - Session value is properly invalidated at server side. - Unique token value should be used in each session. - Implement secure session management. Use strong session IDs, protect them in transit and regenerate session identifiers at frequent intervals. - Proper SSL certification should be enabled with standard cryptographic algorithms. Figure 4 which is a parameter that an attacker cannot guess. Do not use GET requests (URLs); instead, use POST when processing sensitive data requests. Retrieving Sensitive Data from a Temp File - **Attacker:** It is possible for an attacker to gather sensitive information about the payment application such as usernames, passwords, credit card data, account numbers, machine names and/or sensitive file locations. - **Defender:** Clear all parameters, sensitive information and input values when the page is being loaded/reloaded. //Cache-Control: no-cache, no-store, must-revalidate Pragma: no-cache Expires: 0/ Figure 4 (see previous page) depicts an attack tree for payment functionality, comprising attack methods, types of attacks that aim to gain sensitive user payment information and various mitigation techniques. **SEARCH** Search functionality is commonly used in most applications to enable users to discover content --- **Attack Tree with Mitigations for Search-Functionality-Related Vulnerabilities** **FUNCTIONALITY** - Search Functionality **ATTACK METHODS** - Execution of Unintended Payloads **ATTACKS** - XSS - SQL Injection - HTTP Response Splitting **MITIGATION** - White list validation should apply to all the user-controlled data. - Output encoding should apply to the server response. - Escape the malicious characters. - White list validation should apply to all the user-controlled data. - Parameterized data passed to the application. - Application should not display the detailed error message. - Sanitize the response header when user input is reflected in the response header. --- Figure 5 contained in a data repository. Search pages are usually constructed with a single form field and a submit button. A search query would display both the matched results and the searched-for text. Attackers often attempt to exploit search functionality behaviors to execute unintended queries or malicious scripts. **Attacker-Defender Approach** **HTTP Response Splitting** - **Attacker:** A response splitting attack is possible only if there is a proxy server used by multiple users to connect to various websites. The attacker will be able to modify the request header with a value and two responses, separated by `%0d%0a` (CRLF) code. Immediately after sending the first request, the attacker sends a second request for a valid publicly accessible page on the site/server. - **Defender:** Use server side validation and disallow CRLF characters in all requests where user input is reflected in the response header. Figure 5 (see previous page) depicts an attack tree for search functionality attacks that aim to execute unintended payloads, plus defensive remediation techniques. **REGISTRATION** Registration is a basic and essential function. Self-service registration functionality allows new users to register or enroll in the application by providing personal details such as username, date of birth, e-mail address, security questions, etc. The new user is registered if all provided details fit according to the application's requirements, thus allowing users to log in thereafter. Since all users who try to log into the application are not always legitimate users, the application should validate unauthorized inputs before they are processed. **Attacker-Defender Approach** **Enumerating User Information** - **Attacker:** Enumeration is the first stage of the attack; it is the process used to gather the information about a target application by actively connecting to it and identifying the user account, system account and admin account. It is also an activity in which an attacker tries to retrieve valid usernames from a web application. If the system is vulnerable to this attack, the attacker may be able to obtain a list of existing usernames in the system by submitting input (valid and invalid usernames) and analyzing the server response (error messages). The scope of this test is to verify if it is possible to collect a set of valid usernames by interacting with the application's authentication mechanism. The attacker can then run a dictionary attack to further exploit the obtained information. - **Defender:** The effective way to prevent enumeration attacks is to add CAPTCHA in the registration page. Also, display only the customized error messages to the user interface, and disable the unnecessary comments in the source code to prevent the attacker from gathering information from the error messages. **Automated Multiple Registration** - **Attacker:** The attacker tries to increase the size of the request by appending an enormous amount of data that is sent to the server. This could result in a delayed response or server hanging. The attacker can also send "n" number of requests to the server for registering multiple times to cause the denial of service attacks. - **Defender:** The most effective way to prevent automated multiple registration is to validate the content length and check for the file size that is being passed in the request. If the content size is more than the specified limit, drop that particular request. If there are too many requests in the queue, then the upcoming request should be automatically dropped without serving. Approaches such as a one-time password, generating QR code and using CAPTCHA riddles should be implemented to reduce the impact of this attack. ### Sniffing the Unencrypted Data Channel - **Attacker:** This is a type of cyberattack where a malicious user inserts him/herself into a conversation between two parties, impersonates both parties and gains access to information that the two parties were trying to send to each other. This attack allows a malicious user to intercept, send and receive data meant for someone else and gain access to the unauthorized resources. - **Defender:** Use strong encryption standards between the client and the server; also, the server should authenticate the client’s request by presenting a digital certificate, and only then allow connection to be established. ### Decrypt the SSL Certificate if Weak Cipher Is Enabled in the Application - **Attacker:** All systems and applications utilizing the SSL with cipher-block chaining mode ciphers may be vulnerable. By decrypting this SSL certificate, an attacker can gain access to sensitive data passed within the encrypted web session, such as passwords, cookies and other authentication tokens. These can then be used to gain more complete access to a website (impersonating that user, accessing database content, etc.). - **Defender:** It is important to check the SSL configuration being used to avoid putting in place cryptographic support that could be easily defeated. Accordingly, an SSL-based service should not offer the possibility to choose a weak cipher suite. A cipher suite is specified by an encryption protocol (e.g., DES, RC4, AES), the encryption key length (e.g., 256 bits) and a hash algorithm (e.g., SHA, MD5) used for integrity checking. ### Forge the Self-Signed Certificate - **Attacker:** The attackers usually use self-signed digital certificates or stolen certificates that are accepted as valid by most browsers. The browsers display a warning message when encountering errors during SSL certificate validation, but users can proceed anyway. This is the typical scenario for fake SSL connections, which triggers Self-signed certificates with pinning are more secure than CA-signed certificates. **Attack Tree with Mitigations for Registration-Functionality-Related Vulnerabilities** **FUNCTIONALITY** - Registration Functionality - Gaining Sensitive Information - Attacks Related to User Interface - Enumerating user information - Enabling the browser configuration to get sensitive user data (Autocomplete set=ON) - Cross-site scripting - SQL injection - Attacks Related to N/W Channel - Retrieving sensitive data from temp file (Https page enabled the cache/store) - Automated multiple registration - Sniffing the unencrypted data channel - Decrypt the SSL certificate if weak cipher is enabled in the application - Forgery of the self-signed certificate **ATTACK METHODS** **ATTACKS** - Enumerating user information - Enabling the browser configuration to get sensitive user data (Autocomplete set=ON) - Cross-site scripting - SQL injection - Retrieving sensitive data from temp file (Https page enabled the cache/store) - Automated multiple registration - Sniffing the unencrypted data channel - Decrypt the SSL certificate if weak cipher is enabled in the application - Forgery of the self-signed certificate **MITIGATION** - Customized error message should be revealed to the user. - Unnecessary source code comments should be disabled. - Autocomplete set=OFF for sensitive fields. - Whitelist validation should apply to all the user-controlled data. - Parameterized data passed to the application. - Application should not display the detailed error message. - Whitelist validation should apply to all the user-controlled data. Output encoding should apply to the server response. - Escape the malicious characters. - Enable the no-cache/no-store flag. - Proper SSL certification should be enabled with standard cryptographic algorithms. Figure 6 a certificate warning, caused primarily by server misconfigurations. However, these alerts are often ignored by users who trust forged SSL certificates. - **Defender:** Browser vendors could mitigate this cyber threat by adopting HTTP Strict Transport Security, Public Key Pinning and TLS Origin Bound Certificates, and by validating certificates with notaries. In general, self-signed certificates with pinning are more secure than CA-signed certificates. Figure 6 (see previous page) depicts an attack tree for registration functionality, illustrating attack methods and types of attacks that attempt to gain sensitive information from the user. The tree also elaborates several countermeasures. **FILE UPLOAD/DOWNLOAD** Uploaded files represent a significant risk to applications. The consequences of unrestricted file upload can vary, including complete system takeover, an overloaded file system or database, forwarding attacks to back-end systems and simple defacement. It depends on what the application does with the uploaded file and especially where it is stored. **Attacker-Defender Approach** **Remote File Inclusion (RFI)/Local File Inclusion (LFI)** - **Attacker:** Remote file inclusion (RFI) is a type of vulnerability most often found on websites. It allows an attacker to include a remote file, usually through a script on the web server. The vulnerability occurs due to the use of user-supplied input without proper validation. An attacker may use streams to exploit RFI vulnerable parameters. RFI attacks are highly automated, judging by traffic shape (e.g., consistency and rate) and characteristics (e.g., distinctive HTTP headers), making them very suitable for mitigation via reputation-based blacklists. By exploiting RFI vulnerability, an attacker can inject a c99 shell to attack a web server. Scripts also can be injected through RFI in order to deface the websites. In local file inclusion (LFI), which is similar to remote file inclusion vulnerability, only local files (i.e., files on the current server) are included. The vulnerability is also due to the use of user-supplied input without proper validation. LFI enables an attacker to include code that is already hosted on the same web server as the application. LFI vulnerability exploitation requires that the malicious code is hosted on the vulnerable server. By using the presence of LFI, an attacker can execute the remote code via an Apache server log. Code can also be executed via uploading files by including some script files in the uploaded files. - **Defender:** If the uploaded file needs to be stored on the disk, use a server-generated filename. Inspect the content of uploaded files, and enforce a whitelist of accepted, non-executable content types. Enforce a whitelist of accepted, non-executable file extensions. And also ensure that the file extension matches the actual type of the file content. Use a predefined switch/case statement to determine which file to include rather than using a URL or form parameter to dynamically generate the path. If uploaded files are downloaded by users, provide an accurate non-generic content-type header. Enforce appropriate authorization on all critical functionalities. Attack Tree with Mitigations for File-Upload-Related Functionality Vulnerabilities **File Upload** **Execution of Unintended File/Shell/Payloads** - **Remote File Inclusion** - **Local File Inclusion** - **Malicious Content Upload (Shell/Batch)** **MITIGATION** - Use a server-generated filename if storing uploaded files on disk. - Inspect the content of uploaded files, and enforce a whitelist of accepted, non-executable content types. - Enforce a whitelist of accepted, non-executable file extensions. - If uploaded files are downloaded by users, supply an accurate non-generic content-type header. - Enforce a size limit on uploaded files. Reject attempts to upload archive formats such as ZIP/war/jar. **PARAMETER TAMPERING** **Attacker:** The attacker attempts to change the role of his/her user ID to a higher privileged one. First the attacker identifies the parameter representing the user role that is sent in HTTP requests to the application. The attacker then modifies the parameter to a higher privileged one and gains additional privileges. The attack is possible when the application relies on user role/level parameters in HTTP requests to determine the user’s access level. These parameters could initially be set by the application upon authentication, in the HTTP response as cookies or in hidden fields. Based on the parameter, the application could return a list of application functionalities/menu-items applicable to the user. Since a client-supplied role parameter of the application is accepted **Privileged User Functionalities** Privilege escalation attacks aim to obtain additional privileges for web application users to access critical system resources, functions, pages or accounts. They can be either vertical or horizontal privilege escalation attacks. by the server, it is possible to tamper with these values. The attacker force-browses into a particular restricted functionality by tampering with HTTP query parameters. For example: If a user is authorized to only view the list of users using www.app.com/users.aspx?fn=view, he may edit or delete users by force-browsing to www.app.com/users.aspx?fn=edit. The attacker retrieves the data of another user by modifying exposed system object references. Then the attacker attempts to obtain other users’ details by modifying the primary key value such as a database table or record value, exposed by the application. - **Defender:** Do not rely on client-supplied values of user level or role ID to determine the access level for a user. Implement proper access control at the server side for all users. Enforce appropriate authorization on all critical functionalities. Perform authorization checks at the server side to ensure the user is authorized for the requested resource/function. Do not expose references to system objects or primary keys. Each use of an object reference from an untrusted source must include an access control check to ensure the user is authorized for the requested object. Use per-user or session-specific indirect object references. For example, instead of using the resource’s database key, the application should map the user indirect reference back to the actual database key on the server. **Path Traversal** - **Attacker:** The attacker aims to access files and directories that are stored outside the web root folder. This attack can be executed with an external malicious code injected on the path parameters. For example: An attacker can exploit a file download functionality to download sensitive configuration files, such as the Web.config, and gain vital information about the application such as database credentials, admin credentials, etc. - **Defender:** Perform proper input validation on all user-supplied parameters and URI requests. Restrict the user-defined path within a whitelist of allowed paths. The directory/filename should be expanded to its absolute canonical path. Enforce directory level access control. **Forced Browsing** - **Attacker:** The attacker attempts to access the pages of admin/privileged users. He or she initiates a direct request attack wherein he tries accessing sensitive resources by directly browsing to the URL. For example: An attacker may be able to access administrative pages in www.vulnerableapp.com by browsing to www.vulnerableapp.com/admin.apsx. - **Defender:** Do not make the assumption that resources can be reached only through the user interface or by the menu items displayed to the user. Enforce authorization at the server side to ensure the user has the required privilege to access the page. Do not rely on client side validation. Perform server side access control check for all pages/functionalities. **Session Hijacking** - **Attacker:** The attacker gains access to the active session of an authenticated user and using the session gains full access to all functionalities in the privileges of the Regenerate session IDs after every successful login and at frequent intervals. Use unique, sufficiently long, random session identifiers to reduce risk of brute force attack. Attack Tree with Mitigations for Privilege Escalation Functionality-Related Vulnerabilities - View state should be used to avoid tampering. - Function level access control should be enabled. - Whitelist validation should apply to all the user-controlled data. Escape malicious characters in user input. - Perform server side authorization checks. - Avoid client side validation. - Implement secure session management. Use strong session IDs, protect them in transit and regenerate session identifiers at frequent intervals. - Use a server-generated filename if storing uploaded files on disk. - Inspect the content of uploaded files, and enforce a whitelist of accepted, non-executable content types. - Enforce a whitelist of accepted, non-executable file extensions. - If uploaded files are downloaded by users, supply an accurate non-generic content-type header. victimized user. If the victim account has elevated privileges, the attacker can even revoke the admin privileges from the victim account and grant it to him- or herself. - **Defender:** Properly invalidate the session once the user has successfully logged out. Maintain a standard session time out – say, 20 minutes. Do not use static values of session identifiers for the identification of a legitimate user. Do not accept client-supplied session tokens to prevent session fixation. Regenerate session IDs after every successful login and at frequent intervals. Use unique, sufficiently long, random session identifiers to reduce risk of brute force attack. Include http only and secure flags set in cookies in order to avoid session cookie theft. Figure 8 (see previous page) depicts an attack tree for user privilege management, showcasing attacks that exploit vulnerabilities in the application to gain greater privilege access. Possible remediation methods for preventing privilege escalation and maintaining access control are also presented. ABOUT THE AUTHOR Dr. Sivakumar Kathiresan Principal Architect, Technology Sivakumar.Kathiresan@cognizant.com Dr. Sivakumar Kathiresan, B.E., M.E., Ph.D., is a Principal Architect, Technology, within Cognizant’s Enterprise Risk and Security Solutions business unit. In this role, he leads the North American competency, solutions and pre-sales effort in the organization’s integrated vulnerability management services team. He has managed 150-plus security assessment projects across various industry sectors over the last six years. Sivakumar has 22 years of experience, including industry, research and academia, and has delivered more than 125 knowledge-sharing and solution architect sessions on various fields of enterprise security at different forums. His current areas of interest are web security, secure SDLC, advanced log analysis, application vulnerability correlation, integrated vulnerability management, advanced persistent threats and management, and security analytics. Sivakumar received his Ph.D. from the Indian Institute of Technology, Roorkee; he continues to research the area of digital security. His certificates include CEH, CISM, Sourcefire, Qualysguard, Envision, LanDesk and BigData Associate. ACKNOWLEDGMENTS The author recognizes the value added by the following Cognizant associates: • Sivakumar Subramaniam, Head, ITM and IVM. • Sivarama Subramanian Kailasam and the entire IVM delivery team. He also acknowledges the contributions to this white paper of the following Cognizant cybersecurity experts: Balachanthar Palanivelu Rakesh Balasunder Subadeepam Rajappan Nisha Selvaraj Naga Pranavi K Padma Prasoona K Parkavi Neelakandan Jemmi Angelin Manoharan Jayasree Otukuru Abhijeet Ananda Patil Siddesh N Rekha Tharmaraj Pavithra Kamaleswar Pradeep Varadarajan Vimalaasree Anandhan Saravanakumar G Ranjith Kumar Ramu Dinesh Jain Nagamarimuthu Karuppiah Grace Catherine Jothisprakash Sivapradha Sivaraman KK Ashwin Eby Mohan Chendhil Thirumalai Kandasamy Prasath J Madhan Mohan Subhashini Sundaramurthy Rajesh Chilukuri Thirupathaiah ABOUT COGNIZANT ENTERPRISE RISK AND SECURITY SOLUTIONS Cognizant Enterprise Risk and Security Solutions (ERSS) business unit specializes in providing end-to-end information security solutions for various industry sectors, including retail, banking and financial services, logistics, telecom, healthcare, manufacturing, and travel and hospitality, and has served 450-plus customers across various geographies. The team has expertise in providing information security solutions and services based on best-of-breed products in each category of enterprise security. Our services include: - 1600-plus security consultants specializing in IAM, GRC, data security and application security assessment. - 350-plus CISA, CISM, CISSP, CEH and vendor certified associates. - 350-plus Infrastructure Security trained associates. - Over 11000 person years of information security experience. - A proven track record and experience in 500-plus client engagements for security services. - Partnership with leading vendors such as IBM, CA, Oracle, Sail Point, Novell, Dell, RSA, HP, Symantec, etc. ABOUT COGNIZANT Cognizant (NASDAQ-100: CTSH) is one of the world’s leading professional services companies, transforming clients’ business, operating and technology models for the digital era. Our unique industry-based, consultative approach helps clients envision, build and run more innovative and efficient businesses. Headquartered in the U.S., Cognizant is ranked 230 on the Fortune 500 and is consistently listed among the most admired companies in the world. Learn how Cognizant helps clients lead with digital at [www.cognizant.com](http://www.cognizant.com) or follow us @Cognizant.
{"Source-Url": "https://www.cognizant.com/whitepapers/a-multidimensional-view-of-critical-web-application-security-risks-a-novel-attacker-defender-pov-codex2531.pdf", "len_cl100k_base": 6766, "olmocr-version": "0.1.50", "pdf-total-pages": 18, "total-fallback-pages": 0, "total-input-tokens": 39579, "total-output-tokens": 7633, "length": "2e12", "weborganizer": {"__label__adult": 0.0008330345153808594, "__label__art_design": 0.0011339187622070312, "__label__crime_law": 0.0211029052734375, "__label__education_jobs": 0.0014696121215820312, "__label__entertainment": 0.00033545494079589844, "__label__fashion_beauty": 0.0004260540008544922, "__label__finance_business": 0.006671905517578125, "__label__food_dining": 0.0004703998565673828, "__label__games": 0.0028209686279296875, "__label__hardware": 0.005435943603515625, "__label__health": 0.0012874603271484375, "__label__history": 0.00047898292541503906, "__label__home_hobbies": 0.00029206275939941406, "__label__industrial": 0.0013151168823242188, "__label__literature": 0.00045990943908691406, "__label__politics": 0.0007262229919433594, "__label__religion": 0.0006623268127441406, "__label__science_tech": 0.201416015625, "__label__social_life": 0.0002142190933227539, "__label__software": 0.282958984375, "__label__software_dev": 0.46826171875, "__label__sports_fitness": 0.0004777908325195313, "__label__transportation": 0.00067901611328125, "__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, 34334, 0.00319]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 34334, 0.18993]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 34334, 0.87882]], "google_gemma-3-12b-it_contains_pii": [[0, 324, false], [324, 1668, null], [1668, 3594, null], [3594, 5823, null], [5823, 7111, null], [7111, 9391, null], [9391, 11071, null], [11071, 12706, null], [12706, 15819, null], [15819, 18447, null], [18447, 20362, null], [20362, 23518, null], [23518, 25382, null], [25382, 28491, null], [28491, 29534, null], [29534, 30586, null], [30586, 32658, null], [32658, 34334, null]], "google_gemma-3-12b-it_is_public_document": [[0, 324, true], [324, 1668, null], [1668, 3594, null], [3594, 5823, null], [5823, 7111, null], [7111, 9391, null], [9391, 11071, null], [11071, 12706, null], [12706, 15819, null], [15819, 18447, null], [18447, 20362, null], [20362, 23518, null], [23518, 25382, null], [25382, 28491, null], [28491, 29534, null], [29534, 30586, null], [30586, 32658, null], [32658, 34334, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 34334, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 34334, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 34334, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 34334, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 34334, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 34334, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 34334, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 34334, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 34334, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 34334, null]], "pdf_page_numbers": [[0, 324, 1], [324, 1668, 2], [1668, 3594, 3], [3594, 5823, 4], [5823, 7111, 5], [7111, 9391, 6], [9391, 11071, 7], [11071, 12706, 8], [12706, 15819, 9], [15819, 18447, 10], [18447, 20362, 11], [20362, 23518, 12], [23518, 25382, 13], [25382, 28491, 14], [28491, 29534, 15], [29534, 30586, 16], [30586, 32658, 17], [32658, 34334, 18]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 34334, 0.0]]}
olmocr_science_pdfs
2024-11-28
2024-11-28
4cab328b737f2b66d6e90e22b13d3f0b14b40cf5
[REMOVED]
{"Source-Url": "http://cse.unl.edu/~skuttal/IS_EUD.pdf", "len_cl100k_base": 7787, "olmocr-version": "0.1.53", "pdf-total-pages": 16, "total-fallback-pages": 0, "total-input-tokens": 33611, "total-output-tokens": 9158, "length": "2e12", "weborganizer": {"__label__adult": 0.0002472400665283203, "__label__art_design": 0.00029969215393066406, "__label__crime_law": 0.00017070770263671875, "__label__education_jobs": 0.0016040802001953125, "__label__entertainment": 5.143880844116211e-05, "__label__fashion_beauty": 9.399652481079102e-05, "__label__finance_business": 0.0002034902572631836, "__label__food_dining": 0.00017774105072021484, "__label__games": 0.00034689903259277344, "__label__hardware": 0.0003993511199951172, "__label__health": 0.00017654895782470703, "__label__history": 0.00013637542724609375, "__label__home_hobbies": 6.657838821411133e-05, "__label__industrial": 0.0001506805419921875, "__label__literature": 0.0001773834228515625, "__label__politics": 9.942054748535156e-05, "__label__religion": 0.00023555755615234375, "__label__science_tech": 0.0032176971435546875, "__label__social_life": 0.00011098384857177734, "__label__software": 0.01529693603515625, "__label__software_dev": 0.97607421875, "__label__sports_fitness": 0.00013577938079833984, "__label__transportation": 0.00022172927856445312, "__label__travel": 0.0001360177993774414}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 41526, 0.02406]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 41526, 0.58345]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 41526, 0.94733]], "google_gemma-3-12b-it_contains_pii": [[0, 2542, false], [2542, 5845, null], [5845, 7985, null], [7985, 10336, null], [10336, 10841, null], [10841, 14100, null], [14100, 17488, null], [17488, 20872, null], [20872, 23974, null], [23974, 25450, null], [25450, 27799, null], [27799, 29984, null], [29984, 32456, null], [32456, 35567, null], [35567, 38885, null], [38885, 41526, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2542, true], [2542, 5845, null], [5845, 7985, null], [7985, 10336, null], [10336, 10841, null], [10841, 14100, null], [14100, 17488, null], [17488, 20872, null], [20872, 23974, null], [23974, 25450, null], [25450, 27799, null], [27799, 29984, null], [29984, 32456, null], [32456, 35567, null], [35567, 38885, null], [38885, 41526, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 41526, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 41526, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 41526, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 41526, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 41526, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 41526, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 41526, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 41526, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 41526, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 41526, null]], "pdf_page_numbers": [[0, 2542, 1], [2542, 5845, 2], [5845, 7985, 3], [7985, 10336, 4], [10336, 10841, 5], [10841, 14100, 6], [14100, 17488, 7], [17488, 20872, 8], [20872, 23974, 9], [23974, 25450, 10], [25450, 27799, 11], [27799, 29984, 12], [29984, 32456, 13], [32456, 35567, 14], [35567, 38885, 15], [38885, 41526, 16]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 41526, 0.0]]}
olmocr_science_pdfs
2024-12-10
2024-12-10
53dd63d2b23c01ba5ad56fa93e2e2fb8b48987d8
Implementing and Benchmarking Seven Round 2 Lattice-Based Key Encapsulation Mechanisms Using a Software/Hardware Codesign Approach Farnoud Farahmand, Viet B. Dang, Michał Andrzejczak, Kris Gaj George Mason University Co-Authors GMU PhD Students Farnoud Farahmand Viet Ba Dang Visiting Scholar Michał Andrzejczak Military University of Technology in Warsaw, Poland Hardware Benchmarking <table> <thead> <tr> <th>Candidates</th> <th>#Round 2 candidates</th> <th>Implemented in hardware</th> <th>Percentage</th> </tr> </thead> <tbody> <tr> <td>AES</td> <td>5</td> <td>5</td> <td>100%</td> </tr> <tr> <td>SHA-3</td> <td>14</td> <td>14</td> <td>100%</td> </tr> <tr> <td>CAESAR</td> <td>29</td> <td>28</td> <td>97%</td> </tr> <tr> <td>PQC</td> <td>26</td> <td>?</td> <td>?</td> </tr> </tbody> </table> Software/Hardware Codesign Software Hardware Most time-critical operation SW/HW Codesign: Motivational Example 1 Software - Major: 91% - Other: 9% Software/Hardware - Major: ~1% - Other: 9% Time saved: 90% speed-up ≥ 100 91% major operation(s) 9% other operations → ~1% major operation(s) in HW 9% other operations in SW Total Speed-Up ≥ 10 SW/HW Codesign: Motivational Example 2 Software - Major: 99% - Other: 1% Software/Hardware - Major: ~1% - Other: 1% - Time saved: 98% - Speed-up ≥ 100 99% major operation(s) → ~1% major operation(s) in HW 1% other operations → 1% other operations in SW Total Speed-Up ≥ 50 SW/HW Codesign: Advantages ❖ Focus on a few major operations, known to be easily parallelizable ▪ much shorter development time (at least by a factor of 10) ▪ guaranteed substantial speed-up ▪ high-flexibility to changes in other operations (such as candidate tweaks) ❖ Insight regarding performance of future instruction set extensions of modern microprocessors ❖ Possibility of implementing multiple candidates by the same research group, eliminating the influence of different ▪ design skills ▪ operation subset (e.g., including or excluding key generation) ▪ interface & protocol ▪ optimization target ▪ platform SW/HW Codesign: Potential Pitfalls ❖ Performance & ranking may strongly depend on A. features of a particular platform - Software/hardware interface - Support for cache coherency - Differences in max. clock frequency B. selected hardware/software partitioning C. optimization of an underlying software implementation ❖ Limited insight on ranking of purely hardware implementations First step, not the ultimate solution! Two Major Types of Platforms FPGA Fabric & Hard-core Processors - Processor w/ Memory & I/O - FPGA Fabric Examples: - Xilinx Zynq 7000 System on Chip (SoC) - Xilinx Zynq UltraScale+ MPSoC - Intel Arria 10 SoC FPGAs - Intel Stratix 10 SoC FPGAs FPGA Fabric, including Soft-core Processors - Soft-core Processor - FPGA Fabric Examples: - Xilinx Virtex UltraScale+ FPGAs - Intel Stratix 10 FPGAs, including - Xilinx MicroBlaze - Intel Nios II - RISC-V, originally UC Berkeley # Two Major Types of Platform <table> <thead> <tr> <th>Feature</th> <th>FPGA Fabric and Hard-core Processor</th> <th>FPGA Fabric with Soft-core Processor</th> </tr> </thead> <tbody> <tr> <td>Processor</td> <td>ARM</td> <td>MicroBlaze, NIOS II, RISC-V, etc.</td> </tr> <tr> <td>Clock frequency</td> <td>&gt;1 GHz</td> <td>max. 200-450 MHz</td> </tr> <tr> <td>Portability</td> <td>similar FPGA SoCs</td> <td>various FPGAs, FPGA SoCs, and ASICs</td> </tr> <tr> <td>Hardware accelerators</td> <td>Yes</td> <td>Yes</td> </tr> <tr> <td>Instruction set extensions</td> <td>No</td> <td>Yes</td> </tr> <tr> <td>Ease of design (methodology, tools, OS support)</td> <td><strong>Easy</strong></td> <td>Dependent on a particular soft-core processor and tool chain</td> </tr> </tbody> </table> **Xilinx Zynq UltraScale+ MPSoC** 1.2 GHz ARM Cortex-A53 + UltraScale+ FPGA logic Choice of a Platform for Benchmarking <table> <thead> <tr> <th>Embedded Processor:</th> <th>FPGA Architecture:</th> </tr> </thead> <tbody> <tr> <td>ARM Cortex-M4</td> <td>Artix-7</td> </tr> </tbody> </table> In NIST presentations to date: Our recommendation: <table> <thead> <tr> <th>ARM Cortex-A53</th> <th>UltraScale+</th> </tr> </thead> </table> - No FPGA SoC with ARM Cortex-M4 and Artix-7 on a single chip - Cortex-M4 and Artix-7 more suitable for lightweight designs, Cortex-A53 and UltraScale+ for high performance - Zynq UltraScale+: - capability to compare SW/HW implementations with fully-SW and fully-HW implementations realized using the same chip - likely in use in the first years of the new standard deployments All elements located on a single chip Code Release • Full Code & Configuration of the Experimental Setup • Software/Hardware Codesign of Round 1 NTRUEncrypt to be made available at https://cryptography.gmu.edu/athena under PQC by August 31, 2019 Our Case Study SW/HW Codesign: Case Study 7 IND-CCA*-secure Lattice-Based Key Encapsulation Mechanisms (KEMs) representing 5 NIST PQC Round 2 Submissions LWE (Learning with Error)-based: - FrodoKEM RLWR (Ring Learning with Rounding)-based: - Round5 Module-LWR-based: - Saber NTRU-based: - NTRU - NTRU-HPS - NTRU-HRSS - NTRU Prime - Streamlined NTRU Prime - NTRU LPRime * IND-CCA = with Indistinguishability under Chosen Ciphertext Attack SW/HW Partitioning Top candidates for offloading to hardware **From profiling:** - Large percentage of the execution time - Small number of function calls **From manual analysis of the code:** - Small size of inputs and outputs - Potential for combining with neighboring functions **From knowledge of operations and concurrent computing:** - High potential for parallelization Operations Offloaded to Hardware - Major arithmetic operations - Polynomial multiplications - Matrix-by-vector multiplications - Vector-by-vector multiplications - All hash-based operations - (c)SHAKE128, (c)SHAKE256 - SHA3-256, SHA3-512 Example: LightSaber Decapsulation - InnerProduct: 43.52% - MatrixVectorMultiply: 43.44% - Hash: 3.30% - GenSecret: 2.30% - GenMatrix: 5.03% - Other: 2.40% LightSaber Decapsulation Execution time of functions to be moved to hardware 97.60% Execution time of functions remaining in software 2.40% Accelerator Speed-Up = 97.60/8.77 = 11.1 Total Speed-Up = 100/11.17 = 9.0 Tentative Results Software Implementations Used FrodoKEM, NTRU-HPS, NTRU-HRSS, Saber: Round 2 submission packages – Optimized_Implementation Round5: Streamlined NTRU Prime, NTRU LPRime: supercop-20190811 : factored Changes made after the submission of the paper! Results substantially different! New version of the paper available on ePrint soon! Total Execution Time in Software [$\mu$s] Encapsulation <table> <thead> <tr> <th>Algorithm</th> <th>Level 1</th> <th>Level 2</th> <th>Level 3</th> <th>Level 4</th> <th>Level 5</th> </tr> </thead> <tbody> <tr> <td>Round5</td> <td>16,192</td> <td>34,609</td> <td>62,076</td> <td>16,192</td> <td>34,609</td> </tr> <tr> <td>Saber</td> <td>1,000</td> <td>1,500</td> <td>2,000</td> <td>1,000</td> <td>1,500</td> </tr> <tr> <td>Str NTRU Prime</td> <td>1,500</td> <td>2,000</td> <td>2,500</td> <td>1,500</td> <td>2,000</td> </tr> <tr> <td>NTRU LPrime</td> <td>2,000</td> <td>2,500</td> <td>3,000</td> <td>2,000</td> <td>2,500</td> </tr> <tr> <td>NTRU-HRSS</td> <td>3,500</td> <td>4,000</td> <td>4,500</td> <td>3,500</td> <td>4,000</td> </tr> <tr> <td>NTRU-HPS</td> <td>4,500</td> <td>5,000</td> <td>5,500</td> <td>4,500</td> <td>5,000</td> </tr> <tr> <td>FrodoKEM</td> <td>6,000</td> <td>6,500</td> <td>7,000</td> <td>6,000</td> <td>6,500</td> </tr> </tbody> </table> ### Total Execution Time in Software/Hardware [$\mu$s] #### Encapsulation <table> <thead> <tr> <th>Round 5</th> <th>Saber</th> <th>NTRU-HRSS</th> <th>Str NTRU Prime</th> <th>NTRU-HPS</th> <th>NTRU LPRime</th> <th>FrodoKEM</th> </tr> </thead> <tbody> <tr> <td>Level 1</td> <td>1</td> <td>2</td> <td>5⇒3</td> <td>3⇒4</td> <td>6⇒5</td> <td>4⇒6</td> </tr> <tr> <td>Level 2</td> <td>1,223</td> <td>1,642</td> <td>2,186</td> <td>7</td> <td>1,223</td> <td>1,642</td> </tr> </tbody> </table> - **Level 1**: Light green - **Level 2**: Orange - **Level 3**: Gray - **Level 4**: Yellow - **Level 5**: Blue Total Speed-ups: Encapsulation Accelerator Speed-ups: Encapsulation <table> <thead> <tr> <th>Algorithm</th> <th>Level 1</th> <th>Level 2</th> <th>Level 3</th> <th>Level 4</th> <th>Level 5</th> </tr> </thead> <tbody> <tr> <td>NTRU-HRSS</td> <td>146.4</td> <td>140.4</td> <td>192.2</td> <td></td> <td></td> </tr> <tr> <td>NTRU-HPS</td> <td>43.5</td> <td>44.3</td> <td>46.1</td> <td></td> <td></td> </tr> <tr> <td>FrodoKEM</td> <td></td> <td></td> <td></td> <td>20.4</td> <td>27.5</td> </tr> <tr> <td>NTRU LPRime</td> <td>12.3</td> <td>15.3</td> <td>17.7</td> <td></td> <td></td> </tr> <tr> <td>Str NTRU Prime</td> <td>8.7</td> <td>10.6</td> <td>11.1</td> <td></td> <td></td> </tr> <tr> <td>Round5</td> <td>8.5</td> <td>14.5</td> <td>21.3</td> <td></td> <td></td> </tr> <tr> <td>Saber</td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> </tbody> </table> Legend: - Green: Level 1 - Orange: Level 2 - Gray: Level 3 - Yellow: Level 4 - Blue: Level 5 SW Part Sped up by HW[%]: Encapsulation Total Execution Time in Software [$\mu$s] Decapsulation Order reversed compared to encapsulation Level 1 Level 2 Level 3 Level 4 Level 5 ## Total Execution Time in Software/Hardware [μs]: Decapsulation <table> <thead> <tr> <th>System</th> <th>Level 1</th> <th>Level 2</th> <th>Level 3</th> <th>Level 4</th> <th>Level 5</th> </tr> </thead> <tbody> <tr> <td>Round5</td> <td>1</td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>Saber</td> <td>2</td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>NTRU-HPS</td> <td>5⇒3</td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>Str NTRU</td> <td>4</td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>Prime</td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>NTRU-HRSS</td> <td></td> <td></td> <td>6⇒5</td> <td></td> <td></td> </tr> <tr> <td>LPRime</td> <td>3⇒6</td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>FrodoKEM</td> <td></td> <td></td> <td></td> <td></td> <td>7</td> </tr> </tbody> </table> - Total Execution Time: - Round5: 1,319 μs - Saber: 1,866 μs - NTRU-HPS: 3,120 μs - Str NTRU: 1,866 μs - Prime: 3,120 μs - NTRU-HRSS: 3,120 μs - LPRime: 3,120 μs - FrodoKEM: 3,120 μs Total Speed-ups: Decapsulation <table> <thead> <tr> <th>Method</th> <th>Speed-up</th> </tr> </thead> <tbody> <tr> <td>NTRU-HPS</td> <td>119.3</td> </tr> <tr> <td>NTRU-HRSS</td> <td>77.4</td> </tr> <tr> <td>Str NTRU Prime</td> <td>74.1</td> </tr> <tr> <td>FrodoKEM</td> <td>45.5</td> </tr> <tr> <td>Saber</td> <td>20.0</td> </tr> <tr> <td>Round5</td> <td>17.9</td> </tr> <tr> <td>NTRU LPrime</td> <td>4.5</td> </tr> </tbody> </table> Level: 1, 2, 3, 4, 5 Conclusions ❖ Total speed-ups ▪ for encapsulation from 2.4 (Str NTRU Prime) to 28.4 (FrodoKEM) ▪ for decapsulation from 3.9 (NTRU LPRime) to 119.3 (NTRU-HPS) ❖ Total speed-up dependent on the percentage of the software execution time taken by functions offloaded to hardware and the amount of acceleration itself ❖ Hardware accelerators thoroughly optimized using Register-Transfer Level design methodology ❖ Determining optimal software/hardware partitioning requires more work ❖ Ranking of the investigated candidates affected, but not dramatically changed, by hardware acceleration ❖ It is possible to complete similar designs for all Round 2 candidates within the evaluation period (12-18 months) ❖ Additional benefit: Comprehensive library of major operations in hardware Future Work **Current work** <table> <thead> <tr> <th>Breadth</th> <th>Depth</th> </tr> </thead> <tbody> <tr> <td>4 Remaining Lattice-based KEMs</td> <td>3 Lattice-based Digital Signatures</td> </tr> </tbody> </table> - More operations moved to hardware / C code optimized for ARM Cortex-A53* - Algorithmic optimizations of software and hardware* - Hardware library of basic operations of lattice-based candidates - Hardware library of basic operations of code-based candidates - Hardware library for PQC Full hardware implementations *collaboration with submission teams and other groups very welcome Q&A Thank You! Questions? Comments? Suggestions? CERG: http://cryptography.gmu.edu ATHENa: http://cryptography.gmu.edu/athena ## Clock Frequency & Resource Utilization <table> <thead> <tr> <th>Level: Algorithm</th> <th>Clock Freq [MHz]</th> <th>#LUTs</th> <th>#Slices</th> <th>#FFs</th> <th>#36kb BRAMs</th> <th>#DSPs</th> </tr> </thead> <tbody> <tr> <td>1: FrodoKEM</td> <td>402</td> <td>7,213</td> <td>1,186</td> <td>6,647</td> <td>13.5</td> <td>32</td> </tr> <tr> <td>1: Round5</td> <td>260</td> <td>55,442</td> <td>10,381</td> <td>82,341</td> <td>0</td> <td>0</td> </tr> <tr> <td>1: Saber</td> <td>322</td> <td>12,343</td> <td>1,989</td> <td>11,288</td> <td>3.5</td> <td>256</td> </tr> <tr> <td>1: NTRU-HPS</td> <td>200</td> <td>24,328</td> <td>4,972</td> <td>19,244</td> <td>2.5</td> <td>677</td> </tr> <tr> <td>1: NTRU-HRSS</td> <td>200</td> <td>27,218</td> <td>5,770</td> <td>21,410</td> <td>2.5</td> <td>701</td> </tr> <tr> <td>2: Str NTRU Prime</td> <td>244</td> <td>55,843</td> <td>8,134</td> <td>28,143</td> <td>3.0</td> <td>0</td> </tr> <tr> <td>2: NTRU LPrime</td> <td>244</td> <td>50,911</td> <td>7,874</td> <td>34,050</td> <td>2.0</td> <td>0</td> </tr> <tr> <td>Device</td> <td></td> <td>274,080</td> <td>34,260</td> <td>548,160</td> <td>912</td> <td>2,520</td> </tr> </tbody> </table> Clock Frequency & Resource Utilization - Clock Frequency & Resource Utilization - < 21% of total resources of the given device - < 31% - < 15% - < 2% - < 28% Minor Modifications to C code Bare Metal vs. Linux • No functions of OpenSSL – standalone implementations of: o **AES:** Optimized ANSI C code for the Rijndael cipher (T-box-based) by Vincent Rijmen, Antoon Bosselaers, and Paulo Barreto https://fastcrypto.org/front/misc/rijndael-alg-fst.c o **SHA-3:** ▪ fips202.c from SUPERCOP by Ronny Van Keer, Gilles Van Assche, Daniel J. Bernstein, and Peter Schwabe (for all candidates other than Round5) ▪ r5_xof_shake.c by Markku-Juhani O. Saarinen and keccak1600.c from SUPERCOP, by the same authors as fips202.c (for Round5) o **randombytes():** based on SHAKE rather than AES in NTRU-HPS, NTRU-HRSS, and Streamlined NTRU Prime • No support for SUPERCOP scripts randombytes() - Function used for generating pseudorandom byte sequences - The implementation vary among various benchmarking studies, depending on the mode of operation (Bare Metal vs. Operating System), and availability of libraries, such as OpenSSL - Used to different extent by implementations of various candidates <table> <thead> <tr> <th>Algorithm</th> <th>#Calls</th> <th>#Bytes (security category 1)</th> </tr> </thead> <tbody> <tr> <td>FrodoKEM</td> <td>1</td> <td>16</td> </tr> <tr> <td>Round5</td> <td>1</td> <td>16</td> </tr> <tr> <td>Saber</td> <td>1</td> <td>32</td> </tr> <tr> <td>NTRU-HPS</td> <td>1</td> <td>3211</td> </tr> <tr> <td>NTRU-HRSS</td> <td>1</td> <td>1400</td> </tr> <tr> <td>Str NTRU Prime</td> <td>1</td> <td>2612</td> </tr> <tr> <td>NTRU LPRime</td> <td>1</td> <td>32</td> </tr> </tbody> </table> - For 3 algorithms was sped-up over 3 times by using SHAKE128
{"Source-Url": "https://csrc.nist.gov/CSRC/media/Presentations/implementing-and-benchmarking-seven-round-2-lattic/images-media/gaj-session-1-paper-pqc2019.pdf", "len_cl100k_base": 5340, "olmocr-version": "0.1.50", "pdf-total-pages": 40, "total-fallback-pages": 0, "total-input-tokens": 61656, "total-output-tokens": 6069, "length": "2e12", "weborganizer": {"__label__adult": 0.000743865966796875, "__label__art_design": 0.0006842613220214844, "__label__crime_law": 0.0012836456298828125, "__label__education_jobs": 0.001194000244140625, "__label__entertainment": 0.00014710426330566406, "__label__fashion_beauty": 0.00031948089599609375, "__label__finance_business": 0.0005841255187988281, "__label__food_dining": 0.0005173683166503906, "__label__games": 0.0012292861938476562, "__label__hardware": 0.02508544921875, "__label__health": 0.0012006759643554688, "__label__history": 0.000545501708984375, "__label__home_hobbies": 0.0002689361572265625, "__label__industrial": 0.0021991729736328125, "__label__literature": 0.00025582313537597656, "__label__politics": 0.0005373954772949219, "__label__religion": 0.0010309219360351562, "__label__science_tech": 0.453369140625, "__label__social_life": 0.0001308917999267578, "__label__software": 0.0083770751953125, "__label__software_dev": 0.498046875, "__label__sports_fitness": 0.0006346702575683594, "__label__transportation": 0.0012063980102539062, "__label__travel": 0.0002753734588623047}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 14620, 0.0546]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 14620, 0.04446]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 14620, 0.70113]], "google_gemma-3-12b-it_contains_pii": [[0, 219, false], [219, 372, null], [372, 394, null], [394, 850, null], [850, 877, null], [877, 926, null], [926, 1205, null], [1205, 1484, null], [1484, 2120, null], [2120, 2555, null], [2555, 3038, null], [3038, 4050, null], [4050, 4745, null], [4745, 4783, null], [4783, 4998, null], [4998, 5013, null], [5013, 5468, null], [5468, 5849, null], [5849, 6098, null], [6098, 6254, null], [6254, 6470, null], [6470, 6488, null], [6488, 6874, null], [6874, 7562, null], [7562, 8085, null], [8085, 8116, null], [8116, 8878, null], [8878, 8918, null], [8918, 9061, null], [9061, 10027, null], [10027, 10333, null], [10333, 10333, null], [10333, 10333, null], [10333, 11121, null], [11121, 11693, null], [11693, 11824, null], [11824, 11824, null], [11824, 12905, null], [12905, 13677, null], [13677, 14620, null]], "google_gemma-3-12b-it_is_public_document": [[0, 219, true], [219, 372, null], [372, 394, null], [394, 850, null], [850, 877, null], [877, 926, null], [926, 1205, null], [1205, 1484, null], [1484, 2120, null], [2120, 2555, null], [2555, 3038, null], [3038, 4050, null], [4050, 4745, null], [4745, 4783, null], [4783, 4998, null], [4998, 5013, null], [5013, 5468, null], [5468, 5849, null], [5849, 6098, null], [6098, 6254, null], [6254, 6470, null], [6470, 6488, null], [6488, 6874, null], [6874, 7562, null], [7562, 8085, null], [8085, 8116, null], [8116, 8878, null], [8878, 8918, null], [8918, 9061, null], [9061, 10027, null], [10027, 10333, null], [10333, 10333, null], [10333, 10333, null], [10333, 11121, null], [11121, 11693, null], [11693, 11824, null], [11824, 11824, null], [11824, 12905, null], [12905, 13677, null], [13677, 14620, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 14620, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 14620, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 14620, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 14620, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 14620, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 14620, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 14620, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 14620, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 14620, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 14620, null]], "pdf_page_numbers": [[0, 219, 1], [219, 372, 2], [372, 394, 3], [394, 850, 4], [850, 877, 5], [877, 926, 6], [926, 1205, 7], [1205, 1484, 8], [1484, 2120, 9], [2120, 2555, 10], [2555, 3038, 11], [3038, 4050, 12], [4050, 4745, 13], [4745, 4783, 14], [4783, 4998, 15], [4998, 5013, 16], [5013, 5468, 17], [5468, 5849, 18], [5849, 6098, 19], [6098, 6254, 20], [6254, 6470, 21], [6470, 6488, 22], [6488, 6874, 23], [6874, 7562, 24], [7562, 8085, 25], [8085, 8116, 26], [8116, 8878, 27], [8878, 8918, 28], [8918, 9061, 29], [9061, 10027, 30], [10027, 10333, 31], [10333, 10333, 32], [10333, 10333, 33], [10333, 11121, 34], [11121, 11693, 35], [11693, 11824, 36], [11824, 11824, 37], [11824, 12905, 38], [12905, 13677, 39], [13677, 14620, 40]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 14620, 0.25309]]}
olmocr_science_pdfs
2024-11-28
2024-11-28
57bf09d979c4e9343be9a1116e6ed12e75d96eb3
ABSTRACT Context: A substantial portion of the cost of software during its life cycle is consumed not in its development, but in its ongoing maintenance. One of the factors that leads to improved code maintainability is its readability. When code is difficult to read, it is difficult for subsequent developers to understand its flow and its side effects, and they are likely to introduce new bugs while trying to fix old ones or while extending the code’s original functionality. But how do software developers know they have written readable code? Objective: This paper presents a new technique, Code Readability Testing, to determine whether code is readable and evaluates whether the technique increases programmers’ ability to write readable code. Method: The researcher conducted a field study using 21 software engineering master students and followed the Code Readability Testing with each student in four separate sessions evaluating different “production ready” software. After the observations, a questionnaire evaluated the programmer’s perspective. Results: By following Code Readability Testing, half of the programmers writing “unreadable” code started writing “readable” code after four sessions. Programmers writing “readable” code also improved their ability to write readable code. The study reveals that the most frequent suggestions for increasing code readability are improving variable names, improving method names, creating new methods in order to simplify loop conditions. The programmers report that improving method names, creating new methods in order to simplify loop conditions. The programmers report that readability testing is worth their time. They observe increases in their ability to write readable code. When programmers experience a reader struggling to understand their code, they become motivated to write readable code. Conclusion: This paper defines code readability, demonstrates that Code Readability Testing improves programmers’ ability to write readable code, and identifies frequent fixes needed to improve code readability. Categories and Subject Descriptors D.2.5 [Software Engineering]: Testing and Debugging – code inspections and walkthroughs General Terms Experimentation Keywords Code readability 1. INTRODUCTION Writing readable code reduces the costs of development and maintenance of software systems. A considerable portion of the software development cost is ongoing maintenance to add new features and fix defects [7]. Even in the early stages of the software’s evolution, the ability to read and quickly understand existing code is a key factor that affects the code’s ability to change. While creating programmers who write readable code is not a new problem for the software industry, the previous work focuses around what code should look like, not how to train programmers to write readable code. Developers realize the importance of writing code that is readable by their peers, but they often do not receive feedback on whether their code is readable. Programming constructs that are clear to the author can confuse the next developer. Some programmers bemoan that they can’t read their own code six months later. If the code works, clearly the computer can understand it, but can anyone else on the team? Teaching this skill is not a top priority in computer science and software engineering curricula. The Computer Science Curriculum promotes understanding the programming paradigms of a particular language (e.g. functional vs. nonfunctional), not how to write readable code [12]. The Software Engineering Body of Knowledge (SWEBOK) does make one reference to writing “understandable code” in the Coding Practical Considerations for the Software Construction knowledge area [6]. This is just one out of 229 subtopics of SWEBOK. The Graduate Software Engineering reference curriculum (GSwE) does not prescribe any further recommendations beyond SWEBOK for this topic [25]. Some undergraduate courses briefly cover the issues of programming style. A few courses will penalize students for producing unreadable code. In rare courses, students swap assignments simulating the experience of inheriting someone else’s code. While this sensitizes students to the needs of writing readable code, the experience lacks concrete steps to increase their skill. The emphasis of a computer science curriculum or a software engineering curriculum is on the substantial topics in the reference curriculum. Companies tend to assume programmers arrive with this skill or will learn it through on the job training. Project teams may have code style guidelines, or best practices around writing code e.g. when a programmer opens a database connection, immediately write the close statement. There is strong empirical evidence that supports the effectiveness of software inspections and code reviews for uncovering bugs. While these techniques can identify readability issues, they are not designed to teach developers how to write readable code. When an author receives a list of defects, the author loses the opportunity to learn how the code confuses the reader. Code Readability Testing reveals areas where the code is not readable, and enables a dialogue between coder and reader. Feedback is instantaneous, as the author sees exactly how reader interprets the code. 1.1 Research Objectives Using the goal template from Goal Question Metric (GQM), the goal is to: Analyze Code Readability Testing for the purpose of determining its effectiveness in improving programmers’ ability to write readable code with respect to their effectiveness from the point of view of the researcher in the context of the “craft of software development” course at Carnegie Mellon University. This paper decomposes this goal into four questions: Research Question 1: Would programmers who repeatedly follow Code Readability Testing increase the readability of their code? Research Question 2: What kinds of issues does Code Readability Testing detect? Research Question 3: How time-consuming is readability testing? Research Question 4: How did programmers perceive Code Readability Testing? 2. BACKGROUND AND RELATED WORK Improving code readability and programming style is not a new topic for the software industry. In their seminal 1974 book, The Elements of Programming Style, Kernighan and Plauger document heuristics for improving coding practices and code readability by rewriting code used in computer science textbooks [19]. In the 1982 book, Understanding the Professional Programmer, Gerald Weinberg emphasizes that the programmer is a more important reader of the code than the computer’s compiler or interpreter. He suggests that just like the writing process for English text, code needs to be rewritten several times before it becomes exemplary code. He encourages programmers to spend time reworking code that will be frequently read in the future [30]. In recent books aimed at professional programmers, Andrew Hunt, David Thomas, Kent Beck, and Robert Martin tackle the coding style in a variety of ways. In Pragmatic Programmers, Hunt and Thomas examine the tools, processes, and tricks that help programmers master their craft [17]. In Clean Code, Robert Martin addresses techniques to help a developer become a better programmer [22]. In Implementation Patterns, Kent Beck addresses good software development design patterns [3]. In short, they distill their life long experiences into best practices, some of which address code readability. In recent studies, researchers examine code readability from different approaches: automated improvement techniques, naming of identifiers, syntax, and automated metrics. Several studies attempt to automate techniques to improve code readability. Wang examines the automatic insertion of blank lines in code to improve readability [29] whereas Sasaki reorder programming statements to improve readability by declaring variables immediately before their utilization [27]. Several researchers examine the naming of identifiers [5, 9, 21, 26]. Relf’s tool encourages the developer to improve variable and method names [26]. Binkley observes that camel case is easier to read than underscore variables [4]. Jones looks at the issues with operator precedence in code readability [18]. While human assessment remains the gold standard of code readability, automated metrics often serve as a proxy. Several studies strive to create code readability metrics so that a computer program determines the readability [8, 14, 24]. Incorporating these metrics into static analysis tools, development environments, and IDEs provides an inexpensive assessment. Substituting the computer for a human produces problems. Metrics using character counts or dictionary words might score a variable named “something_confusing” or “something_vague” as equally readable as a variable that is “exactly_what_i_mean.” While a statistical approach to readability metrics is helpful, these measures do not reveal the programmer’s intention. 2.1 Comparison to other techniques Fagan Inspections, Code Reviews and Pair Programming are other techniques that improve code quality as summarized in Table 1. Fagan Inspections are a proven, time intensive process for finding defects where a committee of developers reviews code [15]. Inspections often include programming style guides and coding standards. While the author is present, the emphasis is on defect identification, not revealing why reviewers might be confused by the code. Code Reviews are a popular, light-weight process where one developer reviews code before it is committed to the master branch or trunk of a source code management system [11]. The author receives a list of suggested changes or issues to fix. Since the author is not present, the author does not see the process the reviewer goes through to understand the code. Developers primarily use code reviews for bug detection [1, 11], not for training developers how to write readable code. Pair programming occurs when two developers write the code at the same time. Pair programming enables continuous reviewing of code, but doesn’t provide a fresh perspective to reveal issues for which the authors are blind to observe. [10] Resistance to adoption comes either from management who sees it as more expensive than solo programming or from programmers who do not like the social implications of the process. Note: Bacchelli and Bird report that programmers thought the purpose of code reviews is to find defects, when in reality the programmers are increasing their understanding of the code [1]. If this is the main benefit of code reviews, it is possible to design other mechanisms to increase code understandability more efficiently than the code review technique. Perspective-Based-Reading reviews requirements documents from prescribed roles such as user, developer, and tester [2]. A developer will convert requirements into a design and a tester converts requirements into a test plan in order to determine if there are omissions and defects in the requirements. Yet the question remains, “Can the relevant community understand and maintain the code?” Thus we can ask ourselves, “how do we know if our code is readable?” ### 3. CODE READABILITY TESTING The technique proposed here uses an experienced programmer to read code samples by thinking out loud and expressing the reader’s thought process in understanding the code. During the session, the author of the code observes if and where difficulties emerge. At the end of the session, the two programmers discuss approaches to improve code readability. This process reveals to the code author how another programmer parses and understands the author’s code [28]. 1. The author tells the reader the main use case, story card, or functionality produced. The author does not explain the design or the code. 2. The author indicates which files were added or modified. Starting with test cases helps the reader understand how the code is used by client code. 3. The reader reads the code aloud and explains the reader’s mental thought process. If the code is unclear, the reader speculates on the intention of the code. The reader verbally describes how he or she thinks the code works and explains his or her thought process. Voicing questions helps focus the reader and author. If the reader does not understand a line of code due to unfamiliar programming syntax, the reader asks the author what the operation does. 4. The author does not respond to what the reader is thinking or asking. The author can take notes about what makes particular sections confusing. 5. At the end, the reader confirms with the author that the reader properly understands the code. The author then asks the reader any clarifying questions about the experience. 6. The author and the reader discuss how to improve the code. The Usability Testing technique [23] from Human Computer Interaction serves as a model for this process. In usability testing, user experience designers watch representative users attempt tasks on a prototype or the actual interface of a product. The researcher observes the user to determine what is obvious and what confuses the user. In particular, the user’s natural interaction with the system informs natural affordances for the user experience design. When the system deviates from user expectations, indicate opportunities for improved design. In Code Readability Testing, the product is the source code, and the user is another developer. The ideal reader represents future developers and those who will maintain the system. For the typical team, developers on the same team serve as ideal readers. For an open source project, core developers and contributors serve as ideal readers. The ideal reader possesses experiences similar to those of the author, and is proficient with the programming language, framework, and libraries used. If programmers expect their code to be routinely read by less experienced programmers, then novices would be ideal readers. ### 4. FIELD STUDY The researcher followed the Code Readability Testing with each programmer in four separate one-on-one sessions to assess effectiveness and observe improvements over time. The programmers were 21 master students enrolled in the “Craft of Software Development” course at Carnegie Mellon University in Silicon Valley during the Spring 2013 semester. The researcher scheduled each session for thirty minutes, spaced three weeks apart, thus producing 84 data points. For each session, the researcher asked the students to bring “production ready” code, software that was ready to be released on a real project. The students selected their own projects to work on. At the end of each session, the researcher recorded the review’s duration, the number and type of issues detected, and assessment of the overall readability score. The student’s professional development experience ranged from zero to eight years. The average number of years of experience was three years. #### 4.1 Readability Score This paper defines code readability as the amount of mental effort required to understand the code. After examining the code, the researcher assigned a readability score following this scale: 1. Very challenging 2. Medium difficulty 3. Pretty easy to read 4. Easy to read In existing studies [13, 16, 24, 27, 29], there is no standard readability definition or score. In both the Buse and Dorn studies, participants rate code on a Likert scale from “very unreadable” 1 ### Table 1: Comparison to Other Techniques <table> <thead> <tr> <th>Technique:</th> <th>Readability Testing</th> <th>Code Review</th> <th>Fagan Inspection</th> <th>Pair Programming</th> </tr> </thead> <tbody> <tr> <td>Purpose:</td> <td>Understand code</td> <td>Find defects, understand code</td> <td>Find defects</td> <td>High quality code</td> </tr> <tr> <td>Roles:</td> <td>Author Reader</td> <td>Author Reviewer</td> <td>Author Moderator, Inspector (2+) Recorder, Reader / Timekeeper</td> <td>Author Author</td> </tr> <tr> <td>Feedback to the author is</td> <td>Synchronous</td> <td>Asynchronous</td> <td>Asynchronous</td> <td>NA</td> </tr> </tbody> </table> <table> <thead> <tr> <th>Purpose</th> <th>Understand code</th> <th>Find defects, understand code</th> <th>Find defects</th> <th>High quality code</th> </tr> </thead> <tbody> <tr> <td>Roles</td> <td>Author Reader</td> <td>Author Reviewer</td> <td>Author Moderator, Inspector (2+) Recorder, Reader / Timekeeper</td> <td>Author Author</td> </tr> <tr> <td>Feedback to the author is</td> <td>Synchronous</td> <td>Asynchronous</td> <td>Asynchronous</td> <td>NA</td> </tr> </tbody> </table> to “very readable” [8, 14]. The participants define their own meaning for readable. In using this scale, the researcher noticed that the duration of the review correlated with the amount of effort required. For example, reviewing “easy to read” code didn’t take much time to review. The average length was 8 minutes with 4 minutes variance. Reviewing “very challenging” to read code often consumed the whole session. The correlation between readability score and the time to review was 0.77. Typically “easy to read” code presents the reader with a simple to follow narrative, keeping a few items in short term memory. “Very challenging” code obscures the programmer’s intention. When the reader grabs a sheet of paper and manually executes the computer program by writing down variable values in order to understand the program logic, then the code is “very challenging” to read. There are common solutions to many programming problems. “Very challenging” code might avoid typical solutions or typical constructs for a solution. When the code’s solution is different from the reader’s expectation for the solution, the reader finds the code “very challenging.” After reviewing the data, the researcher grouped “Pretty easy to read” and “Easy to read” code samples as “readable” code and groups “Very challenging” and “medium difficulty” code samples as “unreadable” code. For unreadable code, the code clearly required rework before submission on a project. When comparing these two groups, the code samples were indeed, night and day. 5. RESULTS Research Question 1: Would programmers who repeatedly follow Code Readability Testing increase the readability of their code? After graphing trends in the data, the researcher lumped the data into four groups: programmers who initially wrote readable code and made small improvements, programmers who initially wrote unreadable code and made large improvements, programmers whom initially wrote unreadable code and continued to do so, and programmers whose results are not clear. <table> <thead> <tr> <th>Result</th> <th>Count</th> </tr> </thead> <tbody> <tr> <td>Readable to readable (with small improvements)</td> <td>11</td> </tr> <tr> <td>Unreadable to readable (with large improvements)</td> <td>5</td> </tr> <tr> <td>Unreadable to unreadable</td> <td>1</td> </tr> <tr> <td>Results are not clear</td> <td>4</td> </tr> <tr> <td>Total</td> <td>21</td> </tr> </tbody> </table> Starting from the first session, 11 of the programmers wrote readable code consistently. While small improvements can be made to the code, the reader easily understood the code. Of these 11, five progressed from “pretty easy to read” to “easy to read” as represented by Figure 1. The process did not hurt the programmer’s ability to write code. Five programmers initially produced “unreadable code” but over time started improving and finished by writing “readable code” as illustrated by Figure 2. For some, immediate changes occurred, whereas for one programmer, the change required a few sessions. One programmer consistently wrote “unreadable code” during each session as shown in Figure 3. While the programmer improved variable and method naming, the programmer ignored feedback such as breaking multiple nested for loops and if statements. Instead of taking the time to increase readability, the participant reasoned, “I want my code to be as efficient as possible.” (Ironically, by only making readability improvements, the readable code was more efficient than the original code.) Four of the data plots were “all over the place.” While two of them trended towards more “readable code,” the researcher classified them as outliers. Considering the entire sample size, this means that 16 of the 21 programmers improved their ability to write readable code. When considering the 10 programmers who could benefit from improving readability testing, five achieved large improvements. ![Figure 1: Programmer #16 consistently wrote “readable” code with small improvements](image) ![Figure 2: Programmer #11 started by writing “unreadable” code and progressed to “readable” code](image) Looking only at the first and last sessions, then an interesting result emerged. During the first session, 13 programmers wrote readable code and all still wrote readable code at the end. During the first session, eight programmers wrote unreadable code, and at the end two wrote unreadable code, and six wrote readable code. Result 1: Most programmers who write “unreadable” code significantly improve and start writing “readable” code after four sessions. Programmers who initially write “readable” code also improve their ability to write readable code. Research Question 2: What kinds of issues does Code Readability Testing detect? In reviewing the notes on the 84 sessions, the researcher classified suggestions and feedback based upon feedback type. The researcher relied on unstructured interview notes, not an inspection checklist. The following table prioritizes the feedback by the frequency of each feedback type across all 84 sessions. For example, 45 of the 84 reviews mentioned altering the name of variables as a means improve readability. <table> <thead> <tr> <th>Improve code readability by</th> <th>Number of Reviews</th> </tr> </thead> <tbody> <tr> <td>Improving variable names</td> <td>45 / 84</td> </tr> <tr> <td>Improving method names</td> <td>25 / 84</td> </tr> <tr> <td>Extract method to reduce code duplication</td> <td>26 / 84</td> </tr> <tr> <td>Simplifying if conditions</td> <td>10 / 84</td> </tr> <tr> <td>Reducing if nesting</td> <td>11 / 84</td> </tr> <tr> <td>Simplifying loop conditions</td> <td>11 / 84</td> </tr> <tr> <td>Reducing loop structures</td> <td>5 / 84</td> </tr> <tr> <td>Improving class names</td> <td>3 / 84</td> </tr> <tr> <td>Re-sequencing method arguments</td> <td>1 / 84</td> </tr> <tr> <td>Simplifying data structures</td> <td>1 / 84</td> </tr> </tbody> </table> Although not a specific goal, readability testing found nine defects in eight of the code samples. Result 2: Readability testing detects readability issues that are solved by improvements to variable names, improvements to method names, the creation of new methods to reduce code duplication, simplifying if conditions and nesting of if statements, and simplifying loop conditions. Note: the sessions were limited to 30 minutes, the length of the meeting. Often another session was scheduled after any given session. If the reader could not understand the code after 30 minutes, the session was ended. Research Question 3: How time-consuming is readability testing? The reader’s subjective experience was that processing “easy to read” code was not time consuming. If a system is composed entirely of “easy to read” code, then the overhead of this process is small. If a system has “very challenging” sections of code, then it is worth reviewing. When the reviewer detects unreadable code, terminating the process allows a discussion of ways to improve code readability. The Programmers’ Perceptions Research Question 4: How did programmers perceive Code Readability Testing? At the end of the four sessions, the programmers answered an anonymous survey about their experience with 20 of the 21 participants completing the survey. The self-assessment exposes the programmers’ perception of the technique. Question: “Was it worth your time or not worth your time?” 20 out of 20 say that following the process was worth their time. Question: “Why was it worth or why was it not worth your time?” The free-text responses were grouped according to themes. If participants mentioned multiple reasons, then each reason counts in each theme. <table> <thead> <tr> <th>Code Readability Testing…</th> <th>Count</th> </tr> </thead> <tbody> <tr> <td>allows me to see areas of improvement to increase code readability</td> <td>9</td> </tr> </tbody> </table> allows me to see a different perspective on my code | 7 - provides guidance by someone with more experience | 4 - motivates me to improve the readability of my code | 3 - allows me to know if my code was understandable | 3 - allows me to improve my programming speed | 1 - increases collaboration of software development process | 1 Question: “Did you learn how another developer reads and understands your code?” Out of the 20 participants, 18 participants said yes, and two skipped the question. <table> <thead> <tr> <th>I now....</th> <th>Count</th> </tr> </thead> <tbody> <tr> <td>choose clearer variable and method names</td> <td>9</td> </tr> <tr> <td>consider the needs of future readers</td> <td>7</td> </tr> <tr> <td>think about the code narrative</td> <td>5</td> </tr> <tr> <td>write shorter methods</td> <td>2</td> </tr> <tr> <td>don’t repeat yourself (DRY)</td> <td>2</td> </tr> <tr> <td>avoid deep nested if-else logic</td> <td>1</td> </tr> <tr> <td>re-read code before committing</td> <td>1</td> </tr> <tr> <td>isolate complex logic into a method</td> <td>1</td> </tr> </tbody> </table> Questions: “Did you see the reader struggle with understanding your code?” Out of the 20 participants, 10 participants said yes. <table> <thead> <tr> <th>I am...</th> <th>Count</th> </tr> </thead> <tbody> <tr> <td>motivated to write more readable code</td> <td>5</td> </tr> <tr> <td>inspired as it was revealing and insightful</td> <td>4</td> </tr> </tbody> </table> Result 4: Programmers think following readability testing is worth their time. Their ability to write readable code increases. They articulate concrete improvements to the way they write code. When programmers see a reader struggle to understand their code, the programmers are willing to write readable code and inspired by another developer’s point of view. 6. THREATS TO VALIDITY 6.1 Construct Validity Code Readability Testing has the reviewer “think aloud” as they read through the code. The “think aloud” activity might not mirror the process a programmer uses when they read code to themselves. 6.2 Internal Validity a. The selection of the reviewer – in order to remove the difficulty of inter-reviewer reliability, there is only one reviewer in this study. The reviewer is the researcher, which leads to possible researcher bias. The results might change with a different reviewer. Another reviewer might find more or fewer issues. Another reviewer might be more or less experienced at reading other people’s code. The reviewer has professional experience in C, C++, Java, and Ruby. The reviewer is able to read and understand the provided C#, Javascript, Objective C, Python, and Dart code. When the reviewer did not understand programming language syntax or idioms, the reviewer asks the author for clarification. While the reviewer is able to understand Javascript code, a more experienced Javascript programmer might find issues not detected. b. The selection of programming assignments – the programmers select what to work on. The difficulty level of each session might not be consistent. c. The selection of programming languages – this study verifies that the approach works within a variety of programming languages and problem domains. For future research, constraining to a particular language may yield stronger insights. d. Influence from other graduate courses – discussions in the concurrent metrics course and the craft of software development course about code quality might affect the results by sensitizing students to the need to write readable code. 6.3 External Validity The participants were master of software engineering students. Their professional development experience ranged from zero to eight years. The average number of years of experience was three years. The correlation between years of industry experience and improvement was 0.31 showing little relationship between improvement and years of industry experience. In fact, the two participants with the most industry experience (seven years and eight years) both dramatically improved their ability to write readable code. Since all the students were still at the beginning of their careers, the drastic improvements in writing readable code might not transfer to more experienced programmers. 7. FUTURE RESEARCH Several of the programmers appreciate the value a more experienced developer providing feedback. Future work could reveal the results when the reader and the author possess similar expertise, or if the reader possesses less expertise than the author. If code needs to be readable by less experienced peers, then learning how less experienced programmers read code should contain valuable feedback. Removing the researcher from the reader role would remove researcher bias. Perhaps students could act as readers for each other if they’re given training. Future work could entail a direct analysis between code reviews and readability testing. Next time, all the programmers could finish the same programming exercise and the researcher could directly compare the results from the two techniques. One subject persistently wrote “unreadable” code. The subject defended his strategy because “I want my code to be as efficient as possible.” Future work could examine how prevalent is this attitude of writing “efficient” but unreadable code, determine where its origins, and suggest possible mitigation steps. In 1974, Knuth proclaimed that premature optimization is the root of all evil [20], yet the problem remains today. 8. CONCLUSIONS Code readability testing addresses the question, “Is my code readable?” by exposing the thought process of a peer reading the code. In this study, 21 programmers followed Code Readability Testing in four sessions. Most programmers writing “difficult to read” code became programmers writing “easy to read” code after three sessions. Programmers writing “easy to read” code improved their skill. This study identifies several common fixes to unreadable code including improvements to variable names, improvements to method names, the creation of new methods to reduce code duplication, simplifying if conditions and structures, and simplifying loop conditions. The programmers reported that the technique is worth their time and articulated how readability testing alters their programming habits. 9. REFERENCES
{"Source-Url": "http://repository.cmu.edu/cgi/viewcontent.cgi?article=1176&context=silicon_valley", "len_cl100k_base": 6356, "olmocr-version": "0.1.50", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 24044, "total-output-tokens": 7639, "length": "2e12", "weborganizer": {"__label__adult": 0.0005578994750976562, "__label__art_design": 0.0003120899200439453, "__label__crime_law": 0.0004031658172607422, "__label__education_jobs": 0.0019989013671875, "__label__entertainment": 6.145238876342773e-05, "__label__fashion_beauty": 0.00019943714141845703, "__label__finance_business": 0.00023221969604492188, "__label__food_dining": 0.0005006790161132812, "__label__games": 0.0006227493286132812, "__label__hardware": 0.0006194114685058594, "__label__health": 0.0003991127014160156, "__label__history": 0.00018537044525146484, "__label__home_hobbies": 0.0001030564308166504, "__label__industrial": 0.0002961158752441406, "__label__literature": 0.00034165382385253906, "__label__politics": 0.00030684471130371094, "__label__religion": 0.0004897117614746094, "__label__science_tech": 0.0015363693237304688, "__label__social_life": 0.00013935565948486328, "__label__software": 0.002750396728515625, "__label__software_dev": 0.98681640625, "__label__sports_fitness": 0.00043582916259765625, "__label__transportation": 0.00048279762268066406, "__label__travel": 0.0002312660217285156}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 34790, 0.02595]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 34790, 0.63794]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 34790, 0.91084]], "google_gemma-3-12b-it_contains_pii": [[0, 5252, false], [5252, 11035, null], [11035, 16518, null], [16518, 20647, null], [20647, 24741, null], [24741, 29491, null], [29491, 34790, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5252, true], [5252, 11035, null], [11035, 16518, null], [16518, 20647, null], [20647, 24741, null], [24741, 29491, null], [29491, 34790, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 34790, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 34790, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 34790, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 34790, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 34790, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 34790, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 34790, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 34790, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 34790, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 34790, null]], "pdf_page_numbers": [[0, 5252, 1], [5252, 11035, 2], [11035, 16518, 3], [16518, 20647, 4], [20647, 24741, 5], [24741, 29491, 6], [29491, 34790, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 34790, 0.23196]]}
olmocr_science_pdfs
2024-12-02
2024-12-02
e38b29ca1b37d2591b4359a7cfcbeebeb141fb42
ON EXTENDING THE PRIMARY-COPY DATABASE REPLICATION PARADIGM M. Liroz-Gistau, J. R. Juárez-Rodríguez, J. E. Armendáriz-Iñigo, J. R. González de Mendivil Universidad Pública de Navarra, 31006 Pamplona, Spain F. D. Muñoz-Escoí Instituto Tecnologico de Informática, Universidad Politécnica de Valencia, 46022 Valencia, Spain Keywords: Database Replication, Generalized Snapshot Isolation, Read One Write All, Replication Protocols, Middleware Architecture. Abstract: In database replication, primary-copy systems sort out easily the problem of keeping replicate data consistent by allowing only updates at the primary copy. While this kind of systems are very efficient with workloads dominated by read-only transactions, the update-everywhere approach is more suitable for heavy update loads. However, it behaves worse when dealing with workloads dominated by read-only transactions. We propose a new database replication paradigm, halfway between primary-copy and update-everywhere approaches, which permits improving system performance by adapting its configuration to the workload, by means of a deterministic database replication protocol which ensures that broadcast writesets are always going to be committed. 1 INTRODUCTION Database replication is considered as a joint venture between database and distributed systems research communities. Each one pursues its own goals: performance improvement and affording site failures, respectively. These issues bring up another important question that is how different replicas are kept consistent, i.e. how these systems deal with updates that modify the database state. During a user transaction lifetime it is a must to decide in which replica and when to perform updates (Gray et al., 1996). We focus on eager solutions and study the different alternatives that exist according to where to perform updates. The primary copy approach allows only one replica to perform the updates (Daudjee and Salem, 2006; Plattner et al., 2008). Changes are propagated to the secondary replicas, which in turn apply them. Data consistency is trivially maintained since there is only one server executing update transactions. Secondaries are just allowed to execute read-only transactions. This approach is suitable for workloads dominated by read-only transactions, as it tends to be in many modern web applications (Daudjee and Salem, 2006; Plattner et al., 2008). However, the primary replica represents a bottleneck for the system when dealing with a large amount of update transactions and, furthermore, it is a single point of failure. The opposite approach, called update-everywhere (Lin et al., 2005; Kemme and Alonso, 2000), consists of allowing any replica to perform updates. Thus, system’s availability is improved and failures can be tolerated. Performance may also be increased, although a synchronization mechanism is necessary to keep data consistent. This may suppose a significant overload in some configurations. Several recent eager update-everywhere approaches (Kemme and Alonso, 2000; Kemme et al., 2003; Lin et al., 2005; Wu and Kemme, 2005) take advantage of the total-order broadcast primitive (Chockler et al., 2001). Certification-based and weak-voting protocols are the ones which obtain better results (Wiesmann and Schiper, 2005). Certification-based algorithms decide the outcome of a transaction by means of a deterministic certification test, mainly based on a log of previous committed transactions (Lin et al., 2005; Wu and Kemme, 2005; Elnikety et al., 2005). On the contrary, on weak-voting protocols the delegate replica decides the outcome of the transactions and informs the rest of the replicas by sending a message. In an ideal replication system all message exchange should be performed in one round (as in certification-based) and delivered writesets should be committed without stor- ing a redundant log (as it is done in weak-voting). In this paper we propose a novel approach that circumvents the problems of the primary-copy and update-everywhere approaches. Initially, a fixed number of primary replicas is chosen and, depending on the workload, new primaries may be added by sending a special control message. A deterministic mechanism governs who is the primary at a given time. Thus, at a given time slot, only those writesets coming from a given replica are allowed to commit: A primary replica applies the writesets in order (aborting local conflicting transactions if necessary), and when its turn arrives, local transactions waiting for commit are committed them, as explained later. This guarantees that secondary replicas converge to the same snapshot. The way the delegate replica is chosen depends on the transaction type. A read-only transaction is composed by a set of read operations ended either by a commit or an abort operation. A transaction is said to be read-only if it does not contain write operations and an update one, otherwise. Read-only transactions are directly executed (and committed, without any further coordination) over primary or secondary replicas, while update ones are forwarded to the primaries where their execution is coordinated by the replication protocol. If we assume that the underlying DBMS at each replica provides Snapshot Isolation (SI) (Berenson et al., 1995), the proposed protocol will provide Generalized SI (Elnikety et al., 2005; González de Mendivil et al., 2007) (GSI). The rest of this paper is organized as follows: Section 2 depicts the system model. The replication protocol is introduced in Section 3 and fault tolerance is discussed in Section 4. Experimental evaluation is described in Section 5. Finally, conclusions end the paper. ## 2 THE SYSTEM MODEL We assume a partially synchronous distributed system where message propagation time is unknown but bounded. The system consists of a group of sites \( M = (R_0, \ldots, R_{M-1}) \), \( N \) primary replicas and \( M - N \) secondaries, which communicate by exchanging messages. Each site holds an autonomous DBMS providing SI that stores a physical copy of the replicated database schema (i.e. we consider a full-replicated system). An instance of the replication protocol is running on each replica over the DBMS. It is encapsulated at a middleware layer that offers consistent views and a single system entry point through a standard interface, such as JDBC. Middleware layer instances of different sites communicate among them for replica control purposes. A replica interacts with other replicas by means of a Group Communication System (Chockler et al., 2001) (GCS) that provides a FIFO reliable multicast communication service. This GCS includes also a membership service with the virtual synchrony property (Chockler et al., 2001; Birman and Joseph, 1987), which monitors the set of participating replicas and provides them with consistent notifications in case of failures, either real or suspected. Sites may only fail by crashing, i.e., Byzantine failures are excluded. We assume a primary-partition membership service. ## 3 REPLICATION PROTOCOL The main idea of our proposal is to extend the primary-copy approach in order to improve the capacity for processing update transactions and fault tolerance. In fact, its basic operation (working with one primary and several secondaries) follows a classical primary-copy strategy, as shown in Figure 1. The protocol separates read-only from update transactions and it executes them on different replicas: updates on the primary replica and reads on any replica. This scheduler may be easily implemented in a middleware architecture, as the one presented in (Muñoz-Escot et al., 2006). This middleware provides a standard transactional interface to clients, such as JDBC, isolating them from the internal operation of the replicated database. All transactions are executed locally. At commit time, read-only transactions are committed straightforwardly, whilst update transactions must spread their modifications. Thus, writesets are broadcast to the secondaries and they are applied (and committed) in the same order in which the primary site committed them, as explained later. This guarantees that secondary replicas converge to the same snap- shot as the primary and therefore reads executed over secondaries will always use a consistent snapshot installed previously on the primary. 3.1 Extending Primary-Copy Approach In this paper, we extend the primary copy approach to improve its performance (mainly increasing the capacity of handling a high number of updates) and its fault tolerance. This new approach allows different replicas to be primaries alternately (and hence to execute updates) during given periods of time by means of a deterministic protocol. As pointed out before, this protocol follows at each replica (primary or secondary) the most straightforward scheduling policy: at a given slot, only those writesets coming from a given primary replica are allowed to commit. In the primaries, other conflicting local transactions should be aborted to permit those writesets to commit (Muñoz-Escoi et al., 2006). Secondary replicas do not raise this problem since they are not allowed to execute update transactions (read-only transactions do not conflict under SI). As it can be easily inferred, a primary replica will never multicast writesets that finally abort. Therefore, this protocol makes it possible to share the update transaction load among different primary replicas, while secondary replicas are still able to handle consistently read-only transactions, usually increasing the system throughput. Moreover, the most important feature is that a unique scheduling is generated for all replicas. Hence, considering that the underlying DBMS at each replica provides SI, transactions will see a consistent snapshot of the database, although it may not be the latest version existing in the replicated system. Therefore, this protocol will provide GSI. The atomicity and the same order of applying transactions in the system have been proved in (González de Mendivil et al., 2007) to be sufficient conditions for providing GSI. 3.2 Protocol Description In the following, we explain the operation of the deterministic protocol executed by the middleware at a primary replica $R_k$ (Figure 2), considering a fault-free environment. Note that secondary replicas may execute the same protocol, considering that some steps will be never executed or may be removed. All operations of a transaction $T$ are submitted to the middleware of its delegate replica (explicit abort operations from clients are ignored for simplicity). Note that, at a primary copy, a transaction may submit read or update operations, whilst at a secondary just read-only operations. At each replica, the middleware keeps an array ($\text{towork}$) that determines the same scheduling of update transactions in the system by a round-robin scheduling policy based on the identifiers of the primary replicas. In general, $\text{towork}$ establishes at each replica which writesets have to be applied and in which order, ensuring that writesets are committed in the same order at all the replicas. Among primary replicas, $\text{towork}$ is also in charge of deciding which primary is allowed to send a message with locally performed updates. Each element of the array represents a slot that stores the actions delivered from a primary replica. These actions are processed cyclically according to the turn, which defines the order in which the actions have to be performed. There exists a mapping function ($\text{map} \rightarrow \text{turn}()$) that defines which turn is assigned to which primary replica. The middleware of a primary replica forwards all the operations but the commit operation to the local database replica (step I of Figure 2). Each primary replica maintains a list ($\text{wslist}$) which stores local transactions ($T_\text{replica} = R_k$) that have requested their commit. Thus, when a transaction requests its commit, the writeset ($T_\text{WS}$) is retrieved from the local database replica (Plattner et al., 2008). If it is empty the transaction will be committed straight away, otherwise the transaction (together with its writeset) will be stored in $\text{wslist}$. Secondary replicas work just with read-only transactions. Thus, there is no need to use the $\text{wslist}$, since transactions do not modify anything and hence they will always commit directly in the local database without delaying. In order to commit transactions that have requested it, their corresponding delegate primary replica has to multicast their writesets in a $\text{tocommit}$ message, to spread their changes, and wait for the reception of this message to finally commit the transactions (this is just for fault-tolerance issues). Since our protocol follows a round-robin scheduling among primary replicas, each primary has to wait for its turn ($\text{turn} = \text{map} \rightarrow \text{turn}(R_k)$ in step III) so as to multicast all the writesets contained in $\text{wslist}$ using a simple reliable broadcast service. Note that secondary replicas are not represented in the $\text{towork}$ queue and therefore they will never have any turn assigned to them and hence they will never broadcast any message. Secondaries simply execute read-only transactions and apply writesets from primaries. When the turn of a primary replica arrives and there are no transactions stored in $\text{wslist}$, the replica will simply advance the turn to the next primary replica, sending a $\text{next}$ message to all the replicas. This message allows also secondary replicas to know that there is nothing to wait for from that replica. Upon delivery of any of these messages (next and tocommit) at each replica, they are stored in their corresponding positions in the towork array (step II), according to the primary replica which the message came from and the mapping function (map(turn(R))). It is important to note that, although these messages were sent since replica’s turn was reached at their corresponding primary replicas, replicas run at different speeds and there can be replicas still handling previous positions of their own towork. At each replica, messages from a same replica will be delivered in the same order, since we consider FIFO channels between the replicas. However, messages from different replicas may be delivered disordered (as we do not use total order), but this is not a problem since they are processed one after another as their turn arrives. Disordered messages are stored in their corresponding positions in the array and their processing will wait for the delivery and processing of the previous ones. This ensures that all the replicas process messages in the same order and as a result all transactions are committed in the same order in all of them. The towork array is processed in a cyclical way. At each turn, the protocol checks the corresponding position of the array (towork[turn]). If a next message is stored, the protocol will simply remove it from the array and change the turn to the following one (step IV) so as to allow the next position to be processed. If it is a tocommit message, we can distinguish between two cases (step V). When the sender of the message is the replica itself (a primary replica), transactions grouped in its writeset (seq[turn]) are local (already exist in the local DBMS) and therefore the transactions will be straightforwardly committed. In the other case, a remote transaction has to be used to apply and commit the sequence of transactions seq[turn]s at the remote replicas (other primaries and secondaries). In both cases, once committed the transaction, the protocol changes the turn to the following one to continue the process. At primary replicas, special attention must be paid to local transactions, since they may conflict with the remote writeset application, avoiding it to progress. To partially avoid this problem, we stop the execution of write operations in the system (see step I.2.a in Figure 2) when a remote writeset is applied at a replica, i.e. turning the run variable to true. However, this is not enough to ensure the writeset application in the replica; the writeset can be involved in a conflict with local transactions that already updated some data items that intersect with the writeset. Progress is ensured by a block detection mechanism, presented in (Muñoz-Escot et al., 2006), which aborts all local conflicting transactions (VI) allowing the writeset to be successfully applied. Besides, this mechanism prevents local transactions that have requested their commit (T.precommit = true) from being aborted by other local conflicting transactions, ensuring their completion. Note also that the writeset application may be involved in a deadlock situation that may result in its abortion and hence it must be re-attempted until its successful completion. Secondaries do not require this mechanism since they only execute read-only transactions that never conflict with the remote writesets. 3.3 Dynamic Load-Aware Replication Protocol Initial system configuration sets the number of primary and secondary replicas which compose the replicated system. However, this is not a fixed configuration. Our protocol may easily adapt itself dynamically to different transaction workloads by turning primaries into secondaries and vice versa. This makes it possible to handle different situations ensuring the most appropriate configuration for each moment. ![Figure 3: The process of adding a new primary to the replicated system.](image) **Figure 3: The process of adding a new primary to the replicated system.** ### VII. Upon $\langle$new primary, $R_n$$\rangle$ in towork[turn] 1. Remove message from towork[turn] 2. nprimaries $\rightarrow$ nprimaries + 1 3. Increase towork capacity in 1 ### VIII. Upon $\langle$remove primary, $R_n$$\rangle$ in towork[turn] 1. Remove message from towork[turn] 2. nprimaries $\rightarrow$ nprimaries - 1 3. Reduce towork capacity in 1 ![Figure 4: Modifications to Determ-Rep algorithm to add or remove new primaries to the system.](image) **Figure 4: Modifications to Determ-Rep algorithm to add or remove new primaries to the system.** Note that a great number of primary replicas increases the overhead of the protocol, since delay between turns is increased and there are more update transactions from other primary replicas that need to be locally applied. Therefore, it is clear that this leads to higher response times of transactions. However, this improves the system capacity to handle workloads predominated by update transactions. On the other hand, increasing the number of secondary replicas does not involve a major problem, since data consistency is trivially maintained in these replicas as they are only allowed to execute read-only transactions. Thus, this improves the system capacity to handle this type of transactions, although it does not enhance the possibility of handling update ones or putting up with failures of a single primary. Therefore, the system performance is a trade-off between the number of primaries and the number of secondaries, depending on the workload characteristics. In this way, our protocol is able to adapt itself to the particular behavior of the workload processed in the replicated system. Considering a set of replicas where one is primary and the others are secondaries, we can turn a secondary easily into a new primary in order to handle better a workload where update transactions become predominant (see Figure 3). For this, it is only necessary that a primary replica broadcasts a message, pointing which secondary replica should start behaving as a primary (new primary). A separate dynamic load-aware protocol should be in charge of doing this, according to the workload processed by the system. Its study and implementation is not an aim of this paper and this protocol simply provides the required mechanisms. When delivering this message, each replica will update the number of primaries working in the system (nprimaries). They will also add a new entry in the working queue (towork) to store messages coming from that replica so as to process them as stated. With these two minor changes, both primary and secondary replicas will be able to han- dle the incorporation of the secondary as a primary replica. In the same way, when the workload becomes dominated by read-only transactions, we can turn a primary replica into a secondary one through a similar process that updates the number of primaries and removes the corresponding entry in the working queue at each replica of the system. 4 FAULT TOLERANCE In the system treated so far, replicas may fail, rejoin or new replicas may come to satisfy some performance needs. The proposed approach deals also with these issues. We suppose that the failure and recovery of a replica follows the crash-recovery with partial amnesia failure model (Cristian, 1991). Failures and reconnections of replicas are handled by the GCS by means of a membership service providing virtual synchrony under the primary-component assumption (Chockler et al., 2001). In order to avoid inconsistencies the multicast protocol must ensure uniform delivery (Chockler et al., 2001) and prevent contamination (Défago et al., 2004). The failure of a replica \( R_j \) involves firing a view change event. Hence, all the nodes will install the new view with the excluded replica. The most straightforward solution for a primary failure is to silently discard the position of \( \text{towork} \) associated to the primary \( R_j \) at each alive replica \( R_i \). Failures of secondary replicas need no processing at all. The no contamination property (Défago et al., 2004) prevents that correct replicas receive messages from faulty primaries. After a replica has crashed, it may eventually rejoin the system, firing a view change event. This recovering replica has first to apply the possible writesets missed on the view it crashed and then the writesets while it was down. Thanks to the strong virtual synchrony, there is at least one replica that completely contains all the system state. Hence, there is a process for choosing a recovering replica among all living primary nodes; this is an orthogonal process and we will not discuss it here. Let us assume that there exists a recovering replica. Initially, a recovering node will join the system as a secondary replica; later depending on the system load it may become a primary. Upon firing the view change event, we need to rebuild the \( \text{towork} \) queue including the primary replicas available in the system. The recovering node will discard, in turn, messages coming from working primary replicas until it finishes its recovery. The recovering replica will wait for its turn to send the missed information to the recovering replica, in order to include other writesets coming from other replicas which the recovering will discard. Concurrently to this, the recovering replica will store all writesets delivered from primary replicas in an additional queue called pending WS where they may be compacted (Pla-Civera et al., 2007). It is not necessary that another replica stores the committed writesets and discards the ones that have to abort (e.g. after a certification process), since in our proposal delivered writesets are always supposed to have to commit. Once all missed updates transferred by the recovering replica have been applied at the recovering, it will finally apply the compacted writesets stored in pending WS and, thus, finish the recovery. From then on, recovering replica will process the \( \text{towork} \) queue as usual. As it may be seen, we have followed a two phase recovery process very similar to the one described in (Ar-mendáriz-Iliago et al., 2007). 5 EXPERIMENTAL RESULTS To verify the validity of our approach we performed some preliminary tests. We have implemented the proposed protocol on a middleware architecture called MADIS (Muñoz-Escotí et al., 2006), taking advantage of its capabilities provided for database replication. For the experiments, we used a cluster of 4 workstations (openSUSE 10.2 with 2.6.18 kernel, Pentium4 3.4GHz, 2Gb main memory, 250Gb SATA disk) connected by a full duplex Fast Ethernet network. JGroups 2.1 is in charge of the group communication. PostgreSQL 8.1 was used as the underlying DBMS, which ensured SI level. The database consists of 10 tables each containing 10000 tuples. Each table contains the same schema: two integers, one being the primary key. Update transactions modify 5 consecutive tuples, randomly chosen from a table of the database. Read-only transactions retrieve the values from 1000 consecutive tuples, randomly chosen from a table of the database too. The PostgreSQL databases were configured to enforce the synchronization of write operations (enabling the fsync function). We used a load generator to simulate different types of workloads depending on the ratio of update transactions (10%, 50%, 90%). We simulated 12 clients submitting 500 transactions each one with no delay between them. The load generator established with each working replica the same number of connections than simulated clients. Transactions were generated and submitted through connections to replicas according to their role: update transactions to primary ones and read-only transactions to both primary and secondary ones. Note that, as these are preliminary tests, we have not paid much attention to the way transactions were distributed among the replicas and Experimental results are summarized in Figure 5. In the first two tests, we have tested the performance of our proposal working as a primary-copy and an update-everywhere approach respectively. Thus, starting from a primary replica (needed in both cases), we have increased the number of replicas depending on the evaluated approach: primaries for the update-everywhere operation and secondaries for the primary-copy one. As shown in Figure 5a, increasing the number of secondaries permits the system handling better read-only predominant loads (10% updates). However, in this primary-copy approach, it is impossible to enhance its performance when working with loads with a great number of updates (50% or 90% updates). In these cases, increasing the number of secondaries means no improvement, since additional secondaries do not increase the system capacity to process update transactions. In fact, all the update transactions are executed in the primary replica, and this overloads the replica. On the other hand, the update-everywhere operation provides better results (see Figure 5b) than the primary-copy approach with loads including many update transactions (50% and 90% updates). In these cases, increasing the number of primaries permits the system handling better update transactions. However, in this primary-copy approach, it is impossible to enhance its performance when working with loads with a great number of updates (50% or 90% updates). In these cases, increasing the number of secondaries means no improvement, since additional secondaries do not increase the system capacity to process update transactions. In fact, all the update transactions are executed in the primary replica, and this overloads the replica. Primary replicas involve also a greater overhead in their protocols than in a secondary protocol. For these reasons, the performance of the update-everywhere approach is poorer than the primary-copy one when the system works with a great number of read-only transactions. We have seen that each approach behaves better under different loads. Hence, it is interesting to test how an intermediate approach (mixing several primaries and secondaries) performs. We have tested the behavior of mixed compositions, considering a fixed number of replicas. As shown in Figure 5c, mixed configurations with 4 replicas provide in general near the same and usually better results for each load considered in our tests. In particular, for a 10% update load the best behavior (192TPS) is not provided by a pure primary-copy approach but by 2 primaries and 2 secondaries. This happens because using a single primary that concentrates all update transactions penalizes a bit the read-only transactions in such single primary replica, but with two primaries none of them gets enough update transactions for delaying read-only transaction service. Once again, for a 50% update load the best throughput (76TPS) is given by 3 primaries and 1 secondary, outperforming a primary-copy configuration (51TPS) and an update-everywhere one (69TPS). This proves that intermediate configurations are able to improve the throughput achievable. 6 CONCLUSIONS This paper has presented a new database replication approach, halfway between primary-copy and update-everywhere paradigms. The result is an improved performance, which is obtained since the protocol can change its configuration depending on the load. Moreover, it also allows to increase the fault-tolerance of primary-copy protocols. This is feasible thanks to the use of a deterministic database replication protocol that takes the best qualities from both certification and weak-voting approaches. This protocol establishes a unique schedule in all replicas based on primaries identifiers, which ensures that broadcast write-sets are always going to be committed. We have also discussed how this protocol can adapt itself dynamically to different environments (by turning secondaries into primaries to handle heavy-update workloads or primaries into secondaries when read-only transactions become predominant). Finally, we have performed some preliminary experiments to prove the feasibility of this approach, showing how system can provide better performance adapting its configuration to the load characteristics, although we have still to make a great effort to achieve more significant results. ACKNOWLEDGEMENTS This work has been supported by the Spanish Government under research grant TIC2006-14738-C02-02. REFERENCES
{"Source-Url": "http://www.scitepress.org/Papers/2009/22566/22566.pdf", "len_cl100k_base": 6067, "olmocr-version": "0.1.53", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 26425, "total-output-tokens": 7640, "length": "2e12", "weborganizer": {"__label__adult": 0.00034809112548828125, "__label__art_design": 0.00030612945556640625, "__label__crime_law": 0.0003812313079833984, "__label__education_jobs": 0.0006670951843261719, "__label__entertainment": 0.00010347366333007812, "__label__fashion_beauty": 0.0001653432846069336, "__label__finance_business": 0.00042128562927246094, "__label__food_dining": 0.0004131793975830078, "__label__games": 0.0005822181701660156, "__label__hardware": 0.0017328262329101562, "__label__health": 0.0008311271667480469, "__label__history": 0.0003523826599121094, "__label__home_hobbies": 0.00011837482452392578, "__label__industrial": 0.0006499290466308594, "__label__literature": 0.0002892017364501953, "__label__politics": 0.0002925395965576172, "__label__religion": 0.00048613548278808594, "__label__science_tech": 0.1695556640625, "__label__social_life": 0.00010508298873901369, "__label__software": 0.01861572265625, "__label__software_dev": 0.80224609375, "__label__sports_fitness": 0.0003447532653808594, "__label__transportation": 0.0006718635559082031, "__label__travel": 0.00026607513427734375}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 33135, 0.03075]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 33135, 0.25548]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 33135, 0.9003]], "google_gemma-3-12b-it_contains_pii": [[0, 3870, false], [3870, 8219, null], [8219, 13655, null], [13655, 17080, null], [17080, 20342, null], [20342, 25629, null], [25629, 28782, null], [28782, 33135, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3870, true], [3870, 8219, null], [8219, 13655, null], [13655, 17080, null], [17080, 20342, null], [20342, 25629, null], [25629, 28782, null], [28782, 33135, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 33135, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 33135, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 33135, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 33135, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 33135, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 33135, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 33135, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 33135, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 33135, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 33135, null]], "pdf_page_numbers": [[0, 3870, 1], [3870, 8219, 2], [8219, 13655, 3], [13655, 17080, 4], [17080, 20342, 5], [20342, 25629, 6], [25629, 28782, 7], [28782, 33135, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 33135, 0.0]]}
olmocr_science_pdfs
2024-12-06
2024-12-06
fbf95034764f699f4c6aff4a30b06fd83d79d68b
Abstract Peeking into the inner workings of BERT has shown that its layers resemble the classical NLP pipeline, with progressively more complex tasks being concentrated in later layers. To investigate to what extent these results also hold for a language other than English, we probe a Dutch BERT-based model and the multilingual BERT model for Dutch NLP tasks. In addition, through a deeper analysis of part-of-speech tagging, we show that also within a given task, information is spread over different parts of the network and the pipeline might not be as neat as it seems. Each layer has different specialisations, so that it may be more useful to combine information from different layers, instead of selecting a single one based on the best overall performance. 1 Introduction and Background Natural Language Processing is now dominated by transformer-based models (Vaswani et al., 2017), like BERT (Devlin et al., 2019), a model trained on predicting masked tokens and relations between sentences. BERT’s impact is so strong that we already talk about ‘BERTology’ (Rogers et al., 2020). In addition to using BERT in NLP tasks and end applications, research has also been done on BERT, especially to reveal what linguistic information is available in different parts of the model. This is done, e.g., investigating what BERT’s attention heads might be attending to (Clark et al., 2019), or looking at its internal vector representations using so-called probing (or diagnostic) classifiers (Tenney et al., 2019a). It has been noted that BERT progressively acquires linguistic information roughly in the same the order of the classic language processing pipeline (Tenney et al., 2019b,a): surface features are expressed in lower layers, syntactic features more in middle layers and semantic ones in higher layers (Jawahar et al., 2019). So, for example, information on part-of-speech appears to be acquired earlier than on coreference. Most work dedicated to understanding the inner workings of BERT has focused on English, though non-English BERT models do exist, in two forms. One is a multilingual model (Devlin et al., 2019, mBERT), which is trained on Wikipedia dumps of 104 different languages. The other one is a series of monolingual BERTs (Polignano et al., 2019; Le et al., 2019; Virtanen et al., 2019; Martin et al., 2019; de Vries et al., 2019, among others). As expected, also the non-English monolingual BERT models achieve state-of-the-art results on a variety of NLP tasks, and mostly outperform the multilingual model on common NLP tasks (Nozza et al., 2020). Nevertheless, mBERT performs surprisingly well on zero-shot POS tagging and Named Entity Recognition (NER), as well as on cross-lingual model transfer (Pires et al., 2019). If these results imply that the inner workings of other monolingual BERTs and of mBERT are the same as BERT’s is not yet known. Also not known is how homogeneous layer specialisation is: through general performance of, e.g., POS tagging, we see a peak at a given layer, but we do not know how specialisation actually evolves across the whole model. This work investigates such issues. Contributions Using probing classifiers for four tasks on six datasets for a monolingual Dutch model and for mBERT, we observe that (i) these models roughly exhibit the same classic pipeline observed for the original BERT, suggesting this is a general feature of BERT-based models; (ii) the most informative mBERT layers are consistently earlier layers than in monolingual models, indicating an inherent task-independent difference between the two models. Through a deeper analysis of POS tagging, we also show that (iii) the picture of a neatly ordered NLP pipeline is not completely correct, since information appears to be more spread across layers than suggested by the performance peak at a given layer. The full source code is publicly available on Github\(^1\). 2 Approach We run two kinds of analyses. The first is aimed at a rather high level comparison of the performance of a monolingual (Dutch) BERT model (BERTje, de Vries et al. 2019) and multilingual BERT (mBERT) on a variety of tasks at different levels of linguistic complexity (POS tagging, dependency parsing, named entity recognition, and coreference resolution; see Section 2.2), with attention to what happens at different layers. The second is an in-depth analysis of the performance of BERTje and mBERT on part-of-speech tagging. The reason behind this is that looking at global performance over a given task does not provide enough information on what is actually learned by different layers of the model within that task. POS tagging lends itself well for this type of layerwise evaluation. First, because it is a low level task for which relatively little real-world knowledge is required. Second, because analysis of single tags is straightforward since it is done at a token level. Third, because POS tagging contains both easy and difficult cases that depend on surrounding context. Some words are more ambiguous than others, and some classes are open whereas others are closed. Token ambiguity may for instance be an important factor for differences between a monolingual and a multilingual model since the latter has to deal with more homographs, due to the co-presence of multiple languages. Section 2.3 describes how these analyses can be performed in practice using the probes. 2.1 Experimental setup Our method for measuring task performance at different layers is based on the edge probing approach of Tenney et al. (2019a,b). Edge probing is a method to evaluate how well linguistic information can be extracted from a pre-trained encoder. Separate trained classifiers on the outputs of Transformer layers in BERT can reveal which layers contain most information for a particular task. The inputs of the probing classifiers are embeddings extracted from the lexical layer (layer 0) and each Transformer layer (layers 1 up to 12) from either the pre-trained BERTje or mBERT model. Embeddings of token spans are extracted from these full sentence or document embeddings and those spans are used as probe model inputs. The probing classifiers are trained to predict task labels based on span representations using an LSTM layer for tokens that require multiple WordPieces\(^2\). For each model, layer and task we train two probes: a single layer based probe and a scalar mixing probe. The single layer probe uses a single pre-trained Transformer layer output as its input, whereas the scalar mixing probes use a weighted sum of the target layer and preceding layers. 2.2 Tasks and Data We train the probing classifiers on six datasets with four different tasks, chosen to represent linguistic layers of abstraction.\(^3\) For POS tagging and dependency parsing, the LassySmall and Alpino datasets from Universal Dependencies (UD) v2.5 (Zeman et al., 2019) are used with provided splits. For Named Entity Recognition, we use the Dutch portion of the CoNLL-2002 NER dataset (Tjong Kim Sang, 2002) with the provided splits. Finally, we use the coreference annotations of the SoNaR-1 corpus (Delaere et al., 2009) for coreference, with document level training (80%), validation (10%) and testing (10%) splits. 2.3 Analysis We perform a series of analyses aimed at creating a picture of what happens inside of BERTje and mBERT. Initial overall analyses of the tasks are done with the scalar mixing probes as well as the single layer probes for each of the six tasks. First, weights that the scalar mixing probes give to each pre-trained model layer are compared (Section 3.1). Layers that get larger scalar mixing weights may be considered to be more informative than lower weight layers for a particular task (Tenney et al., 2019a). It does not have to be the case that the most informative layers are at the same position in the model since an interaction between layers in different positions may be even more informative. Therefore, we compare layer weights between tasks and pre-trained models. The two \(^1\)https://github.com/wietsedv/bertje/tree/master/probing \(^2\)See Tenney et al. (2019a) for technical details on the classifier architecture. Our hyper-parameters are in Appendix B. \(^3\)Details on size, splits, and processing are in Appendix A. different data sources for POS tagging and dependency parsing will give an indication about stability of these weight distributions across datasets and within tasks. These weights are solely based on training data, so they may not represent the exact layer importance for unseen data. Second, we compare overall prediction scores of the probes on unseen test data for each task (Section 3.2). Through this, we can observe at what stage models peak for what task, and where monolingual and multilingual models might differ. The accuracy deltas between layers for scalar mixing probes will give an indication about which layers add information that was not present in all previous layers combined. For these probes, deltas should be positive if information is added and zero if a layer is uninformative. Third, we take a closer look at POS tagging (Section 4). The previous analyses reveal information about the amount of task-relevant information that is present in each layer, but POS tagging can require different kinds of abstraction for different labels, so that POS performance might be non-homogeneous across layers. Specifically, we (i) compare layerwise performance for each tag and the groups of open and closed class POS tags; (ii) investigate whether information is lost, learned or relearned within the model by combining probe predictions for each individual token; and (iii) check the most frequent confusions between tags to better understand the causes of errors. 3 Analysis over all tasks First, the weights of the scalar mixing models are compared in order to see which layer combinations are most informative. These weights are tuned solely on the training data so they give no indication about layer importance for unseen data. Second, we compare overall prediction scores of the probes on unseen test data for each of the tasks. 3.1 Layer weights Figure 1 shows the scalar mixing weights of the full scalar mixing probes. We highlight a few important patterns that are consistent between tasks, and suggest possible explanations for what we observe, in particular regarding the differences between BERTje and mBERT. The sorted weights form clean curves. The probing classifier is ignorant about ordering of layers when the weights are tuned. Nevertheless the sorted weights mostly show clean curves. The clean curves indicate that embedding of useful information for these tasks is gradually added and removed by the transformer models. This also confirms that our probing model is actually sensitive to these gradual changes in the embeddings. BERTje makes more use of lexical embeddings. The curves in Figure 1 show that the probes for BERTje give higher weights to the first layer than the mBERT probes. This suggests that the pre-trained context-independent lexical embeddings of BERTje are more informative for these tasks than those of mBERT. This makes sense because mBERT word pieces are shared between languages, so there is more word piece level lexical ambiguity in mBERT than BERTje. The exception to this pattern is the SoNaR coreference task, where the difference between mBERT and BERTje is small. Establishing whether two spans of text corefer requires more context-dependent information in addition to lexical embeddings, whereas the other tasks contain examples where context is not always required. BERTje does not rely on the lexical layer more strongly than on subsequent layers for this task. Weights decrease at final layers. If the transformer layers continually add information, the final layer would contain most information. However, information actually decreases after peaking in layers 5 to 9. The reason may be that the actual output of the model should be roughly the same as the original input. Therefore generalisations are discarded in favour of representations that map back to actual word pieces. Generalisations may lead to information loss if they do not correspond to our target tasks, because original information may become less accessible after generalisation. The first and last lexical layers contain most token identity information. If the probes did not benefit from learned language model representations, we would observe that these layers are the most important to solve the tasks. However, the weight peaks that we see in between the lexical layers suggest that the language models contain generalisations that are informative for the given tasks. mBERT peaks earlier than BERTje. The weight peak for the mBERT probes is always in an earlier layer than the peaks of equivalent BERTje probes. These peaks do not correspond with center measures in BERT probing scalar mixing weights of Tenney et al. (2019a), since single center measures only correspond with peaks if the distribution is roughly normal. This might suggest differing priorities during pre-training. Generally, BERTje’s weights start to decrease somewhere in the second half of the layers whereas mBERT’s peaks are closer to the center. This suggests that BERTje uses more layers to generalise than to instantiate back to tokens. The large vocabulary and variety of languages in mBERT may require mBERT to start instantiating earlier with an equal amount of generalisation and instantiation as a result. POS and DEP results are consistent across datasets. The UDLassy and UDAlpino datasets contain equivalent annotations, but the data originates from different text genres. Their POS curves in Figure 1a and 1b and their DEP curves in Figure 1c and 1d are however mostly the same. This indicates that the probes are sensitive to the task and the input embeddings, but not overly sensitive to the specific data that the probes are trained on. 3.2 Prediction scores Figure 2 shows deltas of accuracy scores compared to the preceding layer based on test predictions. The minimum absolute accuracy scores for each task range from 0.630 (SoNaR Coref) to 0.979 (CoNLL-2002 NER) and the maximum accuracy scores per task range from 0.729 (SoNaR Coref) to 0.991 (CoNLL-2002 NER). Accurate deltas for single layer probes are in Appendix C.4 Intuitively, positive deltas in the mixing results in Figure 2 indicate that the introduced layer contains new information that was not present in any preceding layers, whereas zero-deltas indicate that the new layer is completely uninformative. Ideally, the accuracy deltas would never be negative since the probe of layer $N$ has access to information from all layers up to $N$. Negative deltas with cumulative introduction of layers to the probes suggest that the probes sometimes overfit to training data. Otherwise, these deltas should always be zero or higher. Scalar mixing weights of layers that correspond with these uninformative negative delta layers should be lower in order to reduce their effect on the predictions. Figure 1 shows that negative accuracy deltas mainly correspond with negative weight slopes. Therefore, the effects in Figure 1 may be stronger in optimally performing probes. The general pattern in the scalar mixing accuracy deltas in Figure 2 is that deltas are positive in earlier layers and improvement stops for the last layers. This fits with the decreasing weights for the last layers in the full scalar mixing model (Figure 1). One important difference between the layer mixing probes and the single layer probes is that single layer probes sometimes show negative accuracy deltas while the corresponding accuracy delta is positive for the mixing probe. Positive mixing probe deltas suggest that new information is introduced or made more accessible, whereas the negative single layer deltas suggest that some infor- mation is lost or has been made less accessible by the language model. Intuitively, this indicates that some information is sacrificed in order to make place for new information in the embedding. If that is the case, the actual probe prediction mistakes may change between layers even if overall accuracy scores stay the same. Analysis of scalar mixing weights or accuracy on the whole test data only gives an indication of the sum of information for a task. However, a more fine-grained error analysis is required to give any indication about what information is retrievable in which layer and what information becomes harder to identify. 4 In-depth analysis for POS tagging Layer-wise task performance and scalar mixing weights give information about overall information density for a task. For POS tagging, maximum performance and largest scalar mixing weights are assigned to layers 5 to 9 for the pre-trained models, but this does not tell the whole story. Indeed, probes can make different types of errors for different layers and models, because the models may clarify or lose information between layers. Moreover, different examples and labels within a task may rely on information from different layers. We want to give a more thorough view of what BERTje and mBERT learn and whether information becomes unidentifiable between layers as well as whether BERTje and mBERT make the same mistakes. Therefore, we evaluate the errors of the UDLassy POS predictions with single layer probes. We do this analysis on POS predictions because this task stays closest to the lexical level of embedding that the models are pre-trained for, but also rely on context and generalisation for optimal performance. We focus on UDLassy data rather than UDAlpino because the differences between the accuracy deltas of scalar mixing models and single layer models appears higher for UDLassy. This would suggest a larger shift in mistakes. The following analysis is done on the predictions of the 13 single layer BERTje probes and the 13 single layer mBERT probes. POS tagging is not difficult for all tokens, so for 85% of the test data all 26 probes predict the correct tag. In order to focus on errors, we perform all analyses using the subset of the tokens that have an incorrect prediction by at least one of the probes. This amounts to 1,720 tokens. The original test data distribution as well as the filtered distribution are shown in Figure 3. Note that the filtered data distribution does not correspond to the original distribution since some tags are easier to recognise than others. For instance, proper nouns are over-represented in our analysis set whereas adpositions and punctuation are underrepresented. This is not a problem since we are explicitly interested in the mistakes and difficult cases and not in overall performance. 4.1 Accuracies per POS tag Figures 4 and 5 show the F1 scores per POS tag per layer for the single layer probe predictions. POS tags are grouped in aggregates based on whether they are considered to be closed categories (Figure 4) or open categories (Figure 5) according to the Universal Dependencies guidelines. There are six POS tags with relatively low average performance, which also have random fluctuations in per layer performance. Therefore, adp, cconj, punct, num, sym and x are left out of Figures 4 and 5. Figure 4 shows that closed class POS tags seem to be learned by the pre-trained models and not lost in later layers. On average, their scores increase for the first six layers, indicating that the probe uses learned information to identify these tags. After reaching top performance, the probe performance does not really decrease, rather it plateaus. Only the subordinating conjunction class seems to show some decline. There is remarkably little difference between BERTje and mBERT for these classes. Figure 5 shows the tag F1 scores for open class POS tags. Contrary to the closed classes, the mean scores on open classes do seem to decline in later layers. Within the closed classes there are three different patterns. Nouns and proper nouns are learned quickly and stay relatively stable. This is especially true for mBERT. For BERTje, the scores for (proper) nouns seem to decline somewhat after reaching a peak. Verbs keep improving for more layers than (proper) nouns. Apparently, recognition of verbs is something that is resolved later in the pre-trained models. Finally, adjectives and adverbs show an actual decline in performance, since these two tags become hard to distinguish from each other, or possibly other tags, in later layers. 4.2 Confusion between tags The previous figures give an indication about which POS tags are learned by pre-trained models based on context and which tags become unidentifiable, but they do not give an indication about changes in tag confusion. Figure 5 shows that overall single layer performance of open class words peaks in layer 6 for BERTje and layer 6 is also included in the peak layers for mBERT. To illustrate whether biases and confusions change after this peak, we compare the summed confusion matrices from the six layers before and the six layers after layer 6. These confusion matrices (Figure 6) show that there are many similarities between BERTje and mBERT with respect to the confusions that are learned or lost. Decrease in error counts between the first half and the second half of the models suggests that differentiation between tags is learned, whereas increase in errors suggests information loss. For instance verbs and adverbs are more often misclassified as determiners in the first than in the second half. Similarly, proper nouns are confused a lot more often with auxiliary verbs or pronouns in the first half than in the second half. Those differences suggest that discrimination between these tags is learned by both models. However, nouns and proper nouns are confused with adjectives a lot more often in the second than in the first half. 4.3 Example errors BERTje and mBERT do not always make the same mistakes, nor are the same mistakes made in each layer. For many tokens, the probes make incorrect predictions for the first layer(s), but start making correct predictions in later layers, which indicates that learned information is used. Often, these error patterns are similar between BERTje and mBERT. The following are examples of differences: (1) Max Rood — minister van Binnenlandse Zaken, kabinet - Van Agt III [Max Rood — minister of Internal Affairs, cabinet - Van Agt III] (2) Federale Regering [Federal Government] (3) Het ontplooiingsliberalisme stelde de vrije maar verantwoordelijke mens centraal. [The self-development liberalism put the free but responsible man central.] (4) Reeds in het begin van de 20ste eeuw . . . [Already in the beginning of the 20th century] (5) . . . het Duitstalig taalgebied . . . [. . . the German language-area . . .] (6) . . . de Keltische stammen in het gebied . . . [. . . the Celtic tribes in the area . . .] In (1), mBERT initially tags the proper noun “Agt” as verb. In (2) BERTje initially tags the adjective “Federale” as proper noun. Both classifications are incorrect guesses, but with additional context both pre-trained models correctly identify this proper noun in later layers. A different pattern of errors is that the probes make correct predictions based on the first or last layer, but some mistakes for layers in between. In (3) the conjunction “maar” (but) receives the tag adv in several layers instead of the correct tag “cconj”. BERTje makes this mistake in layer 4, 5, and 10; mBERT makes it in layers 3 to 7. It happens relatively often that all BERTje probes assign correct labels, but mBERT goes from incorrect to correct. These mistakes are typically resolved in the first layer of mBERT, suggesting such errors are easily resolvable with a little bit of context; see (4) for an example. There are also a lot of examples where mBERT probes are always correct, but BERTje probes make a mistake somewhere in the middle. It may be the case that these examples are resolvable with and without context but that the internal representations of BERTje get generalised based on non-POS properties. In (5) the adjective “Duitstalig” gets confused with proper noun in layers 4, 5, 7, 8 and 9, but in the layers before and after BERTje probes get it correct. Semantically it is reasonable to think that “Duitstalig” has proper noun-like properties. Finally, (6) is an example where BERTje is always correct but mBERT makes a mistake in the middle somewhere. The word “stammen” should be a noun but mBERT sometimes thinks it is a verb. 5 Conclusion Our results show that BERTje and mBERT exhibit a pipeline-like behaviour along tasks similar to what has previously been shown for English. Tenney et al. (2019a) observed that the pipeline order is roughly first POS tagging, then named entity recognition, then dependency parsing and coreference resolution. Our results suggest that BERTje encodes these pipeline tasks in a similar order. Scalar mixing weights show that there is not a single layer that contains all important information because the weight curves show peaks and valleys. This suggests that useful task information is distributed between layers. Generally, the most informative layers are located early in the second half of the pre-trained models. As an additional note, because we ran the model on different datasets for the same task, we can assess stability across datasets. We observe that POS tagging and dependency parsing results are consistent, suggesting that the probes are sensitive to the task and the embeddings, but not overly sensitive to the specific data that they are trained on. The main task differences between the monolingual BERTje model and the multilingual mBERT model are that BERTje probes make more use of the lexical embedding layer than the mBERT probes and the most important layers of BERTje are mostly later layers than those of mBERT. Semantically rich POS tags like nouns and adjectives become harder to identify in later layers (Figure 5) and confusions mainly happen between semantically rich open categories (Figure 6). This suggests that semantic content is more important than POS discriminating features for final token predictions. So even if the POS abstraction is not readily present in the lexical layer nor in the final token prediction layer, POS tag information is still found in middle layer generalisations. POS tagging is a part of what the pre-trained models learn, but different tag abstractions are present in different layers. Therefore, feature-based use of these models should not use the output of a single best layer. It would be better to combine the outputs of multiple or all layers in order to retrieve all learned information that is relevant for a downstream task. However, actual fine-tuning of pre-trained language models should still be a preferred approach. In sum, our results show that pipeline-like behaviour is present in both a monolingual pre-trained BERT-based model as well as a multilingual model even though task-specific information is distributed between layers. We observed this for POS tagging, but it is still unclear how information within tasks is distributed in these models for other tasks. Moreover, it would be interesting to investigate alternative probing strategies in order to better disentangle what pertains to the model itself from what is specific to a given probing strategy. Lastly, it is an open question how well linguistic properties are embedded within large pre-trained language models for non Indo-European languages. References A Data This is a more detailed description of the data and data preparation that the probing classifiers are trained and tested on. For token level classification tasks like POS tagging, the input span is the range of word pieces that form a single token. For other tasks that use multi-word expressions, like named entity recognition, the spans can be longer than single tokens. Dependency parsing and coreference resolution are not flat token classification tasks but edge prediction tasks. Therefore the probing model can also predict edge labels if two spans are given. The task specific input and output representations are described below. Table 1 shows the sizes of our training datasets and Table 2 shows the data sizes of our test data. Validation data sizes are nearly the same as test data. Part-of-speech (POS) tagging For POS tagging, two datasets from Universal Dependencies (UD) v2.5 (Zeman et al., 2019) are used. These two datasets are the LassySmall (UDv2.5 LassySmall POS) and the Alpino (UD Alpino POS) datasets, both of which consist of documents from the Lassy Small corpus (van Noord et al., 2013). The UD-LassySmall data consists of Wikipedia articles whereas the UD-Alpino data originates from news articles. Universal POS tags are used with 16 coarse lexical categories\(^5\). Both datasets have predefined train, validation and test splits. Dependency (DEP) parsing For dependency parsing, the same same sources with the same splits are used as for POS tagging: UD-LassySmall and UD-Alpino from UD-v2.5. For uniformity across tasks, the probing classifiers are not trained for attachment but for edge labeling. For each edge in a sentence, the head token is used as one span and the full child sequence is used as the other span. The child span is not a single token since a child forms a semantic unit together with its sub-children. For instance, a child span can be "A small child" with a head token "plays" where "plays" is the actual head of "child" in the dependency tree. The semantics of a dependency relationship may be distributed among the tokens within the child tree. The probing classifier is trained to predict which of the 37 UD syntactic relations is the correct one between the head and child span. Predefined splits are used for training, validating, and testing. Named Entity Recognition (NER) For Named Entity Recognition, we use the Dutch portion of the CoNLL-2002 NER dataset (Tjong Kim Sang, 2002), which contains BIO-encoded named entity annotations for newspaper articles with four \(^5\)https://universaldependencies.org/u/pos/ Table 1: Description of our training data. <table> <thead> <tr> <th>task</th> <th># sents</th> <th># tokens</th> <th># examples</th> <th># labels</th> </tr> </thead> <tbody> <tr> <td>UDLassy POS</td> <td>5,787</td> <td>75,165</td> <td>75,165</td> <td>16</td> </tr> <tr> <td>UDLassy DEP</td> <td>5,787</td> <td>75,165</td> <td>69,293</td> <td>34</td> </tr> <tr> <td>UDAlpino POS</td> <td>12,264</td> <td>185,999</td> <td>185,999</td> <td>16</td> </tr> <tr> <td>UDAlpino DEP</td> <td>12,264</td> <td>185,999</td> <td>173,619</td> <td>34</td> </tr> <tr> <td>CoNLL-2002 NER</td> <td>15,806</td> <td>202,644</td> <td>114,288</td> <td>5</td> </tr> <tr> <td>SoNaR Coref NER</td> <td>46,969</td> <td>773,968</td> <td>139,005</td> <td>2</td> </tr> </tbody> </table> Table 2: Description of our test data. All validation data is in the same order of magnitude as test data. <table> <thead> <tr> <th>task</th> <th># sents</th> <th># tokens</th> <th># examples</th> <th># labels</th> </tr> </thead> <tbody> <tr> <td>UDLassy POS</td> <td>875</td> <td>11,581</td> <td>11,581</td> <td>16</td> </tr> <tr> <td>UDLassy DEP</td> <td>875</td> <td>11,581</td> <td>10,681</td> <td>34</td> </tr> <tr> <td>UDAlpino POS</td> <td>596</td> <td>11,053</td> <td>11,053</td> <td>16</td> </tr> <tr> <td>UDAlpino DEP</td> <td>596</td> <td>11,053</td> <td>10,450</td> <td>34</td> </tr> <tr> <td>CoNLL-2002 NER</td> <td>5,195</td> <td>68,875</td> <td>38,488</td> <td>5</td> </tr> <tr> <td>SoNaR Coref NER</td> <td>5,094</td> <td>96,705</td> <td>17,720</td> <td>2</td> </tr> </tbody> </table> classes: persons, organisations, locations and miscellaneous. Spans for full entities are used as inputs for the probing classifier with the entity class as target label. The non-entity tokens are used as negative samples (O label) with random span lengths of one to three tokens. The existing train, validation (test1) and test (test2) splits are used. Coreference (Coref) resolution For coreference resolution, the coreference annotations from the SoNaR-1 corpus (Delaere et al., 2009) are used. There are no pre-defined splits for training and testing, so a random set of 10% of the documents is used for validation and 10% for testing. The splitting is done at document level, so all sentences from the same document are present in the same split. The coreference task is framed as a binary classification task where two spans of tokens are either coreferential or they are not. Because referents are often mentioned in multiple sentences, embeddings are extracted from the pre-trained models with concatenated sentences, until the token limit of 512 tokens is reached. Half of the examples are coreferential strings and half are random referents that do not corefer. Positive examples are sampled from all possible coreferring spans, whereas negative samples can be any non-coreferring expressions. The data contains annotations for spans of potentially referring expressions including singletons, so spans in negative examples are not limited to expressions that are coreferential with another span. B Probe hyper-parameters The probing classifiers use the following hyper-parameters: - Input size: 768 (embedding size of the pre-trained models) - Hidden layer size: 256 - Number of bidirectional LSTM layers: 2 (for span representations) - Dropout: - Input layer: 0.2 - Recurrent layers: 0.3 - Other layers: 0.2 This model is trained with the Adam optimisation algorithm with a learning rate of 0.0001 and weight decay of 0.01. Training is done in mini-batches of 32 examples with evaluation on validation data after every 1000 batches. Training stops when validation loss has not decreased for 20 steps. C Probe accuracies The paper includes accuracy deltas for scalar mixing probes for each task. Figure 7 shows the equivalent accuracy deltas for single layer probes. Figure 7: Accuracy deltas for single layer probes. The general pattern is that the deltas are positive in the earlier layers and improvement stops for the last layers.
{"Source-Url": "https://pure.rug.nl/ws/portalfiles/portal/154948308/2020.findings_emnlp.389.pdf", "len_cl100k_base": 7488, "olmocr-version": "0.1.53", "pdf-total-pages": 13, "total-fallback-pages": 0, "total-input-tokens": 33563, "total-output-tokens": 8571, "length": "2e12", "weborganizer": {"__label__adult": 0.0006341934204101562, "__label__art_design": 0.001377105712890625, "__label__crime_law": 0.0006508827209472656, "__label__education_jobs": 0.003482818603515625, "__label__entertainment": 0.0007839202880859375, "__label__fashion_beauty": 0.00041413307189941406, "__label__finance_business": 0.0006685256958007812, "__label__food_dining": 0.00049591064453125, "__label__games": 0.0014514923095703125, "__label__hardware": 0.0011701583862304688, "__label__health": 0.0009431838989257812, "__label__history": 0.0005502700805664062, "__label__home_hobbies": 0.00012981891632080078, "__label__industrial": 0.000675201416015625, "__label__literature": 0.004894256591796875, "__label__politics": 0.0006780624389648438, "__label__religion": 0.0009007453918457032, "__label__science_tech": 0.3701171875, "__label__social_life": 0.00030803680419921875, "__label__software": 0.0699462890625, "__label__software_dev": 0.53857421875, "__label__sports_fitness": 0.00042319297790527344, "__label__transportation": 0.0007219314575195312, "__label__travel": 0.00030159950256347656}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 35550, 0.04232]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 35550, 0.64036]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 35550, 0.90449]], "google_gemma-3-12b-it_contains_pii": [[0, 0, null], [0, 3719, false], [3719, 8304, null], [8304, 9960, null], [9960, 14536, null], [14536, 15941, null], [15941, 20006, null], [20006, 21930, null], [21930, 24476, null], [24476, 29215, null], [29215, 31803, null], [31803, 35383, null], [35383, 35550, null]], "google_gemma-3-12b-it_is_public_document": [[0, 0, null], [0, 3719, true], [3719, 8304, null], [8304, 9960, null], [9960, 14536, null], [14536, 15941, null], [15941, 20006, null], [20006, 21930, null], [21930, 24476, null], [24476, 29215, null], [29215, 31803, null], [31803, 35383, null], [35383, 35550, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 35550, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 35550, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 35550, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 35550, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 35550, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 35550, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 35550, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 35550, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 35550, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 35550, null]], "pdf_page_numbers": [[0, 0, 1], [0, 3719, 2], [3719, 8304, 3], [8304, 9960, 4], [9960, 14536, 5], [14536, 15941, 6], [15941, 20006, 7], [20006, 21930, 8], [21930, 24476, 9], [24476, 29215, 10], [29215, 31803, 11], [31803, 35383, 12], [35383, 35550, 13]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 35550, 0.11511]]}
olmocr_science_pdfs
2024-12-06
2024-12-06
572bd7f9b74c0481d802584b9600ccab23a658d6
SYNTHEZISING FSMs ACCORDING TO CO-BÜ CHI PROPERTIES by Guoqiang Wang, Alan Mishchenko, Robert Brayton and Alberto Sangiovanni-Vincentelli Memorandum No. UCB/ERL M05/13 12 April 2005 SYNTHESIZING FSMs ACCORDING TO CO-BỤ Chi PROPERTIES by Guoqiang Wang, Alan Mishchenko, Robert Brayton and Alberto Sangiovanni-Vincentelli Memorandum No. UCB/ERL M05/13 12 April 2005 ELECTRONICS RESEARCH LABORATORY College of Engineering University of California, Berkeley 94720 Synthesizing FSMs According to Co-Büchi Properties Guoqiang Wang, Alan Mishchenko, Robert Brayton, and Alberto Sangiovanni-Vincentelli EECS Dept. University of California Berkeley, California, 94720, USA {geraldw, alanmi, brayton, alberto}@eecs.berkeley.edu Abstract. Computations are developed for the synthesis of an FSM embedded in a known larger system such that the overall behavior satisfies a co-Büchi specification. The procedures for this are very similar to those used for regular (non-omega) automata, except for a special final step in which a set of FSM solutions is represented as a SAT instance. Each satisfying assignment corresponds to an FSM solution. To reduce the SAT size, a preprocessing step splits a general solution automaton into a "path" automaton and an "acceptance" automaton. Cycles in the path automaton graph are trimmed while maintaining the input-progressiveness property required for FSMs. Not all FSM solutions are represented by the SAT instance, since in theory there could be an infinite number. The computations have been implemented in the MVSIS environment and a few experiments have been done. 1 Introduction For some applications, the objective is to find a strategy, implementable as a finite state machine, which guides a system to a given subset of states (e.g., a winning state for a game), called the accepting states. Some examples are games and some control problems. Such a situation cannot be captured by a regular automaton specification since the requirement for an FSM solution is that its language is prefix-closed implying that the initial state is accepting. m-type specifications seem to be needed to describe such stronger final constraints. The motivation for considering co-Büchi specification will be clear in Section 2. We present a proposed synthesis flow for co-Büchi specifications. The FSM synthesis problem is stated as follows: Find the most general FSM $X$ such that $F \bullet X \subseteq S$, where $S$ is a co-Büchi automaton, $F$ is a known FSM, and $\bullet$ represents synchronous composition. The most general automaton solution is given by $X = F \bullet S$ where the outside complementation is usually non-deterministic [9]. Thus Büchi and co-Büchi automata complementation are required, which are in general super-exponential in complexity [8]. Instead, we aim for a less general solution and propose a synthesis flow, very similar to that used for regular (finite-word) automata. This uses a subset construction to obtain a deterministic Büchi over-approximation of an ND Büchi automaton. The final complementation is done by simply complement- ing the acceptance conditions to obtain a co-Büchi automaton, which is a subset of the most general solution automaton. An important subclass of co-Büchi automata is “co-looping” automata. For this class of specifications, our procedure obtains the most general solution automaton. To derive the final FSM implementations, the co-Büchi acceptance condition is applied to trim the solution automaton by formulating a SAT [7], [8] instance, all of whose solutions correspond to particular FSM solutions. The SAT instance contains clauses, which ensure the input-progressiveness property required for FSMs (i.e. for each input there must exist a next state and output response). Other clauses enforce the co-Büchi condition by requiring the elimination of all simple cycles that contain a non-final state. The SAT instance represents all FSM solutions that can be associated with sub-graphs of the automaton solution. To help simplify the SAT instance, we use a graph pre-processing step to find a partial order based on input-progressiveness. An edge is classified as essential if its removal causes a state to become non-progressve. Thus this edge removal implies the removal of the corresponding state. This implies that all the states contained in any loop of only essential edges must be removed, implying the removal of other states. This pre-processing is applied until no further removals are possible; the resulting smaller graph becomes the basis for the SAT formulation. The algorithm was implemented in the MVSIS [6] environment and applied to a few examples; the only additional procedure required beyond that used for regular automata specifications was the SAT formulation and solution. The contribution of this paper is a synthesis flow for co-Büchi specifications, which follows the exact flow for regular automata [9], and hence is simpler than for general \(\omega\)-automata; the most complex part is a subset construction. Only in a final step, which extracts an FSM implementation, does the flow differ from that for regular automata specifications. The paper is structured with Section 2 reviewing some preliminaries. The topology used for the unknown component problem is presented in Section 3. The proposed \(\omega\)-property synthesis techniques are addressed in Section 4. The solution computed for a representative example is illustrated in Section 5 and the corresponding automata are shown in Appendix B. Section 6 discusses the complexity of complementing non-deterministic Büchi automata in general and contrasts this with the construction in the present paper. In Section 7, conclusions are discussed. Appendix A considers synthesizing Büchi specifications and discusses a modification of the procedure of the present paper to make it sound for this case. 2 Preliminaries An \(\omega\)-automaton is a finite state automaton that accepts infinite strings [2], [3], [4], [5]. Although there are many different types of \(\omega\)-automata, here we discuss only Büchi, looping, co-Büchi, co-looping and Muller automata. A ND Büchi automaton has the following form: \(M=(Q, \Sigma, q_0, A, Acc)\), where \(Q\) is the finite state space, \(\Sigma\) is the finite input alphabet, \(q_0 \in Q\) is the initial state, $\Delta \subseteq Q \times \Sigma \times Q$ is the transition relation, $Acc \subseteq Q$ represents the acceptance condition. A run of $M$ on the input word $\alpha \in \Sigma^*$, $q(\alpha)$, is successful if it starts at the initial state and the set of states that occur infinitely often intersects $Acc$. For a Muller automaton, $Acc \subseteq 2^Q$ and a run is successful if it starts at the initial state and the set of states which appear infinitely often is a member of $Acc$. Like Büchi, a co-Büchi automaton has also a single set (stable region) in its acceptance condition; but it should eventually enter the stable region and stay there forever. It is a Muller-type automaton where the Muller acceptance condition consists of all subsets of the states in the stable region. Deterministic Büchi and co-Büchi automata are limited in the set of properties that can be expressed, while deterministic Muller automata, ND Büchi, and ND co-Büchi automata can express any $\omega$-regular property. For an ND Büchi automaton with acceptance condition $Acc$, an input sequence is accepted if there exists a run that intersects $Acc$ infinitely often. A co-looping automaton is a co-Büchi automaton with the additional restriction that the final states (stable region) must be a sink, i.e., there is no edge from a final state to a non-final state. A looping automaton is the dual of a co-looping automaton; its non-final states are a sink. Looping automata are useful for expressing safety properties. Looping and co-looping automata have the property that they can be determinized by the subset construction [11]. 3 Problem Statement In this paper, we consider a synthesis problem whose topology is shown in Fig. 1. The setting is that of an unknown component, $X$, embedded in a larger known system where the behavior of the combined system should satisfy some external specification $S$. The components communicate synchronously via the channels labeled with the (multi-valued) variables, $i$, $v$, $u$, $o$. The particular topology of the communication is not really critical for the results of this paper. The synthesis problem has been studied extensively when the specification is a regular finite automaton or an FSM, and a system for efficiently computing the most general solution automaton or the most general FSM solution has been implemented [9]. In this paper, we investigate the situation where $S$ is an $\omega$-automaton. ![Fig. 1. Topological Setup](image) We consider the case where the $\omega$-specification, $S$, is a co-Büchi automaton with multi-valued input signal $o$ whose values are taken from the alphabet $\Sigma_o$. $S$ is represented by $S = (Q_o, \Sigma_o, q_0^o, \Delta_o, A_o)$, where $A_o$ is the stable set. The fixed part $F$ or context is an FSM with multi-valued inputs $i$ and $v$ and multi-valued outputs $o$ and $u$. Here $F$... is interpreted as a special deterministic Büchi automaton, represented by \[ F = (Q, \Sigma, q_0, \delta, B) \], where \( B \) is the set of all states. \( X \) is the unknown component, which is to be implemented as an FSM. In this topology, the unknown component only sees variables \( u \) and \( v \); variables \( i \) and \( o \) are hidden from it. The objective is to find an FSM implementation of \( X \) such that its synchronous composition with \( F \) satisfies the co-Büchi specification \( S \). Solutions are obtained by solving the corresponding \( \omega \)-language containment problem, \[ F \star X \subseteq S \]. The most general solution is given by \( X = F \star \overline{S} \). This is explained further in Section 4, along with the details of our synthesis approach. 4 Overview of the Synthesis Flow An overview of the general synthesis flow is outlined in Figure 2, where each variable is an \( \omega \)-automaton. All operations are done on Büchi or co-Büchi automata. Computation of \[ X = F \star \overline{S} \] Complement \( S \); Complete \( F \) as an automaton; Compute the product \( F \) of \( F \) and \( \overline{S} \); Hide variables invisible to \( X \), e.g. \( i \) and \( o \); Complement \( F \); Restrict to FSM solutions; Fig. 2. High-level algorithm for synthesis of \( X = F \star \overline{S} \) The first five steps compute the most general automaton solution (Section 4.1) while the last step specializes it to a large set of FSM solutions (Section 4.2). We modify this flow by avoiding complementing Büchi chi and co-Büchi automata, as discussed below. 4.1 Computing a General Automaton Solution In this section, we first compute a general \( \omega \)-automaton solution. We follow the first five steps. A sixth step is done as part of extracting particular FSM solutions. Complementing the Specification \( S \). We assume that \( S \) is a deterministic co-Büchi automaton with final states \( A \). It is complemented by simply inverting its acceptance condition. Thus \( \overline{S} \) is a deterministic Büchi automaton and a run of \( \overline{S} \) is accepted if it intersects \( \overline{A} = \overline{Q} \setminus A \) infinitely often. Completing the Fixed Part $F$. $F$ is an FSM and can be interpreted as a special Büchi automaton; it has a set of states $B$ all of which are accepting. Since $F$ as an automaton is incomplete, it is completed by adding a single new state $n_F$, which is the only non-accepting state (it is a state with no-exit and a universal self-loop − a "don't care" state). For convenience, we denote the completed automaton also by $F$. Creating the Product $P = F \cdot \overline{S}$. Since both $F$ and $\overline{S}$ are Büchi automata, their product is conventionally done by introducing a flag as a third entry in the product state to indicate whenever an acceptance condition is met in each operand Büchi automaton. We will remove the need for this flag by using the fact that all states of $F$, except the don't care state, $n_F$, are accepting. In general, the flag is used to ensure that we visit both product states $((s,t))$ in which $s$ is in $B$ infinitely often as well as product states $((q,r))$ in which $r$ is in $\overline{A}$ infinitely often. The flag toggles once we have visited $B$ and again once we have visited $\overline{A}$. Suppose that $\overline{A}$ has just been visited, so the current state $(s,t)$ has $t \in \overline{A}$. There are two cases. If $s \in B$ then we have just visited $B$ also, so the flag does not need to be toggled. The other case is where $s = n_F$. Since $n_F$ is a don't care state, we can never exit it. Thus all subsequent states of the product machine will be $(n_F, -)$. All such states are part of the non-accepting Büchi states of $P$ and can never enter the accepting region. Thus, we don't need to toggle the flag, since nothing important will happen after this. Hence the product automaton $P = F \cdot \overline{S}$ is obtained by taking the regular product of the two operand automata to obtain the transition structure of the Büchi automaton $P = (Q_F, \Sigma_{(\overline{A} \cup \overline{B})}, q_0^F, \Delta_F, C)$. To determine $\overline{C}$, note that $P$ has the following types of states: $(b, a)$, $(b, \overline{a})$, $(n_F, a)$, $(n_F, \overline{a})$, where $a \in \overline{A}$, $\overline{a} \in \overline{\overline{A}}$, and $b \in B$. Thus $\overline{C} = \{(b, \overline{a})\}$ and a run is accepting if and only if it visits states of type $(b, \overline{a})$ infinitely often. Hiding Variables Invisible to $X$. Hiding variables $i$ and $o$ that are invisible to the unknown component $X$ is simply the normal procedure of erasing such labels on the transitions. Even though $P$ is deterministic, the result $P_{48(w)}$ can be non-deterministic. The notation $48_{(w)}$ represents the normal projection operation. Determinizing $P_{48(w)}$. Since $P_{48(w)}$ is a ND Büchi automaton it can't be determinized in general. On the other hand, complementing it is a super-exponential procedure, $2^{ox(w)}$ (see Section 6), which should be avoided if possible. We apply the subset construction to the transition structure of $P_{48(w)}$ to obtain a Büchi automaton $\hat{P}$, whose language contains that of $P_{48(w)}$. The final states of $\overline{C}$ are obtained as follows. When a subset state is reached it is put in $\overline{C}$ if it contains a state of type $(b, \overline{a})$. Complementing $\overline{P}$, $\overline{P}$ can be obtained by duality, by inverting its acceptance condition; thus keeping the same transition structure, but interpreting the result as a co-Büchi automaton with final states $\mathcal{C}$. In general, $\overline{P}$ will be an under-approximation to the most general solution automaton $\overline{P}_{(\omega,\eta)}$. Observations. All the computations above involve only ones that are in the "normal" flow used and implemented in MVSIS for solving problems with regular automata. In particular, one can make use of a partitioned transition structure where the fixed part $\mathcal{F}$ is given as a multi-level circuit [9]. These computations are completion, hiding, product and determinization. Nothing special has been done in Section 4.1 that is associated with computing with Büchi automata. Even the determinization step when deciding which of the subset states are to be put in the Büchi final set, $\mathcal{C}$, is a typical operation in which each subset state is classified as soon as it is generated. The only difference is in the interpretation of the meaning of $\mathcal{C}$ when it is used to construct FSM solutions. In the next subsection, special non-regular methods are formulated to trim $\overline{P}$ to obtain FSM solutions to meet the co-Büchi condition $\mathcal{C}$. Thus all efficient implementations done in MVSIS for computing with regular automata can be used. Another observation is that for specifications, which are co-looping automata, the determinization step in this section is exact, i.e. $\overline{P} = \overline{P}_{(\omega, \eta)}$. This follows from the fact that looping automata can be determinized [11]. Hence for this case, we obtain the most general solution automaton. Note that the result is the same as if we used finite word automata and made all states accepting. 4.2 Computing Particular FSM Solutions $X'$ To obtain particular FSM implementations for the unknown component, we will generate all sub-graphs of $X$, where any loop that contains a non-stable state has been eliminated, leaving only acyclic paths from the initial state to $\mathcal{C}$. The most difficult part is to do this while maintaining input-progressiveness of the solutions.\footnote{Although algorithms for finding minimum feedback-arc sets in directed graphs are available in the literature [1], they do not deal with input progressiveness.} Note that, in general, we may lose some solutions, since only sub-graphs are derived, while state duplication is not allowed. Thus, for example, solutions which circulate around a loop a finite number of times before leaving the loop are not considered. In addition, we have lost some solutions by the determinization of $\overline{P}_{(\omega, \eta)}$. SAT Formulation. We will focus on trimming the deterministic co-Büchi solution $\overline{P}$ so that the only cycles left are those entirely contained in the stable set $\mathcal{C}$. This requires removing transitions (edges) in the graph of $\overline{P}$ making the non-stable part acyclic but still maintaining $u$-progressiveness ($u$ is the only input for the unknown component shown in Fig. 1). This is formulated as a SAT instance. For each transition, we associate a binary variable $e_{ju}$, which is 1 if the transition is chosen to remain. The variable $s_j$ is 1 if State $j$ is chosen to remain. Let $E_{ju} \subseteq E$ be the set of edges that may be traversed on input $u$ in one step from $j$. $E_{ju} = e_j + \ldots + e_{ju}$, where $n$ is the cardinality of $E_{ju}$. The $u$-progressiveness clause, $C_j = E_{ju}$, says that for input $u$, there exists at least one next state. Thus the $u$-progressiveness of State $j$ is $C_j = (s_j \Rightarrow \prod_j E_{ju})$, which says that if State $j$ is selected, then it must be $u$-progressive, meaning that for each minterm of $u$, there exists a next state. A second type of clause, connection clause, says that if edge $e_j$ is selected, then both terminal states have to be selected, i.e. $C_j^e = (e_j \Rightarrow s_j)(e_j \Rightarrow s_\ell)$. Finally, to eliminate every simple loop not entirely contained in the stable set, a third type of clause, loop-breaking clause, is constructed one for each such loop. Suppose $L = \{e_1, e_2, \ldots, e_n\}$ is such a loop. Its clause should say that at least one of these transitions should not be chosen. This is equivalent to $C_L = e_1 e_2 e_3 \ldots e_n$. We must also require that the initial state $s_0$ be selected. Thus $C_0 = s_0$, i.e. $s_0 = 1$, is added to the clauses. Since all simple unstable loops must be enumerated, there could be many such loops. To alleviate this problem, the graph is pre-processed initially to eliminate certain obvious transitions, using the notion of essential edges. This is described in Section 4.3. Hopefully, this reduction will cut down the number of loops considerably. **Theorem 1** (a) An FSM solution (of the \( u \)-language synthesis problem), which corresponds to a sub-graph of \( \overrightarrow{P} \), is a solution of our SAT instance. (b) A solution of our SAT instance is an FSM solution of the \( u \)-language synthesis problem. **Proof:** (a) Since the derived co-Buchi automaton $\overrightarrow{P}$ is a general automaton solution, any deterministic solution to the FSM synthesis problem (implementation) corresponding to a sub-graph of $\overrightarrow{P}$ has the property that for every input string $w$ of $u$ symbols, there is a unique path in the automaton structure of $\overrightarrow{P}$. This path can be decomposed into a finite part $p_1$, and a final part $p_2$ contained entirely in $C$. Suppose $p_2$ is not simple. Then there is a state $s_j$ that is repeated. Let $w_0$ be the part of the input $w = w_0 w_1 w_2$ where $s_j$ is visited for the first time and after $w_1 = \{u_i \ldots u_k\}$, $s_j$ is arrived at again. Then the input $w = w_0 w_1 w_2$ would be an allowed input string to the FSM, but the run for this never eventually remains in $C$. This violates the co-Buchi acceptance condition. Therefore, for any input word, the finite part of each path before finally entering $C$ must be simple. By construction, such a path is contained in a solution of our SAT instance. (b) Suppose we have a solution of the SAT instance. This corresponds to a sub-graph of the most general solution $X$ where every state is $\nu$-progressive and in the graph there is no loop not entirely contained in $C$. Being $\nu$-progressive means that the graph represents a pseudo-non-deterministic FSM (and hence might contain many deterministic solutions). Being a sub-graph of a general solution automaton with the required properties, it is a solution of the synthesis problem, and hence all its deterministic sub-machines are solutions. QED A SAT solver can be configured to enumerate all possible satisfying assignments (a highly efficient one has been implemented in MVSIS). Hence the SAT instance formulated represents a set of FSM solutions. However, all FSM solutions may not be represented, e.g. those where a non-simple loop is traversed a finite number of times before it is exited. An associated FSM would require enough states to count effectively the number of times it has gone around a particular loop. In this sense, such solutions might not be of interest. On the other hand, it is possible that our SAT instance is not satisfiable, but still there exists an FSM solution. This could be remedied by first duplicating one or more states and then formulating a new SAT instance which is satisfiable. Finally, as noted previously, the determinization step in Section 4.1 may cause other FSM solutions to be lost. 4.3 Pre-processing to Simplify the SAT Instance. To reduce the size of the SAT instance, a preprocessing step which trims $P$ can be done. In some cases, after this step, it is possible that no SAT solving is needed. Trimming the Acceptance Set. $P$ is a co-Büchi automaton with accepting set $C$. We create an acceptance automaton as follows. A nominal initial state is created where its outgoing transitions are all the transitions from $\bar{C}$ to $C$, (the labels on these edges are irrelevant) and all states of $\bar{C}$ are eliminated. Thus all transitions from $C$ to $\bar{C}$ being eliminated. This automaton is processed in the regular way [9], which trims away some states and transitions in $C$, to make it $\nu$-progressive. The regular progressive command in MVSIS can be used to trim down this acceptance automaton. If the result is empty, we output that no solution exists and stop, since this means that there can be no cycles entirely contained in $C$. At this point, we modify $P$ by merging all remaining nodes of $C$ into a sink node $f$ having a single universal self loop. Incoming edges to $f$ are only those which lead to the remaining nodes of $C$; other edges are removed. We obtain a so-called path (co-looping) automaton $X_{pad}$, based on $P$, which has only one nominal stable state $f$. Pre-processing the Path Automaton. For each state in $X_{path}$, outgoing transitions are classified as essential or not. An essential edge is one that if eliminated would make that state not $\omega$-progressive. Now restrict $X_{path}$ to the essential transitions and corresponding states. If this graph has a loop (of essential edges) then all states of the connected component containing the loop must be eliminated. This is because there is no way to make $X_{path}$ acyclic since eliminating any transition in the loop requires a corresponding state must be eliminated, causing other transitions and states to be eliminated until the entire connected component is gone. After this, only those connected components, which have no loops of essential transitions, remain. If no states are left in the path automaton, then there is definitely no solution. Now there may be non-essential transitions that must be eliminated because they lead to eliminated states. This can create new essential transitions (which could be called secondary essential transitions). Of the remaining nodes, the essential edges define a partial order; for each totally ordered subset of states, all backward (non-essential) edges within this subset must be eliminated because this is the only way to break such loops while still ensuring input-progressiveness. This could create additional essential transitions (tertiary essential transitions). The above three steps are repeated with all the newly created essential transitions added until no further eliminations are possible. This fixed point can be considered the complex core of the problem for which the SAT instance is formulated. After deriving any particular solution corresponding to the path automaton, it is easy to combine it with the solution of the acceptance automaton to get a corresponding particular solution for the original unknown component problem. 4.4 Discussion Although all transitions are classified as either essential or not, we cannot just set the value associated with all essential transitions to 1 in the clauses since one of their states may not always be in a final solution. However, knowledge of essential edges can help in satisfying the loop-breaking clauses. In general, the graph consisting of essential transitions and the corresponding states could be disconnected. After the preprocessing step, any simple cycle must contain at least one non-essential transition. Only non-essential edges of any loop need to be considered for elimination; otherwise, assume a loop is broken by eliminating an essential edge. This implies that the source node of this edge must be eliminated. Then all edges that lead to this node must be eliminated. If any of these is an essential edge on the loop, then its source node must be eliminated. Eventually we eliminate a node in the loop whose incoming edge on the loop is non-essential. Hence eliminating an essential edge always implies eliminating also a non-essential edge on any loop. 5 Example and Discussion The above presented synthesis approach has some interesting applications in the controller synthesis area. For example, it can nicely handle applications like the Guide-way scheduling synthesis problem discussed in [12]. For ease of illustration, we discuss application of the Wolf-Goat-Cabbage control problem to illustrate the cycle breaking techniques discussed in earlier sections, even though it has a trivial input progressiveness. The problem is to find a strategy to transport by boat all three (wolf, goat, cabbage) across a river without having one of them eat another in the process (wolf eats goat, goat eats cabbage.). The boat can hold only one of the three at once. $X$ represents a transportation strategy (to be found). There is no input to $X$. Thus, if there is only one outgoing transition associated with a state, the transition is essential for progressiveness; if there is more than one outgoing edge, all are non-essential. This example shows how the cycles are broken in the graph. Figures 3 and 4 illustrate this example. The co-Büchi specification is shown in Figure 3 (left). The initial state is $a$; the stable region consists only of $a$. The automaton of the context is not shown since too many states and transitions make it unreadable. Figure 3 (right) shows the minimized most general solution automaton. In this co-Büchi automaton, there is only one state in the stable set. To find a particular FSM implementation, the most general solution is split into two automata. The path automaton is not shown, but has 12 cycles. Some states cannot reach the target state $f$ in the path automaton. We pre-process the path automaton to remove cycles consisting of only essential transitions; and also remove any backward non-essential edges. This leads to the removals of one state and nine transitions. The resulting core structure shown in Figure 4 (left) leads to 29 variables and 57 clauses of the SAT instance, among which 9 clauses are for cycles. It is satisfiable and Figure 4 (right) shows one particular solution of the path automaton. 6 Complexity Issues and Complementing ND Büchi Automata After the construction of the product of two Büchi automata and the hiding of some variables ($i$ and $o$) the ND Büchi automaton $P_{rev}$ is obtained. The last step would be to complement this to obtain the most general solution. There has been much progress in complementing ND Büchi automata (see [8] for a good review and the latest construction). A tight lower bound on the number of states in the complement Büchi automaton is $2^{0.1073n^{2}}$ where $n$ is the number of states in the original Büchi automaton. The most recent results show an upper bound of $(1.06n)^{n}$ in the number of states. In general, it is known that subset constructions do not work for co-Büchi (Büchi) automata but do work for co-looping (looping) automata. The subset construction is upper bounded by $2^{n}$. Thus the procedure in this paper is much less expensive than the general procedure. In addition, experience with the sub-set construction shows that on practical problems, its behavior is well-behaved, in some cases resulting in a reduced number of states. However, the cost, for the general co-Büchi case, is that only a subset of the most general solution is obtained. 7 Conclusions A flow to synthesize an FSM according to co-Büchi specifications was derived. In general, the method is sound but not complete since the determinization step may exclude some solutions (for co-looping specifications it is complete). Indeed, our procedure might wrongly conclude that no FSM solution exists. The steps used to compute a general solution automaton are the same as those used in regular finiteword automata synthesis. A difference occurs only in the last step, which derives a particular solution by formulating and solving a corresponding SAT problem. The SAT formulation is also incomplete since not all solutions can be represented. Simple experimental results demonstrate the correctness of the proposed synthesis procedures on the examples tried. Synthesizing Büchi specifications (useful for liveness properties) is discussed in Appendix A, and is sound and complete if the specification is a looping automaton and if the words Büchi and co-Büchi are interchanged in the procedures. If the specification is non-deterministic, it seems expedient to complement it as a Büchi (co-Büchi) automaton. Algorithms for complementation are discussed in Section 6 and although super-exponential in complexity, the number of states in the specification may be small. Note that trying to treat ND specifications by simply complementing the acceptance condition does not work because this results in a forall (universal) ND automaton whose product with the fixed part needs to be computed. Acknowledgments This research was sponsored partly under NSF contract CCR-0312676 and industrial sponsors, Fujitsu, Intel, Magma, and Synplicity. Guoqiang Wang is sponsored by the Gigascale Systems Research Center. We greatly thank Orna Kupferman for extensive reading and feedback and for suggesting the application to looping automata. Thanks also to Moshe Vardi for very useful comments. References Appendix A – Büchi Specifications Büchi specifications are natural for specifying liveness properties, i.e. always eventually something good happens. The overall flow for using Büchi specifications might seem to be very similar to that discussed for synthesizing co-Büchi specifications, with the only difference being the words “Büchi” and “co-Büchi” interchanged. However, as pointed out earlier, the subset construction for co-Büchi produces a smaller language and so the procedure is not sound (since its complement produces a larger language). On the other hand, if the specification is a looping automaton, then the basic procedure is correct (but properties are restricted to safety properties). The product becomes a co-looping automaton, which can be determinized. On complementing this, the most general solution becomes a looping automaton. Thus, the only modification would be in the trimming as described in Sections 4.2 and 4.3. Since would be a looping automaton, the loop trimming need not be done since is a sink; therefore and all edges to must be eliminated. The remaining graph is then made u-progressive. This is just like that done for finite word automata specifications [9]. For a general deterministic Büchi specification, , a sound approach would be to compute its complement using the procedure in [10]. In addition to this procedure being linear, by adding to the description of the fixed part , often the specification can be described with only a few states. After this, the flow is the same as described for the co-Büchi case, since is obtained as a Büchi automaton and therefore will be a co-Büchi automaton. Appendix B–Figures for Wolf-Goat-Cabbage Example Fig. 3. Co-looping specification (left) and minimized most general automaton solution (right). Fig. 4. Path automaton after pre-processing (left) and a particular solution of the path automaton with bad loops removed (right).
{"Source-Url": "https://www2.eecs.berkeley.edu/Pubs/TechRpts/2005/ERL-05-13.pdf", "len_cl100k_base": 7869, "olmocr-version": "0.1.53", "pdf-total-pages": 16, "total-fallback-pages": 0, "total-input-tokens": 18427, "total-output-tokens": 9221, "length": "2e12", "weborganizer": {"__label__adult": 0.0005016326904296875, "__label__art_design": 0.000621795654296875, "__label__crime_law": 0.0005936622619628906, "__label__education_jobs": 0.0010137557983398438, "__label__entertainment": 0.0001596212387084961, "__label__fashion_beauty": 0.0002884864807128906, "__label__finance_business": 0.0005555152893066406, "__label__food_dining": 0.0005807876586914062, "__label__games": 0.0016193389892578125, "__label__hardware": 0.0036525726318359375, "__label__health": 0.000865936279296875, "__label__history": 0.0005130767822265625, "__label__home_hobbies": 0.00021541118621826172, "__label__industrial": 0.0016937255859375, "__label__literature": 0.000507354736328125, "__label__politics": 0.0006175041198730469, "__label__religion": 0.000934600830078125, "__label__science_tech": 0.438720703125, "__label__social_life": 0.0001208186149597168, "__label__software": 0.00662994384765625, "__label__software_dev": 0.53759765625, "__label__sports_fitness": 0.00045228004455566406, "__label__transportation": 0.0014657974243164062, "__label__travel": 0.00023651123046875}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 35686, 0.03371]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 35686, 0.61028]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 35686, 0.90341]], "google_gemma-3-12b-it_contains_pii": [[0, 0, null], [0, 186, false], [186, 470, null], [470, 3102, null], [3102, 6351, null], [6351, 9234, null], [9234, 11456, null], [11456, 14723, null], [14723, 17791, null], [17791, 20895, null], [20895, 23756, null], [23756, 26758, null], [26758, 30085, null], [30085, 32971, null], [32971, 35460, null], [35460, 35686, null]], "google_gemma-3-12b-it_is_public_document": [[0, 0, null], [0, 186, true], [186, 470, null], [470, 3102, null], [3102, 6351, null], [6351, 9234, null], [9234, 11456, null], [11456, 14723, null], [14723, 17791, null], [17791, 20895, null], [20895, 23756, null], [23756, 26758, null], [26758, 30085, null], [30085, 32971, null], [32971, 35460, null], [35460, 35686, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 35686, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 35686, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 35686, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 35686, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 35686, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 35686, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 35686, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 35686, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 35686, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 35686, null]], "pdf_page_numbers": [[0, 0, 1], [0, 186, 2], [186, 470, 3], [470, 3102, 4], [3102, 6351, 5], [6351, 9234, 6], [9234, 11456, 7], [11456, 14723, 8], [14723, 17791, 9], [17791, 20895, 10], [20895, 23756, 11], [23756, 26758, 12], [26758, 30085, 13], [30085, 32971, 14], [32971, 35460, 15], [35460, 35686, 16]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 35686, 0.0]]}
olmocr_science_pdfs
2024-12-07
2024-12-07
8ce2d07cb0db6c4ee8aea1efcb944a0cf9c5c8cf
The GCC Quad-Precision Math Library Short Contents Introduction ............................................................. 1 1 Typedef and constants ........................................... 3 2 Math Library Routines ............................................ 5 3 I/O Library Routines ............................................. 9 GNU Free Documentation License ................................. 11 4 Reporting Bugs .................................................... 19 Table of Contents Introduction .............................................. 1 1 Typedef and constants ................................. 3 2 Math Library Routines ................................. 5 3 I/O Library Routines ................................. 9 3.1 strtoflt128 — Convert from string .................... 9 3.2 quadmath_snprintf — Convert to string ............... 9 GNU Free Documentation License ..................... 11 ADDENDUM: How to use this License for your documents .... 18 4 Reporting Bugs ................................. 19 Introduction This manual documents the usage of libquadmath, the GCC Quad-Precision Math Library Application Programming Interface (API). 1 Typedef and constants The following data type has been defined via \texttt{typedef}. \texttt{__complex128}: \texttt{__float128}-based complex number The following macros are defined, which give the numeric limits of the \texttt{__float128} data type. \texttt{FLT128\_MAX}: largest finite number \texttt{FLT128\_MIN}: smallest positive number with full precision \texttt{FLT128\_EPSILON}: difference between 1 and the next larger representable number \texttt{FLT128\_DENORM\_MIN}: smallest positive denormalized number \texttt{FLT128\_MANT\_DIG}: number of digits in the mantissa (bit precision) \texttt{FLT128\_MIN\_EXP}: maximal negative exponent \texttt{FLT128\_MAX\_EXP}: maximal positive exponent \texttt{FLT128\_DIG}: number of decimal digits in the mantissa \texttt{FLT128\_MIN\_10\_EXP}: maximal negative decimal exponent \texttt{FLT128\_MAX\_10\_EXP}: maximal positive decimal exponent The following mathematical constants of type \texttt{__float128} are defined. \texttt{M\_Eq}: the constant \(e\) (Euler’s number) \texttt{M\_LOG2Eq}: binary logarithm of 2 \texttt{M\_LOG10Eq}: common, decimal logarithm of 2 \texttt{M\_LN2q}: natural logarithm of 2 \texttt{M\_LN10q}: natural logarithm of 10 \texttt{M\_PIq}: pi \texttt{M\_PI\_2q}: pi divided by two \texttt{M\_PI\_4q}: pi divided by four \texttt{M\_1\_PIq}: one over pi \texttt{M\_2\_PIq}: one over two pi \texttt{M\_2\_SQRTPIQ}: two over square root of pi \texttt{M\_SQRTP2q}: square root of 2 \texttt{M\_SQRTP1\_2q}: one over square root of 2 Chapter 2: Math Library Routines 2 Math Library Routines The following mathematical functions are available: acosq: arc cosine function acoshq: inverse hyperbolic cosine function asinq: arc sine function asinhq: inverse hyperbolic sine function atanq: arc tangent function atanhq: inverse hyperbolic tangent function atan2q: arc tangent function cbrtq: cube root function ceilq: ceiling value function copysignq: copy sign of a number coshq: hyperbolic cosine function cosq: cosine function erfq: error function erfcq: complementary error function exp2q: base 2 exponential function expq: exponential function expmlq: exponential minus 1 function fabsq: absolute value function fdimq: positive difference function finiteq: check finiteness of value floorq: floor value function fmaq: fused multiply and add fmaxq: determine maximum of two values fminq: determine minimum of two values fmodq: remainder value function frexpq: extract mantissa and exponent hypotq: Euclidean distance function ilogbq: get exponent of the value isinfq: check for infinity isnanq: check for not a number issignalingq: check for signaling not a number j0q: Bessel function of the first kind, first order j1q: Bessel function of the first kind, second order jnq: Bessel function of the first kind, n-th order ldexpq: load exponent of the value lgammaq: logarithmic gamma function llrintq: round to nearest integer value llroundq: round to nearest integer value away from zero logbq: get exponent of the value logq: natural logarithm function log10q: base 10 logarithm function log1pq: compute natural logarithm of the value plus one log2q: base 2 logarithm function lrintq: round to nearest integer value lroundq: round to nearest integer value away from zero modfq: decompose the floating-point number nanq: return quiet NaN nearbyintq: round to nearest integer nextafterq: next representable floating-point number powq: power function remainderq: remainder function remquoq: remainder and part of quotient rintq: round-to-nearest integral value roundq: round-to-nearest integral value, return __float128 scalbinq: compute exponent using FLT_RADIX scalbnq: compute exponent using FLT_RADIX signbitq: return sign bit sincosq: calculate sine and cosine simultaneously sinhq: hyperbolic sine function sinq: sine function sqrtq: square root function tanq: tangent function tanhq: hyperbolic tangent function tgammaq: true gamma function truncq: round to integer, towards zero y0q: Bessel function of the second kind, first order y1q: Bessel function of the second kind, second order ynq: Bessel function of the second kind, n-th order cabsq complex absolute value function cargq: calculate the argument cimagq imaginary part of complex number crealq: real part of complex number cacoshq: complex arc hyperbolic cosine function cacosq: complex arc cosine function casinhq: complex arc hyperbolic sine function casinq: complex arc sine function catanhq: complex arc hyperbolic tangent function catanq: complex arc tangent function cosq complex cosine function: ccoshq: complex hyperbolic cosine function cexpq: complex exponential function cexpiq: computes the exponential function of “i” times a real value clogq: complex natural logarithm clogl0q: complex base 10 logarithm conjq: complex conjugate function cpowq: complex power function cprojq: project into Riemann Sphere csinq: complex sine function csinhq: complex hyperbolic sine function csqrtq: complex square root ctanq: complex tangent function ctanhq: complex hyperbolic tangent function Chapter 3: I/O Library Routines 3 I/O Library Routines 3.1 strtoflt128 — Convert from string The function strtoflt128 converts a string into a __float128 number. Syntax ```c __float128 strtoflt128 (const char *s, char **sp) ``` Arguments: - `s` input string - `sp` the address of the next character in the string The argument `sp` contains, if not NULL, the address of the next character following the parts of the string, which have been read. Example ```c #include <quadmath.h> int main () { __float128 r; r = strtoflt128("1.2345678", NULL); return 0; } ``` 3.2 quadmath_snprintf — Convert to string The function quadmath_snprintf converts a __float128 floating-point number into a string. It is a specialized alternative to `snprintf`, where the format string is restricted to a single conversion specifier with Q modifier and conversion specifier e, E, f, F, g, G, a or A, with no extra characters before or after the conversion specifier. The %m$ or *m$ style must not be used in the format. Syntax ```c int quadmath_snprintf (char *s, size_t size, const char *format, ...) ``` Arguments: - `s` output string - `size` byte size of the string, including trailing NUL - `format` conversion specifier string Example ```c #include <quadmath.h> #include <stdlib.h> #include <stdio.h> int main () { __float128 r; int prec = 20; return 0; } ``` int width = 46; char buf[128]; r = 2.0q; r = sqrtq (r); int n = quadmath_snprintf (buf, sizeof buf, "%+-#*.20Qe", width, r); if ((size_t) n < sizeof buf) printf ("%s\n", buf); /* Prints: +1.41421356237309504880e+00 */ quadmath_snprintf (buf, sizeof buf, "%Qa", r); if ((size_t) n < sizeof buf) printf ("%s\n", buf); /* Prints: 0x1.6a09e667f3bcc908b2fb1366ea96p+0 */ n = quadmath_snprintf (NULL, 0, "%+-#46.*Qe", prec, r); if (n > -1) { char *str = malloc (n + 1); if (str) { quadmath_snprintf (str, n + 1, "%+-#46.*Qe", prec, r); printf ("%s\n", str); /* Prints: +1.41421356237309504880e+00 */ } free (str); } return 0; GNU Free Documentation License Version 1.3, 3 November 2008 https://fsf.org/ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. 0. PREAMBLE The purpose of this License is to make a manual, textbook, or other functional and useful document free in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or non- commercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others. This License is a kind of “copyleft”, which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software. We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference. 1. APPLICABILITY AND DEFINITIONS This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The “Document”, below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as “you”. You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law. A “Modified Version” of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language. A “Secondary Section” is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document’s overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them. The “Invariant Sections” are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none. The “Cover Texts” are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words. A “Transparent” copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images com- posed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not “Transparent” is called “Opaque”. Examples of suitable formats for Transparent copies include plain ASCII without markup, TeXinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only. The “Title Page” means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, “Title Page” means the text near the most prominent appearance of the work’s title, preceding the beginning of the body of the text. The “publisher” means any person or entity that distributes copies of the Document to the public. A section “Entitled XYZ” means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as “Acknowledgements”, “Dedications”, “Endorsements”, or “History”.) To “Preserve the Title” of such a section when you modify the Document means that it remains a section “Entitled XYZ” according to this definition. The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License. 2. VERBATIM COPYING You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3. You may also lend copies, under the same conditions stated above, and you may publicly display copies. 3. COPYING IN QUANTITY If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document’s license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Coping with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects. If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages. If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public. It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document. 4. MODIFICATIONS You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version: A. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission. B. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement. C. State on the Title page the name of the publisher of the Modified Version, as the publisher. D. Preserve all the copyright notices of the Document. E. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices. F. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below. G. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document’s license notice. H. Include an unaltered copy of this License. I. Preserve the section Entitled “History”, Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled “History” in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence. J. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the “History” section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission. K. For any section Entitled “Acknowledgements” or “Dedications”, Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein. L. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles. M. Delete any section Entitled “Endorsements”. Such a section may not be included in the Modified Version. N. Do not retitle any existing section to be Entitled “Endorsements” or to conflict in title with any Invariant Section. O. Preserve any Warranty Disclaimers. If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version’s license notice. These titles must be distinct from any other section titles. You may add a section Entitled “Endorsements”, provided it contains nothing but endorsements of your Modified Version by various parties—for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard. You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one. The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version. 5. COMBINING DOCUMENTS You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers. The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work. In the combination, you must combine any sections Entitled “History” in the vari- ous original documents, forming one section Entitled “History”; likewise combine any sections Entitled “Acknowledgements”, and any sections Entitled “Dedications”. You must delete all sections Entitled “Endorsements.” 6. COLLECTIONS OF DOCUMENTS You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects. You may extract a single document from such a collection, and distribute it individu- ally under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document. 7. AGGREGATION WITH INDEPENDENT WORKS A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an “aggregate” if the copyright resulting from the compilation is not used to limit the legal rights of the compilation’s users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document. If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document’s Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate. 8. TRANSLATION Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail. If a section in the Document is Entitled “Acknowledgements”, “Dedications”, or “History”, the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title. 9. TERMINATION You may not copy, modify, sublicense, or distribute the Document except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automatically terminate your rights under this License. However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, receipt of a copy of some or all of the same material does not give you any rights to use it. 10. FUTURE REVISIONS OF THIS LICENSE The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See https://www.gnu.org/copyleft/. Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License “or any later version” applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. If the Document specifies that a proxy can decide which future versions of this License can be used, that proxy’s public statement of acceptance of a version permanently authorizes you to choose that version for the Document. 11. RELICENSING “Massive Multiauthor Collaboration Site” (or “MMC Site”) means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works. A public wiki that anybody can edit is an example of such a server. A “Massive Multiauthor Collaboration” (or “MMC”) contained in the site means any set of copyrightable works thus published on the MMC site. “CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0 license published by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco, California, as well as future copyleft versions of that license published by that same organization. “Incorporate” means to publish or republish a Document, in whole or in part, as part of another Document. An MMC is “eligible for relicensing” if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections, and (2) were thus incorporated prior to November 1, 2008. The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing. ADDENDUM: How to use this License for your documents To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page: Copyright (C) year your name. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the "with...Texts." line with this: with the Invariant Sections being list their titles, with the Front-Cover Texts being list, and with the Back-Cover Texts being list. If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation. If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software. 4 Reporting Bugs Bugs in the GCC Quad-Precision Math Library implementation should be reported via http://gcc.gnu.org/bugs/.
{"Source-Url": "https://gcc.gnu.org/onlinedocs/libquadmath.pdf", "len_cl100k_base": 6993, "olmocr-version": "0.1.53", "pdf-total-pages": 26, "total-fallback-pages": 0, "total-input-tokens": 44221, "total-output-tokens": 8271, "length": "2e12", "weborganizer": {"__label__adult": 0.00028061866760253906, "__label__art_design": 0.0004787445068359375, "__label__crime_law": 0.0007219314575195312, "__label__education_jobs": 0.0010395050048828125, "__label__entertainment": 9.340047836303712e-05, "__label__fashion_beauty": 9.02414321899414e-05, "__label__finance_business": 0.0006213188171386719, "__label__food_dining": 0.000316619873046875, "__label__games": 0.0007777214050292969, "__label__hardware": 0.0008549690246582031, "__label__health": 0.0002415180206298828, "__label__history": 0.00015366077423095703, "__label__home_hobbies": 8.386373519897461e-05, "__label__industrial": 0.00032019615173339844, "__label__literature": 0.0002942085266113281, "__label__politics": 0.00020897388458251953, "__label__religion": 0.00031495094299316406, "__label__science_tech": 0.02593994140625, "__label__social_life": 6.794929504394531e-05, "__label__software": 0.0229339599609375, "__label__software_dev": 0.94384765625, "__label__sports_fitness": 0.00014865398406982422, "__label__transportation": 0.0002598762512207031, "__label__travel": 0.00011396408081054688}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 31298, 0.01879]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 31298, 0.33729]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 31298, 0.84849]], "google_gemma-3-12b-it_contains_pii": [[0, 36, false], [36, 36, null], [36, 482, null], [482, 482, null], [482, 1051, null], [1051, 1051, null], [1051, 1190, null], [1190, 1190, null], [1190, 2704, null], [2704, 2704, null], [2704, 3354, null], [3354, 4350, null], [4350, 5887, null], [5887, 6229, null], [6229, 7616, null], [7616, 8297, null], [8297, 11303, null], [11303, 14631, null], [14631, 17948, null], [17948, 20912, null], [20912, 24035, null], [24035, 27474, null], [27474, 29909, null], [29909, 31172, null], [31172, 31298, null], [31298, 31298, null]], "google_gemma-3-12b-it_is_public_document": [[0, 36, true], [36, 36, null], [36, 482, null], [482, 482, null], [482, 1051, null], [1051, 1051, null], [1051, 1190, null], [1190, 1190, null], [1190, 2704, null], [2704, 2704, null], [2704, 3354, null], [3354, 4350, null], [4350, 5887, null], [5887, 6229, null], [6229, 7616, null], [7616, 8297, null], [8297, 11303, null], [11303, 14631, null], [14631, 17948, null], [17948, 20912, null], [20912, 24035, null], [24035, 27474, null], [27474, 29909, null], [29909, 31172, null], [31172, 31298, null], [31298, 31298, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 31298, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 31298, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 31298, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 31298, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 31298, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 31298, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 31298, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 31298, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 31298, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 31298, null]], "pdf_page_numbers": [[0, 36, 1], [36, 36, 2], [36, 482, 3], [482, 482, 4], [482, 1051, 5], [1051, 1051, 6], [1051, 1190, 7], [1190, 1190, 8], [1190, 2704, 9], [2704, 2704, 10], [2704, 3354, 11], [3354, 4350, 12], [4350, 5887, 13], [5887, 6229, 14], [6229, 7616, 15], [7616, 8297, 16], [8297, 11303, 17], [11303, 14631, 18], [14631, 17948, 19], [17948, 20912, 20], [20912, 24035, 21], [24035, 27474, 22], [27474, 29909, 23], [29909, 31172, 24], [31172, 31298, 25], [31298, 31298, 26]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 31298, 0.0]]}
olmocr_science_pdfs
2024-12-05
2024-12-05
063bb2259606841ba2c180a9e396d4350ddb15e9
Bayesian Concepts in Software Testing: An Initial Review Daniel Rodríguez Universidad de Alcalá Javier Dolado U. País Vasco/Euskal Herriko Unibertsitatea Javier Tuya Universidad de Oviedo <table> <thead> <tr> <th>Bayes' rule</th> <th>Bayesian Networks</th> <th>Literature Review</th> <th>Conclusions</th> </tr> </thead> </table> Outline - Bayes-Laplace Rule - Bayes Theorem - Frequentism vs Bayesianism - Example: Breast Cancer - Example: Drunk Driver - Bayesian Networks - Definition - Basic Example: Defects insertion - Inferences - Literature Review (2010 onwards) This document is available at http://www.sc.ehu.es/jiwdocoj/bayes/bergamoATest2015.pdf Bayes' rule or Bayes-Laplace rule - Bayes' Rule: most probably due to Reverend Thomas Bayes (1702-1761, Kent, England) (or to Nicholas Saunderson 1682-1739) - Only published one mathematical paper in his entire life. - After his death published 'An essay towards solving a problem in the doctrine of chances', 1763, submitted by Richard Price - Pierre-Simon Laplace (1749-1827) independently discovered Bayes' rule in 1812 and made it operational - Bayesian methods were set aside in favour of non-Bayesian (frequentist) methods in the 20th century Bayes' Rule Two definitions of Probability: - **Frequentism**: the definition of probability is related to the *frequency of an event*. The parameters of interest are fixed but the data are a repeatable random sample, hence there is a frequency. No prior information is used. In a strict frequentist view, it does not make sense to talk about the true value of the parameter $\theta$ under study. The true value of $\theta$ is fixed, by definition. Frequentists compute $P(data|\theta)$, which is the probability of observing the data given the null hypothesis. - **Bayesianism**: the definition of probability is related to the *level of knowledge* about an event. The value of knowledge about an event is based on *prior* information and the available data. The parameters of interest are unknown and the data are fixed. From a Bayesian viewpoint we can talk about the probability that the true value of the parameter $\theta$ lies in an interval. Bayesians compute $P(\theta|data)$, which is the probability of a given outcome, given the data. Bayes' Rule - It is all about *conditional probabilities* - The rule allows to make inferences from *causes to effects (symptoms)* and from *effects to causes* - Given two events, H and E, \[ P(H \cap E) = P(H | E) \cdot P(E)\\ P(E \cap H) = P(E | H) \cdot P(H)\\ P(H \cap E) = P(E \cap H)\\ \] \[ P(H | E) \cdot P(E) = P(E | H) \cdot P(H) \] Bayes' Rule - The conditional probability of $H$, given $E$, is $$P(H|E) = \frac{P(E|H) \cdot P(H)}{P(E)}$$ - $P(E)$ is $$P(E) = P(E|H) \cdot P(H) + P(E|\neg H) \cdot P(\neg H)$$ - $P(E)$ acts as a constant Posterior $\propto$ Likelihood $\cdot$ Prior Example: Breast Cancer \[ P(Hypothesis|Data) = \frac{P(Data|Hypothesis)P(Hypothesis)}{P(Data)} \] - It is a textbook example that shows how to infer causes from the symptoms. The data below is for the sake of example. Factual data can be found at http://www.breastcancer.org 1% of women between age forty-fifty who participate in routine screening have breast cancer. 90% of women with breast cancer will get positive mammographies. 9.6% of women without breast cancer will also get positive mammographies. A woman in this age group had a positive mammography in a routine screening. What is the probability that she actually has breast cancer? \[ P(Breast \ Cancer = \text{present}|\text{Test+} = \text{positive})? \] Example: Breast Cancer - The random variables that we define are <table> <thead> <tr> <th>Variable</th> <th>Value</th> <th>When the Variable Takes This Value</th> </tr> </thead> <tbody> <tr> <td>Breast Cancer</td> <td>positive</td> <td>breast cancer is present</td> </tr> <tr> <td></td> <td>negative</td> <td>breast cancer is not present</td> </tr> <tr> <td>Test+</td> <td>positive</td> <td>the test result is positive</td> </tr> <tr> <td></td> <td>negative</td> <td>the test result is negative</td> </tr> </tbody> </table> \[ P(Breast\ Cancer | Test+) = \frac{P(\text{Test+} | Breast\ Cancer) \cdot P(Breast\ Cancer)}{P(\text{Test+})} \] \[ P(\text{present} | \text{positive}) = \frac{P(\text{positive} | \text{present}) \cdot P(\text{present})}{P(\text{positive})} \] Example: Breast Cancer \[ P(\text{present} | \text{positive}) = \frac{P(\text{positive} | \text{present}) P(\text{present})}{P(\text{positive})} \] 1% of women between age forty-fifty who participate in routine screening have breast cancer. 90% of women with breast cancer will get positive mammographies. (TRUE POSITIVES) 9.6% of women without breast cancer will also get positive mammographies (FALSE POSITIVES) \[ P(\text{present} | \text{positive}) \times \frac{P(\text{positive} | \text{present}) P(\text{present})}{P(\text{positive})} = \] \[ = \frac{(0.90) \cdot (0.01)}{P(\text{positive})} = \frac{0.009}{0.10404} = 0.08650519 \approx 8.6 \% \] \[ P(\text{positive}) = P(\text{positive} | \text{present}) P(\text{present}) + P(\text{positive} | \text{absent}) P(\text{absent}) = \] \[ = (0.90) \cdot (0.01) + (0.096) \cdot (0.99) = (0.009) + (0.09504) = 0.10404 \] Bayes' rule Graphical Illustration 1 1% of women between age forty-fifty who participate in routine screening have breast cancer. 90% of women with breast cancer will get positive mammographies. (TRUE POSITIVES) 9.6% of women without breast cancer will also get positive mammographies (FALSE POSITIVES) Table with Conditional Probabilities <table> <thead> <tr> <th>Breast Cancer (is the Hypothesis)</th> <th>present</th> <th>1%</th> <th>absent</th> <th>99%</th> </tr> </thead> <tbody> <tr> <td>Test+ (is the Evidence)</td> <td>positive</td> <td></td> <td>negative</td> <td></td> </tr> <tr> <td>90% (True Positive Rate)</td> <td></td> <td></td> <td>9.6% (False Positive Rate)</td> <td></td> </tr> <tr> <td>10% (False Negative Rate)</td> <td></td> <td>90.4% (True Negative Rate)</td> <td></td> <td></td> </tr> </tbody> </table> Sensitivity = recall = 90% Specificity = 90.4% \[ P(\text{present}|\text{positive}) = \frac{(0.01)(0.9)}{(0.01)(0.9) + (0.096)(0.99)} \approx 8.6\%\] Bayes' rule Graphical Illustration 2 1% out of 10000 = 100 with breast cancer 90% show up positive test = 90 9.6% show up false positive test = 960 Table with Frequencies Breast Cancer <table> <thead> <tr> <th></th> <th>present</th> <th>absent</th> </tr> </thead> <tbody> <tr> <td>Test+</td> <td></td> <td></td> </tr> <tr> <td>positive</td> <td>90 (true positives)</td> <td>960 (false positives)</td> </tr> <tr> <td>negative</td> <td>10 (false negatives)</td> <td>8940 (true negatives)</td> </tr> </tbody> </table> 90/(90+960) = 90/1050 = 8.6% 1% of women between age forty-fifty who participate in routine screening have breast cancer. We have available a new test procedure Test+++ such that 90% of women with breast cancer will get positive mammographies. (TRUE POSITIVES) 0.01% of women without breast cancer will also get positive mammographies (FALSE POSITIVES) ### Table with Conditional Probabilities <table> <thead> <tr> <th>Breast Cancer</th> <th>present</th> <th>1%</th> <th>absent</th> <th>99%</th> </tr> </thead> <tbody> <tr> <td>Test+++</td> <td>positive</td> <td>90% (True Positive Rate)</td> <td>0.01% (False Positive Rate)</td> <td></td> </tr> <tr> <td></td> <td>negative</td> <td>10% (False Negative Rate)</td> <td>99.99% (True Negative Rate)</td> <td></td> </tr> </tbody> </table> \[ P(\text{present} | \text{positive}) = \frac{(0.9)(0.01)}{(0.9)(0.01) + (0.0001)(0.99)} = 98.91\% \] Bayes' rule • Bayesianism was used to prove that mass screening for a large population for a rare disease such as AIDS or other was unprofitable. • Another case is prostate cancer. The disease is so rare that the tests for identifying the specific agent result in most cases returning positive results for a patient that does not have cancer. Example 2: Drunk Driver - A group of policemen have breathalyzers displaying false drunkenness in 5% of the cases in which the driver is sober. - However, the breathalyzers never fail to detect a truly drunk person. - One in a thousand drivers are driving drunk. - Suppose the policemen then stop a driver at random, and force the driver to take a breathalyzer test. It indicates that the driver is drunk. - We assume you don't know anything else about him or her. - How high is the probability he or she really is drunk? Example 2: Drunk Driver - We must find the probability that the driver is drunk given that the breathalyzer indicated they are drunk. <table> <thead> <tr> <th>Breathalyzer</th> <th>Drunk Driver</th> </tr> </thead> <tbody> <tr> <td><strong>positive</strong></td> <td>Drunk: 0.001</td> </tr> <tr> <td>100% (True Positive Rate)</td> <td>5% (False Positive Rate)</td> </tr> <tr> <td><strong>negative</strong></td> <td>0% (False Negative Rate)</td> </tr> </tbody> </table> \[ P(\text{Drunk} | \text{positive}) = \frac{P(\text{positive} | \text{Drunk}) P(\text{Drunk})}{P(\text{positive})} = \frac{(0.001)(1.0)}{(0.001)(1.0)+(0.05)(0.999)} \] \[ = \frac{0.001}{0.001 + 0.04995} = \frac{0.001}{0.05095} = 0.019627085 \approx 2\ \] Bayes' Rule \[ P(\text{Hypothesis} | \text{Data}) = \frac{P(\text{Data} | \text{Hypothesis}) P(\text{Hypothesis})}{P(\text{Data})} \] If instead of having H and \( \neg H \), only one hypothesis and its negation, there are \( n \) Hypotheses \textit{mutually exclusive and exhaustive}, the rule becomes \[ P(\text{Hypothesis}_j | \text{Data}) = \frac{P(\text{Data} | \text{Hypothesis}_j) P(\text{Hypothesis}_j)}{\sum_{1 \ldots n} P(\text{Data} | \text{Hypothesis}_1) P(\text{Hypothesis}_1) + \ldots + P(\text{Data} | \text{Hypothesis}_n) P(\text{Hypothesis}_n)} \] - then Bayesian Networks and their graphical representation come into play in order to ease the computations when there are many variables involved Bayesian model comparison Bayesian model comparison is performed by means of *posterior odds*. The posterior odds ratio for a model $M_1$ against another model $M_2$ involves a ratio of marginal likelihoods, the so-called *Bayes factor* $$ \frac{P(M_1 | x)}{P(M_2 | x)} = \frac{P(x | M_1)}{P(x | M_2)} \frac{P(M_1)}{P(M_2)} $$ *Posterior odds = Bayes factor $\cdot$ Prior odds* Bayesian Networks - A Bayesian network, Bayes network or belief network is a probabilistic graphical model that represents a set of random variables and their conditional dependencies via a directed acyclic graph (DAG). - It allows to make inferences from causes to symptoms and from symptoms to causes. - Bayesian networks are DAGs whose nodes represent random variables, unknown parameters or hypotheses. - Edges represent conditional dependencies. - Each node is associated with a probability function that takes, as input, a particular set of values for the node's parent variables, and gives (as output) the probability (or probability distribution, if applicable) of the variable represented by the node. - Let $G=(V,E)$ a Directed Acyclic Digraph (DAG) composed of a set of vertices $V$ and a set of edges $E$ among the pairs of vertices of $V$. Let $P$ be a joint probability distribution of the random variables in the set of vertices $V$. We call $(G,P)$ a Bayesian Network if $(G,P)$ satisfies the Markov condition. Example: Basic bayesian network for defect estimation - A basic example involving three variables. - The expert has decided that in order to model their predictive problem - Defects inserted: by the development group with different probabilities. - Defects detected: Probability of detecting defects depending on the defects inserted - Residual defects: Probability of remaining defects depending on the inserted and detected defects 1) Create the network with the conditional probabilities tables • If we introduce “the evidences” we get the output probabilities (estimates) Evidences (in red) are introduced in the network From symptoms we can get to the causes: “What is the probability that the number of inserted defects was high, given that the number of residual defects is high?“ → 56% \[ P(I=\text{high}|R=\text{high}) = \frac{P(R=\text{high}, I=\text{high})}{P(R=\text{high})} = \frac{\sum_{D \in \{\text{low}, \text{high}\}} P(R=\text{high}, D, I=\text{high})}{\sum_{D, I \in \{\text{low}, \text{high}\}} P(R=\text{high}, D, I)} \] If we fix the evidence that we had a high number of residual defects, we can deduce, by means of the conditional probability formula, the probability (high or low) of the defects inserted. • For this small probabilistic network the computations can be done by hand, but they are tedious to perform. • Computations performed manually (check the wikipedia entry 'Bayesian network' for the explanation of the procedure) • It is impractical to compute the joint probability distribution when there are many variables \[ P(I=\text{high}|R=\text{high}) = \frac{P(R=\text{high}, I=\text{high})}{P(R=\text{high})} = \frac{\sum_{D \in \{\text{low}, \text{high}\}} P(R=\text{high}, D, I=\text{high})}{\sum_{D, I \in \{\text{low}, \text{high}\}} P(R=\text{high}, D, I)} \] Manual Computations for the Defects BN: $$P(\text{Residuals, Detected, Inserted}) = P(R \mid D, I) \cdot P(D \mid I) \cdot P(I)$$ $$P(I = \text{high} \mid R = \text{high}) = \frac{P(R = \text{high}, I = \text{high})}{P(R = \text{high})} = \frac{\sum_{D \in \{\text{low, high}\}} P(R = \text{high}, D, I = \text{high})}{\sum_{D, I \in \{\text{low, high}\}} P(R = \text{high}, D, I)} = \frac{0.09 + 0.19}{0.09 + 0.19 + 0.18 + 0.04} = \frac{0.28}{0.5} = 0.56$$ $$P(R = \text{high}, D = \text{high}, I = \text{high}) = P(R = \text{high} \mid D = \text{high}, I = \text{high}) \cdot P(D = \text{high} \mid I = \text{high}) \cdot P(I = \text{high}) = 0.3 \times 0.6 \times 0.5 = 0.09$$ $$P(R = \text{high}, D = \text{low}, I = \text{high}) = P(R = \text{high} \mid D = \text{low}, I = \text{high}) \cdot P(D = \text{low} \mid I = \text{high}) \cdot P(I = \text{high}) = 0.95 \times 0.4 \times 0.5 = 0.19$$ $$P(R = \text{high}, D = \text{low}, I = \text{low}) = P(R = \text{high} \mid D = \text{low}, I = \text{low}) \cdot P(D = \text{low} \mid I = \text{low}) \cdot P(I = \text{low}) = 0.6 \times 0.6 \times 0.5 = 0.18$$ $$P(R = \text{high}, D = \text{high}, I = \text{low}) = P(R = \text{high} \mid D = \text{high}, I = \text{low}) \cdot P(D = \text{high} \mid I = \text{low}) \cdot P(I = \text{low}) = 0.2 \times 0.4 \times 0.5 = 0.04$$ - Bayesian networks exploit the graphical properties of the DAG (d-separation) in order to decrease the amount of computations by providing message passing algorithms. Inference - Bayesian networks allow several types of inference: - **Probabilistic inference**: given the *evidence* variables compute the *posterior* distribution of other variables. - **Parameter learning**: in order to specify a BN we need to specify conditional distributions that include parameters which are unknown and must be estimated from data. - **Structure learning**: BNs are specified by experts in the field and then are used to perform inference, in their simplest form. But in other situations the definition of the network must be learned from data. Literature Review • Aim: identify, classify and analyse the available literature since 2010 related to different aspects of software testing and quality that apply Bayesian concepts • Currently, from 2010 onwards. In 2010 position paper by Namin and Sridharan related to the potential of Bayesian reasoning methods. Obstacles detected: – Generalization of the conclusions – Sensitivity to prior probabilities – Difficulties for software engineers to understand bayesian concepts • We use the protocol for a Systematic Literature Review (EBSE website and Kitchenham recommendations.) • Data Sources: ISI Web of Science, Scopus, Elsevier Science Direct, IEEE Xplore, SpringerLink, ACM Digital Library, Wiley Interscience, Google Scholar and The Collection of Computer Science Bibliographies. • Keyword search: *Bayesian & networks & software testing*. Other combinations of keywords did not generate additional results. **Table 1.** Repositories and papers found and selected <table> <thead> <tr> <th>Digital Library</th> <th>Domain</th> <th>Returned</th> <th>Relevant</th> </tr> </thead> <tbody> <tr> <td>ISI Web of Science</td> <td>CS, Eng</td> <td>10</td> <td>6</td> </tr> <tr> <td>Scopus</td> <td>CS</td> <td>45</td> <td>16</td> </tr> <tr> <td>Elsevier ScienceDirect</td> <td>CS</td> <td>40</td> <td>6</td> </tr> <tr> <td>SpringerLink</td> <td>-</td> <td>133</td> <td>10</td> </tr> <tr> <td>IEEEExplore</td> <td>-</td> <td>24</td> <td>3</td> </tr> <tr> <td>ACM DL</td> <td>-</td> <td>12</td> <td>-</td> </tr> <tr> <td>Wiley Interscience</td> <td>-</td> <td>62</td> <td>-</td> </tr> <tr> <td>Google Scholar</td> <td>-</td> <td>2,390</td> <td>-</td> </tr> <tr> <td><strong>Total</strong></td> <td></td> <td></td> <td><strong>41</strong></td> </tr> </tbody> </table> • Software Testing Effort Prediction and Productivity Estimates – 4 references – This topic is concerned with the estimation of the test costs in terms of person-days. Few works have recently applied Bayesian models for testing effort estimation • Fault and Defect Prediction. Software Reliability – 23 references – The topic of reliability is another area where Bayesian approaches have been explored by multiple researchers, specially for real-time systems. • Quality Models – 2 references – A quality model describes in a structured way the concept of quality in a software system. - Test Data Generation, Test Case Selection and Test Plan Generation - 7 references - Test data generation and test case prioritization are important areas within software testing. - Graphical User Interface (GUI) Testing - 2 references - Two works have built a BN that uses the prior knowledge of testers and the BN updates the values depending on the results of the test cases. - Philosophy of Technology - 1 reference - Bayes concepts and the software testing field have been used as the substrate for defining the software engineering area as a “scientifically attested technology” Introduction Bayesian Networks Literature Review Conclusions • 60% of the references lie on the “software reliability” area. The next areas of applications are “test data generation” and “test effort estimation”, with 11% and 10% of the references, respectively. • we may highlight the following issues after reviewing the literature: − Generalization of the conclusions: every work builds its BN starting from scratch and the BN is adapted to its specific problem. A “meta study” or meta-analysis of the results obtained by different researchers would uncover potential similarities in the results and in the graphical structure of the BN. − Sensitivity to priors: an essential characteristic of BNs is the need to provide prior probabilities to variables. One way to avoid discrepancies is to set standard priors in the field, which could be agreed upon in case of parameters such as productivity, etc. The fact that BNs allow us to update the variable probabilities can moderate the results obtained with different priors, provided a robust BN. • Probabilistic graphical models can help in testing activities (and decision making in general) as supervised (prediction) and unsupervised (clustering) techniques from the data mining point of view as well as optimisation approaches. • In prediction, we can consider classifiers such as Naïve Bayes and more complex structures such as TAN (Tree Augmented Naïve Bayes) to generic networks such as Bayesian Networks or Markov Models and their extensions (e.g. Dynamic BNs, Influence Diagrams). These latter Bayesian approaches have not yet been fully exploited (in comparison with the former simpler Bayesian classifiers). Acknowledgements PROJECTS “Testing of data persistence and user perspective under new paradigms” “Gamificación y prototipado de procesos para la detección temprana de oportunidades en la producción del software” PRESI TIN2013-46928-C3-1-R, TIN2013-46928-C3-2-R Ministerio de Economía y Competitividad, Spain
{"Source-Url": "http://www.cc.uah.es/drg/c/RDT_ATest15Slides.pdf", "len_cl100k_base": 5866, "olmocr-version": "0.1.49", "pdf-total-pages": 31, "total-fallback-pages": 0, "total-input-tokens": 54164, "total-output-tokens": 6861, "length": "2e12", "weborganizer": {"__label__adult": 0.00037479400634765625, "__label__art_design": 0.0004868507385253906, "__label__crime_law": 0.0005016326904296875, "__label__education_jobs": 0.001949310302734375, "__label__entertainment": 8.690357208251953e-05, "__label__fashion_beauty": 0.00017213821411132812, "__label__finance_business": 0.000446319580078125, "__label__food_dining": 0.0004742145538330078, "__label__games": 0.0007276535034179688, "__label__hardware": 0.0008878707885742188, "__label__health": 0.001163482666015625, "__label__history": 0.00027632713317871094, "__label__home_hobbies": 0.00014269351959228516, "__label__industrial": 0.000438690185546875, "__label__literature": 0.0005426406860351562, "__label__politics": 0.0002052783966064453, "__label__religion": 0.00040221214294433594, "__label__science_tech": 0.09259033203125, "__label__social_life": 0.0001704692840576172, "__label__software": 0.015350341796875, "__label__software_dev": 0.8818359375, "__label__sports_fitness": 0.0003032684326171875, "__label__transportation": 0.0004010200500488281, "__label__travel": 0.00022590160369873047}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 19818, 0.02514]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 19818, 0.84762]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 19818, 0.83349]], "google_gemma-3-12b-it_contains_pii": [[0, 191, false], [191, 731, null], [731, 1281, null], [1281, 2331, null], [2331, 2677, null], [2677, 2935, null], [2935, 3661, null], [3661, 4359, null], [4359, 5241, null], [5241, 6097, null], [6097, 6620, null], [6620, 7361, null], [7361, 7706, null], [7706, 8229, null], [8229, 8862, null], [8862, 9579, null], [9579, 9960, null], [9960, 10988, null], [10988, 11494, null], [11494, 11622, null], [11622, 12231, null], [12231, 12807, null], [12807, 14315, null], [14315, 14889, null], [14889, 15481, null], [15481, 16620, null], [16620, 17219, null], [17219, 17819, null], [17819, 18882, null], [18882, 19506, null], [19506, 19818, null]], "google_gemma-3-12b-it_is_public_document": [[0, 191, true], [191, 731, null], [731, 1281, null], [1281, 2331, null], [2331, 2677, null], [2677, 2935, null], [2935, 3661, null], [3661, 4359, null], [4359, 5241, null], [5241, 6097, null], [6097, 6620, null], [6620, 7361, null], [7361, 7706, null], [7706, 8229, null], [8229, 8862, null], [8862, 9579, null], [9579, 9960, null], [9960, 10988, null], [10988, 11494, null], [11494, 11622, null], [11622, 12231, null], [12231, 12807, null], [12807, 14315, null], [14315, 14889, null], [14889, 15481, null], [15481, 16620, null], [16620, 17219, null], [17219, 17819, null], [17819, 18882, null], [18882, 19506, null], [19506, 19818, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 19818, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 19818, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 19818, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 19818, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 19818, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 19818, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 19818, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 19818, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 19818, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 19818, null]], "pdf_page_numbers": [[0, 191, 1], [191, 731, 2], [731, 1281, 3], [1281, 2331, 4], [2331, 2677, 5], [2677, 2935, 6], [2935, 3661, 7], [3661, 4359, 8], [4359, 5241, 9], [5241, 6097, 10], [6097, 6620, 11], [6620, 7361, 12], [7361, 7706, 13], [7706, 8229, 14], [8229, 8862, 15], [8862, 9579, 16], [9579, 9960, 17], [9960, 10988, 18], [10988, 11494, 19], [11494, 11622, 20], [11622, 12231, 21], [12231, 12807, 22], [12807, 14315, 23], [14315, 14889, 24], [14889, 15481, 25], [15481, 16620, 26], [16620, 17219, 27], [17219, 17819, 28], [17819, 18882, 29], [18882, 19506, 30], [19506, 19818, 31]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 19818, 0.15079]]}
olmocr_science_pdfs
2024-11-25
2024-11-25
ec16522bab8f79f1943c24846c164986bf11f5df
D Web Development This book guides you through all aspects of web development with D and the vibe.d framework. Covering today's popular operating systems, this guide starts with the setup of your development system. From the first Hello World-style application, you will move on to building static web pages with templates. Next, you will add database access to your application, providing persistent storage for your data. Learning about the internals of vibe.d, you will be able to use low-level techniques such as raw TCP access. The vibe.d concepts can also be used for GUI clients, which is the next topic that you will learn. This comprehensive guide concludes with an overview of the most useful vibe.d extensions and where to find them. The concepts are always illustrated with source code, giving you an insight into how to apply them in your application. Who this book is written for Whether you are new to the world of D, or have already developed applications in D, or if you want to leverage the power of D for web development, then this book is ideal for you. Basic knowledge of core web technologies such as HTML5 is helpful but not required. What you will learn from this book - Create amazingly fast web applications with D - Use Diet templates to easily create a web user interface - Utilize the web framework for interactive applications with input validation and internationalization - Access a database to provide persistent storage for your application - Extend your application with a REST interface and access other applications via REST - Understand vibe.d’s fiber-based approach to asynchronous I/O and use it for the integration of existing components - Create GUI applications with vibe.d Foreword by Andrei Alexandrescu - Co-developer of the D programming language Kai Nacke In this package, you will find: - The author biography - A preview chapter from the book, Chapter 6 'Using the REST Interface' - A synopsis of the book’s content - More information on D Web Development Kai Nacke is a professional IT architect living in Düsseldorf, Germany. He holds a diploma in computer science from the University of Dortmund. His diploma thesis about universal hash functions was recognized as the best of the semester. He has been with IBM for more than 15 years, and has great experience in the development and architecture of business and enterprise applications. Fascinated by the first home computer, he learned to program a VIC-20 in BASIC. Later, he turned to Turbo PASCAL and Small C on CP/M. Experimenting with the source of Small C created his interest in compiler technology. Many computers, operating systems, and languages followed these first steps. Around 2005, he became interested in the D programming language and created the first fun applications in D. Missing a 64-bit D compiler for Windows, he started to contribute to the LLVM compiler framework and LDC, the LLVM-based D compiler. Soon, he became committer of both projects and is now the current maintainer of LDC. He is also a speaker at the Free and Open Source Software Developers' European Meeting (FOSDEM) and was one of the reviewers of *D Cookbook*, Packt Publishing. Preface In the cloud age, web technologies are more important than ever. The vibe.d framework enables you to use the D programming language for a wide range of web-related tasks. The D programming language allows elegant solutions for common problems, while native compilation produces fast binaries. The vibe.d framework takes advantage of these language features. Together with the innovative use of fibers, the applications that you build are scalable and have a very quick response time. This book will explain everything you need to know about the vibe.d framework in order to successfully build and run web applications. What this book covers Chapter 1, Getting Started with Your First Web Application, explains how to set up and use your development environment. At the end of this chapter, you will have already created your first web application. Chapter 2, Using Templates for Your Web Pages, covers the Diet template engine. You will learn all about templates—from creating simple static templates to using D code in templates. Chapter 3, Get Interactive – Forms and Flow Control, brings web forms to your application and introduces route matching. Chapter 4, Easy Forms with the Web Framework, discusses how to validate user input. Chapter 5, Accessing a Database, shows how to use a database in an application using a variety of SQL and NoSQL bases. Preface Chapter 6, Using the REST Interface, teaches you about REST services. You will learn how to provide and consume a generated REST service. You will also study how to interface with an existing REST service. Chapter 7, The vibe.d Internals, introduces you to the fiber-based pseudo-blocking programming model that is the base for vibe.d. Chapter 8, Using vibe.d with a GUI Client, applies the vibe.d programming model to a graphical UI application. Chapter 9, Power Your Application with vibe.d Extensions, shows you what other developers have already implemented with vibe.d and how to publish your application. Using the REST Interface Applications are usually built using components that can be distributed on the network. The protocol that is used to communicate with remote components should be fast but simple to use. Representational State Transfer (REST) is a software architecture style based on the principles of HTTP—the protocol of the World Wide Web (WWW). Combined with simple data representation, REST is a popular way to access remote components or services. In this chapter, we will cover the following topics: - What is REST and how it uses JSON - How to expose an interface via REST - How to access a component remotely via REST - How to tailor the URL path and parameter passing Defining the principles of the World Wide Web As soon as computers were networked, people created binary protocols to execute code on a remote computer. The disadvantage of these Remote Procedure Call (RPC) protocols is the system dependency. Due to the binary nature, it is not easy to get a remote procedure call right: the size of data types, endianness, and alignment may be different on the target machine. With the success of the WWW, the idea of services appeared. A service provides some functionality, for example, retrieving the stock price at NASDAQ in real time. Simple Object Access Protocol (SOAP) was created. SOAP is based on XML and, therefore, enables structured data exchange in heterogeneous networks. Web Service Description Language (WSDL) was created to describe the services, again in XML. The combination of SOAP and WSDL is used to look up services and generate language bindings for them. This works very well, but there are drawbacks. SOAP is designed to be independent of the transport layer. HTTP is often used but other protocols, including e-mail, are possible. Due to this, SOAP contains certain features that are also available with HTTP. Instead of encrypting the SOAP message, you can use an encrypted HTTP connection. Another drawback is that you lose flexibility because most tools generate code from the service description and cannot handle additions to the service description without rerunning the code generator. Another approach is to utilize the success factors of the WWW. Uniform Resource Locator (URL) already describes a resource in a unique way. The HTTP method is an action on this resource: GET can be interpreted to retrieve data while POST creates some data, PUT updates the data, and DELETE deletes it. Combine this with a data representation such as JSON or XML and you have a simple service defined. REST is a software architecture based on this approach. Due to this, you will not find a REST standard. A software architecture is called REST if it adheres to the following constraints: - There is a uniform interface between the client and server. This can be the HTTP communication described previously - The communication is stateless - The client can cache responses - The system is layered, for example, a client does not know if it is directly connected to a server or through a proxy If a system fulfills these constraints, it is called RESTful. From the point of view of the system architecture, it is not an easy decision between SOAP/WSDL and REST because of the many different details. However, vibe.d currently supports REST only, which has been used in this chapter. **Serializing D to JSON and back** With the RESTful approach, the client and server exchange messages using the HTTP protocol. Of the many possible data formats, JavaScript Object Notation (JSON) is used. Originally, JSON was based on a subset of JavaScript. It has basic data types for numbers, strings, and Booleans. Like JavaScript, it uses two different structures to create complex data: - A collection of key/value pairs called an object in JSON. This is like an associative array in D and can be used to represent objects, maps, and so on. The key/value pairs are surrounded by { and }. • An ordered list of values called an array in JSON. The values are surrounded by [ and ]. The format is written in JavaScript. Once properly formatted, this is easily readable. A list of notes could look as follows: ```json [ { "id":1, "topic":"Topic 1", "content":"Content 1" }, { "id":2, "topic":"Topic 2", "content":"Content 2" } ] ``` A single note is the key/value collection in { }. The list consists of the enumerated notes in [ ]. It is possible to construct arbitrarily complex data representations with this approach. JSON is human readable. This is a big advantage while debugging, but the text representation is less compact and always requires the receiver to parse the message. A binary representation called Binary JSON (BSON) was developed to address these issues. BSON is supported by vibe.d as well. However, it is not used for REST but for the MongoDB protocol. D types are serialized to JSON in a straightforward way. D basic types are mapped to the corresponding basic JSON type. D arrays are mapped to JSON arrays and D struct types, class types, and associative arrays are mapped to JSON objects. A Json struct (declared in the vibe.data.json module) is used to hold a single JSON value. In order to serialize a note, you can write the following: ```d Note note = { 1, "Topic 1", "Content 1" }; auto json = serializeToJson(note); auto jsonString = json.toString(); ``` The serializeToJsonString() function creates a string in one call. The serializeToPrettyJson() function creates a JSON string with white space and new lines are added for better readability. To deserialize a JSON string, you can type the following: ```d auto json = parseJsonString(`{"id":1,"topic":"t1","content":"c1"}`); auto note = deserializeJson!Note(json); You can change the serialization, too. You need to implement only one of the following function pairs in struct or class. The first one is as follows: ```cpp Json toJson() const; static T fromJson(Json src); ``` Here is the second one: ```cpp string toString() const; static T fromString(string src); ``` One use case is if you want to map an enumeration value to the string literal instead of the integer value. Let’s suppose that you have the following enumeration: ```cpp enum Color { Red, Green, Blue } ``` The standard serialization maps `Color.Red` to 0, `Color.Green` to 1, and `Color.Blue` to 2. The following code maps the values to `Red`, `Green`, and `Blue` instead: ```cpp struct ColorHolder { import std.conv: to; Color color; const Json toJson() { return Json(color.to!string()); } static ColorHolder fromJson(Json src) { return ColorHolder(src.deserializeJson!string().to!Color()); } } ``` ### Creating and using a REST service The `NoteStore` class is used to persist and retrieve notes. Because other applications may require this functionality, too, you want to provide it as a service. Starting with the implementation based on Redis from *Chapter 5, Accessing a Database*, you can extract the following interface and save it as `notestore.d`: ```cpp module notestore; struct Note { ``` The only change here is that `addNote()` cannot have a `ref Note` parameter. The reason is that the caller of the method lives in a different process that is possible on a different computer. Therefore, the `Note` struct of the caller cannot be changed. The server and client both require this interface. You use a separate module for it. ### Providing a service Let's create the server side. The main difference from the previous implementations is that the implementation of the `NoteStore` interface is registered as a REST service via a call to the `registerRestInterface()` method: 1. Create a new project with `dub`: ``` $ dub init noteapp_server --type=vibe.d ``` 2. Copy the `notestore.d` module we just saved in the previous section to the `source` folder. 3. Implement the functionality in the `app.d` module in the `source` folder. The implementation is based on the Redis version from *Chapter 5, Accessing a Database*: ``` import vibe.d; import notestore; import std.conv : to; import std.format : format; shared static this() { auto redis = new RedisClient(); } auto noteStore = new NoteStoreImplementation(redis.getDatabase(0)); auto router = new URLRouter; ``` Using the REST Interface ``` router.registerRestInterface(noteStore); auto settings = new HTTPServerSettings; settings.port = 8081; settings.bindAddresses = [":1", "127.0.0.1"]; listenHTTP(settings, router); logInfo("Please open http://127.0.0.1:8081/ in your browser."); ``` ```cpp class NoteStoreImplementation : NoteStore { RedisDatabase db; this(RedisDatabase db) { this.db = db; } Note[] getNotes(string name) { import std.array : array; Note[] result = new Note[0]; auto prefix = format("user:%s", name); auto noteskey = format("%s:notes", prefix); auto ids = db.lrange!long(noteskey, 0, db.llen(noteskey)); foreach (id; ids) { auto key = format("%s:note:%d", prefix, id); auto data = array(db.hmget(key, "topic", "content")); if (!data.empty) result ~= Note(id, data[0], data[1]); } return result; } long addNote(string name, Note note) { auto prefix = format("user:%s", name); note.id = db.incr(format("%s:nextid", prefix)); ``` With the call to `registerRestInterface()`, vibe.d adds routes that correspond with the names of the methods in the `NoteStore` interface. It uses the same algorithm as the web framework described in Chapter 4, *Easy Forms with the Web Framework*. The details of the path generation are explained here. Start your Redis database, run this application, and open `http://127.0.0.1:8081/notes?name=yourid` in your browser. If the database still has the content from the previous chapters, then you can see a JSON representation of it in your browser. [Note the changed port number!] **Using a service** Using the previously created service is simple, as follows: 1. Create a copy of the note application based on the Redis database from Chapter 5, *Accessing a Database*. 2. Copy the `notestore.d` module we just saved in the previous section to the source folder. 3. In the `app.d` module, you need to make the following changes: - Add an import `notestore;` statement at the top of the file. - Delete the `NoteStore` class and the `Note` struct because they are now imported. - Delete the `noteStore` variable and the static `this()` constructor that initializes this variable. - Add the following code to use a `NoteStore` service via REST: ``` private __gshared RestInterfaceClient!NoteStore noteStore; shared static this() { noteStore = new RestInterfaceClient!NoteStore("http://127.0.0.1:8081/"); } ``` ``` Instantiating the `RestInterfaceClient` class generates a proxy class that forwards all the method calls to the remote service at http://127.0.0.1:8081. To test your new application, you need to start the Redis database, server application from the previous section, and this client application. **Tailoring the generated REST API** REST is really a tool for service integration. To match the requirements of an existing service, you need control of several parameters such as the path, HTTP method, or header parameters. **Changing the generated path** As in the case of a web application, the URL path and HTTP method is derived from the function to be called. A `@property` method uses the HTTP `GET` method to read the property and `PUT` to write the property. The HTTP method of all the other methods is derived from the prefix of the method name: <table> <thead> <tr> <th>Prefix</th> <th>HTTP method</th> </tr> </thead> <tbody> <tr> <td>get</td> <td>GET</td> </tr> <tr> <td>query</td> <td>GET</td> </tr> <tr> <td>set</td> <td>PUT</td> </tr> <tr> <td>put</td> <td>PUT</td> </tr> <tr> <td>update</td> <td>PATCH</td> </tr> <tr> <td>patch</td> <td>PATCH</td> </tr> <tr> <td>add</td> <td>POST</td> </tr> <tr> <td>create</td> <td>POST</td> </tr> <tr> <td>post</td> <td>POST</td> </tr> <tr> <td>remove</td> <td>DELETE</td> </tr> <tr> <td>erase</td> <td>DELETE</td> </tr> <tr> <td>delete</td> <td>DELETE</td> </tr> </tbody> </table> The default HTTP `POST` method is used if the method is neither an `@property` method nor a method that can be derived from the preceding table. You can set the HTTP method with the `@method` annotation: ```java @method(HTTPMethod.GET) Note retrieveNote(); ``` This overrides the default POST method with GET. The URL path is created from the method name. First, the prefix, according to the preceding table, is removed. Then, the remaining string is mapped using the chosen naming scheme. The default naming scheme is MethodStyle.lowerUnderscored: an underscore is inserted in front of every upper character and then all the characters are made lowercase. For example, the getAllMyData() method name is mapped to all_my_data. The naming scheme is an optional parameter of the registerRestInterface() method. Just pass a different value if you want a different naming scheme. The following are the possible values: <table> <thead> <tr> <th>Name</th> <th>Example</th> </tr> </thead> <tbody> <tr> <td>camelCase</td> <td>allMyData</td> </tr> <tr> <td>lowercase</td> <td>allmydata</td> </tr> <tr> <td>lowerUnderscored</td> <td>all_my_data</td> </tr> <tr> <td>PascalCase</td> <td>AllMyData</td> </tr> <tr> <td>unaltered</td> <td>getAllMyData</td> </tr> <tr> <td>uppercase</td> <td>ALLMYDATA</td> </tr> <tr> <td>upperUnderscored</td> <td>ALL_MY_DATA</td> </tr> </tbody> </table> You can override the name with the @path attribute. It is also possible to specify a relative path with @path: ```java @path("note/all") Note[] getAllNotes(); ``` The getAllNotes() method is now called with GET /note/all instead of GET /all_notes. A common URL prefix can be set with the @path annotation as follows: ```java @path("notestore") interface NoteStore { long addNote(string name, Note note); } ``` The addNote() method is now called with POST /notestore/note instead of POST /note. As an alternative, you can use @rootPathFromName. Then the URL prefix is derived from the interface name. This is a shorthand for @path(""). Using the REST Interface If the first parameter of a method is named \texttt{id}, then this parameter is mapped to the \texttt{void putData(string id, string data);} path using the \texttt{/:id/data} path. This is really a legacy mechanism but you must be aware of it in order to avoid surprises. There is also a more generalized approach. If a parameter name starts with an underscore, then this parameter is not serialized. Instead, it is available as a placeholder and can be used for path generation. Let's take a look at the following declaration: \begin{verbatim} @method (HTTMethod.GET) @path(":_name") void existsDatabase(string _name) \end{verbatim} This results in \texttt{GET /notestore} if the method is called with \texttt{_name} set to \texttt{notestore}. This flexibility to change the generated path is useful if you want to access an existing service. Passing parameters If a method of a REST interface is called, the parameters are passed as a query string if the HTTP \texttt{GET} or \texttt{HEAD} methods are used. Otherwise, they are serialized to JSON and transmitted in the request body. This behavior can be changed with the following annotations: - With \texttt{@headerParam}, the parameter is passed in the HTTP header. This can be used to add new elements to the header, for example, an \texttt{If-Match} header: \begin{verbatim} @headerParam("rev", "If-Match") void postData(string rev, string data) \end{verbatim} - With \texttt{@queryParam}, the parameter is passed in the query string. In the example, the value of the query parameter is appended as \texttt{?param=value of parameter query} to the request URL: \begin{verbatim} @queryParam("query", "param") void postData(string query, string otherdata) \end{verbatim} - With \texttt{@bodyParam}, the parameter becomes part of the JSON object transmitted in the request body. A limitation here is that serialization in the JSON object is not customizable. This can be used to create request bodies if the HTTP \texttt{GET} method is used: \begin{verbatim} @bodyParam("data", "content") void getData(string data) \end{verbatim} Accessing CouchDB The NoteStore service and NoteApp client from the previous sections were written in D. Therefore, there was no problem in using the service. However, the main idea of REST is to be independent of the service implementation. This is best shown by using a different service. CouchDB is another document-based database. It is written in the Erlang programming language and offers a REST interface that you can use to implement NoteStore. Installing CouchDB The website of CouchDB is http://couchdb.apache.org/. Here, you can find detailed installation instructions and precompiled binaries for OS X and Windows. Building from the source requires the Erlang programming language. For a quick start, you can use the version of your distribution: - On Ubuntu/Debian, type the following to install CouchDB: $ sudo apt-get install couchdb - On Fedora 21 or earlier, you can install CouchDB with the following: $ sudo yum install couchdb - On Fedora 22, you type as follows: $ sudo dnf install couchdb - On OS X, the Homebrew package manager can be used to install CouchDB: $ brew install couchdb After the installation, you can start the CouchDB server with sudo /etc/init.d/couchdb. On OS X, you can start the CouchDB server with launchctl load /usr/local/Cellar/couchdb/1.6.1_3/homebrew.mxcl.couchdb.plist. Testing the REST interface CouchDB listens on port 5984 for the incoming HTTP requests. The complete API is documented online at http://docs.couchdb.org/en/1.6.1/api/index.html. The vibe.d framework includes an HTTP client class that is used by the generated REST client. You need to make the decision if you want to use RestInterfaceClient or if you have to create your own access class using the HTTP client. If you scan through the online documentation of CouchDB, then you can note the following deficiencies of RestInterfaceClient: - You have no access to the HTTP status code for successful requests. If the request fails, then the HTTP status code is available in RestException thrown by RestInterfaceClient. - RestInterfaceClient requires a non-empty response body. However, CouchDB provides you with some check APIs that only return an HTTP status code and empty body. For a full-features interface to CouchDB, these restrictions may not be acceptable. However, to implement NoteStore, only some API calls are required. The decision is to go with RestInterfaceClient because it reduces the effort to implement the required functionality. To develop the interface class, it is helpful to use a small test application. Create a new project with the following: ``` $ dub init couchdb --type=vibe.d ``` Then replace VibeDefaultMain with VibeCustomMain in the dub.sdl file. Now you can use a main() method. Another tool that you can use is the logging infrastructure. Every example application outputs a short message using logInfo(). The framework itself uses different logging levels to output diagnostic messages. The default is to output only informational messages, warnings, and errors. This can be changed with the setLogLevel() method. Setting the level to LogLevel.verbose2 outputs the request URLs and the request and response bodies. Let's try to get some information about CouchDB and create a database. A GET request to the base URL returns information about CouchDB. A GET request with a single path element returns information about the database with the name of the path element or status code 404 if the database does not exist. A PUT request with a single path element creates the database or returns a status code 412 if the database already exists. Remember that RestInterfaceClient throws RestException if the HTTP status code does not indicate a successful execution! With this API information, you can write your first CouchDB client that you can put in the `app.d` module of the previously created project: ```d import vibe.d; interface CouchDB { Json get(); @method(HTTPMethod.GET) @path("/:db") Json existsDB(string _db); @method(HTTPMethod.PUT) @path("/:db") Json createDB(string _db); } void main() { // Uncomment to see the requests // setLogLevel(LogLevel.verbose2); auto couchdb = new RestInterfaceClient!CouchDB("http://127.0.0.1:5984/"); auto ver = couchdb.get(); logInfo("CouchDB: %s", ver["couchdb"].to!string); logInfo("Version: %s", ver["version"].to!string); logInfo("Vendor-Version: %s", ver["vendor"]["version"].to!string); logInfo("Vendor-Name: %s", ver["vendor"]["name"].to!string); logInfo("UUID: %s", ver["uuid"].to!string); try { couchdb.existsDB("notestore"); logInfo("Database exists"); } catch (RestException e) { logInfo("Database does not exist (HTTP status code %d)", e.status); couchdb.createDB("notestore"); } } The CouchDB interface uses the JSON structure as the return type. It contains the parsed JSON string. You need to use this if the structure of the JSON string changes dynamically and cannot be mapped to a D structure. In this case, it is simply saved to define a D structure for the deserialization. The get() method does not have a good name; getWelcome() would be better. The point here is that according to the rules, the get prefix is stripped from the method name, which results in an empty name. This results in a GET request to the base URL. There is no other way to specify this. The @path("/") or @path("") annotations are not allowed. Implementing the NoteStore service Encouraged by the success of the sample application, you can now implement the NoteStore class with CouchDB as a persistent store. The CouchDB API for documents is very similar to that for the CouchDB database. The first path element is again the database and the second path element is the document name. As a special feature, CouchDB uses optimistic locking. Each document has a revision. If you want to update a document, you have to specify the revision of the document as well. If the current revision of the document in the database does not match the revision that you have provided, then somebody else has modified the document, your update conflicts with the current state of the database and this is indicated by the HTTP status code 409 (HTTPStatus.conflict). In this case, you have to retry your update. As this is a potentially infinite process, you have to use a loop. Together, this leads to the following implementation of the NoteStore class. At first, you import the required modules and define the CouchDB interface with the needed database methods. This interface makes use of many of the annotations introduced earlier in this chapter: ``` import vibe.d; import notestore; interface CouchDB { Json get(); @method(HTTPMethod.GET) @path(":name") Json existsDB(string _name); @method(HTTPMethod.PUT) @path(":\db") ``` Json createDB(string _db); @method(HTTPMethod.PUT) @path("/:db/:docid") @headerParam("rev", "If-Match") void updateDoc(string _db, string _docid, string rev, Json doc); @method(HTTPMethod.PUT) @path("/:db/:docid") void createDoc(string _db, string _docid, Json doc); @method(HTTPMethod.DELETE) @path("/:db/:docid") @headerParam("rev", "If-Match") void deleteDoc(string _db, string _docid, string rev); @method(HTTPMethod.GET) @path("/:db/:docid") Json retrieveDoc(string _db, string _docid, bool latest = false); Next, you define the static this() constructor. A REST client for CouchDB is instantiated. This CouchDB instance is used by the NoteStore implementation. The NoteStore instance is then exported as a REST interface: shared static this() { auto couchdb = new RestInterfaceClient!CouchDB("http://127.0.0.1:5984/"); auto noteStore = new NoteStoreImplementation(couchdb); auto router = new URLRouter; router.registerRestInterface(noteStore); auto settings = new HTTPServerSettings; settings.port = 8081; settings.bindAddresses = ["::1", "127.0.0.1"]; listenHTTP(settings, router); logInfo("Please open http://127.0.0.1:8081/ in your browser."); } Finally, you implement the NoteStore interface using CouchDB. The implementation is straightforward except for one detail. CouchDB uses optimistic locking. If you try to update a document and the version of the document does not match, then an exception is thrown. This happens if someone else has already updated the document. The solution is to retry the operation with the updated document. Another detail to notice is that the client is not responsible for providing the id of a new Note. Therefore, it is necessary to figure out which id to use: ```java class NoteStoreImplementation : NoteStore { RestInterfaceClient!CouchDB db; this(RestInterfaceClient!CouchDB db) { this.db = db; } Note[] getNotes(string name) { try { auto doc = db.retrieveDoc("notestore", name, true); return deserializeJson!(Note[])(doc["doc"]); } catch (RestException e) { if (e.status == HTTPStatus.notFound) return new Note[0]; throw e; } } long addNote(string name, Note note) { while (true) { try { try { auto doc = db.retrieveDoc("notestore", name, true); Note[] notes; if (doc["doc"].type() != Json.Type.undefined) notes = deserializeJson!(Note[])(doc["doc"]); } catch (RestException e) { if (e.status == HTTPStatus.concurrency) return e.code(); throw e; } } catch (RestException e) { if (e.status == HTTPStatus.notFound) return new Note[0]; throw e; } } } } else notes = new Note[0]; long id = 0; foreach (n; notes) id = max(id, n.id); note.id = id+1; notes ~= note; db.updateDoc("notestore", name, doc["_rev"].toString, serializeToJson(notes)); } catch (RestException e) { if (e.status != HTTPStatus.notFound) throw e; Note[] notes = new Note[1]; note.id = 1; notes[0] = note; db.createDoc("notestore", name, serializeToJson(notes)); } return note.id; } catch (RestException e) { if (e.status != HTTPStatus.conflict) throw e; } } } This implementation can be used as a replacement for the NoteStore service based on the Redis database from the Creating and using a REST service section. The structure of the application that you have now created is as follows: • The web application listens on port 8080 for requests from web browsers. It uses the Redis database to store usernames and their passwords. • The Redis database uses a proprietary protocol and listens on port 6379. • The NoteStore service provides persistence for notes. It provides a REST interface and listens on port 8081 for the incoming requests. • Finally, a note is stored in CouchDB. This is again an application that provides a REST interface and listens on port 5984. Using the REST Interface All these servers can be installed on different nodes on the Internet: this is a distributed application! This application adheres to the REST principle mentioned in the Defining the principles of the World Wide Web section, and it is a RESTful application! Summary In this chapter, RESTful systems were introduced. The HTTP protocol is used for lightweight remote access using JSON objects as the data format. You learned how to create and consume a REST service with vibe.d. You also learned how to tailor the REST request, which is very useful if you have to match an existing interface. For testing purposes, you created an application that used its own main() method. The difference between the main() method provided by vibe.d and your own main() method and the other internals of vibe.d are the topics of the next chapter. Where to buy this book You can buy D Web Development 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/9781785288890_Sample.pdf", "len_cl100k_base": 7796, "olmocr-version": "0.1.49", "pdf-total-pages": 24, "total-fallback-pages": 0, "total-input-tokens": 45782, "total-output-tokens": 8984, "length": "2e12", "weborganizer": {"__label__adult": 0.0003690719604492187, "__label__art_design": 0.00020551681518554688, "__label__crime_law": 0.0001785755157470703, "__label__education_jobs": 0.00042629241943359375, "__label__entertainment": 4.464387893676758e-05, "__label__fashion_beauty": 0.00010669231414794922, "__label__finance_business": 0.00012922286987304688, "__label__food_dining": 0.0003116130828857422, "__label__games": 0.00032520294189453125, "__label__hardware": 0.0003616809844970703, "__label__health": 0.00019884109497070312, "__label__history": 0.00010883808135986328, "__label__home_hobbies": 5.137920379638672e-05, "__label__industrial": 0.00016009807586669922, "__label__literature": 0.00017714500427246094, "__label__politics": 0.0001232624053955078, "__label__religion": 0.0002980232238769531, "__label__science_tech": 0.0007977485656738281, "__label__social_life": 6.377696990966797e-05, "__label__software": 0.004497528076171875, "__label__software_dev": 0.990234375, "__label__sports_fitness": 0.00018024444580078125, "__label__transportation": 0.00022745132446289065, "__label__travel": 0.00018584728240966797}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 33800, 0.00581]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 33800, 0.58141]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 33800, 0.82987]], "google_gemma-3-12b-it_contains_pii": [[0, 1884, false], [1884, 2087, null], [2087, 3259, null], [3259, 4630, null], [4630, 5253, null], [5253, 6758, null], [6758, 9184, null], [9184, 10965, null], [10965, 12332, null], [12332, 13584, null], [13584, 14712, null], [14712, 16187, null], [16187, 17674, null], [17674, 19318, null], [19318, 21437, null], [21437, 22951, null], [22951, 25175, null], [25175, 26306, null], [26306, 28343, null], [28343, 29544, null], [29544, 31444, null], [31444, 32697, null], [32697, 33556, null], [33556, 33800, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1884, true], [1884, 2087, null], [2087, 3259, null], [3259, 4630, null], [4630, 5253, null], [5253, 6758, null], [6758, 9184, null], [9184, 10965, null], [10965, 12332, null], [12332, 13584, null], [13584, 14712, null], [14712, 16187, null], [16187, 17674, null], [17674, 19318, null], [19318, 21437, null], [21437, 22951, null], [22951, 25175, null], [25175, 26306, null], [26306, 28343, null], [28343, 29544, null], [29544, 31444, null], [31444, 32697, null], [32697, 33556, null], [33556, 33800, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 33800, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 33800, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 33800, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 33800, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 33800, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 33800, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 33800, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 33800, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 33800, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, true], [5000, 33800, null]], "pdf_page_numbers": [[0, 1884, 1], [1884, 2087, 2], [2087, 3259, 3], [3259, 4630, 4], [4630, 5253, 5], [5253, 6758, 6], [6758, 9184, 7], [9184, 10965, 8], [10965, 12332, 9], [12332, 13584, 10], [13584, 14712, 11], [14712, 16187, 12], [16187, 17674, 13], [17674, 19318, 14], [19318, 21437, 15], [21437, 22951, 16], [22951, 25175, 17], [25175, 26306, 18], [26306, 28343, 19], [28343, 29544, 20], [29544, 31444, 21], [31444, 32697, 22], [32697, 33556, 23], [33556, 33800, 24]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 33800, 0.04752]]}
olmocr_science_pdfs
2024-11-25
2024-11-25
184b5708407091a4f21a490cfe2fa764de31a420
Linked USDL agreement: effectively sharing semantic service level agreements on the Web How to cite: For guidance on citations see FAQs. © 2015 IEEE Version: Accepted Manuscript Link(s) to article on publisher’s website: http://dx.doi.org/doi:10.1109/ICWS.2015.28 Copyright and Moral Rights for the articles on this site are retained by the individual authors and/or other copyright owners. For more information on Open Research Online’s data policy on reuse of materials please consult the policies page. Abstract—As the use of services available on the Web is becoming mainstream, contracts and legal aspects of the relationship between providers and consumers need to be formalized. However, current proposals to model service level agreements are mostly focused on technical aspects, do not explicitly provide semantics to agreement terms, and do not follow Web principles. These limitations prevent take-up, automatic processing, and effective sharing of agreements. Linked USDL Agreement is a Linked Data based semantic model to describe and share service agreements that extends Linked USDL, which offers a family of languages to describe various technical and business aspects of services. We followed a use case driven approach, evaluating the applicability of our proposal in a cloud computing scenario, and comparing its expressiveness with existing models. Finally, we show a concrete tool that helps to model and check the validity of agreements. Keywords-service level agreements; semantic modelling; service trading; cloud services I. INTRODUCTION Despite the importance of services in developed economies and the widespread adoption of world-wide electronic commerce over the Web, most service trading is still essentially carried out via traditional and, often, manual means [1]. Searching for services, understanding their characteristics, or customizing a contract with service level guarantee are all activities generally carried out manually. The vision towards a Web of services that would provide an economic fabric to complement existing brick and mortar services has led to the creation of conceptual models, and prototypes (see, e.g,Service [2], USDL [3], Linked USDL [1], and cloud computing management [4]). These contributions provide important building blocks in order to support the trading of services over the Web in an open, scalable, and automated manner. Recently, USDL and notably its latest evolution, Linked USDL, have emerged as versatile general purpose means for capturing formal service descriptions covering aspects such as participants, distribution channels, interactions, and resources. Linked USDL has been devised as an extensible and modular family of ontologies providing convenient means for supporting the modelling, sharing, and processing of service descriptions openly over the Web. Thus far, however, Linked USDL provides no coverage for capturing agreement contracts between the parties engaged in a service transaction. Among these agreements, most relevant are service-level agreements (SLA) which define the level of a service (e.g., service reliability and availability) and corresponding actions in case of non-compliance such as compensations and liability issues (an example of a traditional paper SLA contract can be found here). In this paper we present Linked USDL Agreement, an extension to the Linked USDL family of ontologies, which provides domain independent means for capturing SLAs. Our ontology provides the necessary means for capturing the semantics of those agreements in a way such that current heterogeneity issues within existing SLAs specifications are circumvented. At the same time, thanks to using Linked Data principles [5], Linked USDL Agreement constitutes a fundamental building block for the trading of services online, by empowering providers and customers alike to discover, interpret, reuse, and manage the SLAs involved in any service transaction. Compared to other alternatives [6], our proposal covers most of the SLA lifecycle activity, it natively embraces novel principles of the Web of Data as a means for sharing descriptions, and it is accompanied by tooling providing both validation and a reference implementation of essential SLAs analysis methods. This paper is structured as follows. Sec. II provides an overview of the related work in the field of SLAs and introduces Linked USDL. Then, Sec. III enumerates our requirements and describes a motivation scenario used to drive the design of our solution. Sec. IV thoroughly describes the Linked USDL Agreement module. Sec. V evaluates our proposal, while Sec. VI showcases the implemented tooling. Finally, Sec. VII presents the conclusions and our future work. II. RELATED WORK USDL [3] is, to date, perhaps the most comprehensive approach for supporting the description of services for automated processing, with the aim of covering services 1http://www.slatemplate.com/ServiceLevelAgreementTemplate.pdf description, interfaces, pricing models, SLAs, and related legal issues. Despite its comprehensive support, USDL underestimated the need for such a model to be widely open, highly flexible and extensible, and yet simple in nature [1]. To cater for these limitations Linked USDL set out to provide an all-encompassing model for describing services, inspired by USDL but following a simpler, more extensible, open and Web-centric solution [1]. Linked USDL is the latest evolution of USDL building upon the results and experience gained with USDL combined with prior research on Semantic Web Services, business ontologies, and Linked Data to better promote trading at Web scale [1]. Linked USDL is a family of Web vocabularies predicated upon two fundamental principles: i) the adoption of Linked Data [5] for representing and exposing the descriptions of services and related relevant entities, e.g., the companies involved; and ii) the use of formal ontology representation languages, albeit lightweight to retain scalability, as a means to capture the semantics of services and related entities. Linked USDL Core extends widely used vocabularies, such as GoodRelations [7], with the fundamental means for representing services, offerings, the involvement of business entities, as well as the communication channels allowing business entities to trade and deliver services. While Linked USDL Core provides essential descriptive capabilities for managing services, given the wide range of aspects that are relevant to service trading, it enables the creation of extensions allowing users to increase the capabilities of the model as need arises. The management of SLAs is one of those aspects for which a specific extension is necessary. Researchers have faced the need for such an extension and have done preliminary work towards transforming Linked USDL Business Policies to WS-Agreement [1]. This transformation is based on a subset of the general WS-Agreement model extended with ad-hoc constructors which does not, however, cover the compensation elements introduced in Linked USDL Agreement. Marquezan et al. [9] also extend Linked USDL with a Transport and Logistics SLA Vocabulary. Unlike our proposal, this extension is domain-specific, and is therefore essentially targeted at modelling transport and logistics SLAs. Furthermore, it does not support expressing common characteristics of many SLAs such as penalties. Both proposals highlight nonetheless the clear need for a domain-independent SLA extension to Linked USDL. Outside USDL, several languages or models to specify SLAs have also been defined in the literature (cf. a comparative analysis in [6]); amongst them, WSLA [10] and WS-Agreement [11], introduced in 2001 and 2005 by IBM and the Global Grid Forum, respectively, represent the most prominent approaches within industry. Specifically, the latter, which was an evolution of the former, was developed as a specification framework that provides extensibility mechanisms to create fully-fledged SLA languages (cf. [12]). Despite the variety of approaches, most are predicated upon the existence of an underlying WSDL description which, with the advent of Web APIs, is often nonexistent. Furthermore, those approaches are essentially focussed on software based services which, although important, only represent a minimal share of the services market leaving many other service activities (e.g., insurance, eLearning, etc) with a poor coverage and support (cf. Sec. III-A). III. REQUIREMENTS AND USE CASE We have identified a set of requirements that are reflected in a motivating scenario in the cloud computing services domain, following a use case driven approach and using competency questions obtained from the scenario analysis. A. Requirements on Modelling Service Level Agreements Recent technological development in the field of services, e.g., cloud services and Web APIs, have substantially changed the face of computational services and, hence, their SLAs. Thus, there is the need to revisit the field of SLAs to determine if specifications still fulfill current requirements, which are enumerated in the following. 1) Shared Meaning of Content: Effective trading requires service providers and customers to speak the same “language”. Descriptions need therefore be based on an agreed upon format or schema (shared meaning of schema), and be expressed in mutually understandable terms and concepts (shared meaning of content). Previous SLA languages, such as WSLA and WS-Agreement, only address the first requirement. Linked Data on the other hand was purposely proposed to cover the publication, discovery, and interpretation of both schemas and content in a machine understandable form over the Web. For example, the vocabularies itil: {processes, roles, glossary} organise more than 600 terms related to IT services, which can be used to unambiguously share the semantics of contracts’ content. Sec. IV explains how Linked Data can be used by SLA specifications. 2) Open, Web-based Solution: To promote take-up and effectively share and process SLA descriptions online, the technological approach should be open to anybody to publish and exploit such descriptions, but also open to extensions to address unanticipated needs and scenarios. Our approach, as opposed to earlier proposals, embraces Web principles and technologies to provide a highly interoperable and scalable solution. Sec. V compares our solution to other SLA approaches. 3) SLA Lifecycle Automation: The negotiation and creation of SLAs is a key activity in the SLA lifecycle. Other activities include validity checking, conformance and monitoring, which seek to detect contract conflicts and breaches. Manually performing these activities is an expensive and error-prone process. To carry them out efficiently, it is necessary to feed SLAs specifications into automated software applications that can validate SLAs and find violations. Sec. VI demonstrates how this automation can be achieved. 2http://w3id.org/itil/\{processes, roles, glossary\} B. Cloud Computing Services Use Case The Cloud computing paradigm has emerged as a cost-effective and efficient form of on-demand provisioning of computing services. Businesses do not need to host a large number of resources to cope with their computing requirements, but can dynamically use external services that provide them, lowering operating and maintenance costs, as well as supporting a high scalability [13]. Cloud computing architectures are usually divided into four layers: hardware, infrastructure, platform and application layers. For each layer, several vendors provide related services depending on the users’ needs. For instance, the infrastructure layer can be offered as a service, the so-called Infrastructure as a Service (IaaS). These services offer infrastructural resources such as servers and virtual machines, including pre-loaded images or customizable ones. Some examples of IaaS providers are Amazon EC2\(^1\), Microsoft Azure\(^2\), and Google Cloud Platform\(^3\). In this scenario, where different businesses interact using service-oriented architectures to outsource computing needs, the formalisation of the SLAs that govern business relationship is of utmost importance. Most SLAs are described in natural language at providers’ websites. For example, the following table shows a typical SLA for Amazon EC2 service commitment\(^4\). This information was written to be processed by humans and not by software. <table> <thead> <tr> <th>Monthly Uptime %</th> <th>Service Credit %</th> </tr> </thead> <tbody> <tr> <td>Less than 99.95% but equal to or greater than 99.0%</td> <td>10%</td> </tr> <tr> <td>Less than 99.0%</td> <td>30%</td> </tr> </tbody> </table> Focusing on this particular use case and typical contents on other SLAs analysed, we can specify a series of competency questions to devise a semantic vocabulary [14] useful for the SLA lifecycle: Q1: Which functionality and quality levels does a service provide? Q2: Which service properties are guaranteed to have certain values? Q3: Which compensation is obtained if the guaranteed value of a property is not provided? Q4: Who is responsible for enforcing the guaranteed service level values? Q5: Who is responsible for monitoring and computing the guaranteed values? Q6: What is the assessment period during which a guarantee is provided? Q7: How are service property values computed? The design of our semantic model is driven by its ability to effectively answer these competency questions. In addition, an agreement model for services has to be designed for its exploitation on the Web, so that the associated SLA documents should be easily accessible and processable. Consequently, we impose additional requirements concerning scalability, ease of publication, use of existing standards and recommendations, and informed by major efforts on SLA specification frameworks, such as WS–Agreement [11]. IV. MODELLING SERVICE AGREEMENTS Considering the identified requirements and driven by the competency questions discussed previously, we designed an agreement module integrated with the Linked USDL family of vocabularies, following the design decisions and architecture presented below. The Linked USDL Agreement module is publicly available in GitHub\(^7\), including the use cases presented throughout this paper. To provide a shared meaning of SLAs, our model uses formal ontology representation languages to handle the structural and semantic heterogeneity of current SLAs. Therefore, as when designing Linked USDL [1], we have followed Linked Data principles [5], allowing our model to share and interlink data about service agreements on the Web. Linked Data promotes reuse of existing models and datasets, facilitating the design of our model and compatibility with existing tools. Our approach ensures that the identified competency questions were answered successfully, allowing the complete description of our cloud computing use case, as discussed in Sec. V. Fig. 1 presents our proposed agreement model. Essentially, an agreement consists of a set of terms that state the conditions that are guaranteed under the SLA, and which compensations are taken if a certain guarantee is violated. In the following we describe in detail the most important concepts of Linked USDL Agreements. **AgreementTerm** represents a single term of an SLA, which could possibly have a precondition that restricts the situation when the term is enforced. All instances of this concept that are related to a concrete service offering describe the complete SLA provided with that offering. In particular, we differentiate two subtypes of terms that can appear in an agreement, namely guarantees and compensations. **Guarantee** represents an agreement term of an SLA that specifically guarantees certain conditions over service properties. This concept is commonly called Service Level Objective (SLO) in other SLA models. An example of a Guarantee could capture that “Amazon guarantees that the monthly uptime of its EC2 service will be at least 99.95\%\(^7\).” **Compensation** is a specialisation of an agreement term that represents an alternative term that will be guaranteed in case that the original guarantee term (associated with the compensation via the hasCompensation property) is not fulfilled, e.g. “a service credit of 10\% will be entitled if the monthly uptime is less than 99.95\% but equal to or greater than 99.0\%”. Note that this example contains a precondition on the monthly uptime. --- \(^1\)http://aws.amazon.com/ec2 \(^2\)http://azure.microsoft.com \(^3\)https://cloud.google.com \(^4\)http://aws.amazon.com/ec2/sla/ \(^7\)https://github.com/linked-usdl/usdl-agreement **AgreementCondition** describes a particular constraint or axiom that can be checked within the terms of an SLA. These conditions usually refer to a concrete service property, constraining their possible values depending on the actual definition of the condition, e.g., “the monthly uptime will be at least 99.95%” part of the previous guarantee term example. Our vocabulary offers some pre-defined facilities for common axiom types, including concrete guaranteed values (as in the previous compensation example), maximums, minimums, and intervals. However, arbitrary axioms using domain-specific languages to describe conditions can be also included using `rdf:value`. **ServiceProperty** is a convenience class that allows an agreement condition to refer to either a qualitative (e.g., region availability) or a quantitative (e.g., monthly uptime percentage) service property, as defined in GoodRelations vocabulary [7]. **Metric** defines how to measure a particular service property. It is usually defined by a mathematical expression that needs to be computed in order to monitor a concrete property. For example, Amazon EC2 SLA describes that “Monthly Uptime Percentage is calculated by subtracting from 100% the percentage of minutes during the month in which Amazon EC2 (...) was in the state of Region Unavailable.” **EntityLiability** is an extension of the entity involvement concept in Linked USDL Core that enables capturing the liability role that an involved business entity has in a particular agreement term, i.e., its responsibility with respect to that term. For instance, the provider of a service can act as a guarantor of a particular guarantee, being responsible of the fulfillment of that guarantee, while the consumer can be considered to have a beneficiary role in a compensation since they will benefit from it. Linked USDL Agreement provides a simple SKOS\(^8\) taxonomy of liability roles, including the basic **Guarantor** and **Beneficiary** already discussed, but can be easily extended depending on the use case. Following this philosophy we extended the reference business roles SKOS scheme defined in Linked USDL Core module to support the identification of the business entities responsible for evaluating conditions and providing metrics, since these roles are usually defined in SLAs. Apart from the main concepts described previously, we rely on several external vocabularies following Linked Data principles. First and foremost, being an extension of Linked USDL, our model builds upon the main classes of Linked USDL Core. We show this relationship in Fig. 1, where a ServiceOffering is related --- \(^8\)http://www.w3.org/2004/02/skos/core to its corresponding agreement terms by the property hasAgreementTerm. Each guarantee term is itself linked to a particular Service included in the offering over which the conditions are guaranteed by means of guaranteedOver property. Indirectly, we also use GoodRelations vocabulary [7] through its relationship with Linked USDL Core module. GoodRelations defines concepts related to commerce, such as business entities, products and services. We use the qualitative and quantitative service properties from GoodRelations when defining agreement conditions. Thus, an agreement condition may refer to a property that is a subproperty of gr:quantitativeProductOrServiceProperty or gr:qualitativeProductOrServiceProperty. Correspondingly, the values used in the condition definition through the hasValue property can be instances of gr:QuantitativeValue or gr:QualitativeValue. The Time Ontology\(^9\) is also integrated to cover temporal properties relevant for the SLA, including the evaluation and measuring intervals of agreement conditions and metrics, respectively, as well as the validity period of SLA terms [15]. Regarding the metrics support for conditions and service properties, we do not restrict a particular vocabulary to be used, but we recommend the integration with QUDT\(^{10}\) for describing units of measurement, or SPIN\(^{11}\) for defining the metric expressions, for instance. In addition to those vocabularies, we also make use of Dublin Core\(^{12}\), VANN\(^{13}\) and Friend of a Friend (FOAF)\(^{14}\) to cover general purpose metadata about the vocabulary itself, such as creators, modification dates, and preferred namespace prefixes and URIs. Finally, as already discussed, we use Simple Knowledge Organization System (SKOS) vocabulary for creating the classification scheme for liability roles, similarly as other role schemes defined in Linked USDL Core module. V. EVALUATION In this section, we evaluate how well Linked USDL Agreement fulfills the requirements enumerated in Sec. III, validating our model using the introduced cloud computing scenario and additional real-world use cases. Furthermore, we discuss the SLA description coverage considering the framework proposed in [6]. A. Cloud Computing Service Agreement The motivating example described in Sec. III-B served also a validation purpose in our work. Thus, we tested the suitability of our vocabulary to completely describe the SLA of the cloud computing provider Amazon EC2\(^{15}\). We especially focus on verifying the extent to which Linked USDL Agreement vocabulary can describe the terms expressed in the Amazon EC2 SLA, while being able to answer the listed competency questions. The Amazon EC2 SLA contains a series of definitions regarding the monthly uptime percentage and the extent to which it is guaranteed for all the infrastructure provided by Amazon EC2. If the SLA is violated, Amazon honours a service credit to the user. First, our vocabulary is able to associate the guarantees of an SLA to the description of the service offering which is governing, which in turn is associated with a particular service description that describes its functionality, answering Q1. The definitions included in the SLA refer to properties of the Amazon EC2 service that are guaranteed. Therefore, we modelled them using the properties definition from GoodRelations, as described in Sec. IV. Q2 can thus be answered by querying the model about the properties that are referenced, using for example SPARQL as shown in Listing 1. ``` Listing 1. Obtaining service properties relevant to the agreement 1 SELECT ?prop WHERE { 2 :amazonEC2ServiceOffering usdl-agreement:guarantees ?term ; 3 usdl-agreement:hasAgreementTerm ?term , 4 ?term usdl-agreement:guarantees ?conditions ; 5 ?conditions usdl-agreement:refersTo ?prop . } ``` The main part of the agreement states the guaranteed value of the monthly uptime percentage. Listing 2 shows how we modelled that service commitment. First, the guarantee term refers to the concrete service included in the original service offering over which the guarantee is applied, as well as the liability of the different entities involved in the agreement (Amazon as a provider and an abstract customer in our example). This information about the different roles of the entities provides the answers to both Q4 and Q5. ``` Listing 2. Agreement terms 1 :ec2ServiceCommitment a usdl-agreement:Guarantee ; 2 usdl-agreement:guaranteedOver :ec2M1LargeInstanceType ; 3 usdl-agreement:hasEntityLiability :liab_customer , :liab_Amazon ; 4 usdl-agreement:guarantees :monthlyUptimePercentage ; 5 usdl-agreement:hasEvaluationInterval :monthlyInterval ; 6 usdl-agreement:hasValue ( a gr:QuantitativeValueFloat ; 7 gr:hasValueFloat "99.95" ^xsd:float ) ; 8 usdl-agreement:hasValue :ec2ServiceCredit30 , :ec2ServiceCredit10 ; 9 usdl-agreement:hasValidityInterval :monthlyInterval . ``` Second, the guaranteed condition is defined as the minimum value that the monthlyUptimePercentage property has to provide. We also include in our description the definition of the metrics used to compute that property, relying on external vocabularies and tools to properly answer Q7. Third, the time intervals where values are guaranteed or need to be monitored by involved parties are described using intervals modelled with the Time ontology, covering Q6. Finally, compensation terms model alternative conditions that will take into place in the case that the guaranteed values are not fulfilled (Q3). In the particular case of Amazon EC2 compensations, the SLA defines two compensation levels depending on the final value of the monthly uptime percentage, as shown in Sec. III-B. We model them adding preconditions to the compensation terms. B. Software as a Service Contracts To make our evaluation comprehensive, we have also analyzed software as a service agreement contracts that are commonly used in the industry to establish SLAs. These paper-based contracts are often prepared by lawyers and require a case-by-case customization. The following illustrative and representative extract of a service agreement contract\textsuperscript{16} describes service level availability. Contracts are often composed of two parts: 1) the agreement and 2) the exhibits. The agreement describes the general terms of the contract using natural language with no underlying structure. On the other hand, exhibits provide a structured description, still in natural language, about the specific terms of a contract\textsuperscript{17}. The part that we have successfully modeled was “Exhibit A” of the contract under analysis. Nonetheless we have identified that further research and solutions are still required to model the part of the contract agreement due to the complexity of the language used as shown in the following text box. ![Text Box] \textsuperscript{16}Obtained from http://assets-production.govstore.service.gov.uk/G5/1756/5G/1756.003/QD1/MasterSoftwareasServiceAgreement2014.docx \textsuperscript{17}A partial description in Linked USDL Agreement of the use case can be found at https://github.com/linked-usdl/usdl-agreement/tree/master/UseCases/SaaS Alternatively, the agreement part of a contract needs to be simplified and also needs to be written using structured descriptions, as done with the exhibits, to enable an automated processing. This approach is being followed by major cloud computing providers, such as Amazon, Google, and Microsoft. C. Linked USDL Agreement coverage evaluation Finally, we evaluate the coverage of Linked USDL Agreement against the comparison framework proposed in [6]. This comparison framework comprehends 22 criteria grouped by the SLA lifecycle activity in which they are more relevant. These criteria were used to compare 14 SLA and Service Contract Languages. Table I summarises the criteria and shows the evaluation results of Linked USDL Agreement. It also depicts how many of the 9 SLA languages analysed fulfill each criteria. Linked USDL Agreement fulfills 13 out of the 22 criteria. The formalism used to define Linked USDL Agreement are ontologies. Both functional and quality terms can be expressed in Linked USDL Agreement through Linked USDL Core’s ServiceOffering and through the Guarantee introduced by Linked USDL Agreement, respectively. The reusability of SLAs is native to the Linked USDL approach. Metric providers and metric schedule are modelled including the MetricProvider business role in an involved entity, and hasMeasuringInterval of Metric, respectively. The condition evaluator can be specified using the corresponding business role on the relevant involved entity. Qualifying conditions are expressed using the property hasPrecondition of AgreementTerm. The obliged party can be modelled for each AgreementTerm using liability roles via hasEntityLiability property. The assessment schedule of an SLO is specified with property hasEvaluationInterval. Validity periods are expressed by means of property hasValidityInterval for each AgreementTerm. Both penalties and rewards can be expressed at the level of SLOs using property hasCompensation of Guarantee. Finally, the validity period of the whole SLA can be expressed using the validThrough property of a ServiceOffering included in Linked USDL Core. Concerning the remaining criteria, the main reason they have been left outside of Linked USDL Agreement is because they are not shared by most real-world SLAs we have found in our analyses. Specifically, composability is not supported because most SLAs are not for composite services, or rather, they are expressed for the resulting composition which is exposed as a single service. The same applies to the ability to express alternative service levels since most SLAs define just one service level\textsuperscript{18}; the ability to express soft constraints since most SLOs are expressed as hard constraints; the two negotiation-related criteria since most SLAs are take-it-or-leave-it \textsuperscript{18}Note that different service levels can still be expressed in Linked USDL Agreement through different ServiceOfferings or by means of pre-conditions. Table I ![Image](image.png) <table> <thead> <tr> <th>Criteria</th> <th>Description</th> <th>Evaluation</th> <th>Proposals</th> </tr> </thead> <tbody> <tr> <td>Formalism</td> <td>The language’s formalism</td> <td>Ontol.</td> <td>Several</td> </tr> <tr> <td>Coverage</td> <td>The ability to express functional and quality terms</td> <td>[y,y]</td> <td>2 [y,y]</td> </tr> <tr> <td>Reusability</td> <td>The ability to reuse parts of the SLA</td> <td>yes</td> <td>7 yes, 2 part.</td> </tr> <tr> <td>Composability</td> <td>The ability to represent SLAs for composite services</td> <td>no</td> <td>1 good, 4 fair</td> </tr> <tr> <td>Metric definition</td> <td>The ability to define quality metrics</td> <td>no</td> <td>5</td> </tr> <tr> <td>Alternatives</td> <td>The ability to express alternative service levels</td> <td>no</td> <td>7 impl.</td> </tr> <tr> <td>Soft constraints</td> <td>The ability to express soft SLOs</td> <td>no</td> <td>2</td> </tr> <tr> <td>Matchmaking Metric</td> <td>Definition of how to compare SLAs</td> <td>no</td> <td>2</td> </tr> <tr> <td>Meta-Negotiation</td> <td>The ability to represent information about the negotiation process</td> <td>no</td> <td>1 good, 2 fair</td> </tr> <tr> <td>Negotiability</td> <td>The ability to define which parts of the SLA are negotiable</td> <td>no</td> <td>2</td> </tr> <tr> <td>Metric Provider</td> <td>The ability to define the party responsible for producing metric’s measurements</td> <td>yes</td> <td>4</td> </tr> <tr> <td>Metric Schedule</td> <td>The ability to define the measurement frequency of a metric</td> <td>yes</td> <td>4</td> </tr> <tr> <td>Condition Evaluator</td> <td>The ability to define the party responsible for SLO evaluation</td> <td>yes</td> <td>2</td> </tr> <tr> <td>Qualifying Condition</td> <td>The ability to define conditions that must hold in order to assess an SLO</td> <td>yes</td> <td>2</td> </tr> <tr> <td>Obliged</td> <td>The ability to express the party in charge of delivering what is guaranteed in an SLO</td> <td>yes</td> <td>7</td> </tr> <tr> <td>Assessment Schedule</td> <td>The ability to express the assessment frequency of an SLO</td> <td>yes</td> <td>3</td> </tr> <tr> <td>Validity Period</td> <td>The ability to express the time period in which the SLO is guaranteed</td> <td>yes</td> <td>4</td> </tr> <tr> <td>Recovery Actions</td> <td>The ability to express corrective actions to be carried out when an SLO is violated</td> <td>no</td> <td>4</td> </tr> <tr> <td>Penalties</td> <td>The ability to express penalties incurred when one party violates its guarantees</td> <td>SLO</td> <td>3 SLO, 2 SLO</td> </tr> <tr> <td>Rewards</td> <td>The ability to express rewards incurred when one party exceeds its guarantees</td> <td>SLO</td> <td>1 SLO, 2 SLO</td> </tr> <tr> <td>Settlement Actions</td> <td>The ability to express actions concerning the final SLA outcome</td> <td>no</td> <td>2</td> </tr> <tr> <td>SLA Validity Period</td> <td>The ability to express the period where an SLA is valid</td> <td>yes</td> <td>5</td> </tr> </tbody> </table> offers without any possible negotiation; and the ability to express recovery actions and settlement actions since only penalties are usually defined in SLAs. Furthermore, these criteria are also those that are fulfilled by less proposals with no more than 2 different proposals fulfilling each of them except for recovery actions, which are supported by 4 proposals. This reinforces our belief that they are only useful in a very limited set of scenarios. Nevertheless, due to the nature of our modelling approach, new extensions to Linked USDL Agreement can be seamlessly integrated in order to provide these advanced features in scenarios that require them. For instance, one might design a negotiation-related extension that extends the ServiceOffering with information about the negotiation process and the Guarantee with information about its negotiability. VI. TOOLING SUPPORT Writing an SLA in Linked USDL Agreement (like in any other formal language) can be a challenging task. Since it is manual, there is a risk of errors that, depending on the complexity of the SLA, can be very high. Additionally, as SLAs represent rights and responsibilities of the stakeholders that could lead to compensations, they include sensitive statements that should be carefully designed and modelled. Conflicts amongst the terms of the SLAs, such as inconsistencies, represent a major drawback that should be avoided to assure specifications that would not lead to misunderstandings or unexpected situations. To address this drawback, we provide a tool\(^9\) for the definition and consistency checking of SLAs. Fig. 2 shows our tool performing a validity check. The tool was developed within the context of the IDEAS framework that supports the creation of on-line environments for the usage and analysis of formal models by means of different language modules. The proposed Linked USDL Agreement tooling is based on an underlying analysis module that detects problems in SLA documents using constraint programming [12] by performing a validity check that includes detection of dead guarantees (in case a precondition can not be satisfied at any point) and inconsistent terms (when agreement conditions are contradictory). In addition to validity checking, the Linked USDL Agreement tool provides an analysis report answering the different competency questions presented in Sec. III by means of SPARQL queries. Validity check is based on an analysis of the constraints defined in agreement conditions. Specifically, to reuse the constraint programming based technique presented in [12], we developed a transformation from Linked USDL Agreement to a WS–Agreement template that directly maps those constraints as follows: 1) Linked USDL Agree- ment guarantee terms are transformed into WS–Agreement guarantee terms, in which its guarantees, preconditions and compensations are transformed into SLOs, qualifying conditions and penalties or rewards in business value lists, respectively; 2) Linked USDL Agreement service properties referred by agreement conditions are transformed into WS–Agreement service properties as variables; 3) the properties used by the services and included in the service offerings of Linked USDL Agreement are transformed into properties in the service description terms of WS–Agreement and the concrete values assigned to those properties in services are transformed into creation constraints for the service description terms. VII. CONCLUSIONS AND FUTURE WORK Since existing specifications for creating agreements for services, such as WS–Agreements, WSLA, and SLA*, were developed to capture the technical aspects of Web services, we developed Linked USDL Agreement, an extension to the Linked USDL service description family, to capture business aspects, compensations and time constraints, among others. The new specification is to be used to establish and share agreements between customers and providers who seek to automatically perform service trading over the Web. The evaluation of Linked USDL Agreement was two-fold. On the one hand, we evaluated its capabilities to model services such as EC2 made available by Amazon AWS. On the other hand, we showed how our proposal covers the SLA lifecycle compared to existing ones, focusing on actually used features in common SLAs. Furthermore, we discuss how the information captured by our model can be automatically used by tools to perform validity checking, for instance. Future work requires to build a proof-of-concept prototype to illustrate how a service marketplace could automatically provision services to consumers with regards to their requirements and preferences [16] coping with heterogeneity issues, as well as to establish contracting using Linked USDL Agreement, and to automatically detect service level objectives’ violations, which would be reported to customers and trigger compensation actions. ACKNOWLEDGMENTS Authors would like to thank Juan Luis de la Fuente for the development of the tooling. This work has been partially supported by the European Commission (FEDER), the Spanish and the Andalusian R&D&I programmes (grants P12-TIC-1867, TIN2012-32273, TIC-5906, IPT-2013-0890-3). REFERENCES
{"Source-Url": "http://oro.open.ac.uk/43411/1/Untitled.pdf", "len_cl100k_base": 7850, "olmocr-version": "0.1.53", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 27133, "total-output-tokens": 9371, "length": "2e12", "weborganizer": {"__label__adult": 0.0005283355712890625, "__label__art_design": 0.0006656646728515625, "__label__crime_law": 0.0015420913696289062, "__label__education_jobs": 0.00173187255859375, "__label__entertainment": 0.00021338462829589844, "__label__fashion_beauty": 0.0003132820129394531, "__label__finance_business": 0.0097198486328125, "__label__food_dining": 0.000514984130859375, "__label__games": 0.0009055137634277344, "__label__hardware": 0.0011358261108398438, "__label__health": 0.0008635520935058594, "__label__history": 0.0005846023559570312, "__label__home_hobbies": 0.0001671314239501953, "__label__industrial": 0.0007948875427246094, "__label__literature": 0.0011644363403320312, "__label__politics": 0.0009412765502929688, "__label__religion": 0.00049591064453125, "__label__science_tech": 0.2030029296875, "__label__social_life": 0.00024771690368652344, "__label__software": 0.072509765625, "__label__software_dev": 0.7001953125, "__label__sports_fitness": 0.0002722740173339844, "__label__transportation": 0.0012950897216796875, "__label__travel": 0.0003674030303955078}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 41452, 0.02288]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 41452, 0.27312]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 41452, 0.9078]], "google_gemma-3-12b-it_contains_pii": [[0, 796, false], [796, 5262, null], [5262, 11324, null], [11324, 16943, null], [16943, 19633, null], [19633, 24833, null], [24833, 29807, null], [29807, 35721, null], [35721, 41452, null]], "google_gemma-3-12b-it_is_public_document": [[0, 796, true], [796, 5262, null], [5262, 11324, null], [11324, 16943, null], [16943, 19633, null], [19633, 24833, null], [24833, 29807, null], [29807, 35721, null], [35721, 41452, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 41452, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 41452, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 41452, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 41452, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 41452, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 41452, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 41452, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 41452, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 41452, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 41452, null]], "pdf_page_numbers": [[0, 796, 1], [796, 5262, 2], [5262, 11324, 3], [11324, 16943, 4], [16943, 19633, 5], [19633, 24833, 6], [24833, 29807, 7], [29807, 35721, 8], [35721, 41452, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 41452, 0.16092]]}
olmocr_science_pdfs
2024-12-06
2024-12-06
04396c049d00bb8814f2c983ab7c319078c0ff2c
[REMOVED]
{"Source-Url": "http://www.ce.unipr.it/people/tomamic/files/2008-ap2pc.pdf", "len_cl100k_base": 5891, "olmocr-version": "0.1.53", "pdf-total-pages": 11, "total-fallback-pages": 0, "total-input-tokens": 23460, "total-output-tokens": 7157, "length": "2e12", "weborganizer": {"__label__adult": 0.0003268718719482422, "__label__art_design": 0.0004649162292480469, "__label__crime_law": 0.0005497932434082031, "__label__education_jobs": 0.000912189483642578, "__label__entertainment": 0.00016510486602783203, "__label__fashion_beauty": 0.0001646280288696289, "__label__finance_business": 0.000514984130859375, "__label__food_dining": 0.00035309791564941406, "__label__games": 0.0007815361022949219, "__label__hardware": 0.0010404586791992188, "__label__health": 0.0004606246948242187, "__label__history": 0.0004012584686279297, "__label__home_hobbies": 8.958578109741211e-05, "__label__industrial": 0.0004334449768066406, "__label__literature": 0.00042176246643066406, "__label__politics": 0.0003364086151123047, "__label__religion": 0.0004107952117919922, "__label__science_tech": 0.1378173828125, "__label__social_life": 0.00016820430755615234, "__label__software": 0.057220458984375, "__label__software_dev": 0.7958984375, "__label__sports_fitness": 0.0002655982971191406, "__label__transportation": 0.0005230903625488281, "__label__travel": 0.0002856254577636719}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 31944, 0.02735]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 31944, 0.21603]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 31944, 0.91431]], "google_gemma-3-12b-it_contains_pii": [[0, 2448, false], [2448, 4386, null], [4386, 7676, null], [7676, 10719, null], [10719, 13835, null], [13835, 16697, null], [16697, 19911, null], [19911, 23495, null], [23495, 26606, null], [26606, 29734, null], [29734, 31944, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2448, true], [2448, 4386, null], [4386, 7676, null], [7676, 10719, null], [10719, 13835, null], [13835, 16697, null], [16697, 19911, null], [19911, 23495, null], [23495, 26606, null], [26606, 29734, null], [29734, 31944, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 31944, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 31944, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 31944, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 31944, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 31944, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 31944, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 31944, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 31944, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 31944, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 31944, null]], "pdf_page_numbers": [[0, 2448, 1], [2448, 4386, 2], [4386, 7676, 3], [7676, 10719, 4], [10719, 13835, 5], [13835, 16697, 6], [16697, 19911, 7], [19911, 23495, 8], [23495, 26606, 9], [26606, 29734, 10], [29734, 31944, 11]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 31944, 0.0]]}
olmocr_science_pdfs
2024-12-06
2024-12-06
c9b7ed8bd657803584c4d3c5ecb6b89fac32e7c9
An Interactive Method to Discover a Petri Net Model of an Activity Benoît Mathern\textsuperscript{1,2}, Alain Mille\textsuperscript{1}, and Thierry Bellet\textsuperscript{2} \textsuperscript{1} Université de Lyon, CNRS Université Lyon 1, LIRIS, UMR5205, F-69621, France http://liris.cnrs.fr/ \textsuperscript{2} INRETS, LESCOT, 25 avenue François Mitterrand, 69675 Bron cedex, France http://www.inrets.fr/ Abstract. This paper focuses on interactive Knowledge Discovery processes in the context of understanding an activity from behavioural data. Data mining provides patterns experts have to interpret and synthesize as new knowledge. Discovering patterns is an analysis task while building new symbolic knowledge is a synthesis task. A previous trace based approach (Abstract) offered a first answer to support analysis. This paper goes one step forward in supporting the synthesis task. We modify an algorithm of automata discovery in order to involve the user in the mining process, exploiting his expert knowledge about the observed activity. We chose the $\alpha$-algorithm (Van Der Aalst et al.) developed for Petri nets discovery in a workflow management context. The modified algorithm is described and illustrated, showing how to use intermediate data to converge interactively to a satisfying automata. Finally, we discuss the use of this approach to contribute to a new knowledge mining process. Key words: Knowledge discovery, Petri nets, Interactive mining 1 Introduction 1.1 General Context of the Work: Man Machine Interactive Knowledge Discovery The general context of this work is what we could call “man machine interactive Knowledge Discovery” which can be considered as a special case of knowledge engineering approach. Actually, if the knowledge engineering approach finds its roots in the general question of knowledge acquisition, representation and maintenance in order to develop knowledge based systems (KBS)\textsuperscript{[7,12]}, its scope becomes larger and larger for supporting construction of ontologies in knowledge management context\textsuperscript{[8]} and in the semantic web context\textsuperscript{[14]}. A number of tools have been developed to face this problem of semantic integration of data, information and even people\textsuperscript{[17]}: methods and tools for sharing ontologies; algorithms, heuristics and machine learning for ontologies mapping; and, because of the lack of clearly identified experts, machine learning techniques to mine available data, texts and logs [18]. Choosing the corpus of data, texts or events to mine is an expert task. For example, the machine learning process has to be tuned to produce relevant ontologies which are checked by experts. A first issue is to get relevant data, texts and events among what is available in the environment and to prepare these sources to properly build ontologies. A second issue is to support the Knowledge Discovery process leading to create new knowledge about the domain. A third issue is to take into account what is discovered to guide new Knowledge Discovery. Beyond discovering relevant concepts for a process, it becomes increasingly important to discover the dynamics of these processes. Discovering knowledge by observing processes, through their behaviour and their productions, is not new and there is a strong tradition in the Human Computer Interactions research [19] to propose concrete methods for discovering explicit knowledge from various observation sources (computer events, video and audio records, annotations, data, texts, etc.). We can use the general notion of “interaction traces” for referring to such knowledge sources and we are specifically interested in exploiting traces of events for supporting Knowledge Discovery of the dynamics of processes. 1.2 Modeled Trace and Trace Based System Considering such interaction traces as “first class” computer objects, our research team developed the notions of modeled traces (M-Traces) and of trace based system (TBS) [13]. A modeled trace M-Trace is constituted of both the sequence of temporally situated observed elements (obsels) which constitutes the instantiated trace and of the model of this trace which gives the semantics of the observed elements and of the relations between them. A trace based system (TBS) is a framework managing such M-Traces and providing trace oriented services such as: collecting a M-Trace, computing sequences satisfying a pattern in a specific M-Trace, transforming a M-Trace into another one for abstraction purpose (filtering, merging, reformulating obsels), navigating through the transformation graph of a M-Trace... In the context of this paper, we assume these services are available and we take advantage of such a TBS which is embedded in the ABSTRACT software. In this framework, traces are represented in RDF3 and their models are managed with the Protégé tool4. Using such a TBS allows to prepare and transform sequences of events as M-Traces at the relevant level of abstraction with explicit semantics. The ABSTRACT framework [10] has been developed in order to support the Knowledge Discovery process in the context of driver behaviour analysis [9]. In this context, a huge quantity of data is collected during driving sequences, from numerous sensors, video capture, observer annotations... Then, the analyst uses the ABSTRACT interface to progressively transform traces in order to discover relevant patterns according to some hypothesis on the driver behaviour5. 3 http://www.w3.org/RDF/ 4 http://protege.stanford.edu/ 5 For details and ABSTRACT demonstration see http://liris.cnrs.fr/abstract/ 1.3 Towards an Interactive Knowledge Discovery Process Fayyad et al. [6] proposed a general process for discovering knowledge from data (see figure 1 on the following page). We propose a slightly different approach when data are collected from the observation of some process, using a Trace Based System that provides both services of preparation and transformation to support analysis. Furthermore, and following the general idea defended by R. Michalski [16] we propose to complete this Knowledge Discovery process by a computer supported synthesis step providing a formal knowledge representation (for simulation purpose for example). This proposition is sketched in figure 2 on the next page. These knowledge oriented approaches offer opportunities to provide feedback controls at each step with knowledge formal representations and easy interactions with analysts (experts) to understand results and to control the full Knowledge Discovery process. 1.4 AUTOMATA as a Support for Interpretation of the Dynamics of Processes The Abstract approach allows to consider the request to find a pattern as the signature of a new concept which can then be added to the ontology that describes activity traces. This is a first answer to the general issue of considering “knowledge mining” instead of “data mining” according to R. Michalski [16] since this process allows to enrich the formal representation of the activity. In order to go a step further we propose a process, AUTOMATA⁶, to synthesize the knowledge about the dynamics of the observed process, extending the Knowledge Discovery process by supporting the interpretation task (automata description) with the help of a trace mining process focusing on the available occurrences of patterns satisfying a particular request. In order to build such an assistance, we propose to modify algorithms able to synthesize automata from traces. In this paper, we focus on an algorithm developed by Aalst et al. [4] in the context of workflows management. These algorithms assume that the automata traces are complete which, of course, is not often the case when observing a real process. In order to overcome this problem, we propose an interactive version of this algorithm to allow the analyst to mobilize his own knowledge to compensate for the lack of information in the process traces. The state of the art (section 2) presents different data mining approaches for automata discovery, explains the choice of Petri Nets discovery and describes the α-algorithm chosen to illustrate the man machine interactive Knowledge Discovery principle. The contribution is detailed in section 3 and is illustrated with a simple example. The section 4 discusses the first results and future contributions: different ways the modified algorithm can guide the analyst to complete intermediate results in order to get a relevant automata by combining observed events and known elements about the observed activity. ⁶ AUTOMATA means: AUTOmata Modelling of the Activity, based on Trace Analysis. Fig. 1. In this process, all steps are supposed to be automatic but the last one, interpretation, is the only one which allows to tune the previous steps. Fig. 2. In our approach, the user can interactively mine traces to produce relevant patterns (Abstract step). Discovered knowledge (ontology) allows to tune the collecting and the analysing steps. In this paper, we introduce an explicit support (Automata) to the ”synthesis” step, opening a new step “Exploiting” which completes the process. In our context, the formal knowledge representation of dynamics is a Petri Network, allowing further exploitation (for simulation for example). 2 State of the Art 2.1 Overview of Approaches for Building an Automata from Traces **Automata Approaches for Knowledge Representation** An automaton has a graphical representation that can be understood by a non-specialist, and at the same time, it is an *operative* representation of knowledge. Both those qualities are important for our approach as we want both the analyst to understand the discovered knowledge and the discovered knowledge to be used for producing an activity. Actually, automata are used both for producing a behaviour (simulation) and for describing (specification) expected behaviours (for example, the Statechart formalism or UML state diagrams). The literature proposes several ways to discover an automaton that could produce a given set of traces. We focused on the Process Mining approaches [3,2]. Those approaches deal with logs coming typically from an enterprise’s workflow management system. In this context a prescriptive model of the workflow exists (how people should do). However, it does not guarantee that people are following this prescriptive workflow. The goal is to discover a model of the real workflow, as people actually instantiate it, in order to compare this actual workflow to the prescriptive workflow and see how the workflow can be optimised. **Workflow Mining Issues** Van der Aalst and Weijters [3] made a review of the issues of Process Mining. There are several challenging issues that cannot be tackled together by any single algorithm: - mining hidden tasks (a task that does not appear in the traces), - mining duplicate tasks (a task that would correspond to several states or transitions of a model), - mining loops, - mining different perspectives (from the same traces, focusing on different aspects of the activity), - dealing with noise, - dealing with incompleteness, - visualizing results, - ... The authors compare the abilities of these four algorithms to discover known models (to rediscover a model). We have selected four properties of the algorithm from their comparison: the ability to deal with time, parallelism, loops and noise. Table 1 on the following page presents a comparison of these algorithms according to these four properties. This summary shows that EMiT approach is interesting on many aspects but does not deal with noise. Little Thumb and InWoLvE both deal with noise, but not with time. Process Miner neither deal with time nor with noise. In the context we are studying (analysing human activity), it is important to be able to deal with parallelism and with loops, which they all can do. ### Table 1. Comparison of four process mining approaches, adapted from Van der Aalst et al. [2]. <table> <thead> <tr> <th>Approach</th> <th>Time</th> <th>Basic Parallelism</th> <th>Loops</th> <th>Noise</th> </tr> </thead> <tbody> <tr> <td>EMiT</td> <td>Yes</td> <td>Yes</td> <td>++</td> <td>No</td> </tr> <tr> <td>Little Thumb</td> <td>No</td> <td>Yes</td> <td>++</td> <td>Yes</td> </tr> <tr> <td>InWoLvE</td> <td>No</td> <td>Yes</td> <td>+</td> <td>Yes</td> </tr> <tr> <td>Process Miner</td> <td>No</td> <td>Yes</td> <td>+</td> <td>No</td> </tr> </tbody> </table> In our context of use (human activity analysis and synthesis), the ability to represent loops and parallelism is important. The ability to deal with time (EMiT) or noise (Little Thumb or InWoLvE) would be a nice benefit. As both EMiT and Little Thumb are based on a same algorithm, the $\alpha$-algorithm, we propose to make this common algorithm interactive. This would make it possible for an analyst to deal with the incompleteness issue of the data: the analyst can provide the algorithm with additional knowledge. The $\alpha$-algorithm is our first target to add interactivity to a mining algorithm. It does not support itself all the types of loops, but, the resulting algorithm can be integrated into EMiT or Little Thumb. #### 2.2 The $\alpha$-algorithm: Definitions and Basic Presentation The formal definitions introduced here are taken from Van der Aalst et al. [4]. For a complete formal definition of the notions used here and the proof of the algorithm, please refer to Van der Aalst et al. [4]. Given (1) a Petri-net with some properties, and (2) a collection of traces of this model, with some properties, the $\alpha$ algorithm can reproduce the Petri-net (1) from the collection of traces (2). We explain now more precisely what type of Petri-nets we are considering; then, what type of collections of traces we need; and finally, how the $\alpha$ algorithm works. **Petri-Nets** Van der Aalst et al. use a variant of Petri-net called Place/Transition nets. **Definition 1 (P/T-nets).** A Place/Transition net, or simply P/T-net, is a tuple $(P, T, F)$ where: 1. $P$ is a finite set of places, 2. $T$ is a finite set of transitions such that $P \cap T = \emptyset$, and 3. $F \subseteq (P \times T) \cup (T \times P)$ is a set of directed arcs, called the flow relation. The authors define a workflow net (WF-net) as a particular subset of P/T-nets. The figure 3 presents an example of WF-net. WF-nets have an input place $i \in P$, with no flow relation directed to $i$, an output place $o \in P$, with no flow relation starting from $o$ and by linking the output place $o$ to the input place $i$ with a new transition $(t)$, the resulting P/T-net $((P, T', F') = (P, T \cup \{t\}, F \cup \{(o, t), (t, i)\}))$ is strongly connected, that is to say for any two places or transitions $x, y \in P \cup T'$, there is a path of flow relations in $F'$ from $x$ to $y$. **Fig. 3.** A WF-net with 3 parallel transitions. Circles are places, black rectangles with labels are transitions and arcs are flow relations. The black dot represents a token on the input place. The authors define the notion of soundness of a WF-net. In a few words, a WF-net $N = (P, T, F)$ is sound if, - it is safe: while firing transitions, starting from the initial marking (only the input place has a token), there is no more than one token on each place. - While firing transitions (starting from the initial marking), if there is a token on the output place (final marking), then there is no other token on any other place of the WF-net. - It is possible to reach this final marking (from the initial marking). - Any transitions of the WF-net is reachable from the initial marking. The authors define a structured workflow net (SWF-net) as a particular type of WF-net, with some structural properties: no implicit place, a choice between two possible activities or a synchronisation between two activities is possible with some constraints illustrated in figure 4 on the following page. **Workflow Logs** The authors define the notions of workflow trace and workflow log. Given a set of tasks $T$, a workflow trace, noted $\sigma$, is a sequence of tasks of $T$ ($\sigma \in T^*$. A workflow log, noted $W$, is a set of workflow traces. Transitions of a WF-net correspond to tasks of a workflow. Thus, the workflow trace of a WF-net represents the sequence of execution of the different transitions of this WF-net. Van der Aalst et al. [4] define several relations that can be deduced from WF-logs $W$. We will introduce three of these. For a WF-log $W$ of a WF-net $N = (P, T, F)$, and for $a, b \in T$: 1. $a >_W b$ means there is a trace $\sigma \in W$ where $b$ directly follows $a$; 2. $a \rightarrow_W b$ iff $a >_W b$ and $b \not>_W a$, which means there is a trace in $W$ where $b$ directly follows $a$, and in no trace of $W$ $a$ directly follows $b$; and 3. $a \#_W b$ iff $a \not>_W b$ and $b \not>_W a$, which means in no trace of $W$ $b$ directly follows $a$ and in no trace of $W$ $a$ directly follows $b$. In order to use the previous relations, the authors define the notion of complete workflow log. Given a sound WF-net $N$, a workflow log $W$ of $N$ is complete if (1) “all tasks that potentially directly follow each other in fact directly follow each other in some trace in the log” (2) each transition of $N$ appears at least once, in at least one trace $\sigma$ of the workflow log $W$. **α-algorithm** Previous notions allow us to introduce the $\alpha$-algorithm [4]. We explain its meaning step by step. **Definition 2 (Mining algorithm $\alpha$).** Let $W$ be a workflow log over $T$. $\alpha(W)$ is defined as follows. 1. $T_W = \{ t \in T | \exists_{\sigma \in W} t \in \sigma \}$, 2. $T_I = \{ t \in T | \exists_{\sigma \in W} t = \text{first}(\sigma) \}$, 3. $T_O = \{ t \in T | \exists_{\sigma \in W} t = \text{last}(\sigma) \}$, 4. $X_W = \{ (A, B) | A \subseteq T_W \land B \subseteq T_W \land \forall a \in A \forall b \in B a \rightarrow_W b \land \forall a_1, a_2 \in A \ a_1 \#_W a_2 \land \forall b_1, b_2 \in B \ b_1 \#_W b_2 \}$, 5. $Y_W = \{ (A, B) \in X_W | \forall (A', B') \in X_W | A \subseteq A' \land B \subseteq B' \implies (A, B) = (A', B') \}$, 6. $P_W = \{ p(A, B) | (A, B) \in Y_W \} \cup \{ i_w, o_w \}$, 7. $F_W = \{ (a, p(A, B)) | (A, B) \in Y_W \land a \in A \} \cup \{ (p(A, B), b) | (A, B) \in Y_W \land b \in B \} \cup \{ (i_w, t) | t \in T_I \} \cup \{ (t, o_w) | t \in T_O \}$, and 8. $\alpha(W) = (P_W, T_W, F_W)$. **Fig. 4.** Two constructs not allowed in SWF-nets [4]. The authors prove that given a complete WF-log $W$ of a sound SWF-net $N = (P, T, F)$ with no short loops, the $\alpha$-algorithm can reconstruct $N$ from $W$, modulo the name of the places. We explain its meaning in the following. 1. $T_W$ is the set of events observed in the WF-log traces. It corresponds to the set of transitions of the reconstructed WF-net. 2. $T_I$ is the set of input transitions of the reconstructed WF-net. 3. $T_O$ is the set of output transitions of the reconstructed WF-net. 4. $X_W$ characterises a set of candidate places of the reconstructed WF-net. It is a set of couples $(A, B)$ where $A$ and $B$ are sets of transitions, such as any transition of $A$ is the origin of a flow relation to this candidate place and this candidate place is the origin of flow relations to any transition of $B$. The sets $(A, B)$ are constructed such as for any two elements $a_1, a_2 \in A$, there is no trace where $a_1$ is directly followed by $a_2$ and no trace where $a_2$ is directly followed by $a_1$ (the same for any two elements in $B$), and for any couple of elements $(a, b) \in (A, B)$, there is a trace where $a$ is directly followed by $b$ and no trace where $b$ is directly followed by $a$. The figure 5 on the next page illustrates this property. 5. $Y_W$ characterises the places of the reconstructed WF-net (without the input and output places). $Y_W$ is the set of maximum elements of $X_W$. If a candidate place $(A, B) \in X_W$ is such as there exists another candidate place $(A', B') \in X_W$ with $A \subseteq A'$ and $B \subseteq B'$, then either $(A, B) = (A' B')$, and the candidate place is kept, either the place $(A, B)$ is redundant and does not contain more information than the candidate place $(A', B')$. The algorithm does not keep such implicit places. 6. $P_W$ is the set of places of the reconstructed WF-net. Each couple $(A, B)$ of $Y_W$ is explicitly defined as a place $p_{(A, B)}$, and the input ($i_w$) and output ($o_w$) places are added. 7. $F_W$ is the set of flow relations between places in $T_W$ and transitions in $P_W$. The connection between places is defined as for each place $p_{(A, B)}$ each transition of $A$ is connected by a flow relation to the place $p_{(A, B)}$, and the place $p_{(A, B)}$ is connected by a flow relation to each place of $B$. In addition, $F_W$ also contains the flow relation between the input place ($i_w$) and the input transitions ($T_I$) and between the output transitions ($T_O$) and the output place ($o_w$). 8. $\alpha(W)$ is the reconstructed WF-net. 3 Contribution: an Interactive Variant of the $\alpha$-algorithm In this section, we describe how we have adapted the $\alpha$-algorithm to make it interactive. We also describe some further tracks to make interactions stronger and smarter. As several extensions of this algorithm exist (for example the $\alpha^{++}$-algorithm [15]), we keep the possibility to go further without losing the interactive property. Fig. 5. An illustration of elements \((A, B)\) of the \(X_W\) set at the step 4 of the \(\alpha\)-algorithm. \(A\) and \(B\) are two sets of transitions. An arrow between two transitions illustrates that there is a trace in the WF-log where the first transition is directly followed by the other (\(>W\) relation). A crossed out arrow between two transition means there is no trace in the WF-log where the first transition is directly followed by the other (\(\not>_W\) relation). 3.1 From the \(\alpha\)-algorithm to the \(\alpha^i\)-algorithm We want to make the \(\alpha\)-algorithm interactive. This way an expert, a human who wants to discover knowledge, can exploit his or her knowledge to help the \(\alpha\)-algorithm to (re-)discover a workflow net. Why is it necessary for an expert to introduce some of his or her knowledge in the mining step? Because in most cases, it is not possible to know whether the collection of traces (WF-log) we mine is complete or not. Even worse, sometimes, especially when dealing with data related to human activity, we know the collection of traces is incomplete, noisy, and even missing data related to not directly observed\(^7\) behavior. We consider three possibilities for a human to interact with the \(\alpha\)-algorithm. - Before applying the algorithm: by preparing traces, by adding traces as examples, or by giving negative examples (a behaviour that the constructed model should not produce). - On the results of the algorithm: by interpreting the output model, by renaming places of the P/T-net, by editing the places and flow relations, adding non-observable transitions. - In the meanwhile: without changing the algorithm, by editing some intermediary results of the \(\alpha\)-algorithm, or by changing the algorithm, implementing a mechanism of mixed chaining that asks the user for (possibly) missing information. In order to keep the good properties of the \(\alpha\)-algorithm, allowing extensions such as EMI\(T\) or Little Thumb, we focus on the edition of intermediate results of the \(\alpha\)-algorithm. Obviously, each step of the \(\alpha\)-algorithm is an intermediary result. We have chosen to focus on one particular intermediary result which is \(^7\) A behaviour may be observable on a video for a human expert, but not actually logged in a computer-readable trace. not explicitly defined in the algorithm: the definition of the $>_W$ relation. Indeed, step 4 uses the $\rightarrow_W$ and $\#_W$ relations that are defined from the $>_W$ relation. We propose to present the $>_W$ relation to the analyst, so that he or she can edit it, adding his or her own knowledge to the knowledge implicitly contained in the traces. This particular $>_W$ relation seems interesting for the analyst because it can be easily translated in natural language and thus understandable to the analyst. Actually, $a >_W b$ stands for “there is a trace where $b$ directly follows $a$”. But in the case of incomplete traces (WF-logs), the question should be slightly different, as we know everything is not observable in the traces. The real question of our concern is “is it possible that a trace where $b$ directly follows $a$ exists?”. The answer to this question would lead to the definition of a new relation, that we note $>_A$ ($A$ stands for “Analyst”) From this new relation, we can rely on the knowledge of the analyst to make the $\alpha$-algorithm useful on incomplete traces. Then, by using $>_A$ relation, relations $\rightarrow_A$ and $\#_A$ are straightforwardly defined as follows. For all $a, b \in T_W$: - $a \rightarrow_A b$ if and only if $a >_A b$ and $b \not>_A a$, and - $a \#_A b$ if and only if $a \not>_A b$ and $b \not>_A a$. On this basis, we propose the first modification of the $\alpha$-algorithm as follows, that we will refer as the $\alpha'$-algorithm. - Steps 1 to 3 are the same: 1. $T_W = \{ t \in T \mid \exists \sigma \in W \ t \in \sigma \}$, 2. $T_I = \{ t \in T \mid \exists \sigma \in W \ t = \text{first}(\sigma) \}$, 3. $T_O = \{ t \in T \mid \exists \sigma \in W \ t = \text{last}(\sigma) \}$, - Between step 3 and 4, we introduce 3 additional steps, to prompt the analyst for additional knowledge: (a) build the $>_W$ relation from traces, (b) display the definition of $>_W$ in natural language and propose the analyst to complete this relation with his or her knowledge (resulting in the $>_A$ relation), and (c) from the $>_A$ relation, build the $\rightarrow_A$ and $\#_A$ relations. - Then, steps 4 to 8 are exactly the same, except from that they implicitly use knowledge coming from expertise ($A$), not only from WF-logs or traces ($W$). In order to formally show this difference, we rewrite those steps here: 4. $X_A = \{ (A, B) \mid A \subseteq T_W \land B \subseteq T_W \land \forall a \in A \forall b \in B \ a \rightarrow_A b \land \forall a_1, a_2 \in A \ a_1 \#_A a_2 \land \forall b_1, b_2 \in B \ b_1 \#_A b_2 \}$, 5. $Y_A = \{ (A, B) \in X_A \mid \forall (A', B') \in X_A \ A \subseteq A' \land B \subseteq B' \Rightarrow (A, B) = (A', B') \}$, 6. $P_A = \{ p_{(A, B)} \mid (A, B) \in Y_A \} \cup \{ \{ i_w, o_w \} \}$, 7. $F_A = \{ (a, p_{(A, B)}) \mid (A, B) \in Y_A \land a \in A \} \cup \{ (p_{(A, B)}, b) \mid (A, B) \in Y_A \land b \in B \} \cup \{ (i_w, t) \mid t \in T_I \} \cup \{ (t, o_w) \mid t \in T_O \}$, and 8. $\alpha'_A(W) = (P_A, T_W, F_A)$. 3.2 Illustrative Example We propose to show the interest of our approach on a simple example. For this example, we will work with the P/T-net model presented in figure 3 on page 7 (that is a sound SWF-net matching the properties needed for the $\alpha$-algorithm). From this P/T-net model, we produce the following incomplete set of traces (WF-log): $ABCDE$, $ACBDE$, $ABDCE$. As expected from the $\alpha$-algorithm, using this incomplete WF-log produce random results. In this particular case, it produces a meaningful P/T-net, but not the one we are looking for (figure 6). ![Fig. 6. A resulting P/T-net of the $\alpha$-algorithm on incomplete traces (WF-log).](image) With some knowledge coming from the analyst (figure 7), the algorithm is able to rediscover the original P/T-net (figure 8 on the next page). ![Fig. 7. A screenshot presenting the interface the expert can interact with (building the $>_{A}$ relation).](image) An Interactive Method to Discover a Petri Net Model of an Activity Fig. 8. A resulting P/T-net of the interactive $\alpha$-algorithm from an incomplete traces (WF-log) completed by analyst’s knowledge. 4 Discussion and Perspectives 4.1 Discussion We have shown that it is possible to adapt an algorithm, the $\alpha$-algorithm to make it interactive. The user, in our case an expert in the workflow, can interact with the algorithm in order to add knowledge that was not available in the traces. This interaction can be a base for dealing with the incompleteness issue of the traces we collect. The interaction we propose is based on the $\succ_W$ relation, that might be incomplete (or erroneous, due to noise in the data). We propose that the user, based on the computed $\succ_W$ enrich it to produce the $\succ_A$ relation. However, this step hides a complexity problem. Listing all the possible $\succ_A$ relations for a WF-net with $n$ transitions is $O(n^2)$. For the example shown in figure 7 on the facing page, the WF-net studied has 5 transitions, the user has to check the 25 possible relations. This problem would appear nearly hopeless with a traditional mining approach. However, in the context of interactive Knowledge Discovery, introduced at the very beginning of this article, we think we can master this issue. The knowledge discovery is guided by a user, who knows what type of knowledge he or she is looking for. From this top-down approach, it is possible, at the first steps of the process to select data, analyse it with ABSTRACT framework, before using $\alpha^i$-algorithm. 4.2 Perspectives The first immediate improvement for the $\alpha^i$-algorithm, would be to decline it to the improved version of the $\alpha$-algorithm, like in EMiT or Little Thumb. We already started to work on making the $\alpha^{++}$-algorithm interactive. The $\alpha^{++}$-algorithm [15] is a variant of the $\alpha$-algorithm dealing with short loops. It would also be interesting to enrich the possibilities of interaction. As seen in section 3.1, the user could interact at three levels: before applying the algorithm (on the traces), after applying the algorithm (on the resulting model), or in the meanwhile (interacting with intermediary results or with a mechanism of mixed chaining). In the future, we will investigate more specifically the possibility (1) to develop a mixed chaining, and (2) to interact with traces. Mixed chaining would make it possible to reduce the effort of the expert to use an algorithm by suggesting to him or her possible missing information. For example, the algorithm could propose to the user “almost discovered” places or flow relations. This tool would, we believe, improve the usability of such an interactive algorithm. Interacting with traces corresponds to integrating the interactive mining algorithm into a software platform that guarantees that it is easy to loop back and forth from knowledge discovered, to traces, to mining algorithms (figure 2 on page 4). Thus, we integrate the interactive version of the algorithm, in a software platform capable of interacting with the ABSTRACT platform. This integration has to come along with a methodology to discover knowledge, that we will develop and instantiate on car-driving behavioural data, to support the cognitive modelling of the driving activity. 5 Conclusion This paper proposes a first approach to mine an observed activity process in order to interactively construct descriptive and operational knowledge. We show it is possible to adapt a workflow mining algorithm, the α-algorithm, to achieve this interactive discovery approach. Human knowledge and intermediate mining results are interactively woven to construct an automata that can be used as an overall knowledge representation and as an operational knowledge representation available for computer exploitation (simulation). Therefore, such an interactive algorithm supports the general idea of making the overall knowledge discovery process interactive (figure 2 on page 4). Acknowledgments. This work was supported by Région Rhône-Alpes and the “Transport, Territories and Society” Cluster. References
{"Source-Url": "https://hal.archives-ouvertes.fr/hal-00544388/file/2010_04_scientific_report.pdf", "len_cl100k_base": 7788, "olmocr-version": "0.1.53", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 40672, "total-output-tokens": 9574, "length": "2e12", "weborganizer": {"__label__adult": 0.0003867149353027344, "__label__art_design": 0.0008635520935058594, "__label__crime_law": 0.000457763671875, "__label__education_jobs": 0.0023517608642578125, "__label__entertainment": 0.00019478797912597656, "__label__fashion_beauty": 0.0002181529998779297, "__label__finance_business": 0.0006308555603027344, "__label__food_dining": 0.00041961669921875, "__label__games": 0.0013647079467773438, "__label__hardware": 0.0011997222900390625, "__label__health": 0.0006775856018066406, "__label__history": 0.0005331039428710938, "__label__home_hobbies": 0.0002092123031616211, "__label__industrial": 0.0008401870727539062, "__label__literature": 0.0008273124694824219, "__label__politics": 0.00030517578125, "__label__religion": 0.0005326271057128906, "__label__science_tech": 0.421142578125, "__label__social_life": 0.0002112388610839844, "__label__software": 0.0302734375, "__label__software_dev": 0.53466796875, "__label__sports_fitness": 0.00038743019104003906, "__label__transportation": 0.0012598037719726562, "__label__travel": 0.00023567676544189453}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 35501, 0.02156]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 35501, 0.47067]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 35501, 0.87351]], "google_gemma-3-12b-it_contains_pii": [[0, 2495, false], [2495, 5648, null], [5648, 8679, null], [8679, 9321, null], [9321, 11838, null], [11838, 14260, null], [14260, 16487, null], [16487, 18613, null], [18613, 21588, null], [21588, 23936, null], [23936, 27004, null], [27004, 27942, null], [27942, 29910, null], [29910, 32561, null], [32561, 35501, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2495, true], [2495, 5648, null], [5648, 8679, null], [8679, 9321, null], [9321, 11838, null], [11838, 14260, null], [14260, 16487, null], [16487, 18613, null], [18613, 21588, null], [21588, 23936, null], [23936, 27004, null], [27004, 27942, null], [27942, 29910, null], [29910, 32561, null], [32561, 35501, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 35501, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 35501, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 35501, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 35501, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 35501, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 35501, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 35501, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 35501, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 35501, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 35501, null]], "pdf_page_numbers": [[0, 2495, 1], [2495, 5648, 2], [5648, 8679, 3], [8679, 9321, 4], [9321, 11838, 5], [11838, 14260, 6], [14260, 16487, 7], [16487, 18613, 8], [18613, 21588, 9], [21588, 23936, 10], [23936, 27004, 11], [27004, 27942, 12], [27942, 29910, 13], [29910, 32561, 14], [32561, 35501, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 35501, 0.03429]]}
olmocr_science_pdfs
2024-12-06
2024-12-06
7d7b9fdb80497d0b6908ce838d22e20727828c91
ABSTRACT This paper shares our experience with initial negotiation and topic elicitation process for conducting industry experiments in six software development organizations in Finland. The process involved interaction with company representatives in the form of both multiple group discussions and separate face-to-face meetings. Fitness criteria developed by researchers were applied to the list of generated topics to decide on a common topic. The challenges we faced include diversity of proposed topics, communication gaps, misunderstanding about research methods, initial disconnect between research and industry needs, and lack of prior work relationship. Lessons learned include having enough time to establish trust with partners, importance of leveraging the benefits of training and skill development that are inherent in the experimental approach, uniquely positioning the experimental approach within the landscape of other validation approaches more familiar to industrial partners, and introducing the fitness criteria early in the process. 1. INTRODUCTION Experiments conducted with industrial professionals are often considered to produce more generalizable results than their counterparts run in academia [6, 7]. They contribute to building scientifically confirmed theories in software engineering by testing the cause-effect relationships that were previously studied through laboratory experiments (in academia). However, the majority of the experiments conducted in the software engineering context have been in academia. A systematic literature review reveals that only four industry experiments were conducted until 2002, and another 11 were conducted between 2003 and mid-2012 [8]. 1.1 Challenges with Industrial Experiments In experiments conducted in controlled (laboratory) settings where the technical infrastructure for monitoring subjects and collecting data are provided by researchers, using students as subjects is the norm. In these environments, students can be motivated through a reward or grading system. When needed, an initial training on the treatments can be given in the scope of the curriculum. Alternatively only experienced students can be selected. Such options make it relatively easier to conduct experiments in an academic setting. Conducting experiments in industry introduces additional challenges for researchers from planning to reporting. Industry experiments are subject to many confounding factors that may threaten their validity even though they increase the generalizability of the results. For example, when the subjects are software professionals in a company, researchers may not be able to control subject selection and their profiles, resulting in pure convenience sampling. Furthermore, researchers cannot easily enforce adherence to a treatment in a setting that is completely unfamiliar to the subjects. Motivational factors also come into play in a significant way. For both professionals who serve as subjects and their managers, tangible benefits associated with participating in an experiment are fewer, and consequently, buy-in is much more difficult than with students. Experimentation in the industry is generally more costly than in academia since the tasks, subjects and the environments of the experiments should be as realistic as practically possible [6]. While these requirements translate into challenging experimental designs and more effort on the part of the researchers, there might be a significant associated cost to the companies in terms of diverted resources. It is thus difficult to convince software professionals and their employers to spend their valuable and limited resources to contribute to an experiment. 1.2 Mutual Understanding of Needs Successful industry and academia collaborations rely on joint and early agreement of mutual goals and roles. Researcher should understand the industry’s reasons to participate in the collaboration [5]. They should be aware of the challenges of their industrial partners, and choose problems and topics that are novel, feasible, industrially relevant, and potentially impactful [4]. If the problem or topic is sufficiently motivating, buy-in can be secured and the chances for a successful collaboration increases. Existing guidelines for conducting experiments in software engineering usually miss the importance of initial negotiation and topic selection as a main driver. Wohlin et al. [10] state that “the starting point for an experiment is insight, and the idea that an experiment would be a possible way of evaluating whatever we are interested in. Similarly, Kitchenham et al. [11] advocate the experimental context as the first step of an experiment, during which the objectives of the research are properly defined and the description of the research provides enough detail for researchers and practitioners. The process of finding a relevant topic that is linked to a real challenge and tangible outcomes in the industry, and that is suitable for experimentation is not given much upfront attention. The identification of a suitable problem or topic as a main driver is however implied by Jedlitschka and Pfahl [12], who partition the definition of experimental context into problem statement, objective, and context. They argue that the problem and its relevance to the context need to be justified before defining research objectives. This argument aligns with our perspective. The centrality of topic selection was the premise of our industry-academia collaboration in Finland. We recognized early on in the project that topic selection could be paramount in overcoming motivational barriers for our industrial partners. Our first priority was therefore to identify software engineering topics that are both interesting and attractive for practitioners and appropriate for studying with an experimental approach. In the rest of the paper we share our process and experience with initial negotiation and topic elicitation process in the context of our collaboration with six Finnish software organizations. We report on the steps that we followed in this process, which involved face-to-face meetings with software professionals, forming an initial list of topics that are of interest to our partners, assessment of each topic for its fitness for study using an experimental design, and final selection of an initial and agreed-upon topic to pursue. We also discuss the challenges faced during the topic elicitation process, and follow up the challenges with a set of lessons learned. These lessons will help us improve our future industrial collaborations and justify the value of experiments in their organizational contexts. 2. TOPIC ELICITATION PROCESS 2.1 Context Our experience with selecting software engineering topics suitable for experimentation within companies started in early 2013 in the context of the Experimental Software Engineering Industry Laboratory (ESEIL) project. The ESEIL project aims to help Finnish companies achieve efficiency and transparency in their software development processes through experimentation. The operating hypothesis of ESEIL is that if the companies understand the impact of using new practices and techniques that are of interest to them in their own context, they will be able to make better decisions regarding their adoption. With that goal in mind, the researchers approached the ESEIL contributors to identify topics that would provide value to companies and in turn, are worthy of study. We were specifically looking for a set of common topics that would be of interest to all the companies so that we could maximize the utilization of study designs and experimental packages, and pool the data from multiple organizations for meaningful analysis. We needed to utilize limited research resources to the best of our ability. The immediate objective was to identify one viable topic for the first phase of ESEIL experiments. The first task was to inform the companies on the project motivation, goals, elements of the scientific approach used, and potential benefits. This allowed us to generate sufficient interest to continue. We also needed to determine how to gain access to a representative population of the software development organizations so that we can have meaningful input on which topics to pursue as the subject of the first batch of investigations. 2.2 Kick-off meeting The process started in January 2013 with a kickoff meeting with representatives from eight companies. The kickoff meeting was run as a workshop. The lead researcher explained the purpose of experimentation in software engineering, gave an overview of the methods used, provided comparisons to other disciplines, listed common topics pursued by empirical software engineering researchers, and suggested a plan to move forward. The original idea was to solicit topics by deploying a short survey within each participating software development organization. However, this option was deemed too intrusive at the kickoff meeting and proved infeasible. We attributed the companies’ reluctance to dedicate widespread employee resources at these initial stages to their lack of prior working relationships with us. Invariably, the company representatives preferred to have face-to-face meetings with a few selected employees to explore possible topics of common interest. Separate face-to-face meetings were also seen as an opportunity to better understand the advocated research approach and to have further conversation to seed the topic selection process using a more guided format. Out of the eight companies that attended the kickoff meeting, six decided to follow up the proposed collaboration with separate face-to-face meetings involving multiple company representatives. The other two dropped out due to internal problems. We asked our contacts from the six companies that agreed to participate to invite several employees with different software development roles and experience to ensure broad representation. 2.3 Face-to-Face Brainstorming Meetings The profiles of the six companies and their representatives that participated in the separate topic elicitation meetings are summarized in Table 1. We expected to have a larger number of company representatives at each meeting, but our contacts deliberately wanted to keep the meetings small to reduce the impact on their business. The face-to-meetings were conducted as unstructured group interviews. Multiple researchers participated in each meeting, with one researcher leading and asking questions and one researcher taking notes. The companies were first asked to comment on the types of software they develop and the technologies, practices, and processes they use to develop the software. These questions set the context, and the participants were encouraged to talk about specific issues and interests from their own roles’ perspectives. The following question seeded the discussion: “What kind of questions would you like to answer to help you improve the way your teams develop software, the way the development teams interact with their respective clients, and the quality of the resulting software?” Potential topics were elicited in this group setting, and the topics that were both mentioned in passing and explicitly proposed by the participants were recorded by the scribe. The recorded topics... from all meetings were then aggregated in a single list. Closely related topics were merged using ad-hoc iterative clustering. Each face-to-face meeting took about an hour, and in some cases exceeded an hour. The actual length depended on the number of participants and how engaged and interested they were. We essentially left it to the company representatives to figure out their own organizations’ needs when proposing candidate topics. The researchers avoided further guidance to minimize bias. All of the companies visited had a keen interest in agile and lean software development; five were already applying agile and lean practices regularly. Thus many of the topics proposed had some link to these paradigms. ### Table 1. Profiles of companies participated in the process <table> <thead> <tr> <th>Size</th> <th>Domain</th> <th>Company representatives</th> </tr> </thead> <tbody> <tr> <td>A Large</td> <td>Security</td> <td>Innovation Manager</td> </tr> <tr> <td>B Small</td> <td>CRM</td> <td>Development, Architect, Product Owner</td> </tr> <tr> <td>C Med.</td> <td>Games</td> <td>Manager, Technical Lead, User Expert</td> </tr> <tr> <td>D Large</td> <td>Embedded</td> <td>Manager, Developer, QA Lead</td> </tr> <tr> <td>E Large</td> <td>Telecom</td> <td>Manager, QA Lead, Testing Lead</td> </tr> <tr> <td>F Small</td> <td>Retail oil</td> <td>Manager</td> </tr> </tbody> </table> 1. Concreteness: The need to specify a narrow and precisely defined topic for both research and industrial relevance. Non-specific topics may cause difficulties in recruitment and execution. The research team need to have a clear understanding of the objectives and outputs. 2. Suitability for Experimentation: Certain software engineering topics are subject to multiple intangible factors with long-term and organization-wide implications, and as such are better fits for longitudinal field studies with a qualitative orientation. These topics may be difficult to study using experimentation in contrast to topics such as automatic test case generation. For example, it is particularly challenging to design and conduct experiments for evaluating software engineering techniques where human factors, such as attitudes of users and developers, play a major role and development tasks which need to be monitored more than 2-3 hours a day. Topics for which active involvement and observation of subjects over a long period of time are required also have low feasibility and high cost, and in turn, they might be more suitable for qualitative studies. 3. Relevance to Research Community: The research community values contributions that build on existing knowledge. Topics that have potential to add value to, strengthen, or refute existing studies generally reach a wider audience. Consequently, the research designs used and the findings are easier to compare to those of previous studies. Studies that build on others also allow the researchers to leverage lessons learned from previous studies, thereby mitigating validity and execution risks. 4. Prior Experience: Experiments often involve training subjects on a topic or techniques unfamiliar to them, and designing realistic tasks that address problems in the topic’s domain. In addition, if the experiment involves interaction with industrial stakeholders, then the knowledge is more complex and requires more time. Thus researchers need experience in experimental design and research methods in general, but also in the topic, and its underlying domain, being studied. Lack of prior domain experience may raise serious threats to construct validity of a study. These four criteria represent primarily the researchers’ constraints. They were applied as a filtering mechanism to candidate topics. Since we used a pull rather than a push approach during meetings with our industry partners, we assume the candidate topics to be already industrially relevant. Our purpose in articulating the criteria was to make our industrial partners aware of the additional tradeoffs that might not have been visible to them. ### 2.5 Topic Selection Meeting The separate face-to-meetings with the companies were followed up by a topic selection meeting attended by representatives from all participating companies. The researchers presented the outcome of the face-to-face meetings and explained the four fitness criteria. They next summarized the evaluation of the proposed topics relative to the fitness criteria, in which each topic was rated on a three-point scale with respect to each criterion. Table 2 gives this summary. The ratings had been assigned by researchers prior to this meeting. The highest-rated topics are typset in bold in Table 2. The suggested topics exhibited a large variety. Some topics were too general (e.g., open source, testing), whereas some were very platform dependent (e.g., Eclipse versus competitor IDEs). The most frequently mentioned topics were related to quality assurance and testing, while the least frequently mentioned topic was software design (omitted in Table 2). We believe that professionals need some guidance when they are asked about their topics of interest; otherwise they may think too abstractly or in too detail. We didn’t specifically investigate why certain topics were suggested and they differed in specificity. It would have been revealing to know the motivational factors behind the suggested topics, e.g., whether the topics correlated with the participants’ formal education and roles, or whether the suggestions had more to do with the popularity of topics in the industry. The company representatives discussed the list in Table 2. The factors pertaining to industrial relevance, i.e., topicality, learning opportunities, originality and alignment with development process and interests, were brought up. <table> <thead> <tr> <th>Criteria</th> <th>Topic</th> <th>Concreteness</th> <th>Suitability</th> <th>Relevance</th> <th>Experience</th> </tr> </thead> <tbody> <tr> <td>Requirements related</td> <td>Product definition</td> <td>Low</td> <td>Low</td> <td>Low</td> <td>Low</td> </tr> <tr> <td></td> <td>Prioritization of tasks</td> <td>Medium</td> <td>Medium</td> <td>Medium</td> <td>Medium</td> </tr> <tr> <td></td> <td>User Needs (Requirements) Elicitation</td> <td>Medium</td> <td>High</td> <td>High</td> <td>High</td> </tr> <tr> <td>Quality Assurance related</td> <td>Testing</td> <td>Low</td> <td>High</td> <td>High</td> <td>High</td> </tr> <tr> <td></td> <td>Testing team versus beta users</td> <td>High</td> <td>Medium</td> <td>Low</td> <td>High</td> </tr> <tr> <td></td> <td>Model based testing</td> <td>Medium</td> <td>High</td> <td>High</td> <td>Low</td> </tr> <tr> <td></td> <td>Test with or without the hardware</td> <td>High</td> <td>High</td> <td>Low</td> <td>Medium</td> </tr> <tr> <td></td> <td>Manual versus automatic test case generation</td> <td>High</td> <td>High</td> <td>Medium</td> <td>High</td> </tr> <tr> <td></td> <td>Time need to find bugs</td> <td>High</td> <td>High</td> <td>Medium</td> <td>High</td> </tr> <tr> <td></td> <td>Influence of programming language on testing</td> <td>High</td> <td>High</td> <td>Medium</td> <td>Medium</td> </tr> <tr> <td>Development related</td> <td>Refactoring</td> <td>Low</td> <td>Low</td> <td>High</td> <td>Low</td> </tr> <tr> <td></td> <td>Test driven development (TDD) versus non-TDD</td> <td>High</td> <td>High</td> <td>High</td> <td>High</td> </tr> <tr> <td></td> <td>Pair Programming</td> <td>High</td> <td>High</td> <td>High</td> <td>High</td> </tr> <tr> <td>Process related</td> <td>Open source</td> <td>Low</td> <td>Low</td> <td>High</td> <td>Medium</td> </tr> <tr> <td></td> <td>Product line management</td> <td>Low</td> <td>Low</td> <td>High</td> <td>Low</td> </tr> <tr> <td></td> <td>Importance of granularity of commits</td> <td>Medium</td> <td>Medium</td> <td>Medium</td> <td>Low</td> </tr> <tr> <td></td> <td>Kanban for developers at customer site</td> <td>Medium</td> <td>Low</td> <td>Low</td> <td>Low</td> </tr> <tr> <td>Human factors related</td> <td>Impact of personality on code reviews</td> <td>High</td> <td>High</td> <td>High</td> <td>High</td> </tr> <tr> <td></td> <td>Overhead of context switching for developers</td> <td>High</td> <td>High</td> <td>Medium</td> <td>Low</td> </tr> <tr> <td></td> <td>Interaction between developer and HCI experts</td> <td>Medium</td> <td>Low</td> <td>Medium</td> <td>Medium</td> </tr> <tr> <td>Tools</td> <td>Eclipse IDE versus competitor IDEs</td> <td>High</td> <td>High</td> <td>Medium</td> <td>Low</td> </tr> <tr> <td></td> <td>Version control systems: centralized vs. distributed</td> <td>High</td> <td>Medium</td> <td>Low</td> <td>Low</td> </tr> </tbody> </table> After the discussion, the company representatives were asked to vote on topics. Each company had three votes, which could be distributed among at most three topics. The representatives who were not present were later given the opportunity to vote offline on the top two topics that garnered the most votes. The top two topics that received the highest number of votes were “Test-Driven Development” and “Requirements Elicitation”. 2.6 Selected Topic: Test-Driven Development The topic that received the most votes was Test-Driven Development, and it was subsequently chosen as the subject of the initial phase of the ESEIL project. Requirements Elicitation topic has still been under negotiation for clarifying the problem better and increase its concreteness score. It was decided that the remaining topics could be re-evaluated and considered as pending experiments in the subsequent phases of the project. TDD has many noteworthy characteristics that make it both industrially relevant and a good fit for study through experimentation in an industrial context. Since first popularized in the context of Extreme Programming in early 2000s, TDD has continued to be a topical and controversial practice. It advocates interleaving normally distinct activities, such as construction, testing, low-level design, and even documentation, into a micro process that requires skill, mastery, and extra effort by developers. It promises both long-term productivity and quality benefits in return when practiced systematically by the development team [2]. TDD’s industrial relevance is evidenced by its consistent high ranking by software development managers [1]. However, due to its reputation as a challenging practice to apply, TDD had been unexplored at the organization-level by our industrial partners, despite the fact that the companies were familiar with and using many other agile practices. One company had had some employees with TDD training, but the practice was not In terms of satisfying the fitness criteria, TDD is well-defined enough as a development technique. It lends itself to study using an experimental approach because it’s a low-level technique with a natural control alternative, and both its productivity and quality effects and the subjects’ level of conformance to the workflow it prescribes are objectively measurable. The quality and productivity effects of TDD have been studied extensively by several researchers [9], which make TDD relevant to the research community. Interestingly, cumulative evidence about TDD’s effectiveness is still not conclusive enough [2], with contextual factors appearing to play an important role. This is an additional motivating factor because it promises ample opportunities to extend the existing knowledge. Finally, the research team had substantial collective experience applying TDD, using it, studying it, and teaching it, with an arsenal of experimental designs and results at their disposal to build on. This collective experience gave the research team a unique domain knowledge advantage. After the topic selection meeting, four companies decided to participate in the TDD experiments. The remaining two decided that the topic didn’t fit in with their priorities at the time. ### 2.7 Challenges We faced several challenges, particularly in the initial phases of the topic elicitation process, which pertained to diversity of topics, communication gaps, misunderstanding of research methods, disconnect between needs and lack of prior relationship. **Diversity of topics.** We expected most topics to be pervasive among the software organizations that we approached. We were surprised that even among the companies following similar type of development methodology and within the same company, many proposed topics were unique. There was no obvious convergence to a common area, and consensus seemed elusive. Some of the topics were so marginal that it led us to think that the employees did not mention more obvious, but hard problems because they didn’t have a realistic expectation that an academic approach could effectively tackle them. Perhaps the diversity of suggested topics should not have been surprising, since the differences among software practitioners in terms of their experience, role, and in turn, their dissimilar interest can lead to this variation. The results of previous surveys at Microsoft on employees’ suggestions of interesting software engineering topics also exhibited much variation [4]. These surveys resulted in 12 prioritized categories that spanned a variety of activities and issues with rankings highly dependent on role, geography, and experience level. **Communication gaps.** Terminology differences between researchers and practitioners were a pervasive source of misunderstanding. Practitioners sometimes referred to well-known software engineering concepts using company-specific acronyms or terms. Among the companies themselves, similar concepts were sometimes referred to by different names, and clarifications were often required. Vagueness of concepts and translation to English may have compounded these communication problems. In a few instances, we were unsuccessful in recording a proposed topic in concrete and well-known terms. Misunderstanding of research methods. Although the company representatives initially appeared to grasp the notion of an experiment as a way of evaluating alternative software engineering approaches, and went along with the idea, they later had an issue with the experimental approach. The necessity of using multiple subjects in multiple treatment groups appeared to them as too resource-intensive, logistically and politically complicated, and somewhat wasteful. Although the experimental approach was explained in the beginning, some companies later appeared to be surprised by its implications, and decided not to be involved in the first batch of the experiments. **Disconnection between needs.** Based on our past experience, we were well aware of the differences between researcher needs (publications, research relevance, technical feasibility, and validity) and company needs (effort spent for experimentation, tangible benefits to company in terms of skills development, quality and productivity improvement, new knowledge that aids solving a critical problem). Even though we rationalized the research needs during the topic elicitation process using the fitness criteria and explained it, it was still difficult for companies to come to terms with them. **Lack of prior relationship.** Skepticism about the concept of an experiment and research methods was apparent from the beginning. Skepticism manifested itself in subtle ways, as silence and lack of enthusiasm in meetings, and reluctance to provide access to employees without reasonable assurance of benefits. Our initial plan to run a survey was to get as much feedback from employees as possible. This idea was rejected in favor of group meetings with a few selective individuals. Lack of a working relationship prior to ESEIL project possibly played a role in the companies’ reluctance to provide us access to their employees, since after we had developed that relationship, one of the most reluctant company contacts proposed to solicit input from many more representatives in the future. ### 3. LESSONS LEARNED The challenges faced during topic elicitation process led us to rethink our approach. We believe that addressing certain challenges earlier in the process would have helped alleviate some of the mutual frustrations and roadblocks. In retrospect, the initial expectations might have been too high on both sides. Managing those expectations more proactively would have been advisable. Key points to take away from this experience and key changes that we are planning to implement in future rounds of the ESEIL project are summarized below. **Establishing trust takes time.** It is not reasonable to expect companies to be enthusiastic about a research-based approach from the very beginning. Energy and effort put into developing and nurturing relationships and creating champions pay off. We were fairly successful in this regard once we overcame the initial hurdles. The resistance faced regarding access to employees was a wake-up call. In the future, a gentler introduction based on one-on-one interactions with the main company contacts (champions) before the kickoff meeting is likely to prove useful. The company champions sometimes emerged later in the process than we would have liked because of delayed interactions with the key personnel. **Understand why a particular topic is of interest to the practitioners.** Although we did not ask why an employee proposed a particular topic (we were more interested in the topics themselves than the reasons for suggesting them), we suspected that topic proposals were (a) influenced in terms of the topics’... generality vs. specificity by the employees’ role and level inside the organization and (b) motivated in terms of coverage by either a perceived area of weakness within the organization about a topic or a lack of knowledge about a topic coupled with an intuition that more knowledge is needed. In the future, addressing the influencers and motivators explicitly could provide us with better clarity about the topics proposed and more solid grounding in establishing industrial relevance. **Explain researcher needs and the topic fitness criteria earlier in the process.** Articulating the fitness criteria and using it explicitly during topic selection was extremely useful in communicating our needs. However, doing this upfront may have set boundaries and filtered out some topics though they would be very interesting and useful for practitioners. We plan to discuss the validity of fitness criteria earlier in brainstorming meetings and argue what could be done for topics that researchers did not have much experience, but were considered as useful by practitioners. **Differentiate the experimental approach from other validation strategies used in industry.** The needs, benefits, and caveats of different validation strategies are different, and the companies did not display a clear understanding of the differences, causing them to confuse experiments with pilot studies. This confusion could have been avoided if the experimental approach had been positioned within the larger landscape of empirical approaches. In particular, we could have explained the differences between experiments and other empirical approaches, and the benefits of experiments over other controlled validation models used in industry (e.g. feasibility evaluations, pilots) [3]. **Leverage agile and lean values to get buy-in.** All of the companies were familiar with agile and lean principles, and most had already embraced some relevant key practices. Experimentation is mentioned in several agile and lean approaches in the literature. Thus, we could have leveraged this explicit focus and strengthened the argument for experimentation by appealing to related agile and lean tenets, such as continuous improvement, learning, benchmarking, importance of adaptation to own context, use of scientific method, and measurement. **The training angle gave us the best leverage we had in securing buy-in.** Training is often an integral part of the experimental approach while being of significant interest to the companies. It may be central for aligning research and industry interests. Some organizations have set budgets allocated to training and professional development, with employees being interested. Some organizations have set budgets allocated to training and professional development, with employees being interested. Some organizations have set boundaries and filtered out some topics though they would be very interesting and useful for practitioners. We plan to discuss the validity of fitness criteria earlier in brainstorming meetings and argue what could be done for topics that researchers did not have much experience, but were considered as useful by practitioners. 4. **Conclusions** In this paper, we describe our experience with initial negotiation and topic elicitation for conducting industry experiments with six companies. We do not aim to identify worthwhile topics for all industry experiments, nor attempts to generalize the results pertaining to an instance of topic elicitation. Based on this experience, we have found that identifying relevant and motivating software engineering topics for conducting industry experiments is difficult. There is considerable variation in the selected topics, both within the same organization and across six organizations. Even in the presence of strong consensus, a topic that is deemed industrially relevant may later turn out to be unviable or a poor fit for an experiment. Researchers should therefore be well served by tackling topic selection and fitness early and systematically in their industrial collaborations. Close collaboration with practitioners, i.e., understanding their needs and attracting them for experimentation, is also as essential in industry experiments as in case studies. Researchers should strive to clarify the novelty and relevance of candidate topics with their industrial collaborators. They should make research needs, methods, and criteria for topic selection transparent to companies. 5. **Acknowledgment** This research has been partly funded by Spanish Ministry of Science and Innovation projects TIN2011-23216 and TEKES’ Finland Distinguished Professor Program. 6. **References**
{"Source-Url": "http://oa.upm.es/37553/1/37553_INVE_MEM_2014_195495.pdf", "len_cl100k_base": 6532, "olmocr-version": "0.1.50", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 18402, "total-output-tokens": 6986, "length": "2e12", "weborganizer": {"__label__adult": 0.0004706382751464844, "__label__art_design": 0.0004093647003173828, "__label__crime_law": 0.0003786087036132813, "__label__education_jobs": 0.00812530517578125, "__label__entertainment": 6.473064422607422e-05, "__label__fashion_beauty": 0.0002027750015258789, "__label__finance_business": 0.000728607177734375, "__label__food_dining": 0.0004317760467529297, "__label__games": 0.0006036758422851562, "__label__hardware": 0.0005507469177246094, "__label__health": 0.0004973411560058594, "__label__history": 0.0002987384796142578, "__label__home_hobbies": 0.00011527538299560548, "__label__industrial": 0.0004320144653320313, "__label__literature": 0.0004062652587890625, "__label__politics": 0.0003409385681152344, "__label__religion": 0.0004732608795166016, "__label__science_tech": 0.00566864013671875, "__label__social_life": 0.0001970529556274414, "__label__software": 0.004093170166015625, "__label__software_dev": 0.97412109375, "__label__sports_fitness": 0.0003685951232910156, "__label__transportation": 0.0005731582641601562, "__label__travel": 0.0002372264862060547}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 36139, 0.01638]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 36139, 0.16815]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 36139, 0.95907]], "google_gemma-3-12b-it_contains_pii": [[0, 4461, false], [4461, 11382, null], [11382, 17032, null], [17032, 22264, null], [22264, 29198, null], [29198, 36139, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4461, true], [4461, 11382, null], [11382, 17032, null], [17032, 22264, null], [22264, 29198, null], [29198, 36139, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 36139, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 36139, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 36139, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 36139, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 36139, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 36139, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 36139, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 36139, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 36139, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 36139, null]], "pdf_page_numbers": [[0, 4461, 1], [4461, 11382, 2], [11382, 17032, 3], [17032, 22264, 4], [22264, 29198, 5], [29198, 36139, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 36139, 0.29091]]}
olmocr_science_pdfs
2024-11-28
2024-11-28
5ac1e41b8a7280ed7ceebb488fbe1e530317dfb1
Productivity of non-orthogonal term rewrite systems Raffelsieper, M. Published in: Published: 01/01/2011 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. Productivity of Non-Orthogonal Term Rewrite Systems Matthias Raffelsieper Department of Computer Science, TU Eindhoven P.O. Box 513, 5600 MB Eindhoven, The Netherlands eMail: M.Raffelsieper@tue.nl Abstract Productivity is the property that finite prefixes of an infinite constructor term can be computed using a given term rewrite system. Hitherto, productivity has only been considered for orthogonal systems, where non-determinism is not allowed. This paper presents techniques to also prove productivity of non-orthogonal term rewrite systems. For such systems, it is desired that one does not have to guess the reduction steps to perform, instead any outermost-fair reduction should compute an infinite constructor term in the limit. As a main result, it is shown that for possibly non-orthogonal term rewrite systems this kind of productivity can be concluded from context-sensitive termination. 1 Introduction Productivity is the property that a given set of computation rules computes a desired infinite object. This has been studied mostly in the setting of streams, the simplest infinite objects. However, as already observed in [9], productivity is also of interest for other infinite structures, for example infinite trees, or mixtures of finite and infinite structures. A prominent example of the latter are lists in the programming language Haskell [7], which can be finite (by ending with a sentinel “[]”) or which can go on forever. Existing approaches for automatically checking productivity, e.g., [2, 3, 9], are restricted to orthogonal systems. The main reason for this restriction is that it disallows non-determinism. A complete computer program (i.e., a program and all possible input sequences, neglecting sources of true randomness) always behaves deterministically, as the steps of computation are precisely determined. However, often a complete program is not available, too large to be studied, or its inputs are provided by the user or they are not specified completely. In this case, non-determinism can be used to abstract from certain parts by describing a number of possible behaviors. In such a setting, the restriction to orthogonal systems, which is even far stronger than only disallowing non-determinism, should be removed. An example of such a setting are hardware components, describing streams of output values which are depending on the streams of input values. To analyze such a component in isolation, all possible input streams have to be considered. This paper presents an extension of the techniques in [9] to analyze productivity of specifications that may contain non-determinism. These specifications are assumed to be given as term rewrite systems (TRS) [1], where the terms are considered to have two possible sorts. The first sort \( d \) is for data. Terms of this sort represent the elements in an infinite structure, but which are not infinite terms by themselves. An example for data are the Booleans false and true, or the natural numbers represented in Peano form by the two constructors 0 and succ. The second sort is the sort \( s \) for structure. Terms of this sort are to represent the intended structure containing the data and therefore are allowed to be infinite. We still have to impose some restrictions on specifications to make our approach work. These restrictions are given below in the definition of proper specifications. Definition 1. A proper specification is a tuple \( \mathcal{S} = (\Sigma_d, \Sigma_s, C, R_d, R_s) \), where \( \Sigma_d \) is the signature of data symbols, each of type \( d^m \to d \) (then the data arity of such a symbol \( g \) is defined to be \( \text{ar}_d(g) = m \)), \( \Sigma_s \) is the signature of structure symbols \( f \), which have types of the shape \( d^m \times s^n \to s \) (and data arity \( \text{ar}_d(f) = m \), structure arity \( \text{ar}_s(f) = n \)), \( C \subseteq \Sigma_s \) is a set of constructors, \( R_d \) is a terminating TRS over the signature \( \Sigma_d \), and \( R_s \) is a TRS containing rules \( f(u_1, \ldots, u_m, t_1, \ldots, t_n) \to t \) satisfying the following properties: • $f \in \Sigma_\nu \setminus C$ with $ar_d(f) = m$, $ar_s(f) = n$. • $f(u_1, \ldots, u_m, t_1, \ldots, t_n)$ is a well-sorted linear term, $t$ is a well-sorted term of sort $s$, and • for all $1 \leq i \leq n$ and for all $p \in Pos(t_i)$ such that $t_i|_p$ is not a variable and $root(t_i|_p) \in \Sigma_s$, it holds that $root(t_i|_p) \notin C$ for all $p' < p$ (i.e., no structure symbol is below a constructor). Furthermore, $\mathcal{R}_s$ is required to be exhaustive, meaning that for every $f \in \Sigma_\nu \setminus C$ with $ar_d(f) = m$, $ar_s(f) = n$, ground normal forms $u_1, \ldots, u_m \in \text{NF}_{\text{gnd}}(\mathcal{R}_d)$, and terms $t_1, \ldots, t_n \in T(\Sigma_d \cup \Sigma_s)$ such that for every $1 \leq i \leq n$, $t_i = c_i(u_i', \ldots, u_{i'}', t_1', \ldots, t_n')$ with $u_j' \in \text{NF}_{\text{gnd}}(\mathcal{R}_d)$ for $1 \leq j \leq k = ar_d(c_i)$ and $c_i \in C$, there exists at least one rule $\ell \rightarrow r \in \mathcal{R}_s$ such that $\ell$ matches the term $f(u_1, \ldots, u_m, t_1, \ldots, t_n)$. A proper specification $\mathcal{S}$ is called orthogonal, if $\mathcal{R}_d \cup \mathcal{R}_s$ is orthogonal, otherwise it is called non-orthogonal. Nesting of structure symbols inside constructors on left-hand sides of $\mathcal{R}_s$ is disallowed for technical reasons, however it is not a severe restriction in practice. Often, it can be achieved by unfolding the specification, as was presented in [4, 8]. The above definition coincides with the definition of proper specifications given in [9] for orthogonal proper specifications.\footnote{To see this, observe that a defined symbol cannot occur on a non-root position of a left-hand side. Otherwise, such a subterm would unify with some left-hand side due to exhaustiveness, which would contradict orthogonality.} For such orthogonal proper specifications, productivity is the property that every prefix depth $d \in \mathbb{N}$, the term $t$ can be rewritten to another term $t'$ having only constructor symbols on positions of depth $d$ or less. It was already observed in [2] that productivity of orthogonal specifications is equivalent to the existence of an outermost-fair reduction computing a constructor prefix for any given depth. Below, we give a general definition of outermost-fair reductions, as they will also be used in the non-orthogonal setting. **Definition 2.** - A redex is a subterm $t|_p$ of a term $t$ at position $p \in Pos(t)$ such that a rule $\ell \rightarrow r$ and a substitution $\sigma$ exist with $t|_p = \ell \sigma$. The redex $t|_p$ is said to be matched by the rule $\ell \rightarrow r$. - A redex is called outermost iff it is not a strict subterm of another redex. - A redex $t|_p = \ell \sigma$ is said to survive a reduction step $t \rightarrow t' \rightarrow t''$ if $p \parallel q$, or if $p < q$ and $t' = t[\ell \sigma']|_p$ for some substitution $\sigma'$ (i.e., the same rule can still be applied at $p$). - A rewrite sequence (reduction) is called outermost-fair, iff there is no outermost redex that survives as an outermost redex infinitely long. - A rewrite sequence (reduction) is called maximal, iff it is infinite or ends in a normal form (a term that cannot be rewritten further). For non-orthogonal proper specifications, requiring just the existence of a reduction to a constructor prefix of arbitrary depth does not guarantee an outermost-fair rewrite sequence to reach it, due to the possible non-deterministic choices. **Example 3.** Consider a proper specification with the TRS $\mathcal{R}_s$ consisting of the following rules: \[ \begin{align*} \text{maybe} & \rightarrow 0 : \text{maybe} & \text{random} & \rightarrow 0 : \text{random} \\ \text{maybe} & \rightarrow \text{maybe} & \text{random} & \rightarrow 1 : \text{random} \end{align*} \] This specification is not orthogonal, since the rules for maybe and those for random overlap. We do not want to call this specification productive, since it admits the infinite outermost-fair reduction maybe $\rightarrow$ maybe $\rightarrow \ldots$ that never produces any constructors. However, there exists an infinite reduction producing infinitely many constructors starting in the term maybe, namely maybe $\rightarrow 0 :$ maybe $\rightarrow 0 : 0 :$ maybe $\rightarrow \ldots$. When only considering the rules for random then we want to call the resulting specification productive, since no matter what rule of random we choose, an element of the stream is created. Requiring just the existence of a constructor normal form is called weak productivity in [2]. We already stated above that this is not the notion of productivity we are interested in, since it requires to “guess” the reduction steps leading to a constructor term. The notion we are interested in is strong productivity, which requires all outermost-fair reductions to reach a constructor term. This kind of productivity was also defined in [2]. Definition 4. A proper specification $S$ is called strongly productive iff for every ground term $t$ of sort $s$ all maximal outermost-fair rewrite sequences starting in $t$ end in (i.e., have as limit for infinite sequences) a constructor normal form. Thus, the term maybe in Example 3 is not strongly productive, whereas the term random in that example is strongly productive. It was shown in [2] that weak and strong productivity coincide for orthogonal proper specifications. 2 Criteria for Strong Productivity An orthogonal proper specification is productive if and only if a reduction exists that creates a constructor at the top, as was shown in [9]. This is also the case for non-orthogonal proper specifications. However, here we have to consider all maximal outermost-fair reductions, instead of just requiring the existence of such a reduction. Hence, the characterization for strong productivity used in this paper is the following. Proposition 5. Let $S$ be a proper specification. Then $S$ is strongly productive iff for every maximal outermost-fair reduction $t_0 \rightarrow^* R_0 \cup R_1 \cup \ldots$ with $t_0$ being of sort $s$ there exists $k \in \mathbb{N}$ such that $\text{root}(t_k) \in C$. This characterization of productivity leads to a first technique to prove strong productivity of proper specifications. It is a simple syntactic check that determines whether every right-hand side of sort $s$ starts with a constructor. For orthogonal proper specifications, this was already observed in [9]. Theorem 6. Let $S$ be a proper specification. If for all rules $\ell \rightarrow r \in R_s$ we have $\text{root}(r) \in C$, then $S$ is strongly productive. The above criterion is sufficient to prove strong productivity of the proper specification consisting of the two rules for random in Example 3, since both have right-hand sides with the constructor : at the root. However, it is easy to create examples which are strongly productive, but do not satisfy the syntactic requirements of Theorem 6. Example 7. Consider the proper specification with the following TRS $R_s$: \[ \begin{align*} \text{ones} & \rightarrow 1 : \text{ones} \\ \text{finZeroes} & \rightarrow 0 : 0 : \text{ones} \\ f(0 : xs) & \rightarrow f(xs) \\ \text{finZeroes} & \rightarrow 0 : \text{ones} \\ f(1 : xs) & \rightarrow 1 : f(xs) \end{align*} \] The constant finZeroes produces non-deterministically a stream that starts with one, two, or three zeroes followed by an infinite stream of ones. Function $f$ takes a binary stream as argument and filters out all occurrences of zeroes. Thus, productivity of this example proves that only a finite number of zeroes can be produced. This however cannot be proven with the technique of Theorem 6, since the right-hand side of the rule $f(0 : xs) \rightarrow f(xs)$ does not start with the constructor :. Another technique presented in [9] to show productivity of orthogonal proper specifications is based on context-sensitive termination. The idea is to disallow rewriting in structure arguments of constructors, thus context-sensitive termination implies that for every ground term of sort $s$, a term starting with a constructor can be reached (due to the exhaustiveness requirement). As was observed by Endrullis and Hendriks recently in [4], this set of blocked positions can be enlarged, making the approach even stronger. Below, the technique for proving productivity by showing termination of a corresponding context-sensitive TRS is extended to also be applicable in the case of our more general proper specifications. This version already includes an adaption of the improvement mentioned above. **Definition 8.** Let $S$ be a proper specification. The replacement map $\mu_S : \Sigma_d \cup \Sigma_s \to 2^N$ is defined as follows: - $\mu_S(f) = \{1, \ldots, ar_d(f)\}$, if $f \in \Sigma_d \cup C$ - $\mu_S(f) = \{1, \ldots, ar_d(f) + ar_s(f)\} \setminus \{1 \leq i \leq ar_d(f) + ar_s(f) \mid t_i \text{ is a variable for all } \ell \to r \in \mathcal{R}_s \text{ and all non-variable subterms } t \text{ of } \ell \text{ with root}(t) = f\}$, otherwise In the remainder, we leave out the subscript $S$ if the specification is clear from the context. The replacement map $\mu$ is used to define the set of *allowed* positions of a non-variable term $t$ as $\text{Pos}_\mu(t) = \{i \mid i \in \mu(\text{root}(t)), p \in \text{Pos}_\mu(t_i)\}$. This replacement map is *canonical* [6] for the left-linear TRS $\mathcal{R}_s$, guaranteeing that non-variable positions of left-hand sides are allowed. We extend it to the non-left-linear TRS $\mathcal{R}_d \cup \mathcal{R}_s$ by allowing all arguments of symbols from $\Sigma_d$. Context-sensitive rewriting is the restriction of the rewrite relation to those redexes on positions from $\text{Pos}_\mu$. Formally, $t \mu \to t' \mu$ if $t \to t' \mu$ and $p \in \text{Pos}_\mu(t)$ and we say a TRS $\mathcal{R}$ is *\(\mu\)-terminating* iff no infinite $\mu$-chain exists. Our main result of this paper is that also for possibly non-orthogonal proper specifications, $\mu$-termination implies productivity. **Theorem 9.** A proper specification $S = (\Sigma_d, \Sigma_s, C, \mathcal{R}_d, \mathcal{R}_s)$ is strongly productive, if $\mathcal{R}_d \cup \mathcal{R}_s$ is $\mu_S$-terminating. It can be shown that Theorem 9 subsumes Theorem 6, since for a TRS $\mathcal{R}_s$ with root$(r) \in C$ for all $\ell \to r \in \mathcal{R}_s$, the only allowed positions on right-hand sides are of sort $d$ and $\mathcal{R}_d$ is terminating. The technique of Theorem 9, i.e., proving $\mu$-termination of the corresponding context-sensitive TRS, is able to prove strong productivity of Example 7. This can for example be seen by typing the corresponding context-sensitive TRS into a modern termination tool such as AProVE [5]. Checking productivity in this way, i.e., by checking context-sensitive termination, can only prove productivity but not disprove it. This is illustrated in the next example. **Example 10.** Consider the proper specification with the following rules in $\mathcal{R}_s$: \[ \begin{align*} a & \to f(a) \\ f(x; xs) & \to x : f(xs) \\ f(f(xs)) & \to 1 : xs \end{align*} \] Starting in the term $a$, we observe that an infinite $\mu$-reduction starting with $a \to f(a)$ exists, which can be continued by reducing the underlined redex repeatedly, since $\mu(f) = \{1\}$. Thus, the example is not $\mu$-terminating. However, the specification is productive, as can be shown by a case analysis based on the root symbol of some arbitrary ground term $t$. In case $\text{root}(t) = \cdot$, then nothing has to be done, according to Proposition 5. Otherwise, if $\text{root}(t) = a$, then any maximal outermost-fair reduction must start with $t = a \to f(a)$, thus we can reduce our analysis to the final case, where $\text{root}(t) = f$. In this last case, $t = f(t')$. Due to the rules for the symbol $f$, another case analysis is performed for $t'$. If $\text{root}(t') = \cdot$, then this --- 2 Note that in [4], Endrullis and Hendriks consider orthogonal TRSs and also block arguments of symbols in $\Sigma_d$ that only contain variables on left-hand sides of $\mathcal{R}_d$. This however is problematic when allowing non-left-linear data rules. Example: \[ \begin{align*} \mathcal{R}_s : & f(1) \to f(d(0,d(1,0))) \\ \mathcal{R}_d : & d(x,x) \to 1 \\ \end{align*} \] Here, the term $f(d(0,d(1,0)))$ can only be $\mu$-rewritten to the term $f(0)$ (which then in turn has to be rewritten to $c$) if defining $\mu(d) = \{1\}$, since the subterm $d(1,0)$ can never be rewritten to $0$. However, the example is not strongly productive, as reducing in this way gives rise to an infinite outermost-fair reduction $f(d(0,d(1,0))) \to f(d(0,0)) \to f(1) \to \ldots$. Blocking arguments of data symbols can only be done when $\mathcal{R}_d$ is left-linear. 3 The requirement of $t$ not being a variable ensures that $\text{root}(t)$ is defined. constructor cannot be reduced further. Hence, in any maximal outermost-fair reduction sequence a redex of the form $f(\tilde{u} : t)$ exists at the root, until it is eventually reduced using the second rule which results in a term with the constructor $:\$ at the root. For root($t' = a$) we again must reduce $t = f(a) \rightarrow f(f(a))$. Finally, in case $t = f(t' = f(t''))$, we have two possibilities. The first one occurs when the term $t'$ is eventually reduced at the root. Since root($t' = f$), this has to happen with either of the $f$-rules, creating a constructor $:\$. which, as we already observed, must eventually result in the term $t$ also being reduced to a term with the constructor $:\$ at the root. Otherwise, in the second possible scenario, the term $t'$ is never reduced at the root. Then however, an outermost redex of the shape $f(f(\tilde{t}))$ exists in all terms that $t$ can be rewritten to in this way, thus it has to be reduced eventually with the third rule. This again creates a term with constructor $:\$ at the root. Combining all these observations, we see that in every maximal outermost-fair reduction there exists a term with the constructor $:\$ as root symbol, which proves productivity due to Proposition 5. 3 Conclusions and Future Work We have presented a generalization of the productivity checking techniques in [9] (including an improvement observed in [4]) to non-orthogonal specifications, which are able to represent non-deterministic systems. These naturally arise when abstracting away certain details of an implementation, such as for example concrete sequences of input values. A main difference to the orthogonal setting is that in the non-orthogonal case, a single reduction to a constructor term is not sufficient, instead all outermost-fair reductions must be considered. Our non-orthogonal setting still imposes certain restrictions on the specifications that can be treated. The most severe restriction is the requirement of left-linear rules in $R_s$. Dropping this requirement however would make Theorem 9 unsound. Similarly, also the requirement that structure arguments of constructors must be variables cannot be dropped without losing soundness of Theorem 9. This requirement however is not that severe in practice, since many specifications can be unfolded by introducing fresh symbols [4, 8]. In the future, it would be interesting to investigate whether transformations of non-orthogonal proper specifications, similar to those in [9], can be defined. It is clear that rewriting of right-hand sides for example is not productivity-preserving for non-orthogonal specifications, since it only considers one possible reduction. However, it would be interesting to investigate whether for example narrowing of right-hand sides is productivity preserving, as it considers all possible reductions. References
{"Source-Url": "https://pure.tue.nl/ws/files/3727686/Metis254727.pdf", "len_cl100k_base": 5412, "olmocr-version": "0.1.53", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 22162, "total-output-tokens": 6475, "length": "2e12", "weborganizer": {"__label__adult": 0.0005745887756347656, "__label__art_design": 0.0005002021789550781, "__label__crime_law": 0.00075531005859375, "__label__education_jobs": 0.0014028549194335938, "__label__entertainment": 0.00011718273162841796, "__label__fashion_beauty": 0.00028896331787109375, "__label__finance_business": 0.00040841102600097656, "__label__food_dining": 0.0007014274597167969, "__label__games": 0.0008134841918945312, "__label__hardware": 0.001316070556640625, "__label__health": 0.002048492431640625, "__label__history": 0.0003924369812011719, "__label__home_hobbies": 0.00018167495727539065, "__label__industrial": 0.0007219314575195312, "__label__literature": 0.0008077621459960938, "__label__politics": 0.0004875659942626953, "__label__religion": 0.000911235809326172, "__label__science_tech": 0.1370849609375, "__label__social_life": 0.00018417835235595703, "__label__software": 0.00586700439453125, "__label__software_dev": 0.8427734375, "__label__sports_fitness": 0.0004651546478271485, "__label__transportation": 0.0009012222290039062, "__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, 23511, 0.01584]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 23511, 0.74558]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 23511, 0.86682]], "google_gemma-3-12b-it_contains_pii": [[0, 2171, false], [2171, 6297, null], [6297, 10798, null], [10798, 14629, null], [14629, 19224, null], [19224, 23511, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2171, true], [2171, 6297, null], [6297, 10798, null], [10798, 14629, null], [14629, 19224, null], [19224, 23511, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 23511, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 23511, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 23511, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 23511, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 23511, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 23511, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 23511, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 23511, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 23511, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 23511, null]], "pdf_page_numbers": [[0, 2171, 1], [2171, 6297, 2], [6297, 10798, 3], [10798, 14629, 4], [14629, 19224, 5], [19224, 23511, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 23511, 0.0]]}
olmocr_science_pdfs
2024-12-09
2024-12-09
09f80a9d4a212ff4935e5599cc1295b8be737e39
Outline 1. Background - In-lined Reference Monitors (IRM)s - Aspect-Oriented Programming (AOP) 2. Contributions - SPoX (Security Policy XML) - Automated policy analysis - Service-oriented IRM}s 3. Next paper: Automated IRM certification Publications Service-Oriented Security Problem Client enters address Applet server Geospatial data server Client requests drug stores in city Policy: User is willing to divulge city but \textit{not} street to server. End Goal: Formally Certified IRMs Trusted Rewriter Untrusted Policy Untrusted binary Rewritten binary End Goal: Formally Certified IRMs - Trusted - Policy - Verifier - yes → accept - no → reject - Untrusted - Untrusted binary - Rewriter - Rewritten binary End Goal: Formally Certified IRMs Trusted Verifier yes Policy no Untrusted Rewriter Untrusted binary Rewritten binary accept reject Security Automata An established way to describe security policies* **Network Send Policy (N):** Untrusted applets may not send messages over the network after they have read from the street field. *[Alpern & Schneider, J.Distrib. Comp. '86]* Security Automata Resource Bound Policy (R): Do not create more than 3 new files on the user’s desktop. Enforcement Approaches 1. Add runtime security checks to the OS or VM – OS/VM is large and difficult to modify – Hard to verify that customized OS/VM is secure 2. Statically verify that the binary code is secure – Undecidable in general – Especially difficult for temporal policies 3. Automatically inject security checks into the untrusted binary code – The approach used in In-lined Reference Monitors (IRMs) In-lined Reference Monitors Uninstrumented code: ```java int s = 0; if (Regex.matches(arg1, ".*\Users\.*\Desktop\.*") if (s == 3) halt(); if (s >= 0 && s <= 2) s := s + 1; } ``` Instrumented code: ```java File.new(arg1); if (Regex.matches(arg1, ".*\Users\.*\Desktop\.*") File.new(arg1); if (s == 3) halt(); if (s >= 0 && s <= 2) s := s + 1; } In-lining Process Original code: ```java ... File.new(arg1); ...``` Rewritten code: ```java ... if (Regex.matches(arg1, ".*\Users\.*\Desktop\.*") { if (s == 3) halt(); if (s >= 0 && s <= 2) s := s + 1; } File.new(arg1); ...``` Security Policy Rewriter [Jones & Hamlen, ISI ‘09] IRM Systems • SASI [Erlingsson & Schneider, NSPW ‘99] – Early IRM for Java and x86 binaries • PoET/PSLang [Erlingsson, PhD Thesis ‘04] – Successor to SASI, IRM for Java – Enforces more complex policies than SASI • Java-MaC [Kim et al., FMSD ’04] – Uses language with limited ability to specify security-relevant events • ConSpec [Aktug & Naliuka, SCP ‘08] – Uses limited, effect-free version of PSLang – Guard instructions are trusted Aspect-Oriented Programming (AOP) • Emerging form of software development • Builds upon (does not replace) OOP • Two components: – Pointcuts describe sets of instructions – Advice provides code to run before, after, or around instructions matched by pointcuts • The combination of a pointcut and its corresponding advice is an Aspect • In-lining a security automaton is really AOP An Example Aspect [The AspectJ Manual, §2.2.1] ```java aspect FaultHandler { private boolean Server.disabled = false; private void reportFault() { System.out.println("Failure! Please fix!"); } public static void fixServer(Server s) { s.disabled = false; } pointcut services(Server s): call(public * *(..)) && target(s); before(Server s): services(s) { if (s.disabled) throw new DisabledException(); } after(Server s) throwing (FaultException e): services(s) { s.disabled = true; reportFault(); } } ``` AspectJ Pointcut Language call\(\text{MethodPattern}\) – matches call sites call\(\text{MethodPattern}\) – matches method entry points get\(\text{FieldPattern}\) – matches field-reads set\(\text{FieldPattern}\) – matches field-writes \(p_1 \&\& p_2\) – matches places where both \(p_1\) and \(p_2\) match \(p_1 \mid\mid p_2\) – matches places where \(p_1\) or \(p_2\) matches (or both) !\(p\) – matches when \(p\) doesn’t match within\(\text{TypePattern}\) – matches all code within a class within\(\text{MethodPattern}\) – matches all code within a method cflow\(p\) – matches anytime there is a stack frame matching \(p\) CFlow Examples • $\text{cflow} \left( \text{call}(f) \right) \land \text{cflow} \left( \text{call}(g) \right) \land \text{call}(h)$ – f and g are both on the call stack when h is called • $\text{cflow} \left( \text{call}(f) \land \text{call}(g) \right) \land \text{call}(h)$ – there is a stack frame that is both a call to f and a call to g – impossible! (unless f and g are the same function) • $\text{cflow} \left( \text{call}(f) \land \neg \text{within}(g) \right) \land \text{call}(h)$ – h is called while there is a call to f on the stack, and the call to f was not located within g Aspect-Oriented IRMs Enforcing **3-desktop-files** policy using Java-MOP*: ```java import java.util.regex.*; SafeFile() { static int counter = 0; static final String REGEX = ".*\Users\.*\Desktop\.*"; static final int MAX_FILES = 3; event createFile before() : call(File.new(filename)) { if (Pattern.matches(REGEX, filename)) { if (counter >= MAX_FILES) System.exit(1); else counter++; } } } * [Chen & Roşu, TACAS ‘05] Aspect-Oriented IRMs An alternate version: ```java import java.util.regex.*; SafeFile() { static int counter = 0; static final String REGEX = ".*\Users\.*\Desktop\.*"; static final int MAX_FILES = 3; event createFile before() : call(File.new(filename)) { if (Pattern.matches(REGEX, filename)) counter++; } event illegalCreateFile before() : call(*.new(filename)) { if (Pattern.matches(REGEX, filename) && counter >= MAX_FILES) System.exit(1); } } ``` (policy (state name="s") (pointcut name="new_desktop_file" (and (call "File.new") (argval 1 (streq ".*\Users\.*\Desktop\.*")))) (forall var="i" from="0" to="2" (edge name="count" (pointcutid "new_desktop_file") (nodes var="s" i, i+1))))) (edge name="too_many_files" (pointcutid "new_desktop_file") (nodes var="s" 3, #)))) **SPoX Pointcut Extensions** \[ \text{argval}(i, \text{ValuePredicate}) \text{ – arg } i \text{ of operation satisfies } \text{ValPred} \] \[ \text{argtyp}(i, \text{TypePattern}) \text{ – arg } i \text{ has type } \text{TypePattern} \] **Value Predicates** \[ \text{intle}(n) \text{ – matches integer values no greater than } n \] \[ \text{streq}(\text{Regexp}) \text{ – matches string values matching } \text{Regexp} \] SPoX • SPoX specifications denote security automata • Denotational semantics: \[ q \in Q = (SV \cup (Obj \times SV)) \rightarrow N \] \[ S \in SM = (SV \cup (ID \times SV)) \rightarrow N \] \[ I \in IM = IV \rightarrow N \] \[ b \in Bnd = ID \rightarrow Obj \] \[ r \in OBnd = Bnd \cup \{\text{Fail}\} \] \[ P : pol \rightarrow (\gamma \times 2^Q \times \gamma \times ((Q \times JP) \rightarrow 2^Q)) \] \[ ES : edg \rightarrow IM \rightarrow 2^{(JP \rightarrow OBnd) \times SM \times SM} \] \[ PC : pcd \rightarrow JP \rightarrow OBnd \] \[ EP : s \rightarrow IM \rightarrow (SM \times SM) \] \[ A : a \rightarrow IM \rightarrow N \] security states state-variable maps iteration var maps bindings optional bindings policy denotations edgeset denotations pointcut denotations endpoint constraints arithmetic \[ P[edg_1 \ldots edg_n] = (Q, \{q_0\}, JP, \delta) \] \[ \text{where } q_0 = (SV \cup (Obj \times SV)) \times \{0\} \] \[ \text{and } \delta(q, JP) = \{q[S'[b]] | (f, S, S') \in \cup_{1 \leq i \leq n} ES[edg_i] \} \] \[ f(jp) = b, S[b] \in q \} \[ ES[\text{forall var} \text{ iv from} \text{ a1 to} \text{ a2} \text{ edg}/\text{forall}]I = \] \[ \cup_A[1;11]_1 \leq j \leq A[1;12]]I_1 ES[edg][I[j/iv]] \] \[ ES[\text{edge} pcd ep_1 \ldots ep_n/\text{edge}]I = \] \[ \{p,c[pcd], \cup_1 \leq i \leq nS_j, \cup_1 \leq j \leq nS'_j\} \] \[ \text{where } \forall j \in N. (1 \leq j \leq n) \Rightarrow ((S_j, S'_j) = EP[ep_j][I]) \] \[ PC[pcd]jp = match-pcd(pcd)jp \] \[ EP[\text{nodes var} \text{ sv} \text{ a1, a2}/\text{nodes}]I = \] \[ \{(sv, A[a1][I]), (sv, A[a2][I])\} \] \[ EP[\text{nodes obj} \text{ id} \text{ var} \text{ sv} \text{ a1, a2}/\text{nodes}]I = \] \[ \{((id, sv), A[a1][I]), (((id, sv), A[a2][I])\} \] A[n]I = n [Hamlen & Jones, PLAS ‘08] Debugging SPoX Policies Buggy policy: (policy (state name="s") (pointcut name="new_desktop_file" (and (call "File.new") (argval 1 (streq ".\Users\.*\"\Desktop\.*")))) (forall var="i" from="0" to="3" (edge name="count" (pointcutid "new_desktop_file") (nodes var="s" i, i+1))) (edge name="too_many_files" (pointcutid "new_desktop_file") (nodes var="s" 3, #))) Debugging SPoX Policies Non-deterministic automaton: Aspect-Oriented IRMs An alternate version: ```java import java.util.regex.*; SafeFile() { static int counter = 0; static final String REGEX = ".*\Users\.*\Desktop\.*"; static final int MAX_FILES = 3; event createFile before() : call(File.new(filename)) { if (Pattern.matches(REGEX, filename)) counter++; } event illegalCreateFile before() : call(*.new(filename)) { if (Pattern.matches(REGEX, filename) && counter >= MAX_FILES) System.exit(1); } } ``` Debugging SPoX Policies • Declarative policies allow detection of non-determinism • SPoX non-determinism detection is reducible to: – Integer linear programming • Determines ambiguous state transitions – Boolean satisfiability (SAT) • Determines overlap of pointcuts – Regular language non-emptiness • Determines overlap of regular expressions in pointcuts [Jones & Hamlen, AOSD ‘10] Debugging SPoX Policies • SAT reduction for pointcuts E1 label: \[(\text{and})\] \[(\text{call } "\text{File.open}"), (\text{argval 1 (streq "filename"))})\] \[\rightarrow A*B\] E2 label: \[(\text{or})\] \[(\text{call } "\text{File.open}"), (\text{call } "\text{File.close}"))\] Constraint: \(\neg(A*C)\) \[S = (A*B)*(A+C)*\neg(A*C)\] # Constraint Chart <table> <thead> <tr> <th></th> <th>call</th> <th>exec</th> <th>get</th> <th>set</th> <th>argv</th> <th>targ</th> <th>argt</th> <th>with</th> </tr> </thead> <tbody> <tr> <td>call</td> <td>CR</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>exec</td> <td>E</td> <td>CR</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>get</td> <td>E</td> <td>E</td> <td>CR</td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>set</td> <td>E</td> <td>E</td> <td>E</td> <td>CR</td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>argv</td> <td>C</td> <td>C</td> <td>E</td> <td>C</td> <td>CR</td> <td>RV</td> <td></td> <td></td> </tr> <tr> <td>targ</td> <td>CR</td> <td>CR</td> <td>C</td> <td>C</td> <td>I</td> <td>CR</td> <td></td> <td></td> </tr> <tr> <td>argt</td> <td>C</td> <td>C</td> <td>E</td> <td>C</td> <td>T</td> <td>I</td> <td>CR</td> <td></td> </tr> <tr> <td>with</td> <td>I</td> <td>E</td> <td>I</td> <td>I</td> <td>I</td> <td>I</td> <td>I</td> <td>CR</td> </tr> </tbody> </table> **Legend:** - **I**: independent (no constraint required) - **E**: mutually exclusive (use constraint $\neg(a \land b)$) - **C**: independent except for known classes - **R**: regular expression non-emptiness check - **V**: argval check - **T**: argval–argtyp compatibility check Non-Determinism Tool Runtimes - Implemented in Java using Prolog CLP - 9200 lines of Java; Prolog code is dynamically generated - Median runtime per line of policy code: 3.2 ms <table> <thead> <tr> <th>Policy</th> <th>Size (chars)</th> <th>Pointcut vars</th> <th>CNF vars</th> <th>CNF clauses</th> <th>Runtimes</th> </tr> </thead> <tbody> <tr> <td>FileMode</td> <td>1488</td> <td>9</td> <td>1764</td> <td>2061</td> <td>2243ms</td> </tr> <tr> <td>FileModeFixed</td> <td>1570</td> <td>8</td> <td>706</td> <td>850</td> <td>248ms</td> </tr> <tr> <td>Logger</td> <td>722</td> <td>2</td> <td>10</td> <td>12</td> <td>235ms</td> </tr> <tr> <td>LoggerFixed</td> <td>956</td> <td>3</td> <td>34</td> <td>40</td> <td>156ms</td> </tr> <tr> <td>GetPermission</td> <td>938</td> <td>5</td> <td>44</td> <td>57</td> <td>90ms</td> </tr> <tr> <td>GetPermissionFixed</td> <td>1189</td> <td>5</td> <td>49</td> <td>61</td> <td>85ms</td> </tr> <tr> <td>FileExists</td> <td>437</td> <td>3</td> <td>10</td> <td>14</td> <td>35ms</td> </tr> <tr> <td>FileExistsFixed</td> <td>423</td> <td>0</td> <td>0</td> <td>0</td> <td>25ms</td> </tr> <tr> <td>NoFreeride</td> <td>1024</td> <td>3</td> <td>22</td> <td>28</td> <td>797ms</td> </tr> <tr> <td>NoFreerideFixed</td> <td>1075</td> <td>3</td> <td>18</td> <td>22</td> <td>825ms</td> </tr> <tr> <td>Encrypt</td> <td>986</td> <td>3</td> <td>34</td> <td>40</td> <td>163ms</td> </tr> <tr> <td>Log&amp;Encrypt</td> <td>2281</td> <td>4</td> <td>972</td> <td>1180</td> <td>538ms</td> </tr> <tr> <td>Log&amp;EncryptFixed</td> <td>2321</td> <td>4</td> <td>578</td> <td>703</td> <td>391ms</td> </tr> </tbody> </table> Service-Oriented IRMs Applet server Geospatial data server Client Applet requests drug stores in city Returns drug stores in city Trusted Computing Base (TCB) SPoX Java Rewrite service JAR File: Browse Policy File: Browse Rewrite Request applet Provide applet Return safe applet Submit applet and policy Service-Oriented IRMs - Web service provides trusted in-liner - Under submission to MobiWIS 2011 - Statistics: <table> <thead> <tr> <th>Program</th> <th>Original Size (KB)</th> <th>Rewritten size (KB)</th> <th>Rewrite time (s)</th> </tr> </thead> <tbody> <tr> <td>jWeatherWatch</td> <td>140</td> <td>146</td> <td>4.3</td> </tr> <tr> <td>Google.mE</td> <td>921</td> <td>513</td> <td>21.7</td> </tr> <tr> <td>Jeti</td> <td>533</td> <td>474</td> <td>20.4</td> </tr> </tbody> </table> End Goal: Formally Certified IRMs - Trusted - Policy - Rewriter - Verifier - yes - accept - no - reject - Untrusted - Untrusted binary - Rewritten binary Conclusion • Main Contributions 1. SPoX (Security Policy XML) • Fully declarative, aspect-oriented policy language • Working rewriter 2. Automated policy analysis • Tool detects non-determinism in SPoX policies 3. Service-oriented IRMs • Web service provides trusted rewriting service 4. Automated IRM certification • Next time! References
{"Source-Url": "http://utdallas.edu/~hamlen/cs6301fa15/cs6301fa15-spox.pdf", "len_cl100k_base": 4877, "olmocr-version": "0.1.53", "pdf-total-pages": 35, "total-fallback-pages": 0, "total-input-tokens": 47881, "total-output-tokens": 6865, "length": "2e12", "weborganizer": {"__label__adult": 0.0003323554992675781, "__label__art_design": 0.0002034902572631836, "__label__crime_law": 0.0004580020904541016, "__label__education_jobs": 0.0006442070007324219, "__label__entertainment": 4.285573959350586e-05, "__label__fashion_beauty": 0.0001227855682373047, "__label__finance_business": 0.0002114772796630859, "__label__food_dining": 0.0002295970916748047, "__label__games": 0.00036072731018066406, "__label__hardware": 0.0005774497985839844, "__label__health": 0.0003173351287841797, "__label__history": 0.00012695789337158203, "__label__home_hobbies": 7.098913192749023e-05, "__label__industrial": 0.00028705596923828125, "__label__literature": 0.0001823902130126953, "__label__politics": 0.00023257732391357425, "__label__religion": 0.00032639503479003906, "__label__science_tech": 0.005199432373046875, "__label__social_life": 9.059906005859376e-05, "__label__software": 0.003948211669921875, "__label__software_dev": 0.9853515625, "__label__sports_fitness": 0.0002498626708984375, "__label__transportation": 0.00035762786865234375, "__label__travel": 0.00014638900756835938}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 16831, 0.01737]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 16831, 0.09787]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 16831, 0.59782]], "google_gemma-3-12b-it_contains_pii": [[0, 0, null], [0, 255, false], [255, 1361, null], [1361, 1570, null], [1570, 1678, null], [1678, 1854, null], [1854, 1997, null], [1997, 2243, null], [2243, 2348, null], [2348, 2777, null], [2777, 3177, null], [3177, 3486, null], [3486, 3937, null], [3937, 4323, null], [4323, 4882, null], [4882, 5507, null], [5507, 6106, null], [6106, 6589, null], [6589, 7099, null], [7099, 7463, null], [7463, 7889, null], [7889, 9775, null], [9775, 10180, null], [10180, 10234, null], [10234, 10744, null], [10744, 11149, null], [11149, 11492, null], [11492, 12444, null], [12444, 14048, null], [14048, 14366, null], [14366, 14879, null], [14879, 15077, null], [15077, 15426, null], [15426, 16169, null], [16169, 16831, null]], "google_gemma-3-12b-it_is_public_document": [[0, 0, null], [0, 255, true], [255, 1361, null], [1361, 1570, null], [1570, 1678, null], [1678, 1854, null], [1854, 1997, null], [1997, 2243, null], [2243, 2348, null], [2348, 2777, null], [2777, 3177, null], [3177, 3486, null], [3486, 3937, null], [3937, 4323, null], [4323, 4882, null], [4882, 5507, null], [5507, 6106, null], [6106, 6589, null], [6589, 7099, null], [7099, 7463, null], [7463, 7889, null], [7889, 9775, null], [9775, 10180, null], [10180, 10234, null], [10234, 10744, null], [10744, 11149, null], [11149, 11492, null], [11492, 12444, null], [12444, 14048, null], [14048, 14366, null], [14366, 14879, null], [14879, 15077, null], [15077, 15426, null], [15426, 16169, null], [16169, 16831, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 16831, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 16831, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 16831, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 16831, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 16831, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 16831, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 16831, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 16831, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 16831, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 16831, null]], "pdf_page_numbers": [[0, 0, 1], [0, 255, 2], [255, 1361, 3], [1361, 1570, 4], [1570, 1678, 5], [1678, 1854, 6], [1854, 1997, 7], [1997, 2243, 8], [2243, 2348, 9], [2348, 2777, 10], [2777, 3177, 11], [3177, 3486, 12], [3486, 3937, 13], [3937, 4323, 14], [4323, 4882, 15], [4882, 5507, 16], [5507, 6106, 17], [6106, 6589, 18], [6589, 7099, 19], [7099, 7463, 20], [7463, 7889, 21], [7889, 9775, 22], [9775, 10180, 23], [10180, 10234, 24], [10234, 10744, 25], [10744, 11149, 26], [11149, 11492, 27], [11492, 12444, 28], [12444, 14048, 29], [14048, 14366, 30], [14366, 14879, 31], [14879, 15077, 32], [15077, 15426, 33], [15426, 16169, 34], [16169, 16831, 35]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 16831, 0.07481]]}
olmocr_science_pdfs
2024-12-08
2024-12-08
b6addd8a8843f912bd24dff8d738bbf44a298635
A PERSPECTIVE APPROACH OF SOFTWARE RELIABILITY MODELS AND TECHNIQUES Chahat Sharma and Sanjay Kumar Dubey Department of Computer Science and Engineering, ASET, Amity University, Noida (U.P.), India E-Mail: chahat.s.03@gmail.com ABSTRACT Software Reliability holds an important place in maintaining software quality. The efficiency of any software depends on its reliable nature. The evaluation of reliability is a prime function of any software system. A widespread research has been done and various methodologies exist to predict the reliability of software systems. This paper extracts relevant methodologies from various journals, conferences and transactions. It is a perspective approach to analyze the widely used models and techniques which are used to measure software reliability. The paper is mainly divided into five sections: elucidate the evolution of various models and approaches of software reliability, illustrates the object oriented metrics used for estimation of software reliability, the review approach, the literature review and the review results along with certain merits and issues which form basis to bridge the gap between the current and the past research done on software reliability. It also discusses about the future work to stretch the breadth of the relevant literature in order to conduct more research on the extensively used reliability techniques in software industry. Keywords: software reliability, model, technique, metrics, assessment. INTRODUCTION Software reliability is an essential and crucial factor to estimate software quality. Software reliability is the probability that software will not cause the failure of a system for a specified time under specified conditions [1]. ISO/IEC 25010:2011 product quality model defines reliability as the degree to which a system, component or product performs specified functions under specified conditions for a specified period of time [2]. Reliability is a key factor among the eight functional characteristics of quality model that contributes to the efficiency of the software system. The reliability characteristic is further composed of four related sub-characteristics which are maturity, availability, fault tolerance and availability. Just like hardware, the reliability of software can be measured and evaluated [3]. The evaluation of reliability is very important as it contributes to the economic success of any software system. There are various approaches that can be used to measure the reliability of the software system. The software reliability is inversely related to software complexity [4]. Hence it is required to analyse different reliability metrics under different factors that can affect reliability. In the recent years various software reliability growth models have been proposed [5, 6, and 7]. In general there are two reliability models - deterministic model and probabilistic model. The deterministic model is one which studies the number of operands and operators in the program whereas probabilistic model represents fault removal and failure occurrences. The probabilistic models are further classified into different categories, such as failure rate, error seeding and Non Homogeneous Poisson Process (NHPP). Among these NHPP has been widely used because it describes the failure phenomenon [8, 9, 10 and 11]. However, it poses certain shortcomings because of its stochastic behaviour on software failure process. An alternative solution to this problem is the use of neural networks. The use of neural network models has a significant advantage over the analytical models as it requires only failure history as input and no priori assumptions. An extensive research has been done in past to predict the software reliability using neural networks. The usefulness of neural networks lies in the fact that user is required to gather the concerned data and invoke algorithms for training the neural network. The domain metrics which were used in neural network were not sufficient to predict the object oriented faults. Hence, software metrics in object oriented paradigm were used to improve the accuracy and reliability of software. A perspective approach is aimed to study and analyse various methodologies used for the evaluation and estimation of software reliability. The remaining part of the paper is summarized as follows: Section 2 illustrates the object oriented metrics used to provide accurate and reliable software. Section 3 describes the review methodology approach. Section 4 is an analysis of the literature structured to enlist the techniques for measuring the software reliability. Section 5 concludes and discusses the future work on software reliability. OBJECT ORIENTED METRICS The object oriented design metrics used for evaluating object oriented design and selecting an optimal design among alternatives with respect to reliability are as [12,13]. Data Encapsulation The classes are treated as black boxes in which the operations are defined in the internals of the black box. The details internal to the class are hidden from the clients of the class. The clients can see only public methods of the class. The instance variables of a class can be manipulated only by the methods of class which is possible when all instance variables are private members of the class. The encapsulation of data members and complexity of the class can be measured by the number of instance variables which are private members of the class. a) Number of Encapsulated Variables (EV): The number of instance variables that are private members of the class. The higher the number of instance variables, the better is encapsulation. b) Number of Non-Encapsulated Variables (NEV): The number of instance variables that are public members of the class. The higher the number of instance variables, the worse is the encapsulation. Number of Methods (NM) The number of methods of a class denotes the complexity of class. It is indicated by the number of operations (methods) which a class can support. The more the number of methods in a class, the more is its complexity. Lines of Code per Class (SLOC) The number of lines of code in a method represents size of the class interface. The SLOC is used to indicate the number of source lines of code for methods of a class. Coupling between Classes (CBC) The relationship between pair of classes exists when methods of one class uses the instance variables of other class. CBC for a class is the number of classes coupled to that class. Depth of Inheritance Tree (DIT) The depth of inheritance of a class is the longest path in the graph which originates from the node representing the graph. The structure of inheritance of classes can be represented as acyclic directed graph, where the nodes represent classes. The DI indicates the dependence of the class on class hierarchy. The hierarchy of the depth is represented in the form of a tree. Number of Subclasses (NSC) The classes designed to be generic can have subclasses while a class that is very specialized do not contain any subclass. The reusability amount of a class is estimated by the number of derived classes in the class. The number of subclasses in most cases decreases as the depth of inheritance for class increases. Lack of Cohesion of Methods (LCOM) This metric shows the use of common instance variables in the methods of a class. The methods such as M_i and M_j of a class are cohesive in nature if they share one or more instance variables. The lack of cohesion can split the class into two or more classes containing the same functionality as the original class. Hence the LCOM denotes the cohesive of classes sharing common instance variables. Number of Children (NOC) It measures the number of post descendants of a particular class. This leads to measurement of the reusability of class. The more reusable a class, more is the complexity as many classes are affected due to the modifications after implementation. Coupling Between Objects (CBO) Coupling between Objects refers to the coupling of one class to other classes. Weighted Methods per Class (WMC) Weighted Methods per Class refers to the number of member functions and operators which are defined in every class. REVIEW METHODOLOGY Inclusion Approach The papers based on software reliability are only included aiming to study, analyse and improve the software reliability process. The journal papers are included in our review to describe the research based on software reliability. The papers other than the The identification of research papers were based in the context of objective, issue, manual reading of titles, abstract and conclusion of all published papers in various journals, like IEEE, ACM, Springer and Elsevier etc. and in conferences. Some papers were identified through the reference list of relevant papers while some were extracted from the digital library of IEEE, ACM and Springer. Both the authors searched for good journals potentially. The papers were combined together to meet the objective of the research. The papers which were more important for inclusion in our review were read in detail to determine its effectiveness with respect to the literature review. Out of 78 papers 41 papers were extracted from the relevant journals, transactions and conferences etc. ### Categorization of Papers In order to analyse, the research papers have been classified according to attributes as well as categories listed in Table-1. The categories are selected according to the requirement of analysis. <table> <thead> <tr> <th>Attributes</th> <th>Categories</th> </tr> </thead> <tbody> <tr> <td>Research Area</td> <td>Models, Visual Representation, Examination, Approach, Statistical Estimations, Datasets, Others</td> </tr> <tr> <td>Research Application</td> <td>Survey, Experiments, Principles, Review, Evaluation, Case study</td> </tr> <tr> <td>Participants</td> <td>Employees, Students, Not Applicable</td> </tr> </tbody> </table> The tabular schema of classification was developed for the purpose of review. It is not meant to be a general purpose classification of reliability studies. The classification may provide substantial help to other researchers searching for related papers. Most of the categories are non-exclusive in nature i.e. a paper may take into consideration more than one reliability approach or apply more than one research model. The classification of the reliability based papers is improved in the best possible manner while the descriptions of classification are subject to change further. However, the categorization of classification is considered as whole for the purpose of analysis. ### ANALYSIS In the work by Thwin and Quah [13] a study was conducted to predict the software development faults using object oriented metrics. The experiment was conducted on three industrial real systems. The data set taken was divided into training set, production and test-set. The computations of the patterns derived from the training set were investigated using Ward Network [14]. The neural network is aimed to identify the faults in object oriented metrics concerning with the inheritance related measures, complexity measures, coupling measures and memory allocation metrics defined by [15], [16]. The accuracy of the model was predicted using multiple regression models. Aggarwal and Gupta [17] explained the concept of neural network approach to measure the reliability of software modules. The role of neural network based on the study of failure associated with the code and environment was discussed [18]. The techniques such as threshold acceptance based neural network, P-Sigma Network (PSN), Multivariate Adaptive Regression Splines (MARS) etc., were compared with the neural network technique. Due to performance problem in every technique ensemble models were developed to forecast the software reliability accurately. Arora and Choudhary [19] used feed-forward neural networks to predict software reliability. The neural network was tailored using the static approach in the architecture. In the static approach, the architecture of network was defined in advance which remains invariant throughout the training phase. The training data by Yoshiro Tohma which described the prediction accuracy of neural network was used. The network was trained with 40 random seeds for given each training set size and their predictions were averaged. The percentage prediction error against execution time shown by feed forward network showed the relative prediction error. Pandey and Ahlawat [20] presented the use of neural networks for predicting the software reliability and maintainability using object oriented metrics. The neural network architecture was used emphasizing on Back Propagation Network algorithm to find out possible errors at the output. The paper focused on the internal product metrics in comparison to the traditional metrics as it lacks certain important object oriented concepts such as data centric encapsulation, inheritance polymorphism [6]. The object oriented metrics such as size metrics, inheritance metrics, cohesion metrics and coupling metrics are used as the independent variables for the estimation and prediction reliability and maintainability. Sharma and Bano [21] found software defects/faults, requirement analyse (feasibility, survey methods, interview), cost, size estimation as the potential reliability factors affecting the reliability of a software. The source of data collection formed the basis of software reliability. The defect reports were used as the data which was collected in the form of survey questionnaire conducted in six different IT organizations. In the review of the reliability measurement of object oriented design by Gupta and Kumar [22] software reliability facts were gathered to bridge the gap between the current researches to present framework for future examination. The software reliability evaluation is done listing the possible issues, function and knowledge required by the software engineer while executing a life cycle reliability management plan. The systematic review concludes to emphasize on reducing the effort in measuring reliability of object oriented design to deliver quality software in estimated time and budget. In the research work by Hudli and Hudli [12] the software reliability of product is evaluated using software metrics. The complexity of object oriented software was measured by defining metrics for object-oriented design. The reliability of four software projects in the healthcare domain was calculated respectively. The results showed the complexity introduced by object oriented metrics, which should be considered in the reliability models for the software. Kotiah and Khan [23] performed a survey on software reliability assessment using different machine learning techniques. Various machine learning techniques or approaches such as artificial neural network, fuzzy network, genetic algorithm, neuro-fuzzy approach, support vector machine (SVM), Bayesian classification, self-organizing map approach were used to compute the performance of machine learning techniques for prediction of software reliability. The results validate the effectiveness and efficiency of the machine learning approaches. Schneidewind [24] comprehended the use of UML diagrams as the mathematical software for providing good view of design process. The UML diagrams do not lack comprehensibility and is an easier way to integrate all the relevant details of the software reliability design. The O-O paradigm was found to be less advantageous in comparison to other paradigm such as structured design for mathematical software. Khateinneh and Mustafa [25] developed a new fuzzy expert system to predict software failures. The model was based on the growth of the reliability which focused on particular dataset behaviour in predicting software reliability. The results obtained from the experiment showed that the developed model predicted more accurate results of the target dataset in most points. In the experimental work, Kiran and Ravi [26] assessed the software reliability based on ensemble models. One non-linear ensemble and three linear ensembles were designed and tested. Intelligent techniques such as Back Propagation trained Neural Network (BPNN), dynamic evolving neuro-fuzzy inference system (DEFNIS) and tree nets as well as statistical techniques such as Multivariate Adaptive Regression Splines (MARS) and Multiple Linear Regression (MLR) constituted the ensembles. The experiments based on software reliability from the literature showed that non-linear ensemble outperformed linear ensembles. Hence ensembles can be used as an alternative method to predict software reliability. Antony and Dev [27] used CK metrics for measuring the reliability of software. Using the tool Java Class Analyzer the values of metric parameters from the source code were extracted to establish a relationship between reliability and object oriented metrics. The results from the assessment proved that by keeping low values of RFC, WMC, LCOM, CBO, DIT and high value of NOC software designers can achieve high reliability of the system. Hence CK metrics can be used as indicators of quality of the system. In the systematic review by Singhal and Singhal [28] reliability is found to be quality factor that predicts the effort needed for software testing. The reduction in effort to measure reliability of object oriented design is highly important for delivery of reliable software within estimated budget and time. The results were concluded from the literature reviewed in the context of the reliability models and the frameworks used for measuring the reliability of OO design during early phases of software development lifecycle. Dolbec and Shepard [29] gave a mathematical model which is a component based software reliability model. This model takes into consideration the execution paths in order to enhance the software reliability. The paper shows the simplification of previous work to structure software reliability on execution paths and converts it into component based model using component reliabilities and component usage ratios. In the research done by Kumar and Dinker [30] object oriented features are described as class level metrics. Since the complexity of any software depends on the object oriented metrics a relation between reliability and CK metrics was established. The two strategies were proposed to correlate the factors of complexity of software under test and the effect of case-suit on the object oriented software reliability models. Dadhich and Mathur [31] focused on the cross cutting factors in a distributed system to measure the reliability of the aspect oriented system. The implementation showed the improvement quality of software, higher productivity, cost savings and a better understanding through the use of fuzzy logic approach. Alvarez and Aleman [32] discussed the use of software modelling approaches which manages the UML features before the development of UML for improving the software reliability. Nowadays various tools have been developed for modelling such as Rational Rose. In the work by Khatri, Chhillar and Chhikara [4] object oriented system was taken under testing. The datasets included Squirrel SQL and SQL for Python on which the model worked. The results showed the improvement in reliability of software after testing on the bugs. Nagar and Thankachan [33] discussed the reliability in the context of software medicine and manufacturing which covers the software structural quality and software functional quality. Some previous development models (Spiral development, prototyping, waterfall model) and advanced techniques (AGILE) are analyzed. The paper proposes algorithm for appropriate selection of the model for improving software reliability. Gaudan, Motet and Auriol [34] showed the advancement in the object oriented metrics for software reliability. Some new metrics were presented to assess the complexity of object oriented models. The assessment of reliability was based on two approaches, statistical metrics and new MESS metrics which is a good predictor of fault risk. Tyagi and Sharma [35] discussed the component based reliability estimation of system. Thirteen models such as Everett’s model, Kubat’s model, Cheng’s model, Gokhal’s model, Lettlewood’s model were discussed for estimation of reliability. To calculate the reliability of the component paper proposed two major points, firstly, reliability of individual component, secondly operation profiles of the system. In the research work by P. Xu and S. Xu [36] a reliability model with object oriented paradigm was developed using mutation operation of Inheritance, Polymorphism, Dynamic Binding and Information Hiding. The complexity of software was calculated using method overloading. The metrics used for testing effectiveness and complexity were CBO, NOC, LCOM, WMC and DIT. Singh, Khatri and Kapur [37] described the research in the field of object oriented approach for the closed source software. The work to develop reliability growth model under concurrent distributed development environment based on the open source software uses object oriented approach before development. It is a mathematical model that took use of the reported data of bugs of SQL for Squirrel and SQL for Python. Mishra and Dubey [38] elucidated the methodology for evaluation of reliability of object oriented software system using fuzzy approach. The evaluation was done by taking ISO/IEC-9126 as the base model and object oriented metrics for the experiment. The reliability of object oriented software was evaluated by applying AHP and fuzzy layered approach. Mishra and Dubey [39] in fuzzy qualitative evaluation of reliability of object oriented software system evaluated the reliability of object oriented software system. The CK metrics are considered and mapped with the sub-characteristics of reliability. The reliability of the object oriented software is evaluated using AHP approach. Khoshgoftrar et al. [41] introduced the use of the neural network as a tool for predicting software quality. They found neural network model to show better predictive accuracy after comparing the neural network model with a non-parametric discriminant model. The domain metrics derived from the complexity metric data were used in their model. However, these metrics are not sufficient to predict the object oriented faults. The comparison of the various methodologies, techniques and approaches to improve software reliability are shown in Table-2. ### Table-2. Comparison of literature review. <table> <thead> <tr> <th>S.N.</th> <th>Year</th> <th>Author(s)</th> <th>Methodology</th> <th>Dataset</th> <th>Techniques</th> <th>Merits</th> <th>Demerits</th> </tr> </thead> <tbody> <tr> <td>1.</td> <td>2002</td> <td>M.M.T. Thwin and T.S. Quah [13]</td> <td>Software development faults using object oriented metrics for reliability and maintainability prediction.</td> <td>Programs of three subsystem of Human Machine Interface (HMI) software.</td> <td>Multiple regression model and neural network model.</td> <td>The object oriented metrics can be used to predict the number of development faults.</td> <td>No issues</td> </tr> <tr> <td>2.</td> <td>2007</td> <td>N.R. Kiran and V. Ravi [26]</td> <td>Software reliability prediction based on ensemble models.</td> <td>Software failure data</td> <td>BPNN, DENIS, MARS and MLR</td> <td>Non-linear ensemble models can be used as an effective alternative for predicting software reliability.</td> <td>The hardware failures were not addressed.</td> </tr> <tr> <td>4.</td> <td>2009</td> <td>N.F. Schneidewind [24]</td> <td>Use of UML diagrams for providing good view of design process.</td> <td>Software failure data</td> <td>Object oriented design approach</td> <td>UML diagrams can be used to represent software reliability models.</td> <td>OO- paradigm is complex for mathematical software</td> </tr> <tr> <td>5.</td> <td>2011</td> <td>S.A. Hudli and A.V. Hudli [12]</td> <td>To estimate reliability of software by addressing the complexity of object oriented design</td> <td>Four software projects from healthcare domain</td> <td>Metrics of object oriented design were defined.</td> <td>Complexity of object oriented software should be considered to measure reliability of software.</td> <td>Testing effectiveness should also be considered.</td> </tr> <tr> <td>6.</td> <td>2011</td> <td>A. Singhal and A. Singhal [28]</td> <td>Improvisation in software reliability research.</td> <td>141 papers in 34 journals on software reliability.</td> <td>Systematic review</td> <td>Increased breadth of relevant studies, selected set of essential papers and more studies on commonly used technique in software industry.</td> <td>Adherence to recommendation s does not necessarily leads to better software reliability prediction.</td> </tr> <tr> <td>7.</td> <td>2011</td> <td>Y. Wu and R. Yang [40]</td> <td>Prediction of software reliability</td> <td>Data set from a NASA supported project</td> <td>General Regression Neural Network</td> <td>More accurate and reasonable prediction model</td> <td>No issues</td> </tr> <tr> <td>8.</td> <td>2012</td> <td>B. Kotaiah and R.A. Khan [23]</td> <td>Survey on software reliability assessment</td> <td>Software failure datasets of projects</td> <td>ANN, fuzzy network, genetic algorithm, SVM, Bayesian classification</td> <td>Machine learning techniques can be used for software reliability model</td> <td>Decision region, self-organizing map and neuro fuzzy approach needs to be used.</td> </tr> <tr> <td>10.</td> <td>2013</td> <td>G. Aggarwal and V.K. Gupta [17]</td> <td>To measure the reliability of software modules</td> <td>Four different variants of ensembles</td> <td>Neural network approach</td> <td>Non-linear ensemble neural network outperformed other neural network</td> <td>No model was discussed related to work.</td> </tr> </tbody> </table> CONCLUSIONS This paper reviews software reliability from various sources like journals, conferences, transactions and company specific journal and then classified according to research area, research application and study relation. On the basis of the analysis, software reliability is observed as an important quality factor in which object oriented metrics play an important role in software reliability prediction. After substantial review it was found that object oriented metrics along with the neural network technique is effective for delivering quality software within estimated time and budget. In future, work will be carried out to assess the reliability of object oriented software system based on soft computing techniques to widen the breadth of research in software reliability. REFERENCES [40] Y. Wu and R. Yang. 2011. Study of Software Reliability Prediction Based on GR Neural Network. 9th International Conference on Reliability, Maintainability and Safety (ICRMS), IEEE.
{"Source-Url": "http://www.arpnjournals.com/jeas/research_papers/rp_2015/jeas_0915_2556.pdf", "len_cl100k_base": 5278, "olmocr-version": "0.1.48", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 28687, "total-output-tokens": 7597, "length": "2e12", "weborganizer": {"__label__adult": 0.0003387928009033203, "__label__art_design": 0.0002301931381225586, "__label__crime_law": 0.0003018379211425781, "__label__education_jobs": 0.0006456375122070312, "__label__entertainment": 5.7697296142578125e-05, "__label__fashion_beauty": 0.00013017654418945312, "__label__finance_business": 0.00023818016052246096, "__label__food_dining": 0.0003783702850341797, "__label__games": 0.0007224082946777344, "__label__hardware": 0.0005726814270019531, "__label__health": 0.0004906654357910156, "__label__history": 0.00016498565673828125, "__label__home_hobbies": 5.835294723510742e-05, "__label__industrial": 0.0002551078796386719, "__label__literature": 0.00031828880310058594, "__label__politics": 0.0001704692840576172, "__label__religion": 0.00032782554626464844, "__label__science_tech": 0.0109710693359375, "__label__social_life": 7.50422477722168e-05, "__label__software": 0.00702667236328125, "__label__software_dev": 0.97607421875, "__label__sports_fitness": 0.00022077560424804688, "__label__transportation": 0.0002720355987548828, "__label__travel": 0.00014603137969970703}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 34079, 0.01894]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 34079, 0.49185]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 34079, 0.91569]], "google_gemma-3-12b-it_contains_pii": [[0, 4606, false], [4606, 8552, null], [8552, 12666, null], [12666, 17928, null], [17928, 22782, null], [22782, 26102, null], [26102, 27438, null], [27438, 31117, null], [31117, 34079, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4606, true], [4606, 8552, null], [8552, 12666, null], [12666, 17928, null], [17928, 22782, null], [22782, 26102, null], [26102, 27438, null], [27438, 31117, null], [31117, 34079, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 34079, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 34079, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 34079, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 34079, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 34079, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 34079, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 34079, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 34079, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 34079, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 34079, null]], "pdf_page_numbers": [[0, 4606, 1], [4606, 8552, 2], [8552, 12666, 3], [12666, 17928, 4], [17928, 22782, 5], [22782, 26102, 6], [26102, 27438, 7], [27438, 31117, 8], [31117, 34079, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 34079, 0.12319]]}
olmocr_science_pdfs
2024-11-24
2024-11-24
4f81ce3b35aad96ec9ee17633a5d6ec16353a7a8
Semantic Annotation and Transcoding: Making Text and Multimedia Contents More Usable on the Web Katashi Nagao IBM Research, Tokyo Research Laboratory 1623–14 Shimotsuruma, Yamato, Kanagawa 242–8502, Japan knagao@jp.ibm.com Abstract This paper proposes an easy and simple method for constructing a super-structure on the Web which provides current Web contents with new value and new means of use. The super-structure is based on external annotations to Web documents. We have developed a system for any user to annotate any element of any Web document with additional information. We have also developed a proxy that transcodes requested contents by considering annotations assigned to them. In this paper, we classify annotations into three categories. One is linguistic annotation which helps the transcoder understand the semantic structure of textual elements. The second is commentary annotation which helps the transcoder manipulate non-textual elements such as images and sounds. The third is multimedia annotation, which is a combination of the above two types. All types of annotation are described using XML, and correspondence between annotations and document elements is defined using URLs and XPaths. We call the entire process “semantic transcoding” because we deal with the deep semantic content of documents with annotations. The current semantic transcoding process mainly handles text and video summarization, language translation, and speech synthesis of documents including images. Another use of annotation is for knowledge discovery from contents. Using this idea, we have also developed a system which discovers knowledge from Web documents, and generates a document which includes the discovered knowledge and summaries of multiple documents related to the same topic. 1 Introduction The conventional Web structure can be considered as a graph on a plane. In this paper, we propose a method for extending such planar graph to a three-dimensional structure that consisting of multiple planar layers. Such metalevel structure is based on external annotations on documents on the Web. (The original concept of external annotation was given in [5]. We use this term in a more general sense.) Figure 1 represents the concept of our approach. Figure 1: Super-structure on the Web A super-structure on the Web consists of layers of content and metacommunity. The first layer corresponds to the set of metacontents of base documents. The second layer corresponds to the set of metacontents of the first layer, and so on. We generally consider such metacommunity an external annotation. A famous example of external annotations is external links that can be defined outside of the set of link-connected documents. These external links have been discussed in the XML (Extensible Markup Language) community but they have not yet been implemented in the current Web architecture [17]. Another popular example of external annotation is comments or notes on Web documents created by people other than the author. This kind of annotations is helpful for readers evaluating the documents. For example, images without alternative descriptions are not understandable for visually-challenged people. If there are comments on these images, these people will understand the image contents by listening to them via speech transcoding. This example is explained later in more detail. We can easily imagine that an open platform for creating and sharing annotations would greatly extend the expressive power and value of the Web. ### 1.1 Content Adaptation Annotations do not just increase the expressive power of the Web but also play an important role in content reuse. An example of content reuse is, for example, the transformation of content depending on user preferences. Content adaptation is a type of transcoding which considers a users’ environment such as devices, network bandwidth, profiles, and so on. Such adaptation sometimes also involves a deep understanding of the original document contents. If the transcoder fails to analyse the semantic structure of a document, then the results may cause user misunderstanding. Our technology assumes that external annotations help machines to understand document contents so that transcoding can have higher quality. We call such transcoding based on annotation “semantic transcoding.” The overall configuration of semantic transcoding can be viewed in Figure 2. There are three main new parts in this system: an annotation editor, an annotation server, and a transcoding proxy server. The remaining parts of the system are a conventional Web server and a browser. There are previous work on device dependent adaptation of Web documents [7]. The developed system can dynamically filter, convert or reformat data for content sharing across disparate systems, users, and emerging pervasive computing devices. They claim that the transcoding benefits include: 1. eliminating the expense of re-authoring or porting data and content-generating applications for multiple systems and devices 2. improving mobile employee communications and effectiveness, and 3. creating easier access for customers who are using a variety of devices to purchase products and services. The technology enables the modification of HTML (HyperText Markup Language) documents, such as converting images to links to retrieve images, converting simple tables to bulleted lists, removing features not supported by a device such as JavaScript or Java applets, removing references to image types not supported by a device, and removing comments. It can also transform XML documents by selecting and applying the right stylesheet for the current request based on information in the relevant profiles. These profiles for preferred transcoding services are defined for an initial set of devices. Our transcoding involves deeper levels of document understanding. Therefore, human intervention into machine understanding of documents is required. External annotations of additional information is a guide for machines to understand. Of course, some profiles for user contexts will work as a guide to transcode, but it is clear that such profiles are insufficient for transcoders to recognize deep document characteristics. ### 1.2 Knowledge Discovery Another use of annotations is in knowledge discovery, where huge amounts of Web contents are automatically mined for some essential points. Unlike conventional search engines that retrieve Web pages using user specified keywords, knowledge miners create a single document that satisfies a user’s request. For example, the knowledge miner may generate a summary document on a certain company’s product strategy for the year from many kinds of information resources of its products on the Web. Currently, we are developing an information collector that gathers documents related to a topic and generates a document containing a summary of each document. There are many unresolved issues before we can realize true knowledge discovery, but we can say that annotations facilitate this activity. 2 External Annotation We have developed a simple method to associate external annotations with any element of any HTML document. We use URLs (Uniform Resource Locators), XPaths (location identifiers in the document) [18], and document hash codes (digest values) to identify HTML elements in documents. We have also developed an annotation server that maintains the relationship between contents and annotations and transfers requested annotations to a transcoder. Our annotations are represented as XML formatted data and divided into three categories: linguistic, commentary, and multimedia annotation. Multimedia (especially video) annotation is a combination of the other two types of annotation. 2.1 Annotation Environment Our annotation environment consists of a client side editor for the creation of annotations and a server for the management of annotations. The annotation environment is shown in Figure 3. 2.1 Annotation Environment The process flows as follows (in this example case, an HTML file is processed): 1. The user runs the annotation editor and requests an URL as a target of annotation. 2. The annotation server accepts the request and sends it to the Web server. 3. The annotation server receives the Web document. 4. The server calculates the document hash code (digest value) and registers the URL with the code to its database. 5. The server returns the Web document to the editor. 6. The user annotates the requested document and sends the result to the server with some personal data (name, professional areas, etc.). 7. The server receives the annotation data and relates it with its URL in the database. 8. The server also updates the annotator profiles. Below we explain the editor and the server in more detail. ### 2.2 Annotation Editor Our annotation editor, implemented as a Java application, can communicate with the annotation server explained below. The annotation editor has the following functions: 1. To register targets of annotation to the annotation server by sending URLs 2. To specify any element in the document using the Web browser 3. To generate and send annotation data to the annotation server 4. To reuse previously-created annotations when the target contents are updated An example screen of our annotation editor is shown in Figure 4. The left window of the editor shows the document object structure of the HTML document. The right window shows some text that was selected on the Web browser (shown on the right hand). The selected area is automatically assigned an XPath. Using the editor, the user annotates text with linguistic structure (grammatical and semantic structure, described later) and adds a comment to an element in the document. The editor is capable of natural language processing and interactive disambiguation. The user will modify the result of the automatically-analyzed sentence structure as shown in Figure 5. ![Figure 4: Annotation editor with Web browser](image) ![Figure 5: Annotation editor with linguistic structure editor](image) ### 2.3 Annotation Server Our annotation server receives annotation data from any annotator and classifies it according to the annotator. The server retrieves documents from URLs in annotation data and registers the document hash codes with their URLs in its annotation database. The hash codes are used to find differences between annotated documents and updated documents identified by the same URL. A hash code of document internal structure or DOM (Document Object Model) enables the server to discover modified elements in the annotated document [8]. The annotation server makes a table of annotator names, URLs, XPaths, and document hashcodes. When the server accepts a URL as a request from a transcoding proxy (described below), the server returns a list of XPaths with associated annotation files, their types (linguistic or commentary), and a hash code. If the server receives an annotator’s name as a request, it responds with the set of annotations created by the specified annotator. We are currently developing a mechanism for access control between annotation servers and normal Web servers. If authors of original documents do not want to allow anyone to annotate their documents, they can add a statement about it in the documents, and annotation servers will not retrieve such contents for the annotation editors. 2.4 Linguistic Annotation The purpose of linguistic annotation is to make WWW texts machine-understandable (on the basis of a new tag set), and to develop content-based presentation, retrieval, question-answering, summarization, and translation systems with much higher quality than is currently available. The new tag set was proposed by the GDA (Global Document Annotation) project [4]. It is based on XML, and designed to be as compatible as possible with HTML, TEI [15], CES [2], EAGLES [3], and LAL [16]. It specifies modifier-modifiee relations, anaphor-referent relations, wordsenses, etc. An example of a GDA-tagged sentence is as follows: ```xml <su><np rel="agt" sense="time0">Time</np><v sense="fly1">flies</v><adp rel="eg">like</ad><np><n sense="arrow0">arrow</n></np></adp></su> ``` The rel attribute encodes a relationship in which the current element stands with respect to the element that it semantically depends on. Its value is called a relational term. A relational term denotes a binary relation, which may be a thematic role such as agent, patient, recipient, etc., or a rhetorical relation such as cause, concession, etc. For instance, in the above sentence, `<np rel="agt" sense="time0">Time</np>` depends on the second element `<v sense="fly1">flies</v>`. rel="agt" means that Time has the agent role with respect to the event denoted by flies. The sense attribute encodes a word sense. Linguistic annotation is generated by automatic morphological analysis, interactive sentence parsing, and word sense disambiguation by selecting the most appropriate paraphrase. Some research issues on linguistic annotation are related to how the annotation cost can be reduced within some feasible levels. We have been developing some machine-guided annotation interfaces that conceal the complexity of annotation. Machine learning mechanisms also contribute to reducing the cost because they can gradually increase the accuracy of automatic annotation. In principle, the tag set does not depend on language, but as a first step we implemented a semi-automatic tagging system for English and Japanese. 2.5 Commentary Annotation Commentary annotation is mainly used to annotate non-textual elements like images and sounds with some additional information. Each comment can include not only tagged texts but also other images and links. Currently, this type of annotation appears in a subwindow that is overlayed on the original document window when a user locates a mouse pointer at the area of a comment-added element as shown in Figure 6. Users can also annotate text elements with information such as paraphrases, correctly-spelled words, and underlines. This type of annotation is used for text transcoding that combines such comments on texts and original texts. Commentary annotation on hyperlinks is also --- 1 A more detailed description of the GDA tag set can be found at [http://www.etl.go.jp/etl/nl/GDA/tagset.html](http://www.etl.go.jp/etl/nl/GDA/tagset.html). available. This contributes to quick introduction of target documents before clicking the links. If there are linguistic annotations on the target documents, the transcoders can generate summaries of these documents and relate them with hyperlinks in the source document. There are some previous work on sharing comments on the Web. ComMentor is a general meta-information architecture for annotating documents on the Web [11]. This architecture includes a basic client-server protocol, meta-information description language, a server system, and a remodeled NCSA Mosaic browser with interface augmentations to provide access to its extended functionality. ComMentor provides a general mechanism for shared annotations, which enables people to annotate arbitrary documents at any position in-place, share comments/pointers with other people (either publicly or privately), and create shared “landmark” reference points in the information space. There are several annotation systems with a similar direction, such as CoNote and the Group Annotation Transducer [13]. These systems are often limited to particular documents or documents shared only among a few people. Our annotation and transcoding system can also handle multiple comments on any element of any document on the Web. Also, a community wide access control mechanism can be added to our transcoding proxy. If a user is not a member of a particular group, then the user cannot access the transcoding proxy that is for group use only. In the future, transcoding proxies and annotation servers will communicate with some secured protocol that prevents some other server or proxy from accessing the annotation data. Our main focus is adaptation of WWW contents to users, and sharing comments in a community is one of our additional features. We apply both commentary and linguistic annotations to semantic transcoding. ### 2.6 Multimedia Annotation Our annotation technique can also be applied to multimedia data such as digital video. Digital video is becoming a necessary information source. Since the size of these collections is growing to huge numbers of hours, summarization is required to effectively browse video segments in a short time without losing the significant content. We have developed techniques for semi-automatic video annotation using a text describing the content of the video. Our techniques also use some video analysis methods such as automatic cut detection, characterization of frames in a cut, and scene recognition using similarity between several cuts. There is another approach to video annotation. MPEG-7 is an effort within the Moving Picture Experts Group (MPEG) of ISO/IEC that is dealing with multimedia content description [9]. Using content descriptions, video coded in MPEG-7 is concerned with transcoding and delivery of multimedia content to different devices. MPEG-7 will potentially allow greater input from the content publishers in guiding how multimedia content is transcoded in different situations and for different client devices. Also, MPEG-7 provides object-level description of multimedia content which allows a higher granularity of transcoding in which individual regions, segments, objects and events in image, audio and video data can be differentially transcoded depending on publisher and user preferences, network bandwidth and client capabilities. Our method will be integrated into tools for authoring MPEG-7 data. However, we do not currently know when the MPEG-7 technology will be widely available. Our video annotation includes automatic segmentation of video, semi-automatic linking of video segments with corresponding text segments, and interactive naming of people and objects in video frames. Video annotation is performed through the following three steps. First, for each video clip, the annotation system creates the text corresponding to its content. We employed speech recognition for the automatic generation of a video transcript. The speech recognition module also records correspondences between the video frames and the words. The transcript is not required to describe the whole video content. The resolution of the description affects the final quality of the transcoding (e.g., summarization). Second, some video analysis techniques are applied to characterize scenes, segments (cuts and shots), and individual frames in video. For example, by detecting significant changes in the color histogram of successive frames, frame sequences can be separated into cuts and shots. Also, by searching and matching prepared templates to individual regions in the frame, the annotation system identifies objects. The user can specify significant objects in some scene in order to reduce the time to identify target objects and to obtain a higher recognition success ratio. The user can name objects in a frame simply by selecting words in the corresponding text. Third, the user relates video segments to text segments such as paragraphs, sentences, and phrases, based on scene structures and object-name correspondences. The system helps the user to select appropriate segments by prioritizing based on the number of objects detected, camera movement, and by showing a representative frame of each segment. We developed a video annotation editor capable of scene change detection, speech recognition, and correlation of scenes and words. An example screen of our video annotation editor is shown in Figure 7. On the editor screen, the user can specify a particular object in a frame by dragging a rectangle. Using automatic object tracking techniques, the annotation editor can generate descriptions of an object in a video frame. The description is represented as XML data, and contains object coordinates in start and end frames, time codes of the start and end frames, and motion trails (series of coordinates for interpolation of object movement). The object descriptions are connected with linguistic annotation by adding appropriate XPaths to the tags of corresponding names and expressions in the video transcript. As mentioned later, the annotation of video objects can be used for creation of hyper-video, in which annotated objects are hyperlinked with external information, and objects are retrieved with keywords. 3 Semantic Transcoding Semantic transcoding is a transcoding technique based on external annotations, used for content adaptation according to user preferences. The transcoders here are implemented as an extension to an HTTP (HyperText Transfer Protocol) proxy server. Such an HTTP proxy is called a transcoding proxy. Figure 8 shows the environment of semantic transcoding. The information flow in transcoding is as follows: 1. The transcoding proxy receives a request URL with a client ID. 2. The proxy sends the request of the URL to the Web server. 3. The proxy receives the document and calculates its hash code. 4. The proxy also asks the annotation server for annotation data related to the URL. 5. If the server finds the annotation data of the URL in its database, it returns the data to the proxy. 6. The proxy accepts the data and compares the document hash code with that of the already retrieved document. 7. The proxy also searches for the user preference with the client ID. If there is no preference data, the proxy uses a default setting until the user gives the preference. 8. If the hash codes match, the proxy attempts to transcode the document based on the annotation data by activating the appropriate transcoders. 9. The proxy returns the transcoded document to the client Web browser. We explain in more detail the transcoding proxy and various kinds of transcoding. 3.1 Transcoding Proxy We employed IBM’s WBI (Web Intermediaries) as a development platform to implement the semantic transcoding system [6]. WBI is a customizable and extendable HTTP proxy server. WBI provides APIs (Application Programming Interfaces) for user level access control and easy manipulation of input/output data of the proxy. The transcoding proxy based on WBI has the following functionality: 1. Maintenance of personal preferences 2. Gathering and management of annotation data 3. Activation and integration of transcoders 3.1.1 User preference management For the maintenance of personal preferences, we use the web browser’s cookie to identify the user. The cookie holds a user ID assigned by the transcoding proxy on the first access and the ID is used to identify the user and to select user preferences defined at the last time. The ID stored as a cookie value allows the user, for example, to change an access point using DHCP (Dynamic Host Configuration Protocol) with the same preference setting. There is one technical problem. Generally, cookies can be accessed only by the HTTP servers that have set their values and ordinary proxies do not use cookies for user identification. Instead, conventional proxies identify the client by the hostname and IP address. Thus, when the user ac- cesses our proxy and sets/updates the preferences, the proxy server acts as an HTTP server to access the browser’s cookie data and associates the user ID (cookie value) and the hostname/IP address. When the transcoding proxy works as a conventional proxy, it receives the client’s hostname and IP address, retrieves the user ID, and then obtains the preference data. If the user changes access point and hostname/IP address, our proxy performs as a server again and reassociates the user ID and such client IDs. 3.1.2 Collecting and indexing annotation data The transcoding proxy communicates with annotation servers that hold the annotation database. The second step of semantic transcoding is to collect annotations distributed among several servers. The transcoding proxy creates a multi-server annotation catalog by crawling distributed annotation servers and gathering their annotation indexes. The annotation catalog consists of server name (e.g., URL) and its annotation index (set of annotator names and identifiers of the original document and its annotation data). The proxy uses the catalog to decide which annotation server should be accessed to get annotation data when it receives a user’s request. 3.1.3 Integrating the results of multiple transcoders The final stage of semantic transcoding is to transcode requested contents depending on user preferences and then to return them to the user’s browser. This stage involves activation of appropriate transcoders and integration of their results. As mentioned previously, there are several types of transcoding. In this paper we describe four types: text, image, voice, and video transcodings. 3.2 Text Transcoding Text transcoding is the transformation of text contents based on linguistic annotations. As a first step, we implemented text summarization. Our text summarization method employs a spreading activation technique to calculate the importance values of elements in the text [10]. Since the method does not employ any heuristics dependent on the domain and style of documents, it is applicable to any linguistically-annotated document. The method can also trim sentences in the summary because importance scores are assigned to elements smaller than sentences. A linguistically-annotated document naturally defines an intra-document network in which nodes correspond to elements and links represent the semantic relations. This network consists of sentence trees (syntactic head-daughter hierarchies of subsentential elements such as words or phrases), coreference/anaphora links, document/subdivision/paragraph nodes, and rhetorical relation links. Figure 9 shows a graphical representation of the intra-document network. Figure 9: Intra-document network The summarization algorithm works as follows: 1. Spreading activation is performed in such a way that two elements have the same activation value if they are coreferent or one of them is the syntactic head of the other. 2. The unmarked element with the highest activation value is marked for inclusion in the summary. 3. When an element is marked, the following elements are recursively marked as well, until no more elements are found: • the marker’s head • the marker’s antecedent • the marker’s compulsory or a priori important daughters, the values of whose relational attributes are \textit{agt} (agent), \textit{pat} (patient), \textit{rec} (recipient), \textit{sbj} (syntactic subject), \textit{obj} (syntactic object), \textit{pos} (possessor), \textit{cnt} (content), \textit{cau} (cause), \textit{cnd} (condition), \textit{sbm} (subject matter), etc. • the antecedent of a zero anaphor in the marker with some of the above values for the relational attribute 4. All marked elements in the intra-document network are generated preserving the order of their positions in the original document. 5. If a size of the summary reaches the user-specified value, then terminate; otherwise go back to Step 2. The size of the summary can be changed by simple user interaction. Thus the user can see the summary in a preferred size by using an ordinary Web browser without any additional software. The user can also input any words of interest. The corresponding words in the document are assigned numeric values that reflect degrees of interest. These values are used during spreading activation for calculating importance scores. Figure 10 shows the summarization result on the normal Web browser. The top document is the original and the bottom one is the summarized version. Another kind of text transcoding is language translation. We can predict that translation based on linguistic annotations will produce a much better result than many existing systems. This is because the major difficulties of present machine translation come from syntactic and word sense ambiguities in natural languages, which can be easily clarified in annotation. An example of the result of English-to-Japanese translation is shown in Figure 11. Furthermore, we are developing a dictionary-based text paraphrasing as another repertoire of text transcoding. Using word sense attributes in linguistic annotation and dictionary definitions, difficult words are replaced with more readable expressions. These expressions are generated by modifying the dictionary definitions for word senses according to the local contexts of the target words. 3.3 Image Transcoding Image transcoding is to convert images into those of different size, color (full color or grayscale), and resolution (e.g., compression ratio) depending on user’s device and communication capability. Links to these converted images are made from the original images. Therefore, users will notice that the images they are looking at are not original if there are links to similar images. Figure 12 shows the document that is summarized in one-third size of the original and whose images are reduced to half. In this figure, the preference setting subwindow is shown on the right hand. The window appears when the user double-clicks the icon on the lower right corner (the transcoding proxy automatically inserts the icon). Using this window, the user can easily modify the parameters for transcoding. 3.4 Voice Transcoding Voice synthesis also works better if the content has linguistic annotation. For example, a speech synthesis markup language is being discussed in [12]. A typical example is processing proper nouns and technical terms. Word level annotations on proper nouns allow the transcoders to recognize not only their meanings but also their readings. Voice transcoding generates spoken language version of documents. There are two types of voice transcoding. One is when the transcoder synthesizes sound data in audio formats such as MP3 (MPEG-1 Audio Layer 3). This case is useful for devices without voice synthesis capability such as cellular phones and PDAs (Personal Digital Assistants). The other is when the transcoder converts documents into more appropriate style for voice synthesis. This case requires that a voice synthesis program is installed on the client side. Of course, the synthesizer uses the output of the voice synthesizer. Therefore, the mechanism of document conversion is a common part of both types of voice transcoding. Documents annotated for voice include some text in commentary annotation for non-textual elements and some word information in linguistic annotation for the reading of proper nouns and unknown words in the dictionary. The document also contains phrase and sentence boundary information so that pauses appear in appropriate positions. Figure 13 shows an example of the voice-transcoded document in which icons that represent the speaker are inserted. When the user clicks the speaker icon, the MP3 player software is invoked and starts playing the synthesized voice data. 3.5 Video Transcoding Video transcoding employs video annotation that consists of linguistically-marked-up transcripts such as closed captions, time stamps of scene changes, representative images (key frames) of each scene, and additional information such as program names, etc. Our video transcoding has several variations, including video summarization, video to document transformation, video translation, etc. Video summarization is performed as a by-product of text summarization. Since a summarized video transcript contains important information, corresponding video sequences will produce a collection of significant scenes in the video. Summarized video is played by a player we developed. An example screen of our video player is shown in Figure 14. There are some previous work on video summarization such as Infomedia [14] and CueVideo [1]. They create a video summary based on automatically extracted features in video such as scene changes, speech, text and human faces in frames, and closed captions. They can transcoded video data without annotations. However, currently, an accuracy of their summarization is not practical because of the failure of automatic video analysis. Our approach to video summarization has sufficient quality for use if the data has enough semantic annotation. As mentioned earlier, we have developed a tool to help annotators to create semantic annotation data for multimedia data. Since our annotation data is task-independent and versatile, annotations on video are worth creating if the video will be used in different applications such as automatic editing and information extraction from video. Video to document transformation is another type of video transcoding. If the client device does not have video playing capability, the user cannot access video contents. In this case, the video transcoder creates a document including important images of scenes and texts related to each scene. Also, the resulting document can be summarized by the text transcoder. Our system implements two types of video translation. One is a translation of automatically generated subtitle text. The subtitle text is generated from the transcript with time codes. The format of the text is as follows: ``` <subtitle duration="00:01:19"> <time begin="00:00:00"/>\clear/\n No speech <time begin="00:00:05"/> .... <time begin="00:00:07"/> .... <time begin="00:00:12"/>\clear/\n .... </subtitle> ``` The text transcoder can translate the subtitle text into different languages as the user wants, and the video player shows the results synchronized with the video. An example screen of the video player with subtitle window is shown in Figure 15. voice transcodings. First, a video transcript with linguistic annotation is translated by the text transcoder. Then, the result of translation is converted into voice-suitable text by the voice transcoder. Synchronization of video playing and voice synthesis makes another language version of the original video clip. The duration of each voice data is adjusted according to the length of its corresponding video segment by changing speed of synthesized voice. Using object-level annotations, the video transcoder can create an interactive hyper-video in which video objects are hyperlinked with information such as names, times, locations, related Websites, etc. The annotations are used for object retrieval from multiple video clips and generation of object-featured video summaries. The above described text, image, voice, and video transcodings are automatically combined according to user demand, so the transcoding proxy has a planning mechanism to determine the order of activation of each transcoder necessary for the requested content and user preferences (including client device constraints). 4 Future Plans We are planning to apply our technology to knowledge discovery from huge online resources. Annotations will be very useful to extract some essential points in documents. For example, an annotator adds comments to several documents, and he or she seems to be a specialist of some particular field. Then, the machine automatically collects documents annotated by this annotator and generates a single document including summaries of the annotated documents. Also, content-based retrieval of Web documents including multimedia data is being pursued. Such retrieval enables users to ask questions in natural language (either spoken or written). While our current prototype system is running locally, we are also planning to evaluate our system with open experiments jointly with Keio University in Japan. In addition, we will distribute our annotation editor, with natural language processing capabilities, for free. 5 Concluding Remarks We have discussed a full architecture for creating and utilizing external annotations. Using the annotations, we realized semantic transcoding that automatically customizes Web contents depending on user preferences. This technology also contributes to commentary information sharing like ComMentor and device dependent transformation for any device. One of our future goals is to make contents of the WWW intelligent enough to answer our questions asked using natural language. We imagine that in the near future we will not use search engines but will instead use knowledge discovery engines that give us a personalized summary of multiple documents instead of hyperlinks. The work in this paper is one step toward a better solution of dealing with the coming information deluge. Acknowledgments The author would like to acknowledge the contributors to the project described in this paper. Koiti Hasida gave the author some helpful advices to apply the GDA tag set to our linguistic and multimedia annotations. Hideo Watanabe developed the prototype of English-to-Japanese language translator. Shinichi Torihara developed the prototype of voice synthesizer. Shingo Hosoya, Yoshinari Shirai, Ryuichiro Higashinaka, Mitsuhiro Yoneoka, and Kevin Squire contributed to implementation of the prototype semantic transcoding system. References Corpus Encoding Standard. http://www.cs.vassar.edu/CES/. EAGLES online. http://www.ilc.pi.cnr.it/EAGLES/home.html.
{"Source-Url": "http://www.nagao.nuie.nagoya-u.ac.jp/papers/pdfs/nagao_mma01.pdf", "len_cl100k_base": 7242, "olmocr-version": "0.1.53", "pdf-total-pages": 14, "total-fallback-pages": 0, "total-input-tokens": 34664, "total-output-tokens": 8606, "length": "2e12", "weborganizer": {"__label__adult": 0.00039076805114746094, "__label__art_design": 0.0009899139404296875, "__label__crime_law": 0.00045680999755859375, "__label__education_jobs": 0.001682281494140625, "__label__entertainment": 0.0003235340118408203, "__label__fashion_beauty": 0.0002188682556152344, "__label__finance_business": 0.0003590583801269531, "__label__food_dining": 0.00037741661071777344, "__label__games": 0.0005793571472167969, "__label__hardware": 0.0018024444580078125, "__label__health": 0.0006313323974609375, "__label__history": 0.0004525184631347656, "__label__home_hobbies": 9.250640869140624e-05, "__label__industrial": 0.000499725341796875, "__label__literature": 0.0010242462158203125, "__label__politics": 0.0003235340118408203, "__label__religion": 0.0006890296936035156, "__label__science_tech": 0.26611328125, "__label__social_life": 0.00015032291412353516, "__label__software": 0.06549072265625, "__label__software_dev": 0.65625, "__label__sports_fitness": 0.0001989603042602539, "__label__transportation": 0.00045013427734375, "__label__travel": 0.00021278858184814453}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 39866, 0.02004]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 39866, 0.64732]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 39866, 0.88321]], "google_gemma-3-12b-it_contains_pii": [[0, 2726, false], [2726, 6669, null], [6669, 8334, null], [8334, 10684, null], [10684, 14461, null], [14461, 17991, null], [17991, 21295, null], [21295, 23455, null], [23455, 26639, null], [26639, 28628, null], [28628, 31706, null], [31706, 33984, null], [33984, 37772, null], [37772, 39866, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2726, true], [2726, 6669, null], [6669, 8334, null], [8334, 10684, null], [10684, 14461, null], [14461, 17991, null], [17991, 21295, null], [21295, 23455, null], [23455, 26639, null], [26639, 28628, null], [28628, 31706, null], [31706, 33984, null], [33984, 37772, null], [37772, 39866, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 39866, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 39866, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 39866, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 39866, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 39866, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 39866, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 39866, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 39866, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 39866, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 39866, null]], "pdf_page_numbers": [[0, 2726, 1], [2726, 6669, 2], [6669, 8334, 3], [8334, 10684, 4], [10684, 14461, 5], [14461, 17991, 6], [17991, 21295, 7], [21295, 23455, 8], [23455, 26639, 9], [26639, 28628, 10], [28628, 31706, 11], [31706, 33984, 12], [33984, 37772, 13], [37772, 39866, 14]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 39866, 0.0]]}
olmocr_science_pdfs
2024-12-10
2024-12-10
756304dd5753f9841045d94a6eae2e98bf103532
1. Overview This document describes the usage and installation of the DPF Manager. In the first section it is explained how to install the software in different operating systems. The second section provides detailed explanation of the modes from which the application can be executed, i.e. **command line**, **graphical user interface** and **client/server**. 2. Installation Procedure In this section the installation procedure for Windows, Linux and Mac operating systems are explained in detail. In each case, the installer comes in two versions, one that includes the Java Virtual Machine (larger size) and another that does not (“lite” version). If the installer that does not include the JVM is chosen, then Java 8 needs to be already installed in the computer. 2.1 Java 8 Java 8 only needs to be installed for the versions of DPF Manager that do not include the Java Virtual Machine. To check if Java 8 is already installed, open the terminal (in Windows OS `c:\Windows\System32\cmd.exe`) and type “java -version”. If the command is not found or the Java version is lower than 1.8, then Java needs to be upgraded. Java 8 can be downloaded from the following URL: [http://www.oracle.com/technetwork/java/javase/downloads/index.html](http://www.oracle.com/technetwork/java/javase/downloads/index.html) Go to the JRE link (or JDK if you are a developer), download the file for your operating system, run the installer and follow the steps in the screen. You can also use the OpenJDK (instead of the OracleJDK). However, if you want to use OpenJDK, you will need to build with the open version of OpenJDK that includes JavaFX that can be downloaded from here: [https://wiki.openjdk.java.net/display/OpenJFX/Building+OpenJFX](https://wiki.openjdk.java.net/display/OpenJFX/Building+OpenJFX) In Linux you may need to set the environment variable JRE_HOME and point it to the location where Java has been installed. 2.2 Windows 2.2.1 Installation The Windows installer is provided in a .exe file. A version that includes the Java Virtual Machine is available for 64-bit machines. And a version that does not include the Java Virtual Machine is available for 32 and 64 bit machines. The EXE installer is a four-step installation process. Open the installer, and click the “Next” button. Then select the desired folder for the application to be installed and click “Next”. After that, specify the application name and click “Next”. Finally, in the last step you can select whether to create a desktop shortcut or not, and also if you want to add the DPF Manager in the system path variable (so that you can run the program with the terminal without specifying its full path) and then click “Next” and “Install” for installing the software in the computer. At the end of the installation wizard you can choose to start the installed program. A link to the application will be put in the Windows Start Menu and also in the desktop (if the option in the installer was selected). The default location of the user data directory (where the reports and configuration files are stored by default) is: "c:\users\YOUR_USER\DPF Manager". 2.3 Linux For Linux installation, there are installers in .deb and .rpm formats, so as to be used in the most common Linux distributions, including Ubuntu, Fedora, Debian and Open Suse. 2.3.1 DEB installer To install the .deb package double click it and follow these steps: Click the “Install” button, in the top right. When prompted, click “Ignore and Install”. After that, enter your root password to grant administrator privileges. Now the DPF Manager is installed in the computer. Its default location is “/opt/DPFManager”. In order to run the DPF Manager in Linux, remember to have set the JRE_HOME variable and pointing to the actual Java location. ### 2.3.2 RPM installer Double click the install button when asked and wait until the packages have been installed. The DPF manager folder is located in the default location “/opt/DPFManager”. In order to run the DPF Manager in Linux, remember to have set the JRE_HOME variable and pointing to the actual Java location. ### 2.4 MacOS For Mac OS, the installer is a DMG file. For installing the DPF Manager in Mac OS, double click the DMG, and then just drag the application and drop it into your Applications folder, as indicated. To use the DPF Manager in Mac with the terminal, the executable is located at “/Applications/DPF Manager.app/Contents/MacOS/DPF Manager”. You can create an alias to run it from anywhere with the command: ``` alias dpf_manager="/Applications/DPF Manager.app/Contents/MacOS/DPF Manager" ``` 3. Application Usage DPF Manager can be run in command line mode (CLI) and through a Graphical user interface (GUI). In Linux there is a single executable for both interfaces of the DPF Manager, with the name “dpf-manager”. In order to open the GUI, execute “dpf-manager” (without parameters). For running the CLI, execute it with parameters, e.g. “dpf-manager --help”. In Windows there are two executables, one for the CLI, named “dpf-manager-console.exe” and another one for the GUI, named “DPF Manager.exe”. For MacOS, there is a single package in the Applications folder with the name “DPF Manager” that runs the GUI by default (double-clicking it). The CLI can be run by executing the inner executable “DPF Manager.app/Contents/MacOS/DPF Manager” through the terminal. 3.1 Command line To run the DPF Manager from the command line, execute the appropriate executable file for your operating system as explained before (in this section we will refer to it simply as dpf-manager, as it is in Linux), and run the following command: dpf-manager [commands] These are the available commands: - check: Performs a local files check. - config: Manages the configuration files. - gui: Launches graphical user interface. - modules: Manage the conformance checkers. - periodic: Manage periodical checks. - remote: Performs remote file checks (client mode). - server: Launches the server mode. There are also some general options: - -h, --help: Shows this screen. - -v, --version: Shows application version number. - -l, --language <lang_id>: Change the application language. Every command has its associated options and parameters, explained in the subsections below, and its own help function, so in order to see the available options for the “check” command you can “run dpf_manager check --help”. 3.1.1 Check Usage: dpf-manager check [options] source1 [source2 ... sourceN] Where sources is the tiff’s list to scan. Each element of the list can be either: - A file. It can be an absolute or a relative path. Example: "image.tif" - A folder. All the files inside the folder will be processed. Example: "photos/tifimages" - An URL. Example: "http://www.dpfmanager.org/image1.tif" - A zip file. Example: "images.zip" The following options are available: - `-c, --configuration <filename>`: Selects a configuration file. - `-f, --format [xml, json, pdf, html]`: Specifies the report format (overriding the one in the config file). Default is 'xml,html'. - `-h, --help`: Shows this screen - `-o, --output <path>`: Specifies the output folder (overriding the one specified in the config file). - `-r, --recursive [depth]`: Check directories recursively. If nodepth is given (-r) then it is fully-recursive. Default is '-r 1'. - `-s, --silence`: Silent execution (do not display info messages in the console) - `--show-report`: Open the report at the end - `-t, --threads <N>`: Specify maximum number of threads used for checking. By default, SO chooses. - `-w, --overwrite`: Overwrites the output folder - `-q, --quick`: Performs a quick check 3.1.2 Config Usage: dpf-manager config [action] [options] Actions (only one action allowed): - `-a, --add <name>`: Creates a new configuration. The name can be either a path or a configuration file name (it will be places in the default configuration folder). - `-e, --edit <name>`: Edits a configuration. The name can be either a path or a configuration file name (placed in the configuration folder). - `-h, --help`: Shows this help. - `-i, --info <name>`: Shows a configuration. The name can be either a path or a configuration file name (placed in the configuration folder). - `-l, --list [type]`: Lists useful information depending on 'type'. Type can be: - 'iso': Lists all possible ISOs. - 'rule': Lists all accepted tags for rules. - 'fix': Lists all accepted tags for fixes. - 'autofix': Lists all autofixes. - none: Lists all configurations in default folder. -r, --remove <name>: Deletes a configuration. The name can be either a path or a configuration file name (placed in the configuration folder). Options: - --autofix <autofix>: Adds an autofix. Use 'dpf-manager config --list autofix' to see the autofixes list. - -d, --description <description>: Sets the description of the configuration. If description is 'EMPTY', it will remove the description. - --disable-iso-rule <iso_id> <rule_id>: Disables a rule of an ISO. Use 'dpf-manager config --list iso' to see the ISOs list. - --enable-iso-rule <iso_id> <rule_id>: Enables a rule of an ISO. Use 'dpf-manager config --list iso' to see the ISOs list. - --fix <operator> <tag> [value]: Adds a fix specified by the parameters. See fix specification below. - -f, --format '[xml, json, pdf, html]': Specifies the report format. Default is 'xml,html' when creating. - --iso <iso_id>: Adds a ISO to check. Use 'dpf-manager config --list iso' to see the ISOs list. - -o, --output <path>: Specifies the output folder. Path can be either a path or 'DEFAULT', which will set the output folder to the default one. - --remove-autofix <autofix>: Removes an autofix. - --remove-fix <operator> <tag> [value]: Removes a fix specified by the parameters. See fix specification below. - --remove-iso <iso_id>: Removes a ISO to check. - --remove-rule <type> <tag> <operator> <value>: Removes a rule specified by the parameters. See rule specification below. - --rule <type> <tag> <operator> <value>: Adds a rule specified by the parameters. See rule specification below. Rule specification: - Type must be 'error' or 'warning'. - Tag must be an accepted Tag. Use 'dpf-manager config --list rule' to see the list of accepted tags. - Operator must be 'GT' (Greater than), 'LT' (Less than) or 'EQ' (Equals). Example: --rule error ImageWidth GT 500 Example: --rule warning ImageLength EQ 500 Fix specification: - Operator must be 'addTag' or 'removeTag'. - Tag must be an accepted Tag. Use 'dpf-manager config --list fix' to see the list of accepted tags. - Value is the value of the added tags. Example: --fix removeTag Copyright Example: --fix addTag Artist John 3.1.3 Modules Usage: dpf-manager modules [options] Options: - `-a, --add <name> <path>`: Add a conformance checker. - `--configure <name> <configuration>`: Set the configuration of a conformance checker. - `--disable <name>`: Deactivate a conformance checker. - `-e, --edit <name> <path>`: Edit the execution path of a conformance checker. - `--enable <name>`: Activate a conformance checker. - `--extensions <name> [ext1,ext2..extN]`: Set the extensions of a conformance checker. For example ‘tif,tiff’. - `-h, --help`: Shows this screen. - `-i, --info <name>`: Get information of a conformance checker. - `-l, --list`: Show the list of conformance checkers. - `--parameters <name> <parameters>`: Set the input parameters of a conformance checker. - `-r, --remove <name>`: Remove a conformance checker from the list. 3.1.4 Periodic Usage: dpf-manager periodic [options] [source1 ... sourceN] Options: - `-a, --add`: Add a new periodical check. It requires the options `--periodicity`, `--configure` and the sources. - `--configure <filename>`: Specifies the configuration file. - `-e, --edit <id>`: Edits the periodical check with the specified id. It requires the options `--periodicity`, `--configure` and the sources. - `-h, --help`: Shows this screen. - `-l, --list`: Lists all periodical checks. - `--periodicity <D|W|M> [extra_info]`: Specifies the periodical check mode. It must be D (daily), W (weekly) or M (monthly). In case of weekly, extra_info must be a list of the week days (with numbers, where 1 = Monday and 7 = Sunday) separated by ‘,’. In case of monthly, extra_info must be the number of the day of the month (between 1 and 28, both included). - `-r, --remove <id>`: Removes the periodical check with the specified id. - `--time <HH:mm>`: Specifies the time for the periodical check. The time format must be HH:mm. Default value is '00:00'. 3.1.5 Remote Usage: dpf-manager remote [options] [source1 ... sourceN] (the sources can be single files, directories, zip files or URLs) Options: - `-c`, `--configuration <filename>`: Selects a configuration file. - `-f`, `--format [xml, json, pdf, html]`: Specifies the report format (overriding the one in the config file). Default is 'xml,html'. - `-h`, `--help`: Shows this screen - `-j`, `--job <job_id>`: Get job state. - `-o`, `--output <path>`: Specifies the output folder (overriding the one specified in the config file). - `-u`, `--url <url>`: Specifies the remote server url. For example "http://example.com/dpfmanager", and also with a custom port "example.com:9000/dpfmanager". - `-w`, `--wait`: Wait for a remote check to finish. Default is false. 3.1.6 Server Usage: dpf-manager server [options] Options: - `-h`, `--help`: Shows this screen - `-p`, `--port <port_number>`: Specifies a port number. Default port is randomly chosen. 3.1.7 Results of the execution The results of the execution can be found in the specified output folder, or the default user data directory (in Windows: “c:\users\YOUR_USER\DPF Manager”, in Linux and MacOS: “/home/YOUR_USER”) if no output folder has been specified. Each one of the analysed tiff images will have its own report (in the specified formats), and a summary report will be also generated. In case that some fixes have been defined in the configuration file, the fixed images will be stored in the “fixed” directory, and each image will have generated an additional report for the fixed image, where the differences with the original image will be highlighted. 3.2 Client-Server mode The CLI can be used for client/server mode using the commands server to create the server instance and remote to use the client mode. When running the conformance checker in client mode, it does not halt until the job is done, but a job id is returned instead, which can be used to know the state of the job at any time through a -job call. The next call after the job is finished will return also the report. The option `-w` changes this behaviour allowing the client to wait until the job is done, instead of returning its job id. 3.3 Graphical User Interface The main window of the graphical user interface (GUI) is the following: The input file (or folder, or url, or zip) can be defined by: - manually typing its location - dragging the input into the text box - clicking the “Select” button in the right side (the arrow allows specifying files or folders to select). In order to verify the files, a configuration needs to be defined. The software comes with a default configuration file, which verifies that the files conform to the Tiff Baseline 6.0 and generates a report in HTML format. New configuration files can be defined by clicking the “New” button. Configuration files can also be edited, removed or imported from other sources than the default. Once both the files to be analysed, and the configuration file have been defined, the check buttons starts the process. A full check validates the tiff files and shows all the errors found in the report, while a quick check only shows if the tiff files have any error or not. The language of the GUI can be changed using the bottom-right selector. **3.3.1 Create Configuration** The creation of a new configuration file consists in 5 steps. In the first step, the ISO standards to be checked are selected. As mentioned in the above note, the DPF Manager automatically checks the validity of all the available ISOS, and identifies in the report the standards where it conforms to, even if they have not been selected in this step. In the second step the policy checker is defined. It consists in two parts. In the first part (custom standards), each of the standards selected in the implementation checker step can be edited. In the second part the acceptance criteria of the organization can be defined by adding rules with the desired properties for the Tiff files. When editing an ISO a new panel will appear showing all of the rules that the iso validates for a file to be valid. These rules can be disabled in order to create a less restrictive implementation check. In the second part rules can be added with the desired properties for the Tiff files. Rules can be **mandatory**, meaning that images not satisfying the rule will produce a policy error, or can be **warnings**, meaning that the images satisfying the rule will produce a warning. The available policies are the following: - **ImageWidth**: Checks the width in pixels of the image. This corresponds to tag 256 ImageWidth. - **ImageLength**: Checks the height in pixels of the image. This corresponds to tag 257 ImageWidth. - **PixelDensity**: Checks the resolution, in pixels per centimetre. This corresponds to tags 282 XResolution and 283 YResolution, which have usually the same value. - **NumberImages**: Checks the number of images in a single Tiff file. This is the number of IFD in the TIFF file. - **BitDepth**: Number of bits per pixels component (multiples of 2). This corresponds to tag 258 BitsPerSample. - **ExtraChannels**: Number of extra pixel components (e.g. transparency). - **EqualXYResolution**: Checks that the X and Y resolution of the image are the same. - **Compression**: Compression scheme. This corresponds to tag 259 Compression. - **Photometric**: Color space of the image data. This corresponds to tag 262 PhotometricInterpretation. - **Planar**: How the pixels components are stored. This corresponds to tag 284 PlanarConfiguration. - **ByteOrder**: Byte order (little endian, big endian). - **FileSize**: The size of the file in bytes. - **ICCProfileClass**: Class of the device ICC Profile. In the third step, the format of the report and the output folder is chosen: ![Output Format Options](image) By default the reports are stored in the user data directory (in windows operating systems it is “c:\users\USER_NAME\DPF Manager”, in Linux and MacOs it is “/home/USER_NAME/DPF Manager”). But a custom folder can be also set. The step number four is the metadata fixer, where the user can specify which fixes have to be done in the image. A fix means that a new image will be generated with the changes specified in this section, for example, adding or removing metadata into the image. There are four autofixes available: - **Clear Private Data**: This removes all the information related with the GPS coordinates where the photo was taken. - **Fix non-Ascii tags**: This solves a common error related with text that is not encoded in 7-bit ascii, which is the encoding allowed for tiff. - **Make Baseline Compliant**: Fixes some common errors regarding the Baseline 6 specifications. - **Fix Metadata Inconsistencies**: Resolves incoherencies in the metadata coming from IPTC, XMP and EXIF, following the guidelines of the Metadata Working Group\(^1\). \(^1\) [http://www.metadataworkinggroup.org/specs/](http://www.metadataworkinggroup.org/specs/) Finally, a summary window shows all the configuration properties for revision. And the whole configuration can be saved into a file, providing its name and a short description (optional). 3.3.2 Editing a configuration Configurations can be also opened and modified by clicking the button “Edit” in the main window. The steps of the wizard are going to be the same, and finally the configuration will be saved either to the same file or to a new one. 3.3.3 Importing a configuration External configuration files can also be imported to the configuration files folder through the “Import” button in the main window. When a configuration file is imported, the program asks if you want to save it in the default configuration directory, so that in future executions the configuration will appear in the configurations list, or not. 3.3.4 Periodical checks The periodical checks tab allows the user to define checks to be performed periodically. In order to configure a periodical check, a source (file or folder) must be defined and a configuration file has to be selected. Then, the periodicity can be either daily, weekly or monthly, and we can specify also the desired time of the check. Periodical checks create tasks in the operating system, so it is not necessary for the DPF Manager to be left opened for the periodical checks to be run. 3.3.5 Conformance checkers External conformance checkers can be configured in the “Conformance checkers” tab. By default, only the built-in TIFF conformance checker is available, but we can define other conformance checkers for other file formats (file extensions). Then we have to specify the location of the external conformance checker, the arguments to run it, and its configuration file. Note that you can define more than one conformance checker for the same file extension. In this case, the DPF Manager will automatically leverage the load over all the available conformance checkers of the same format. 3.3.6 Tasks A tasks widget is available in the bottom of the window. By default it is minimized, but clicking in the “Tasks” button in the bottom-left will show it. Here, all the checks that have been done in the current execution, or are currently running, can be seen. The icon in the left shows the main report format for the completed tasks, and clicking on it will show the report. When a task is running, it can be paused, resumed and cancelled. 3.3.7 Console A console widget is also available, which is used for the application as a logging system, and to show to the user possible errors that could occur during the execution. 3.3.8 Report Window After the report has been generated, the icon in the task takes the user to the report window, where a summary of the validation is shown. At the top, there is a table with a pie graph showing the total number of files analysed, and the total number of errors, correct files, and valid files with warnings. At the right side, the different formats for the global report are shown and can be clicked to create the corresponding file. The table at the bottom shows all the files analysed and the errors and warnings found. Also, a list of formats is available in order to generate the individual reports. When quick checks are performed instead of full checks, the errors and warnings columns are not shown, but an option to generate full checks of the individual reports is available, as well as a button to generate full checks of the entire set of files. An HTML-formatted global report looks like this, similar to the information shown before. The individual reports show the details of the Tiff structure, including a tree object, the metadata inconsistencies, the tag list and the results of the validation of each one of the selected profiles. In case the Tiff file contains multiple images, they can be chosen from the File Structure section, and the Tags list will be updated. For JSON and XML reports, the tag list contains all the existing tags in the Tiff file, while in human-readable formats, i.e. PDF and HTML, only the most relevant tags are displayed. 3.3.9 Summary of reports window The summary reports window shows a table of all the reports generated with the DPF Manager. Each row shows the most relevant statistics of the report, and the formats in which the report was generated. By clicking in the formats icons, the reports can be examined. The reports folder can be cleaned using the “clear options” button in the bottom left, which allows to remove all the reports, or only reports older than an specific date. 3.3.10 Statistics module The statistics module shows an overview of all the reports that have been performed with DPF Manager. In the top table, the total number of validations is shown, with basic general information. The second table shows all the tags that have been found in the reports, sorted by frequency. The information is divided in main images and thumbnail images (TIFF files can include reduced versions of a full resolution image). Each tag can be clicked in order to show the different values that have been found in the analysed reports. After that, the implementation checker table, shows the different ISOSs that have been analysed, and on clicking in them, an additional table appears showing all the errors that have been encountered in the files analysed with this standard. Finally, the policy checker table, shows all the policies that have been defined in any report and the results that have been obtained. 3.3.11 First time run The first time the application is opened, a legal advice is displayed. Here the user can send their contact information and tell the application whether to send anonymous usage information to the development team. The feedback option can be later modified in the About tab.
{"Source-Url": "http://dpfmanager.org/Downloads/User%20Manual.pdf", "len_cl100k_base": 5932, "olmocr-version": "0.1.53", "pdf-total-pages": 29, "total-fallback-pages": 0, "total-input-tokens": 54190, "total-output-tokens": 7160, "length": "2e12", "weborganizer": {"__label__adult": 0.0002923011779785156, "__label__art_design": 0.0005583763122558594, "__label__crime_law": 0.0002357959747314453, "__label__education_jobs": 0.0006766319274902344, "__label__entertainment": 0.0001163482666015625, "__label__fashion_beauty": 0.0001093149185180664, "__label__finance_business": 0.00019872188568115232, "__label__food_dining": 0.00015115737915039062, "__label__games": 0.0008816719055175781, "__label__hardware": 0.0012521743774414062, "__label__health": 0.00014591217041015625, "__label__history": 0.0001621246337890625, "__label__home_hobbies": 8.678436279296875e-05, "__label__industrial": 0.00022029876708984375, "__label__literature": 0.00020778179168701172, "__label__politics": 0.00013744831085205078, "__label__religion": 0.0004072189331054687, "__label__science_tech": 0.005413055419921875, "__label__social_life": 9.906291961669922e-05, "__label__software": 0.28759765625, "__label__software_dev": 0.70068359375, "__label__sports_fitness": 0.00015342235565185547, "__label__transportation": 0.0001316070556640625, "__label__travel": 0.0001747608184814453}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 25367, 0.02305]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 25367, 0.36169]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 25367, 0.7948]], "google_gemma-3-12b-it_contains_pii": [[0, 0, null], [0, 0, null], [0, 0, null], [0, 1929, false], [1929, 3144, null], [3144, 3468, null], [3468, 4633, null], [4633, 6436, null], [6436, 8566, null], [8566, 10707, null], [10707, 12647, null], [12647, 14763, null], [14763, 15330, null], [15330, 16232, null], [16232, 16774, null], [16774, 18039, null], [18039, 18899, null], [18899, 19565, null], [19565, 20397, null], [20397, 20913, null], [20913, 21528, null], [21528, 22169, null], [22169, 23049, null], [23049, 23139, null], [23139, 23662, null], [23662, 24134, null], [24134, 24933, null], [24933, 25069, null], [25069, 25367, null]], "google_gemma-3-12b-it_is_public_document": [[0, 0, null], [0, 0, null], [0, 0, null], [0, 1929, true], [1929, 3144, null], [3144, 3468, null], [3468, 4633, null], [4633, 6436, null], [6436, 8566, null], [8566, 10707, null], [10707, 12647, null], [12647, 14763, null], [14763, 15330, null], [15330, 16232, null], [16232, 16774, null], [16774, 18039, null], [18039, 18899, null], [18899, 19565, null], [19565, 20397, null], [20397, 20913, null], [20913, 21528, null], [21528, 22169, null], [22169, 23049, null], [23049, 23139, null], [23139, 23662, null], [23662, 24134, null], [24134, 24933, null], [24933, 25069, null], [25069, 25367, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 25367, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 25367, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 25367, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 25367, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 25367, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 25367, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 25367, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 25367, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 25367, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 25367, null]], "pdf_page_numbers": [[0, 0, 1], [0, 0, 2], [0, 0, 3], [0, 1929, 4], [1929, 3144, 5], [3144, 3468, 6], [3468, 4633, 7], [4633, 6436, 8], [6436, 8566, 9], [8566, 10707, 10], [10707, 12647, 11], [12647, 14763, 12], [14763, 15330, 13], [15330, 16232, 14], [16232, 16774, 15], [16774, 18039, 16], [18039, 18899, 17], [18899, 19565, 18], [19565, 20397, 19], [20397, 20913, 20], [20913, 21528, 21], [21528, 22169, 22], [22169, 23049, 23], [23049, 23139, 24], [23139, 23662, 25], [23662, 24134, 26], [24134, 24933, 27], [24933, 25069, 28], [25069, 25367, 29]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 25367, 0.0]]}
olmocr_science_pdfs
2024-12-10
2024-12-10
d85f12543dc4d675b6aff68e258528147ee23ded
ontoTools: software for working with ontologies in Bioconductor VJ Carey stvjc@channing.harvard.edu April 30, 2008 Contents 1 Introduction 2 2 Basic structures 2 2.1 Rooted DAG .......................... 2 2.2 compoundGraph ...................... 3 2.3 ontology ............................. 5 2.4 Mapped key-value list ............... 5 2.5 OOC: object-ontology complex ...... 6 3 Basic methods 6 3.1 Matrix conversion of DAG; namedSparse extension ................. 6 3.1.1 child2parent ........................ 6 3.1.2 Accessibility ..................... 8 3.2 Coverage matrix for an OOC ........ 9 3.3 Depth of terms in an ontology .......... 9 4 Applications to large data objects 9 4.1 Key-value list for LocusLink to GO .............. 9 4.2 GO graph and ontology for molecular function .......... 10 4.3 Mapping from LocusLink to GO ................ 10 5 Applications 10 5.1 Lord’s Bioinformatics 2003 paper ............ 10 5.1.1 Setup of the data .................. 11 5.1.2 Concept probabilities .............. 12 5.1.3 Identifying the most informative subsumer ...... 13 5.2 Iyer’s time-course experiment ............ 14 5.2.1 Setup ............................ 14 1 Introduction An ontology is a vocabulary arranged as a rooted directed acyclic graph (rDAG, or just DAG). This package provides tools for working with such data structures. A key concern is the interpretation of sets of objects mapped to an ontology. This package relies heavily on the graph package from Bioconductor, and the SparseM package from UIUC, available from CRAN. 2 Basic structures 2.1 Rooted DAG The rootedDAG class is built using a graph::graphNEL and specifying a root. This package comes with litOnto, which is a graphNEL. ```r > library(graph) > library(ontoTools) > data(litOnto) > print(litOnto) A graphNEL graph with directed edges Number of Nodes = 12 Number of Edges = 14 > print(class(litOnto)) [1] "graphNEL" attr(,"package") [1] "graph" ``` Children point to parents by default. When Rgraphviz is available, the graphical structure can be plotted using plot. It is possible to reverse the directions of arcs in such a graph. The rootedDAG object is constructed by hand. ```r > g1 <- new("rootedDAG", DAG = litOnto, root = "A") > show(DAG(g1)) A graphNEL graph with directed edges Number of Nodes = 12 Number of Edges = 14 ``` 2.2 compoundGraph This structure was devised to allow presentations like the following: ``` > root(g1) [1] "A" ``` The R code that generated the dot code from which this image was created, and the dot language code for the image, are as follows: ``` data(litObj) com <- new("compoundGraph", grList = list(litOnto, litObj), between = list(c("W", "Y"))) ``` + "E"), c("X", "K"), c("Y", "B"), c("Z", "D"), c("Z", "G")) > compRendList <- list(list(prenodes = "node [fontsize=28 color=orange fontcolor=orange"); + preedges = "edge [color=black];"), list(prenodes = "node [fontsize=28 color=green fontcolor=green"); + preedges = "edge [color=black];"), betweenRend = list(preedges = "edge [color = red"); > ff <- "demoComp.dot" > toDot(com, ff, compRendList) dot file written to demoComp.dot use 'dot -Tps [.dot] [.ps] to render > cat(readLines(ff), sep = "\n") digraph G { subgraph cluster_1 { node [fontsize=28 color=orange fontcolor=orange]; "A" ; "B" ; "C" ; "D" ; "E" ; "F" ; "G" ; "H" ; "I" ; "J" ; "K" ; "L" ; edge [color=black]; edge [dir=back] "A" -> "B" ; edge [dir=back] "A" -> "C" ; edge [dir=back] "B" -> "D" ; edge [dir=back] "B" -> "E" ; edge [dir=back] "C" -> "F" ; edge [dir=back] "C" -> "G" ; edge [dir=back] "D" -> "H" ; edge [dir=back] "E" -> "H" ; edge [dir=back] "D" -> "I" ; edge [dir=back] "C" -> "I" ; edge [dir=back] "E" -> "I" ; edge [dir=back] "F" -> "J" ; edge [dir=back] "F" -> "K" ; edge [dir=back] "G" -> "L" ; } 2.3 ontology This is just a lightly annotated rootedDAG. ```r > g1 <- new("rootedDAG", DAG = litOnto, root = "A") > o1 <- new("ontology", name = "demo", version = "0.1", rDAG = g1) > show(o1) Ontology object demo, version 0.1 root= A Terms: [1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" ``` 2.4 Mapped key-value list At present this is not a class. ```r > kvlist <- list(W = "E", X = "K", Y = "B", Z = c("D", "G")) > litMap <- otkvList2namedSparse(names(kvlist), LETTERS[1:12], + kvlist) > print(litMap) named sparse matrix of dim[1] 4 12 northwest 4x4: A B C D W 0 0 0 0 X 0 0 0 0 Y 0 1 0 0 Z 0 0 0 1 ``` 2.5 OOC: object-ontology complex This combines an ontology and a mapped key-value list that specifies how objects map to terms. ```r > ooc1 <- makeOOC(o1, litMap) > show(ooc1) ``` Object-ontology complex with ontology: Ontology object demo, version 0.1 root= A Terms: [1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" Object-ontology map: named sparse matrix of dim[1] 4 12 northwest 4x4: A B C D W 0 0 0 0 X 0 0 0 0 Y 0 1 0 0 Z 0 0 0 1 3 Basic methods 3.1 Matrix conversion of DAG; namedSparse extension This should be a generic. There are two basic sorts of matrices available: child2parent which has 1 in element (i,j) if node i is the child of node j, and an accessibility matrix that has 1 in element (i,j) if node i may be reached from node j. 3.1.1 child2parent ```r > g1 <- new("rootedDAG", DAG = litOnto, root = "A") > mg1d <- getMatrix(g1, "child2parent", "dense") > print(mg1d) ``` ``` A B C D E F G H I J K L A 0 0 0 0 0 0 0 0 0 0 0 0 B 1 0 0 0 0 0 0 0 0 0 0 0 C 1 0 0 0 0 0 0 0 0 0 0 0 D 0 1 0 0 0 0 0 0 0 0 0 0 E 0 1 0 0 0 0 0 0 0 0 0 0 F 0 0 1 0 0 0 0 0 0 0 0 0 ``` Typically a sparse representation will be needed. ```r > ng1 <- getMatrix(g1, "child2parent", "sparse") > ng1 <- new("namedSparse", mat = ng1) > dimnames(ng1) <- list(as.character(1:dim(ng1@mat)[1]), as.character(1:dim(ng1@mat)[2])) > print(ng1@mat) An object of class "matrix.csr" Slot "ra": [1] 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Slot "ja": [1] 1 1 1 2 2 3 3 4 5 4 3 5 6 6 7 Slot "ia": [1] 1 2 3 4 5 6 7 8 10 13 14 15 16 Slot "dimension": [1] 12 12 > print(as.matrix(ng1)) 1 2 3 4 5 6 7 8 9 10 11 12 1 0 0 0 0 0 0 0 0 0 0 0 0 2 1 0 0 0 0 0 0 0 0 0 0 0 3 1 0 0 0 0 0 0 0 0 0 0 0 4 0 1 0 0 0 0 0 0 0 0 0 0 5 0 1 0 0 0 0 0 0 0 0 0 0 6 0 0 1 0 0 0 0 0 0 0 0 0 7 0 0 1 0 0 0 0 0 0 0 0 0 8 0 0 0 1 1 0 0 0 0 0 0 0 9 0 0 1 1 1 0 0 0 0 0 0 0 10 0 0 0 0 0 1 0 0 0 0 0 0 11 0 0 0 0 0 1 0 0 0 0 0 0 12 0 0 0 0 0 0 1 0 0 0 0 0 ``` We have not implemented a full set of element subsetting operations as we expect the SparseM authors to do so. However, efficient operations using names of rows and columns are essential. These are implemented using hashed environments. ```r > dimnames(ng1) <- list(letters[1:12], LETTERS[1:12]) > print(class(ng1)) [1] "namedSparse" attr(,"package") [1] "ontoTools" > print(getSlots("namedSparse")) Dimnames mat "list" "matrix.csr" > print(as.matrix(ng1)) A B C D E F G H I J K L a 0 0 0 0 0 0 0 0 0 0 0 0 b 1 0 0 0 0 0 0 0 0 0 0 0 c 1 0 0 0 0 0 0 0 0 0 0 0 d 0 1 0 0 0 0 0 0 0 0 0 0 e 0 1 0 0 0 0 0 0 0 0 0 0 f 0 0 1 0 0 0 0 0 0 0 0 0 g 0 0 1 0 0 0 0 0 0 0 0 0 h 0 0 0 1 1 0 0 0 0 0 0 0 i 0 0 1 1 1 0 0 0 0 0 0 0 j 0 0 0 0 1 0 0 0 0 0 0 0 k 0 0 0 0 0 1 0 0 0 0 0 0 l 0 0 0 0 0 1 0 0 0 0 0 0 3.1.2 Accessibility Currently this is only handled for an ontology. > show(accessMat(o1)) named sparse matrix of dim[1] 12 12 northwest 4x4: A B C D A 0 0 0 0 B 1 0 0 0 C 1 0 0 0 D 1 1 0 0 3.2 Coverage matrix for an OOC This matrix has element 1 in row r, column c if object corresponding to row r is covered by the term corresponding to column c. This means that the term for column c is accessible from some term to which the object for row r was explicitly mapped. ```r > print(coverageMat(ooc1)) ``` ``` named sparse matrix of dim[1] 4 12 northwest 4x4: A B C D W 1 1 0 0 X 1 0 1 0 Y 1 1 0 0 Z 1 1 1 1 ``` 3.3 Depth of terms in an ontology We need to be able to get the set of terms at a certain depth (root is depth 0) and the depth of any given term. ```r > print(ontoDepth(g1)) ``` ``` A B C D E F G H I J K L 0 1 1 2 2 2 2 3 3 3 3 3 ``` ```r ds1 <- depthStruct(g1) > print(ds1$tag2depth("B")) ``` ``` [1] 1 ``` ```r > print(ds1$depth2tags(3)) ``` ``` [1] "H" "I" "J" "K" "L" ``` 4 Applications to large data objects 4.1 Key-value list for LocusLink to GO The humanLLMappings metadata package from Bioconductor includes humanLLMappingsLL2GO, to regarded as a key-value environment mapping. The otkvEnv2namedSparse function can be used with this environment and the GOMF terms to create the object to term mapping. See ooMapLL2GOMFdemo.rda. 4.2 GO graph and ontology for molecular function The buildGOGraph function was used to create goMFgraph.1.15.rda on the basis of the GO package. With this graph in hand, we construct the rooted DAG \[ \text{data(goMFgraph.1.15)} \] \[ \text{gomfrDAG } \leftarrow \text{new("rootedDAG", root = "GO:0003674", DAG = goMFgraph.1.15)} \] and then the ontology: \[ \text{GOMFonto } \leftarrow \text{new("ontology", name = "GOMF", version = "bioc 1.3.1", } \] \[ + \text{rDAG = gomfrDAG)} \] The term accessibility matrix is important for semantic calculations. This is a slow calculation and its result is archived. \[ gomfAmat \leftarrow \text{accessMat(GOMFonto)} \] \[ \text{save(gomfAmat,file="gomfAmat.rda", compress=TRUE)} \] 4.3 Mapping from LocusLink to GO The LocusLink database is a collection of one-to-many mappings from genes or gene-associated sequence to GO tags. This object-to-term (‘ot’) association is provided as an environment by bioconductor in the humanLLMappings package. We will use a named sparse matrix structure to encode the object to term mapping. For this example, the mapping is archived after computation by the following code: \[ \text{library(humanLLMappings)} \] \[ \text{data(humanLLMappingsLL2GO)} \] \[ \text{data(goMFgraph1.15)} \] \[ \text{obs } \leftarrow \text{ls(env=humanLLMappingsLL2GO)} \] \[ \text{tms } \leftarrow \text{nodes(goMFgraph.1.15)} \] \[ \text{ooMapLL2GOMFDemo } \leftarrow \text{otkvEnv2namedSparse( obs, tms, humanLLMappingsLL2GO )} \] \[ \text{save(ooMapLL2GOMFDemo,file="ooMapLL2GOMFDemo.rda")} \] 5 Applications 5.1 Lord’s *Bioinformatics 2003* paper Lord’s paper on semantic similarity measures defines a probability \( p(c) \) for each concept term \( c \). Semantic similarity between terms \( c_1 \) and \( c_2 \) can be measured as \(- \log p_{ms}(c_1, c_2)\), where \( p_{ms} \) is the so-called “probability of the minimum subsumer”, defined as \[ p_{ms}(c_1, c_2) = \min_{c \in S(c_1, c_2)} \{ p(c) \}, \] where $S(c_1, c_2)$ is the set of all terms that are refined by both $c_1$ and $c_2$. We indicate how these computations can be performed using test data in *ontoTools*. Most of the functions defined here as x.vig are included in the package (sometimes with slight modifications), lacking the vig suffix. ### 5.1.1 Setup of the data We begin by attaching the package and converting the litOnto information (encoding the 12-term ontology) into a rootedDAG. ```r > library(ontoTools) > data(litOnto) > g1 <- new("rootedDAG", DAG = litOnto, root = "A") ``` Now we create an ontology object based on this rooted DAG: ```r > o1 <- new("ontology", name = "demo", version = "0.1", rDAG = g1) ``` The mapping from objects to the concepts in the ontology uses a key-value list, with multimappings represented by vectors. ```r > kvlist <- list(W = "E", X = "K", Y = "B", Z = c("D", "G")) ``` A special function compute the object to term map: ```r > demomap <- otkvList2namedSparse(names(kvlist), LETTERS[1:12], + kvlist) ``` We obtain the object-ontology complex. ```r > demoooc <- makeOOC(o1, demomap) ``` The map from objects to terms is: ```r > print(OOmap(demoooc)) ``` ```r named sparse matrix of dim[1] 4 12 northwest 4x4: A B C D W 0 0 0 0 X 0 0 0 0 Y 0 1 0 0 Z 0 0 0 1 ``` The coverage matrix can be directly computed: ```r > cov1 <- coverageMat(demoooc) > print(cov1) ``` named sparse matrix of dim[1] 4 12 northwest 4x4: A B C D W 1 1 0 0 X 1 0 1 0 Y 1 1 0 0 Z 1 1 1 1 5.1.2 Concept probabilities We begin with the concept probabilities. The counts of usages per term is ```r > ACC <- accessMat(ontology(demooc)) > acctms <- dimnames(ACC)[[2]] > print(acctms) [[1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" > MAP <- OOmap(demooc) > nterms <- function(x) length(nodes(DAG(rDAG(x)))) > ontoTerms <- function(x) nodes(DAG(rDAG(x))) > print(ontoTerms) function (x) nodes(DAG(rDAG(x))) > usageCount.vig <- function(MAP, ACC) { + maptms <- dimnames(MAP)[[2]] + acctms <- dimnames(ACC)[[2]] + usages <- rep(0, length(maptms)) + names(usages) <- maptms + for (i in 1:nrow(MAP)) { + hits <- maptms[as.matrix.ok(MAP[i, ]) == 1] + usages[hits] <- usages[hits] + 1 + for (j in 1:length(hits)) { + anctags <- acctms[as.matrix.ok(ACC[hits[j], ]) == 1] + usages[anctags] <- usages[anctags] + 1 + } + } + usages + } > print(usageCount.vig(MAP, ACC)) ``` because whenever a term is used, all its ancestors are implicitly used as well (Lord section 2). This inherited usage does not recurse, however. A basic usage event fires up the graph once; the fact that a descendent is used transitively does not increment the usage of its ancestors. The total number of basic usage events is > print(N <- max(usages)) [1] 5 The vector of concept probabilities is > print(usages/N) A B C D E F G H I J K L 1.0 0.6 0.4 0.2 0.2 0.2 0.2 0.0 0.0 0.0 0.2 0.0 So we have > conceptProbs.vig <- function(ooc) { + if (is(occ, "OOC")) + stop("arg must have class OOC") + pc <- usageCount.vig(OOmap(ooc), accessMat(ontology(ooc))) + pc/max(pc, na.rm = TRUE) + } 5.1.3 Identifying the most informative subsumer This task involves the ontology (to identify subsumers) and then the concept probabilities. > subsumers.vig <- function(c1, c2, ont) { + if (!is(ont, "ontology")) + stop("ont must have class ontology") + tmp <- colSums(accessMat(ont)[c(c1, c2), ]) + names(tmp[tmp == 2]) + } > print(subsumers.vig("I", "K", ontology(demoooc))) [1] "A" "C" Thus we can use > pms.vig <- function(c1, c2, ooc) { + if (!(is(ooc, "OOC"))) + stop("arg must have class OOC") + if (any(!(c(c1, c2) %in% nodes(DAG(rDAG(ontology(ooc))))))) + stop("some term not found in ontology DAG nodes") + S <- subsumers.vig(c1, c2, ontology(ooc)) + pc <- conceptProbs.vig(ooc) + min(pc[S]) + } > print(pms("I", "K", demooc)) progress in (1, 4): [1] 0.4 Now we can compute semantic similarity relative to an OOC: > semsim.vig <- function(c1, c2, ooc) -log(pms.vig(c1, c2, ooc)) 5.2 Iyer’s time-course experiment 5.2.1 Setup We attach the Iyer517 library and the IyerAnnotated data structure. IyerAnnotated is a data.frame that gives the mapping from probes in Iyer517 to up to 5 GO MF tags. > library(ontoTools) > library(Iyer517) > data(IyerAnnotated) > print(IyerAnnotated[1:3, ]) <table> <thead> <tr> <th>Iclust</th> <th>GB</th> <th>seqno</th> <th>locusid</th> <th>GO1</th> <th>GO2</th> <th>GO3</th> <th>GO4</th> <th>GO5</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>N</td> <td>W95909</td> <td>1</td> <td></td> <td></td> <td></td> <td>&lt;NA&gt;</td> <td>&lt;NA&gt;</td> </tr> <tr> <td>2</td> <td>A</td> <td>AA045003</td> <td>2</td> <td>6414</td> <td>GO:0008430</td> <td>&lt;NA&gt;</td> <td>&lt;NA&gt;</td> <td>&lt;NA&gt;</td> </tr> <tr> <td>3</td> <td>A</td> <td>AA044605</td> <td>3</td> <td>5300</td> <td>GO:0003755</td> <td>GO:0005515</td> <td>&lt;NA&gt;</td> <td>&lt;NA&gt;</td> </tr> </tbody> </table> We also attach the concept probabilities for GO MF, relative to the LocusLink usages. > data(LL2GOMFcp.1.15) > print(LL2GOMFcp.1.15[1:3]) <table> <thead> <tr> <th>GO:0000010</th> <th>GO:0000014</th> <th>GO:0000016</th> </tr> </thead> <tbody> <tr> <td>4.675082e-05</td> <td>4.675082e-05</td> <td>2.337541e-05</td> </tr> </tbody> </table> We also define a function that extracts the most informative of a set of tags: > getMostInf <- function(tags, pc = LL2GOMFcp.1.15) { + if (length(tags) == 1) + return(tags) + if (all(is.na(tags))) + return(NA) + tags[pc[tags] == min(pc[tags])][1] + } and apply this to the probe-specific tag sets: > GOmost <- apply(IyerAnnotated[, 5:9], 1, function(x) getMostInf(as.character(x[!is.na(x)])) We also need an OOC for GOMF relative to LocusLink: > data(goMFgraph.1.15) > data(LL2GOMFooMap.1.15) > data(goMFamat.1.15) > gomfrDAG <- new("rootedDAG", root = "GO:0003674", DAG = goMFgraph.1.15) > GOMFonto <- new("ontology", name = "GOMF", version = "bioc 1.3.1", + rDAG = gomfrDAG) > LLGOMFOOC <- makeOOC(GOMFonto, LL2GOMFooMap.1.15) 5.2.2 Filtering the IyerAnnotated tags The Iyer data have been clustered. > print(table(IyerAnnotated$Iclust)) <table> <thead> <tr> <th></th> <th>A</th> <th>B</th> <th>C</th> <th>D</th> <th>E</th> <th>F</th> <th>G</th> <th>H</th> <th>I</th> <th>J</th> <th>N</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>100</td> <td>145</td> <td>34</td> <td>43</td> <td>7</td> <td>34</td> <td>15</td> <td>63</td> <td>19</td> <td>25</td> <td>32</td> </tr> </tbody> </table> We will work with the four largest clusters, extracting the most informative tag for each cluster. > getMostInfTags <- function(let) { + grp.GO <- GOmost[IyerAnnotated$Iclust == let] + grp.GO[!is.na(grp.GO)] + } > A.GO <- getMostInfTags("A") > B.GO <- getMostInfTags("B") > D.GO <- getMostInfTags("D") > H.GO <- getMostInfTags("H") 5.2.3 Computing pairwise semantic similarity The next function computes the pairwise semantic similarities in a group of tags. However, to save time, the loop is truncated at 20 pairs. ``` > getSim <- function(x, Nchk = 60) { + library(combinat) + prs <- combn(x, 2) + sim <- rep(NA, ncol(prs)) + for (i in 1:ncol(prs)) { + if (i > Nchk) + break + cat(i) + if (any(!(c(prs[1, i], prs[2, i]) %in% goMFamat.1.15@Dimnames[[1]]))) + sim[i] = NA + else sim[i] <- semsim(prs[1, i], prs[2, i], acc = goMFamat.1.15, + pc = LL2GOMFcp.1.15, ooc = LLGOMFOOC) + } + sim[1:Nchk] + } ``` We compute the pairwise similarities for the 4 groups. ``` > Asim <- getSim(A.GO) > Bsim <- getSim(B.GO) > Dsim <- getSim(D.GO) > Hsim <- getSim(H.GO) ``` Display the similarity statistics: ``` > boxplot(Asim, Bsim, Dsim, Hsim) ```
{"Source-Url": "http://bioconductor.org/packages/2.2/bioc/vignettes/ontoTools/inst/doc/ontoTools.pdf", "len_cl100k_base": 7126, "olmocr-version": "0.1.53", "pdf-total-pages": 16, "total-fallback-pages": 0, "total-input-tokens": 31117, "total-output-tokens": 8108, "length": "2e12", "weborganizer": {"__label__adult": 0.00032973289489746094, "__label__art_design": 0.0007219314575195312, "__label__crime_law": 0.0004696846008300781, "__label__education_jobs": 0.0018320083618164065, "__label__entertainment": 0.0001990795135498047, "__label__fashion_beauty": 0.00019669532775878904, "__label__finance_business": 0.0003829002380371094, "__label__food_dining": 0.00044465065002441406, "__label__games": 0.0008702278137207031, "__label__hardware": 0.0011739730834960938, "__label__health": 0.000935077667236328, "__label__history": 0.00045180320739746094, "__label__home_hobbies": 0.00019729137420654297, "__label__industrial": 0.00058746337890625, "__label__literature": 0.0005326271057128906, "__label__politics": 0.0003809928894042969, "__label__religion": 0.0006375312805175781, "__label__science_tech": 0.283203125, "__label__social_life": 0.00023543834686279297, "__label__software": 0.0765380859375, "__label__software_dev": 0.62841796875, "__label__sports_fitness": 0.0003285408020019531, "__label__transportation": 0.00037217140197753906, "__label__travel": 0.00025725364685058594}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 18117, 0.08478]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 18117, 0.71883]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 18117, 0.65329]], "google_gemma-3-12b-it_contains_pii": [[0, 1233, false], [1233, 2401, null], [2401, 2761, null], [2761, 3993, null], [3993, 4618, null], [4618, 5768, null], [5768, 6603, null], [6603, 7638, null], [7638, 8813, null], [8813, 10809, null], [10809, 12201, null], [12201, 13223, null], [13223, 14344, null], [14344, 15954, null], [15954, 17239, null], [17239, 18117, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1233, true], [1233, 2401, null], [2401, 2761, null], [2761, 3993, null], [3993, 4618, null], [4618, 5768, null], [5768, 6603, null], [6603, 7638, null], [7638, 8813, null], [8813, 10809, null], [10809, 12201, null], [12201, 13223, null], [13223, 14344, null], [14344, 15954, null], [15954, 17239, null], [17239, 18117, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 18117, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 18117, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 18117, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 18117, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 18117, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 18117, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 18117, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 18117, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 18117, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 18117, null]], "pdf_page_numbers": [[0, 1233, 1], [1233, 2401, 2], [2401, 2761, 3], [2761, 3993, 4], [3993, 4618, 5], [4618, 5768, 6], [5768, 6603, 7], [6603, 7638, 8], [7638, 8813, 9], [8813, 10809, 10], [10809, 12201, 11], [12201, 13223, 12], [13223, 14344, 13], [14344, 15954, 14], [15954, 17239, 15], [17239, 18117, 16]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 18117, 0.02087]]}
olmocr_science_pdfs
2024-12-06
2024-12-06
30ed2e2d5feee07f730c72329c2b625ce63db2ce
A self–stabilizing algorithm for finding weighted centroid in trees Halina Bielak\textsuperscript{1*}, Michał Pańczyk\textsuperscript{2†} \textsuperscript{1}Institute of Mathematics, Maria Curie-Sklodowska University, pl. M. Curie-Sklodowskiej 1, 20-031 Lublin, Poland. \textsuperscript{2}Institute of Computer Science, Maria Curie-Sklodowska University, pl. M. Curie-Sklodowskiej 1, 20-031 Lublin, Poland. Abstract – In this paper we present some modification of the Blair and Manne algorithm for finding the center of a tree network in the distributed, self-stabilizing environment. Their algorithm finds \(\frac{n}{2}\)-separator of a tree. Our algorithm finds weighted centroid, which is direct generalization of the former one for tree networks with positive weights on nodes. Time complexity of both algorithms is \(O(n^2)\), where \(n\) is the number of nodes in the network. 1 Introduction A notion of self-stabilizing algorithms on distributed systems was introduced by Dijkstra [1] in 1974. A survey in the topic can be found in the paper by Schneider [2], and more details in the book by Dolev [3]. The notions from the graph theory not defined in this paper can be found in the book by Harary [4]. A distributed self-stabilizing system consists of a set of processes (computing nodes) and communication links between them. Every node in the system runs the same algorithm and can change state of local variables. These variables determine local state of a node. Nodes can observe the state of variables on themselves and their neighbour nodes. The state of all the nodes in the system determines the global state. Every self-stabilizing algorithm should have a class of global states called legitimate state defined, when the system is stable and no action can be done by the algorithm itself. Every other global state is called illegitimate and for the algorithm to be correct \*hbiel@hektor.umcs.lublin.pl \†mjpanczyk@gmail.com there has to be some possibility to make a move if the state is illegitimate. The aim of the self-stabilizing algorithm is to bring the legitimate (desirable) state of the whole system after some alteration (from the outside of the system) of variables in the nodes or after the system has started. The tree leader (medians) notions were first studied by Zelinka in [5] in 1967. The self-stabilizing leader electing in unweighted trees was presented in [6] by Bruell, et al. and improved in [7] by Blair and Manne. Recently Chepoi et al. [8] have presented the self-stabilizing algorithm for the so-called partial rectangular grids. Their algorithm uses generalization of the algorithm from [6], which computes also the median of a tree, but in a different way from that in our paper. In this paper we present an algorithm for electing a centroid node in weighted trees. Every node in the system has its weight. We are going to find the node whose removal would split the tree into connected components with the sum of weights not greater than the half of the weight of the whole tree. Of course, for any node there would be as many such components as the degree of the node is. In other words, we are looking for weighted centroid of a tree. Fig. 1 presents the weighted tree of order 7. 2 Computational Model We consider a self-stabilizing system modelled by a finite, undirected graph $G = (V, E)$. Let the number of vertices be $n = |V|$ and the number of edges $e = |E|$. In this paper we consider trees, so the number $e$ of the edges in the graph is $n - 1$. A set of all neighbours of the node $i$ is $N(i)$. We think of every process as a node in the tree, whereas edges are the connection links between them. There are some variables in each node. Names and types of the variables are set during design of an algorithm. Every node can also look up the state of the variables at its neighbours. ![Fig. 1. An example of a weighted tree.](image-url) Each node runs the same algorithm. The algorithm consists of a set of rules. A rule has the form ``` : label If guard then assignment instructions. ``` A `guard` is a logic predicate which can refer to variables in the node itself and its neighbours. We say that a rule is `active` if its guard is evaluated to be true. A node is `active` if it contains any active rule. If there is no active node in the graph, we say that the system is `stabilized`. A self-stabilizing system contains also a `scheduler`. Its task is to choose one process from the set of active processes and to trigger an active rule in it. We call such an action a `move`. In this article the scheduler is assumed to be distributed and adversarial, so the order of activating the nodes is nondeterministic. As a consequence, while describing pessimistic complexity of the algorithm (number of moves), we must take the worst case scenario of triggering actions in particular nodes. ### 3 Finding Centroid Node Algorithm Blair and Manne [7] presented a fast algorithm for leader election in unweighted trees. Now we present an algorithm for finding centroid in weighted trees. The idea is quite similar to the original algorithm without weights. Let us have an unrooted tree. Every node \(i\) of the tree has got the assigned weight \(w_i\) which is a positive natural number. A `weighted centroid` is such a node that its removal splits the tree into connected components with the sum of weight of each one not greater than \(W/2\), where \(W\) denotes the entire tree weight. **Lemma 1.** There is at least one weighted centroid node in a weighted tree. **Proof.** Let us assume that there is no weighted centroid node in a tree. This means that if we remove any node from the tree, there will be one connected component with the weight greater than \(W/2\). Starting at an arbitrary node we can go to a neighbour which is a part of the component with the weight greater than \(W/2\). By repeating this step, at some point we will get back to the previous node we have been in. Further steps would loop infinitely between these two nodes. If we cut the edge between them, there will be two connected trees, both with the weight greater than \(W/2\). But this cannot be true since the weights should sum up to \(W\). \(\square\) As the existence of centroid nodes has been proven, now we state an upper bound on the number of such nodes. **Theorem 1.** The number of centroid nodes in a tree with positive weights on the nodes is either one or two. Moreover, if there are two centroid nodes, they are adjacent. A self–stabilizing algorithm for finding weighted... Proof. Let us assume that there are two weighted centroid nodes \( i, j \) in a tree, such that they are not adjacent. There is at least one node between them from the subtree containing nodes from the set \( B \) as shown in Fig. 2. Let \( B \) contain neither \( i \) nor \( j \). Also let \( A \) and \( C \) denote the sets of nodes in subtrees (other than the subtree containing \( B \)) rooted on the neighbours of nodes \( i \) and \( j \) respectively. Fig. 2. Visualisation of the proof of Theorem 1. Let \( W \) denote the weight of the entire tree, so we can write \[ w_A + w_i + w_B + w_j + w_C = W, \] where \( w_A, w_B, w_C, w_i, w_j \) mean the weights of subgraphs induced by the sets \( A, B, C, \{i\}, \{j\} \), respectively. Since \( i \) is a weighted centroid we can write down: \[ w_B + w_j + w_C \leq W/2. \] The same applies for \( j \), so \[ w_A + w_i + w_B \leq W/2. \] By adding the above two inequalities side by side we have \[ w_A + w_i + 2w_B + w_j + w_C \leq W, \] which compared to (1) implies that \( w_B = 0 \). But this cannot be true since all weights in the tree are positive. This proves that two centroid nodes are always adjacent. To end up the proof, it is sufficient to show that there cannot be more than two centroid nodes. Let us assume that there are at least 3 centroid nodes. Since every two of them must be adjacent, they must form a cycle with 3 nodes as a subgraph. But this is impossible since a tree is an acyclic connected graph (net). Now we are ready to present the searching weighted centroid node algorithm in the weighted trees. The algorithm consists of two phases. The first one determines weights of some components adjacent to every node of a tree. After stabilization of the first phase every node can also find out the weight of entire entire tree. The second phase of the algorithm selects the centroid node relying on the information given by the first phase. Both phases of algorithms run in parallel. However, while the first one is running, moves made by the second phase are meaningless — they only increase the number of moves made by the algorithm. 3.1 Phase one — determining weights of components In our algorithm each node contains in itself an array $W_i$ of weights. After stabilization of the system, the value of array $W_i[j]$ for every neighbour $j$ of the node $i$ is the weight of connected component containing node $i$ but with $\{i, j\}$ edge cut. $$R1: \text{If } \exists j \in N(i) \text{ such that } W_i[j] \neq w_i + \sum_{k \in N(i) - \{j\}} W_k[i] \text{ then } W_i[j] := w_i + \sum_{k \in N(i) - \{j\}} W_k[i]$$ Note that for any leaf $i$ and its neighbour $j$, $W_i[j]$ will be set to the weight $w_i$ of the node $i$. ![Fig. 3. The tree from Fig. 1 with $W_i[j]$ calculated for every node $i$ and its neighbour $j$ — after stabilization of R1 algorithm.](image) Below we state a lemma about stabilization of R1 algorithm. It is analogous to that from [7], but in this case for the weighted tree network algorithm. The idea of the proof is also the same, but in this paper we give an extension to the weighted tree network algorithm. **Lemma 2.** Algorithm R1 stabilizes. **Proof.** Let us have any sequence of executions $E_1, E_2, \ldots, E_k$ of the rule R1 on a sequence of the consecutive nodes $n_1, n_2, \ldots, n_k, n_{k+1}$ ($E_i$ is an execution of R1 rule on $n_i$ node) such that $E_i, 1 < i \leq k$, is the first update of $W_{n_i}[n_{i+1}]$ that makes use of the value $W_{n_i-1}[n_i]$. For example, the first such dependency is the use of $W_{n_i}[n_2]$ for updating $W_{n_i}[n_3]$. Now we show that $n_i \neq n_j$ for $i \neq j$. According to the rule R1, it is impossible to have $n_i = n_{i+1}$. To show that also $n_i \neq n_{i+2}$ for every $i$, let us consider that propagation of R1 moves along a path in the tree (see Fig. 4). For any node $i$ the value of $W_i[j]$ depends only on the values $W_h[i]$ in the neighbours $h \neq j$. On the other hand, the value $W_i[j]$ influences the value $W_j[k]$ in a node $j$ for its any neighbour $k \neq i$. If we take $n_i = h$ and $n_{i+2} = j$, then the equation $n_i = n_{i+2}$ would imply that there is A self-stabilizing algorithm for finding weighted... a cycle in the graph. But since it is a tree it is not possible. The above argument can be repeated for any \( c \geq 2 \) in rejecting the equation \( n_i = n_{i+c} \). Thus we have \( k < n \), where \( n \) is the number of nodes of the tree. There exists exactly one path between any two nodes in a tree. Thus the set of all maximal paths of executing the rule R1 contains \( n^2 \) elements when the orientation of such paths (the order from left to right, and from right to left) is distinguished. The only way the number of paths is unbounded is if the same path sequence appears more than once in the set but with different input values. To show that it is impossible, note that the first move of every maximal sequence of moves must depend only on the system initial state. So if \( E \) and \( E' \) are two maximal paths of execution of the rule R1 such that \( n_i = n'_i \), then the first move for both sequences must be the same. Now it follows by induction that \( E \) and \( E' \) must consist of the same moves since the \( i \)-th move is uniquely dependent on the previous \( (i - 1) \)-th move. \[ \square \] \[ \text{Fig. 4. Propagation of R1 moves along a path in a tree.} \] **Lemma 3.** When algorithm R1 has stabilized \( W_i[j] \) is correctly computed for every node \( i \) and its neighbour \( j \). **Proof.** The proof is by induction on the number of nodes in a tree. As the base case let us take a leaf. There are two possibilities: either \( W_i[j] \) in a leaf \( i \) is correct or it is not correct at the beginning of running of the algorithm. If it is not correct, the rule R1 is active and it will be triggered finally. After this move, the rule R1 becomes inactive. If the \( W_i[j] \) is correct in a leaf, it will never be changed or become incorrect. Now our induction hypothesis is that for a node \( i \) its every neighbour \( k \) except for a node \( j \), i.e. \( k \neq j \) has computed the value \( W_k[i] \) correctly. Given that, if node \( i \) has the value \( W_i[j] \) incorrect, now it can compute it and set a correct value to \( W_i[j] \) relying on its neighbours’ information. The proof is done. \[ \square \] We will now consider a number of moves the algorithm makes to stabilize. Let \( v_i(j) \) be the number of nodes in the connected component containing the node \( i \) in the graph with \( \{i, j\} \) edge cut, and let \( c_i(j) \) be the number of the value \( W_i[j] \) changes during execution of algorithm R1. Now we comprise lemma from [7] that will allow us to deduce about the complexity of our algorithm. **Lemma 4.** When algorithm R1 has stabilized $c_i(j) \leq v_i(j)$ for every node $i$ and its neighbour $j$. The proof of Lemma 4 is similar to that for lemma 3, so it is omitted. The number of moves in our algorithm is the same as in that for the network tree without weights, so the following lemma from [7] also holds. **Lemma 5.** The rule R1 is executed at most $n(n-1)$ times. **Proof.** For every pair of adjacent nodes $i, j$ the property $v_i(j) + v_j(i) = n$ holds, so from Lemma 4 the total number of times that the values $W_i[j]$ and $W_j[i]$ change is at most $n$. Since the network system is a tree, so the number of edges is $n - 1$, the result follows. □ ### 3.2 Phase two — rooting the tree Once the R1 phase has stabilized the system, every node can determine the weight of the tree. To show this, we introduce a predicate similar to that from [7], which in our algorithm states whether from the node $i$ point of view, it can determine correct weight of the whole tree. The following predicate: $$w\text{Correct}_i = \left( \forall j \in N(i) \quad ( W_i[j] = w_i + \sum_{k \in N(i) \backslash \{j\}} W_k[i] ) \right)$$ is evaluated in order to run the following part of the algorithm. It is worth mentioning that for any node $i$, the predicate $w\text{Correct}_i$ is true iff the rule R1 is not active for the node. Given that the system has been stabilized, every node can determine the weight of the tree. The following lemma gives the method how the node $i$ can calculate the weight of the whole tree. **Lemma 6.** If $w\text{Correct}_i$ is true then $W_i[j] + W_j[i] = W_i[k] + W_k[i]$ for the neighbours $j, k$ of node $i$. **Proof.** Since $w\text{Correct}_i$ is true: $$W_i[j] + W_j[i] = w_i + \sum_{q \in N(i) \backslash \{j\}} W_q[i] + W_j[i] = w_i + \sum_{q \in N(i)} W_q[i] = w_i + \sum_{q \in N(i) \backslash \{k\}} W_q[i] + W_k[i] = W_i[k] + W_k[i]$$ □ This way each node can determine whether any of its neighbours has component weight bigger than half of the weight of the whole tree. If this occurs, the node itself cannot be the weighted centroid, and the neighbour is closer to it. In fact, it can be the centroid itself. On the other hand, if for a node its every neighbour has component weight less than half of the whole tree weight, then this node is considered the weighted centroid of the tree. There can be a situation, where two adjacent nodes can be considered as the weighted centroid, actually when two neighbours have component weight exactly equal to half of the whole tree weight. In such a case we arbitrarily choose the node with greater ID. All the time the $wCorrect_i$ predicate is true for the node $i$, from its point of view it can determine the weight of the whole tree, but it is not necessarily correct. It is correct after the rule $R1$ has stabilized in the whole system. Apart from the above correctness, the weight of the entire tree calculated by node $i$ we denote by $W_i$. We present below four further rules of our algorithm. Their meaning is to make a pointer to the centroid: after stabilization if a node is centroid then it points to itself, otherwise the node points to the neighbour closer to the centroid. So each node $i$ contains the variable $p_i$ whose integer value points to the neighbour closer to the centroid or to itself if it is the centroid itself. : $R2$ If $(wCorrect_i) \land (\forall j \in N(i) W_j[i] < W_i/2) \land (p_i \neq i)$ then $p_i := i$ : $R3$ If $(wCorrect_i) \land (\exists j \in N(i) W_j[i] > W_i/2) \land (p_i \neq j)$ then $p_i := j$ : $R4$ If $(wCorrect_i) \land (\exists j \in N(i) W_j[i] = W_i/2) \land (ID_i > ID_j) \land (p_i \neq i)$ then $p_i := i$ : $R5$ If $(wCorrect_i) \land (\exists j \in N(i) W_j[i] = W_i/2) \land (ID_i < ID_j) \land (p_i \neq j)$ then $p_i := j$ In all above rule guards there is $wCorrect_i$ predicate. This makes the rules inactive if from the node $i$ point of view weights of components have not been calculated yet. Thus for a node any of the rules $R2-R5$ can be active if and only if the rule $R1$ is inactive. The meaning of the rule $R2$ is to indicate in the node $i$ that the weighted centroid is only one (unique) and $i$ is the one. The rule $R3$ makes the $p_i$ pointing to the neighbour of $i$ closer to the centroid if $i$ is not the one. The rules $R4$ and $R5$ are activated only if there are two weighted centroid nodes. Then the one with greater ID becomes elected: by itself (the rule $R4$) and by the other one (the rule $R5$). Lemma 7. The algorithm R1–R5 stabilizes on every weighted tree network after at most $2n^2 - n$ moves. Proof. The first phase of the algorithm (stabilization of the rule R1) takes no more than $n^2 - n$ moves. The second phase consisting of the rules R2-R5 gives the following number of moves: every node can make one move according to the rules R2-R5 before any node triggers the rule R1. This gives $n$ moves. Furthermore, after every R1 move a node can make one of the R2-R5 rules move — this gives extra $n^2 - n$ moves. All in all, it gives $n^2 - n + n + n^2 - n = 2n^2 - n$ moves. □ Lemma 8. After stabilization of the R1-R5 algorithm, the pointer values $p_i$ for every node $i$ in the weighted tree determine a rooted tree with the weighted centroid as the root. Proof. It is obvious that execution of the R2-R5 rules does not have any influence on the rule R1. Thus the rule R1 will stabilize with correct values $W_i[j]$, for every node $i$ and its neighbour $j$. Let us now assume that the entire algorithm has stabilized the weighted tree network. Take a look at the nodes that are not the weighted centroid. Any such node $i$ has exactly one neighbour $j$ for which $W_j[i] > \mathcal{W}/2$, where $\mathcal{W}$ is the weight of the entire tree. For these nodes $i$ the rule R3 may apply after stabilization of the rule R1, but none of the R2, R4, R5 rules is applicable. After possible application of the rule R3, $p_i$ will point to the neighbour which is part of the connected component with its weight greater than $\mathcal{W}/2$. So these nodes point to the neighbour which is part of the subtree containing the weighted centroid. Now let us assume that there is a unique weighted centroid. Thus there exists no node with $W_j[i] = \mathcal{W}/2$. The centroid $i$ has all the neighbours $j$ with the property $W_j[i] < \mathcal{W}/2$. Then the node $i$ which is the unique centroid may apply the rule R2, pointing to itself as a centroid node. But it is also impossible that $i$ can make a move according to the rules R3-R5. Given that all the other nodes may apply only the rule R3, the whole tree has been stabilized with orientation to the root denoted. The other case is when there are two nodes with the weighted centroid property. This means that there is a pair of adjacent nodes $p$ and $q$ such that $W_p[q] = W_q[p] = \mathcal{W}/2$. Then no node $i$ in the tree can have $W_j[i] < \mathcal{W}/2$ for all its neighbours. Thus the nodes with the weighted centroid property cannot apply the rules R2 or R3, and all other nodes can apply only the rule R3. The non-centroid nodes will properly set their $p$ variables pointing towards the centroid node, as shown above. The weighted centroid nodes are adjacent so one of them can apply the rule R4 and the other one can apply the rule R5 if necessary. So the one with greater ID becomes a leader and the other one points to the leader. This proves the last case. The proof is done. □ To end up we can state the following corollary. **Corollary 1.** Starting with any global state of weighted tree network system, the algorithm R1-R5 stabilizes in at most \(2n^2 - n\) moves having the values \(p_i\) for every node \(i\) pointing towards the just elected leader as one of the weighted centroid nodes. The final state of the system Fig. 1 is shown in Fig. 5. The arrows symbolize the pointers \(p_i\) for every node \(i\). We have two weighted centroids in the example (nodes 4 and 5). The leader is marked with the circle. ![Fig. 5. A state of variable \(p_i\) for every node \(i\) in a tree after stabilization of the algorithm R1–R5. The weighted centroid node elected by the algorithm is circled.](image) 4 Conclusions We have presented the self-stabilizing algorithm for finding a centroid in the weighted trees. It is generalization of the algorithm [7] for tree networks without weights (precisely with all node weights equal to 1). Our algorithm can be applied in the networks with the weights for electing a node which is the center of the network. One can think of it as limelight of the network. In the future work we would like to study the weighted centroid and the weighted median in the self-stabilizing systems with topologies other than trees. Some results connected with the above subject can be found in [9]. References
{"Source-Url": "http://journals.umcs.pl/ai/article/download/3346/2540", "len_cl100k_base": 5894, "olmocr-version": "0.1.53", "pdf-total-pages": 11, "total-fallback-pages": 0, "total-input-tokens": 33565, "total-output-tokens": 6828, "length": "2e12", "weborganizer": {"__label__adult": 0.0004513263702392578, "__label__art_design": 0.0005154609680175781, "__label__crime_law": 0.0006818771362304688, "__label__education_jobs": 0.0010509490966796875, "__label__entertainment": 0.0001537799835205078, "__label__fashion_beauty": 0.00023996829986572263, "__label__finance_business": 0.0004584789276123047, "__label__food_dining": 0.000579833984375, "__label__games": 0.0011167526245117188, "__label__hardware": 0.002216339111328125, "__label__health": 0.0017337799072265625, "__label__history": 0.0006055831909179688, "__label__home_hobbies": 0.00025272369384765625, "__label__industrial": 0.0009169578552246094, "__label__literature": 0.0005030632019042969, "__label__politics": 0.0005106925964355469, "__label__religion": 0.0008139610290527344, "__label__science_tech": 0.455078125, "__label__social_life": 0.00014674663543701172, "__label__software": 0.00807952880859375, "__label__software_dev": 0.52197265625, "__label__sports_fitness": 0.000457763671875, "__label__transportation": 0.0011415481567382812, "__label__travel": 0.00032210350036621094}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 23338, 0.01911]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 23338, 0.69745]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 23338, 0.92188]], "google_gemma-3-12b-it_contains_pii": [[0, 1950, false], [1950, 3913, null], [3913, 6508, null], [6508, 8706, null], [8706, 10758, null], [10758, 13275, null], [13275, 15311, null], [15311, 17942, null], [17942, 20909, null], [20909, 22514, null], [22514, 23338, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1950, true], [1950, 3913, null], [3913, 6508, null], [6508, 8706, null], [8706, 10758, null], [10758, 13275, null], [13275, 15311, null], [15311, 17942, null], [17942, 20909, null], [20909, 22514, null], [22514, 23338, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 23338, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 23338, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 23338, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 23338, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 23338, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 23338, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 23338, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 23338, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 23338, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 23338, null]], "pdf_page_numbers": [[0, 1950, 1], [1950, 3913, 2], [3913, 6508, 3], [6508, 8706, 4], [8706, 10758, 5], [10758, 13275, 6], [13275, 15311, 7], [15311, 17942, 8], [17942, 20909, 9], [20909, 22514, 10], [22514, 23338, 11]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 23338, 0.0]]}
olmocr_science_pdfs
2024-12-11
2024-12-11
7e63ada8d83ad569ebcf29fe35f417b89225bdc0
Open Archive TOULOUSE Archive Ouverte (OATAO) OATAO is an open access repository that collects the work of Toulouse researchers and makes it freely available over the web where possible. This is an author-deposited version published in: http://oatao.univ-toulouse.fr/ Eprints ID: 17012 The contribution was presented at NOMS 2016: http://noms2016.ieee-noms.org/ Any correspondence concerning this service should be sent to the repository administrator: staff-oatao@listes-diff.inp-toulouse.fr Composing data and control functions to ease virtual networks programmability Messaoud Aouadj, Emmanuel Lavinal, Thierry Desprats, Michelle Sibilla University of Toulouse, IRIT 118 Route de Narbonne, F-31062 Toulouse, France Email: {FirstName.LastName}@irit.fr Abstract—This paper presents a new domain specific language, called AirNet, to design and control virtual networks. The central feature of this language is to rely on network abstractions in order to spare operators the trouble of dealing with the complex and dynamic nature of the physical infrastructure. One novelty of this language is to integrate a network abstraction model that offers a clear separation between simple transport functions and advanced network services. These services are classified into three main categories: static control functions, dynamic control functions and data functions. In addition, we provide an easy and elegant way for programming these functions using the decorator design pattern. The AirNet language is supported by a runtime system handling, in particular, the virtual-to-physical mapping. Despite the fact that it is still in a prototype stage, this runtime has been successfully tested on several use cases. I. INTRODUCTION Software Defined Networking (SDN) is one of the latest attempts that aims to make current networks more flexible, so that they can quickly adapt to today’s evolving needs. Unfortunately, current SDN controllers are difficult to use in practice, mainly because they provide only low-level programming interfaces that: i) prevent network operators from writing separate control modules that can be composed and ii) require operators to deal directly with the complex and dynamic nature of the physical infrastructure. By allowing the use of network abstractions, network virtualization has emerged as the most appropriate solution to address these limits. Currently, there are two main approaches to abstract the physical infrastructure: i) the overlay network model which consists in overlaying a virtual network of multiple switches on top of a shared physical infrastructure [1] and ii) the single switch abstraction model [2] which abstracts the entire network view into a single logical switch. In previous work [3], we have shown that these two models present some drawbacks, among which: the one big switch model forces network administrators to always use a single router to abstract their physical infrastructure, while the overlay network model does not consider any distinction or logical boundaries between in-network functions and packet transport functions, despite the fact that these two auxiliary policies solve two different problems. In this paper, we present AirNet, a new high-level language for programming SDN platforms, whose main novelty is to integrate an abstraction model that explicitly identifies two kinds of virtual units: i) Fabrics to abstract packet transport functions and ii) Edges to support, on top of host-network interfaces, richer in-network functions (firewall, load balancing, caching, etc.). Thus, unlike existing work, AirNet’s abstraction model allows to ease the configuration, control and management of the physical infrastructure, while also allowing fine-grained control in order to be able to respond to different types of constraints, whether physical or logical. Additionally, we have designed and implemented a hypervisor that supports this model and achieves its mapping on a physical infrastructure. The remainder of this paper is organized as follows: in section II, existing works are briefly presented. In section III we start by presenting our network abstraction model, then we give an overview of AirNet’s key elements. Its implementation is described in section IV and a program example is exposed through a complete use case in section V. Finally, we conclude and shortly present ongoing work. II. RELATED WORK Early works have addressed issues related to the low-level nature of programming interfaces and their inability to build control modules that compose. The FML language [4] is one of the very first, it allows to specify policies about flows, where a policy is a set of statements, each representing a simple if-then relationship. Frenetic [5] is a high-level language that pushes programming abstractions one-step further. Frenetic is implemented as a Python library and comprises two integrated sub-languages: i) a declarative query language that allows administrators to read the state of the network and ii) a general-purpose library for specifying packet forwarding rules. Additional recent proposals introduced features that allow to build more realistic and sophisticated control programs. Indeed, languages such as Procera [6] and NetCore [7] offer the possibility to query traffic history, as well as the controller’s state, thereby enabling network administrators to construct dynamic policies that can automatically react to conditions like authentication or bandwidth use. Traffic isolation issues were also addressed in works like FlowVisor [8] and Splendid Isolation [9]. FlowVisor is a software slicing layer placed between the control and data plane. This slicing layer divides the data plane into several slices completely isolated, where each slice has its own and distinct control program. Following the same idea, Gut et al. proposed splendid isolation which is a language that allows, on one side, to define network slices, and on the other, to formally verify isolation between these slices. Recently, Monsanto et al. proposed the Pyretic language [10], which introduced two main programming abstractions that have greatly simplified the creation of modular control programs. First, they provide, in addition to the existing parallel composition operator, a new sequential one that allows to apply a succession of functions on the same packet flow. Second, they enable network administrators to apply their control policies over abstract topologies, thus constraining what a module can see and do. Although these related work provide advanced network control languages, none of them make an explicit distinction between transport and in-network functions, property that we think is essential for the program’s modularity and reusability. III. The AirNet Language In this section, we present AirNet’s programming pattern and its key instructions, which are summarized in Fig. 1. Each AirNet program contains three major parts. The first part deals with the design of the virtual network. We have chosen a fully declarative approach: one primitive for each virtual unit that has to be added to the network (addHost, addEdge, etc.). The second part contains control policies that will be applied over the defined virtual network (in the following subsections, we describe in more details the primitives used to specify and compose these control policies). Finally, the third part is a separate initialization module through which the administrator defines the mappings existing between virtual units and switches present at the physical level (associating IP addresses to hosts, or mapping an edge to multiple physical units and switches present at the physical level (associating IP addresses to hosts, or mapping an edge to multiple physical units and switches present at the physical level). Note that adding a new virtual edge may trigger the lifting it up at the language level. Network operators will thus build their virtual networks using three types of network abstractions: - **Edges** which are general-purpose processing devices used to support the execution of in-network functions. - **Fabrics** which are more restricted processing devices used to deal with packet transport issues. ![Fig. 2. A simple virtual network using the edge-fabric model](image) **Virtual Network Design:** - `addHost(name)` - `addNetwork(name)` - `addEdge(name, ports)` - `addFabric(name, ports)` - `addLink((name, port), (name, port))` **Edge Primitives:** - `filters: match(h=v) | all_packets` - `actions: forward(dst) | modify(h=v) | tag(label) | drop` - `network functions: @DynamicControlFct | @DataFct` **Fabric Primitives:** - `match(flow) | carry(dst, requirements=None)` - `composition operators: ` - parallel composition: `*` (using specific primitives that we will present in the next section), then redirect flows towards a fabric. From this point, it is the fabric’s responsibility to carry flows to another border edge in order to be delivered to its final destination (host or network). **B. Edge primitives: filters and actions** Edge primitives are divided into three main groups: Filters, Actions and Network Functions. The language’s main filter is the `match(h=v)` primitive that returns a set of packets that have a field `h` in their header matching the value `v`. Actions are applied on sets of packets that are returned by installed filters. `Drop`, `forward` and `modify` are standard actions found in most network control languages. As for the `tag` action, it attaches a label onto incoming packets, label that is used by fabrics to identify and process a packet. As a simple example, consider the following policy applied to the virtual network of Fig. 2, that matches all in web flows (independently of the destination address) on edge `IO` and forwards them to the fabric with a `in_web_flows` tag: ```plaintext match(edge="IO", tp_dst=80) >> tag("in_web_flows") >> forward("Fab") ``` This policy uses the match instruction to capture all in web flows (i.e., TCP destination port equals to 80), then it tags these flows as `in_web_flows` by sequentially combining the `match` with a `tag` instruction. Finally, the result is passed to the `forward` action that transfers the packet to the output port leading to the fabric. **C. Edge primitives: network functions** As we have just seen, filters and actions allow network operators to write simple and static control applications. However, we believe that a control language should provide more powerful instructions in order to allow operators to write sophisticated and realistic control applications that can meet a variety of requirements. To fulfill this goal, we have identified two types of advanced network functionalities: 1) Functions that implement complex processing that cannot be performed by the language’s basic set of actions (i.e., `forward`, `modify`, `drop`). Encryption, compression or transcoding are examples of such functions. ![Fig. 1. AirNet’s key primitives](image) 2) Functions that implement a decision making process capable of generating, at runtime, new policies that change the overall control program behavior. A typical example is a forwarding decision emanating from some deep packet analysis that cannot be specified through the `match` instruction. We have integrated these two types of functions to AirNet by using the decorator design pattern. Programmers will therefore be able to transform their own Python functions by simply applying these decorators, thereby being able to compose them with other AirNet primitives to build advanced policies. The first type of function uses the `DataFct` decorator and relies on entire network packets to accomplish its task and return the modified packets. The second type of function uses the `DynamicControlFct` decorator and can rely either on entire network packets or network statistics to generate, at runtime, new policies. Thus, each time a new packet or statistic is available, it is passed to the `decorated` function, which behaves like a callback function that returns, in the end, either a modified packet or a new policy. ```python @DataFct(limit=number, split=[h=v]) @DynamicControlFct(data="packet", limit=None, split=None) ``` As shown above, the `DataFct` decorator takes always two parameters: the first one is `limit`, it defines how many packets (from the matched flow) must be redirected to the network function. If `limit` is set to None, it means that all packets need to be redirected to the network function. The second parameter is `split`, it allows to discriminate between packets that are sent to the network function. The `split` parameter is a list of headers (e.g., `split=["nw_src","tp_dst"]`) that is used by our runtime as a key to identify subflows on which the limit parameter applies. If `split` is set to None, it means that the limit parameter applies on the entire flow. As for the `DynamicControlFct` decorator, the `data` parameter specifies whether to retrieve entire network packets or statistics related to the number of received bytes and packets. If network packets are used then the `limit` and `split` parameters apply (alike data functions), whereas for statistics, the `limit` parameter is replaced by a polling period specified thanks to the `every` parameter. In the remainder of this section we will give a few usage examples of data and dynamic control functions. Let us assume that on edge IO, on top of forwarding web flows, a network operator wants to do some advanced processing on the packet’s payload before forwarding it to the fabric, in this case compression. This policy can be specified by relying on a specific `compress` function and by sequentially composing it with the other edge primitives: ```python match(edge="IO", tp_dst=80) >> compress() >> tag("in_web_flows") >> forward("Fab") ``` Here, the parameters `limit` and `split` are set to None, meaning that all packets of the flow must be redirected to the `compress` function and that no discrimination is needed. Also, it is important to stress that the network function must return the modified packet since its result is an input for the next instruction in the composition chain. Regarding dynamic control functions, we will take a first example of a simplified web application firewall that is implemented within the `waf` function: ```python match(edge="IO", tp_dst=80) >> waf() ``` As shown below, the `waf` function analyses the first packet of a flow and returns a new policy: if it detects malware, a policy dropping all packets from that malicious network address is returned, otherwise, a forwarding policy is returned (note that the `split` parameter is used here to discriminate packets based on the network source address; the `waf` function will thus apply for each first packet coming from a different source address). ```python def waf(packet): ip = packet.find("ip") my_match = match(nw_src=ip.srcip, tp_dst=80) if DPI(packet): return my_match >> tag("in_web_flows") >> forward("Fab") else: return my_match >> drop ``` D. Fabric primitives Fabrics provide two main primitives that are `catch` and `carry`. The first primitive captures an incoming flow on one of the fabric’s ports. Data flows are identified based on a label that has been inserted beforehand by an edge. The second one transports a flow from an input port to an output port; it also allows to specify some forwarding requirements such as maximum delay to guarantee or minimum bandwidth to offer. Back to the previous virtual network example (cf. Fig. 2), we suppose that the administrator wishes to handle both incoming web and ssh flows. The following program represents the transport policy carrying these input flows from edge IO to edge LB, and vice versa. Since these flows have the same destination, we used the parallel operator to compose the catch primitives and thus have a more concise policy (although we could have also used one policy for each type of flow): ```python (catch(fabric="Fab", src=IO, flow="in_web_flows") + catch(fabric="Fab", src=IO, flow="in_ssh_flows")) >> carry("LB") (catch(fabric="Fab", src=LB, flow="out_web_flows") + catch(fabric="Fab", src=LB, flow="out_ssh_flows")) >> carry("IO") ``` IV. IMPLEMENTATION In this section we give a brief description of our implementation of the AirNet language which consists of a domain-specific language embedded in Python, as well as a runtime system executed on top of an SDN controller. At the moment, the runtime system, which we name “AirNet Hypervisor”, is only a prototype, nevertheless it has been successfully tested on several use cases (using various virtual and physical topologies), including the ones mentioned in this article, using the POX controller and the Mininet network emulator. A. Filters and actions The execution of any AirNet program passes through two main phases. The first one is completely independent of the physical infrastructure and deals mainly with composition issues between the different virtual policies. Conversely, the second one is highly correlated to the physical infrastructure since it generates OpenFlow [12] rules that have to be installed on real network devices. At the very beginning of the first phase, edge policies are combined, sequentially and in parallel, to form an edge composition policy. One difficulty of this process lies in the overlapping rules that can exist. To solve this problem, rules are placed into containers called classifiers that allow us to order the rules by priority and solve match intersection issues. Indeed, when classifiers are generated, rules are combined, and if an intersection exists between two rules, a new one is created, with a match corresponding to the result of the intersection, and a set of actions containing the union of the two original rules actions. Regarding fabric policies, they are also composed together to form a fabric composition policy. In this case, this is a simple process that constructs one forwarding table per fabric, containing incoming flows and their respective edge destination. The second phase consists in compiling rules stored into classifiers according to the target physical infrastructure and the operator’s mapping instructions. For each edge rule that applies on an virtual edge, the runtime fetches the edge’s corresponding physical switches, then transforms this virtual rule into one or several physical rules. This transformation includes, for instance, replacing symbolic identifiers present in the program by the corresponding low-level parameters. As for fabric rules, it is not a trivial algorithm since we cannot just rely on the fabric’s forwarding table to install flow rules, mainly because an edge can map to more than one physical switch, and hosts that are connected to this edge can be in reality connected to different physical switches. Thus, we need to split flows that are carried to an egress edge into several flows according to the final destination. In other words, we only deliver (following a shortest path algorithm) to border switches the flows that are intended for a destination directly connected to that switch, and not all the flows arriving to the virtual egress edge. B. Network functions In this section we present, through a set of algorithms written in Python, how network functions work and the main ideas behind their implementation. Given that network functions cannot be executed on standard OpenFlow switches, we have implemented them within the controller. Note that this two-tiered architecture is completely transparent to administrators. We can divide the life cycle of a network function within the controller into three main phases: i) initialization at deployment time, ii) processing incoming packets at runtime before the limit parameter has been reached, and iii) processing incoming packets at runtime once the limit is attained (note that the every parameter is handled almost in the same manner). 1) First phase: initialization This first phase has two main objectives. The first one is to install data path rules sending packets and statistics to the controller, and the second one is to create data structures named buckets that will receive and process this data at runtime on the controller. The algorithm in Fig. 3 describes the main steps of this phase. ```python def init_net_functions(): for net_rule in net_function_rules: create_bucket(net_rule) actions = set() for act in net_rule.actions: if not isinstance(act, NetworkFunction) and (not isinstance(act, forward)): actions.add(act) actions.add(forward('controller')) ctrl_rule = Rule(net_rule.match, net_rule.tag, actions) enforce_rule(ctrl_rule) ``` Fig. 3. Initialization phase for network functions The controller rule is created by keeping the same match filter and flow tag as the network function rule. As for the set of actions, it is copied from that same rule except for the network function action that is replaced by a forward action to the controller. 2) Second phase: incoming packets After the initialization phase, each time a packet arrives at a switch and matches a controller rule, it will be directly forwarded to that controller. The AirNet runtime system will then execute the general algorithm exposed in Fig. 4. It first looks up the appropriate bucket that is going to handle the packet (i.e., the bucket’s match covers the packet header) and uses it to call the network function included in the policy. Applying a network function will process the packet and return the results. In case of a data function, the result is a modified packet that will be re-injected into the network and transported to its final destination following the existing policies. In case of a dynamic control function, the result consists in first, a new policy that will be compiled and enforced on the physical infrastructure, and second, re-injecting the incoming packet into the network, thus transporting it according to the newly generated policies as well as the existing ones. If the limit parameter is set on the network function then the bucket counts the number of incoming packets and calls the appropriate function when that limit is reached (cf. next section). Note that if the split parameter is also set, then it is necessary to have a packet counter for each micro-flow, which is obtained by applying the split arguments on the packet’s header, and appending the result with the rule’s match. 3) Third phase: limit reached When a flow limit is reached, it means that the network function must not be applied anymore. In order to do so, we have implemented the remove_net_function that deletes the network function from the rule’s action set, while leaving the other basic actions (i.e., modify, tag and forward). The runtime then regenerates edge classifiers and compares them with the old classifiers using the get_diff_lists function. This step aims to identify the differences that exist between what is already installed onto the physical infrastructure and For micro-flows (cf. Fig. 6), the process is a bit different since the network function has reached its limit only for a micro-flow (depending on the split parameter) and not for all flows. Thus, we only have to install one new rule that handles this micro-flow, while maintaining the general controller rule. To this end, the runtime starts by fetching the network function rule that covers the deprecated micro-flow, it creates a copy of it, changes its match with the micro-flow match and removes the network function action (keeping the other actions). Finally, it enforces this new rule onto the physical infrastructure with a higher priority than the controller rule (thus guaranteeing that packets matching the micro-flow rule will be handled using this new rule while the other packets will still remain redirected to the controller). V. USE CASE In this section, we present a complete use case which consists in programming a dynamic load balancer. The goal is to show how a realistic AirNet program is built and executed from start to end. As a proof of concept, the use case has been implemented and tested on the Mininet emulator. Virtual network design: As with any AirNet program, the first step is to define a virtual topology that meets our high-level goals. Here, we reuse the virtual topology presented in Fig. 2. Policy functions: The second part of the program deals with control policies definition. In this use case, we have grouped these policies into three functions, one per virtual device. The first function encapsulates policies that need to be installed on the IO edge. It configures the behavior of the edge as a simple input/output device, meaning that it will only match flows and redirect them either inside or outside the network. ```python def process_packet_in(switch_id, packet_match, packet): bucket = get_bucket_covering(packet_match) bucket.apply_network_function(switch_id, packet) if bucket.split is None: bucket.nb_packets += 1 if bucket.nb_packets == bucket.limit: flow_limit_reached(bucket.match) else: micro_flow = get_micro_flow(packet) try: bucket.nb_packets[micro_flow] += 1 except KeyError: bucket.nb_packets[micro_flow] = 1 if bucket.nb_packets[micro_flow] == limit: micro_flow_limit_reached(micro_flow) ``` Concerning the load balancing policy, it will be implemented on the LB edge. Its goal is to intercept web flows (i.e., HTTP flows sent to the web server’s public address), and pass them to a dynamic control function. This dynamic function will install at runtime rules that change the destination addresses (i.e., IP and MAC) of these flows to one of the backend servers, while ensuring a workload distribution over the two servers using a simple Round-Robin algorithm (cf. network function \(rrlb\) in the 11 policy below). The load balancer needs also to modify the responses in order to restore the public address instead of the private ones (policies 12 and 13). ```python def load_balancing_policy(self): i1 = match(edge="IO", src="Net.A", nw_dst=pub_WS, tp_dst=80) >> "in_web_flows" i2 = match(edge="IO", dst="Net.B", nw_src=pub_WS, tp Src=80) >> "out_web_flow" i3 = match(edge="IO", dst="Net.B", nw_src=pub_WS, tp Src=80) >> "out_web_flow" i4 = match(edge="IO", dst="Net.B", nw_dst=pub_WS, tp_dst=80) >> "out_web_flow" rrlb_token = 1 try: bucket = get_bucket_covering(packet_match) if bucket.nb_packets[micro_flow] == limit: micro_flow_limit_reached(micro_flow) except: micro_flow = get_micro_flow(packet) my_match = apply_network_function(bucket.match) new_rule = copy.deepcopy(rule) new_rule.match = micro_flow new_rule = to_physical_rules(edge_policies) remove_net_function(new_rule) remove_net_function(rule) install_diff_lists(updates) if rule.match.covers(micro_flow): bucket.nb_packets[micro_flow] = 1 flow_limit_reached(bucket.match) else: bucket.nb_packets[micro_flow] += 1 bucket.nb_packets[old_classifier] += 1 if bucket.nb_packets[old_classifier] == limit: old_classifier_limit_reached(old_classifier) if bucket.nb_packets[old_classifier] == limit: old_classifier_limit_reached(old_classifier) ``` The \(rrlb\) function is triggered for each first packet coming from a different IP source address, since the parameter \(limit\) is set to “1”, and the parameter \(split\) is set to “nw src”. Below, we can see that the \(rrlb\) function extracts the match filter from the received packet, then uses it to install a rule for the other packets that belong to the same flow as the retrieved packet. The forwarding decision is based on the actual value of a token: if it is one, then the flow is sent to the first backend server, else it is sent to the second one. ```python @DynamicControlFct(data="packet", limit=1, split=["nw src"]) def rrlb(self, packet): my_match = match fron packet(packet) if self.rrlb_token == 1: self.rrlb_token = 2 return my_match >> modify(dst="WS1") >> forward("WS1") else: self.rrlb_token = 1 return my_match >> modify(dst="WS2") >> forward("WS2") ``` The last policy concerns the fabric. Here, we need a simple transport policy that carries in web flows to the egress edge, and out web flows to the ingress edge. The following extract shows the definition of this transport policy: def fabric_policy(self): t1 = catch(fabric="Fab", src="IO", flow="in_web_flows") >> carry("LB") t2 = catch(fabric="Fab", src="LB", flow="out_web_flows") >> carry("IO") return t1 + t2 Experiments: The use case is tested by first launching Mininet, the POX controller and the AirNet hypervisor, and then by generating web requests from our web clients (three clients: one in Net.A and two in Net.B). Regarding the physical infrastructure, we relied on the topology depicted in Fig. 7 and we have chosen a virtual-to-physical mapping showed within Table I (lines 1 and 3). In the first phase, our hypervisor compiles the high-level policies and generates OpenFlow rules that are pushed onto the switches through the controller (all this process is part of the proactive phase). The OpenFlow entries that are generated are match, output and drop actions. In addition, due to the rrlb dynamic control function, OpenFlow entries that send packets to the controller via packet-in messages are also generated. Next, we executed several wget requests on the web server’s public address from the hosts connected to s1 and s2. All the requests and their responses were correctly routed through the network, allowing the web clients to retrieve the requested HTML files on the back-end web servers. The requests were balanced on the two web servers according to the round robin algorithm implemented in the rrlb dynamic control function (these packets arriving at runtime at the controller are handled in the reactive phase). Discussion: Table I shows the number of rules that have been installed on each physical switch, during both the proactive and reactive phases. The switches s1 and s2 have three OpenFlow rules each: two forwarding rules (web flows to and from networks 192.168.1.0/24 on s1 and 172.16.0.0/16 on s2) and one drop rule for all other traffic. As for s8, it contains four rules: one that redirects the first packet of each web flow towards the controller, two to handle traffic coming from WS1 and WS2 and one drop-all rule. Regarding the fabric’s switches, s3, s4 and s5 have each five rules installed: two to handle incoming web flows towards the server's public IP address, two rules to handle the responses from the private web servers, and one drop-all rule for any other unidentified flow. Since s6 and s7 are not located on the shortest path, only one drop-all rule has been installed on these switches. Overall, 27 physical rules have been automatically installed by the AirNet hypervisor (during the proactive phase), while only 9 policies have been specified on the virtual network. Note that this ratio would have been even greater if we were dealing with a more complex physical infrastructure including a greater number of hosts and switches. Additionally, during the reactive phase, the number of rules changes dynamically on s8 since the LB edge containing the rrlb function is mapped on that switch. Each time a host sends a request to the web server’s public address, the first packet of the flow is redirected from s8 to the controller that executes the rrlb function. As a result, a new rule is installed on s8 to forward the flow to one of the two back-end web servers. Since we have used three clients in our tests, in the end, seven rules are installed on s8. Although some issues are still under development, these first results are encouraging and demonstrate the feasibility of the approach. Notably, this use case shows that AirNet allows to significantly simplify network programmability by relying on high-level policies and network functions that can be easily composed and reused, without considering the large amount of underlying physical rules. Another benefit is that the administrator no longer needs to deal manually with intersection issues between policies, and possible side-effects resulting from the application of a policy. For instance, in this use case, the fact of having applied a modify action on the servers responses to change their IP source address from WS1 and WS2 to pub_WS implies that rules installed on path [s5, s4, s3] must use the public IP address while rules installed on s8 must use the private ones. This kind of issue is automatically solved by the AirNet hypervisor, avoiding a complicated and error-prone process. VI. CONCLUSION This paper described the design and the implementation of AirNet, a new high-level domain specific language for programming virtual networks. We used network virtualization as a main feature in order to both build portable control programs independent of the physical infrastructure and to spare administrators the trouble of dealing with low-level parameters, thus complying with the SDN promise to make network programming easier. The main novelty in AirNet is to integrate an abstraction model that offers a clear separation between functions that represent network basic packet transport capacities and functions that represent richer network services. In addition, AirNet provides, through the decorator design pattern, an easy and intuitive way for programming advanced network functions, allowing operators to extend the language according to their own requirements. Finally, we described our prototype of AirNet hypervisor, which has been successfully tested over several use cases, some of them presented in this article. Currently, we are still testing the AirNet hypervisor and finishing some implementation issues such as handling dynamic events emanating from the physical topology. Also, we are working on the language’s formal model in order to be able to guarantee the policies correctness. REFERENCES
{"Source-Url": "http://oatao.univ-toulouse.fr/17012/1/aouadj_17012.pdf", "len_cl100k_base": 7058, "olmocr-version": "0.1.50", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 25114, "total-output-tokens": 8424, "length": "2e12", "weborganizer": {"__label__adult": 0.0003662109375, "__label__art_design": 0.0002818107604980469, "__label__crime_law": 0.0003299713134765625, "__label__education_jobs": 0.0005273818969726562, "__label__entertainment": 9.918212890625e-05, "__label__fashion_beauty": 0.00014901161193847656, "__label__finance_business": 0.00026488304138183594, "__label__food_dining": 0.0003597736358642578, "__label__games": 0.0005440711975097656, "__label__hardware": 0.0015316009521484375, "__label__health": 0.0005669593811035156, "__label__history": 0.0002696514129638672, "__label__home_hobbies": 8.916854858398438e-05, "__label__industrial": 0.0004940032958984375, "__label__literature": 0.0002307891845703125, "__label__politics": 0.0002918243408203125, "__label__religion": 0.00044345855712890625, "__label__science_tech": 0.07159423828125, "__label__social_life": 9.965896606445312e-05, "__label__software": 0.01296234130859375, "__label__software_dev": 0.9072265625, "__label__sports_fitness": 0.0003254413604736328, "__label__transportation": 0.0006961822509765625, "__label__travel": 0.0002351999282836914}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 36740, 0.01079]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 36740, 0.6104]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 36740, 0.88589]], "google_gemma-3-12b-it_contains_pii": [[0, 827, false], [827, 6355, null], [6355, 11343, null], [11343, 17162, null], [17162, 23507, null], [23507, 29035, null], [29035, 34669, null], [34669, 36740, null]], "google_gemma-3-12b-it_is_public_document": [[0, 827, true], [827, 6355, null], [6355, 11343, null], [11343, 17162, null], [17162, 23507, null], [23507, 29035, null], [29035, 34669, null], [34669, 36740, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 36740, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 36740, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 36740, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 36740, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 36740, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 36740, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 36740, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 36740, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 36740, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 36740, null]], "pdf_page_numbers": [[0, 827, 1], [827, 6355, 2], [6355, 11343, 3], [11343, 17162, 4], [17162, 23507, 5], [23507, 29035, 6], [29035, 34669, 7], [34669, 36740, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 36740, 0.0]]}
olmocr_science_pdfs
2024-11-30
2024-11-30
e5fe6d67a040e3cfcb9af71469bff517c3acdd4c
AN ALGORITHM FOR GENERATING RANDOM NUMBERS WITH BINOMIAL DISTRIBUTION Dorin BOCU Faculty of Science, Department of Computer Science "Transilvania" University of Braşov, Romania Abstract: In this paper we introduce an algorithm for generating random numbers with binomial distribution. The algorithm is based on the idea of a "pipe" between the simulation of a statistical experiment and the algorithm for selection according to utility, often invoked in genetic search problems. Keywords: Binomial distribution, selection according to utility. 1. PRELIMINARIES First, we shall introduce several definitions and results that are useful in the main statements of the paper. Definition 1.1. We call a system a set of interacting components that operate within a boundary to a certain predefined purpose. The boundary filters the types and flow rates of inputs and outputs between the system and its environment. The specification of the boundary defines both the system and the environment of the system. We denote with \( S \) an object, process or phenomenon indicated according to Definition 1.1. Definition 1.2. We call the context of a system the set of restrictions under which the system can achieve its purpose. Eliminating or adding restrictions to the context of a system \( S \) affects its knowing, so it requires a new specification effort. We denote with \( C_S \) the context of system \( S \). Definition 1.3. We call the observation criterion of a system $S$ by an instance $I$ the set of all different and significant states of system $S$ from the point of view of instance $I$. We denote with $O_{SI}$ the observation criterion of system $S$ by instance $I$. We remark that $O_{SI}$ is a representing model of system $S$ in context $C_S$, according to the perception of instance $I$. Definition 1.4. We call an experiment the repeated analysis of a system $S$ working in the same context $C_S$ and according to the same observation criterion $O_{SI}$. We denote with $E$ a generic experiment. Definition 1.5. We call an elementary random event the result of an unpredictable experiment. If $S$ is a system which is the object of an experiment $E$, we call the result of the experiment the state in which system $S$ arrives at the end of experiment $E$. The set of distinct events, characteristic of an unpredictable experiment, is called a complete event system. We denote with $E$ the complete event system associated to experiment $E$. Definition 1.6. We call a random event any proper subset of $E$. We denote random events by $A$, $B$, $C$, ... Definition 1.7. Let $E$ be experiment whose complete system event is $E$. If $(3) p: P(E) \rightarrow [0,1]$ so that $p$ is a measure of the possibility of the occurrence of events $A \subseteq E$ then we say that $p$ is a probability. Definition 1.8. Let $E$ be experiment whose complete event system is $E$. We call the distribution law of the events related to $E$ a mathematical model by means of which we can make probabilistic predictions about the results of experiment $E$. Such mathematical models are: probability density, repartition function, characteristic function the random variable. Out of the usual distribution laws we illustrate: uniform distribution, binomial distribution, Poisson distribution, etc. This paper does not aim to discuss aspects related to the theoretical contents of any of these laws. However, we shall study to obtain an algorithm which allows the simulation of the behaviour of a system with a binomial distribution of events. Related to the binomial experiment we present the definition below. Definition 1.9. We say that a random variable $X$ given by table: \[ \begin{pmatrix} 0 & 1 & 2 & \ldots & n \\ p_0 & p_1 & p_2 & \ldots & p_n \end{pmatrix} \] has a binomial distribution with parameters $n$ and $p$ if: Remark 1.1. The most simple way to introduce a binomial distribution is by studying the following experiment: "Let $E$ be an experiment related to which event $A$ occurs with probability $p$ and event $\overline{A}$ occurs with probability $1-p$. Given the experiment $E$, which is obtained by repeating experiment $E$ $n$-times we raise the question: what is the probability that $A$ occurs $i$-times?". The theoretical probability that the above-mentioned event occurs is specified in Definition 1.9. In this paper we are looking for an algorithm which generates integer numbers belonging to $\{0,1,...,n\}$ according to the law of binomial distribution of $n$ and $p$ given parameters. Proposition 1.1. A random variable $Y$ which takes values uniformly distributed in $(0,1]$ has the repartition function: $$F_Y(x) = \begin{cases} 0 & \text{if } x \in (-\infty,0] \\ x & \text{if } x \in [1,\infty) \end{cases}$$ Proof: Because $Y$ has the uniform distribution of values in $(0,1]$ then the probability density is: $$f_Y(x) = \begin{cases} 1 & \text{if } x \in [0,1] \\ 0 & \text{if } x \in \mathbb{R} \setminus [0,1] \end{cases}$$ So: $$F_Y(x) = \int_0^x f_Y(t) \, dt = \begin{cases} 0 & \text{if } x \in (-\infty,0] \\ x & \text{if } x \in (0,1] \\ 1 & \text{if } x \in (1,\infty) \end{cases}$$ Proposition 1.2. Let $k \in (0,1)$ and experiment $E$ be defined in this way: 1) A random number $NRA \in (0,1)$ is generated according to the uniform distribution law; 2) If $NRA \leq k$ then we consider that event $A$ is realized; 3) If $NRA > k$ then we consider that event $A$ is not realized; What is the probability of event $A$? Proof: $$P(A) = P(NRA \leq k) = P(0 \leq NRA \leq k) = P(NRA = 0) + P(0 < NRA \leq k).$$ Because $NRA$ is uniformly distributed in $(0,1]$, according to Definition 1.1 we have $P(A) = F_{NRA}(k) - F_{NRA}(0) = k$. $$p_i = P(X = i) = C_n^i p^i (1-p)^{n-i}; \quad i = 0, n$$ The statement of Proposition 1.2 represents the basis of a procedure which models an abstract experiment \( E \) related to which an event \( A \) occurs with probability \( k \). So, the experiment \( E \) which represents the basis of introducing binomial distribution as a consequence of \( E \) repeated \( n \)-times. **Proposition 1.3.** Let \( RND \) be a function which returns randomly and uniformly distributed numbers in \([0,1]\) and let \( S \) be a system having the space of states \( \Omega = \{0,1,\ldots,n\} \). Let \( F = \{f_0, f_1, \ldots, f_n\} \) be the utility vector related to the states of system \( S \) so that \( f_i \in [0,1] \) \( \forall i \in \{0,1,\ldots,n\} \) and \[ \sum_{i=0}^{n} f_i = 1. \] Then the algorithm: \[ \begin{align*} \text{NRA} &= \text{RND} \\ \text{IndSel} &= \min_{0 \leq i \leq n} \{f_0 + f_1 + \cdots + f_{i-1} < \text{NRA} \leq f_0 + f_1 + \cdots + f_i\} \end{align*} \] is a selection algorithm according to the utility of the states of system \( S \). **Proof:** Because \( RND \) returns randomly, uniformly distributed numbers in \([0,1]\), according to Proposition 1.1 we have: \[ F_{\text{RND}}(x) = \begin{cases} 0 & \text{if } x \in (-\infty,0] \\ x & \text{if } x \in (0,1] \\ 1 & \text{if } x \in (1,\infty) \end{cases} \] So, we have: \[ P(\text{IndSel} = i) = P(f_0 + f_1 + \cdots + f_{i-1} < \text{NRA} \leq f_0 + f_1 + \cdots + f_i) = F_{\text{RND}}(f_0 + f_1 + \cdots + f_i) - F_{\text{RND}}(f_0 + f_1 + \cdots + f_{i-1}) = f_i. \] The demonstration is concluded. ### 2. Algorithm GBDRN GBDRN is the abbreviation for Generating Binomially Distributed Random Numbers. **Theorem 2.1.** The algorithm GBDRN specified by: \[ \begin{align*} \text{PredParDB}(n, p) \\ \text{ZeroCom}(\text{VUABS}) \end{align*} \] PrelAmplExp(nre) for i := 1 to nre do begin ConApA := 0 for j := 1 to n do begin NrA := RND if NrA ≤ p then ConApA := ConApA + 1 end VUABS(ConApA) := VUABS(ConApA) + 1 end VUREL := Convert(VUABS) NAL := RNDBD It generates randomly, binomially distributed numbers in \( \{0, 1, \ldots, n\} \). In the above algorithm: - PrelParDB(n, p) is a procedure which takes over the parameters of binomial distribution which represent the basis of generating random numbers. - ZeroCom(VUABS) is a procedure which sets at zero the components of absolute utility vector VUABS. - PrelAmplExp is a procedure which takes over the size of the generating experiment. - ConApA is a variable which counts the number of occurrences of the hypothetical event A having probability p. - Convert is a function which transforms absolute utility vector VUABS to relative utility vector VUREL. - RNDBD is the function which returns a number in \( \{0, 1, \ldots, n\} \) that is randomly, binomially distributed by parameters n and p. The selection of the returned number is made according to the utilities associated to them in VUREL. Proof: Let \( n \in \mathbb{N}^* \) and \( p \in (0, 1) \) be the number taken over by procedure PrelParDB. Let nre be a number high enough taken over by procedure PrelAmplExp. According to Proposition 1.2 the sequence \[ \begin{align*} NrA &:= RND \\ & \quad \text{if } NrA \leq p \text{ then } ConApA := ConApA + 1 \end{align*} \] simulates experiment \( E \). The sequence \[ \text{for } j := 1 \text{ to } n \text{ do} \begin{align*} \text{NrA} & := \text{RND} & \\ \text{if } \text{NrA} \leq p \text{ then } \text{ConApA} & := \text{ConApA} + 1 \end{align*} \] end simulates experiment \( E^1 \) indicated in Definition 1.9. After repeating experiment \( E^1 \) many times, absolute utility vector \( V_{UABS} \) will contain the frequency with which \( A \) occurs \( i \)-times in experiment \( E^1 \) for \( i \in \{0, 1, \ldots, n\} \). Applying Proposition 1.3 the result is that the random numbers are generated according to a binomial distribution. 3. BORLAND PASCAL IMPLEMENTATION OF GBDRN unit RNDBD; {IFNDEF CPU87} {N+} {ENDIF} {---------------------------------------------------------------------------------------------------} {The unit contains the capabilities necessary to} {generate random numbers with a binomial distribution} {by parameters \(<n> \text{ and } <p> \text{ given.} \} {---------------------------------------------------------------------------------------------------} interface uses crt,dos,objects; type {---------------------------------------------------------------------------------------------------} {Object type which incapsulates the capabilities of} {generating random numbers with a binomial} {distribution.} {---------------------------------------------------------------------------------------------------} PTO_RNDBD = ^TO_RNDBD; TO_RNDBD = object N : longint; P : double; NRE : longint; Total : double; D. Bocu / An Algorithm for Generating Random Numbers with Binomial Distribution 105 PColUAbs : PCollection; constructor Init (FN:longint ;FP:double ;FNRE:longint); destructor Done;virtual; procedure GenExpBinom; function RNDBD:longint; end; implementation type {--------------------------------------------------------------------------------------------------- } {Object type which specifies a generic element} {of the collection in which absolute utility is} {kept.} {--------------------------------------------------------------------------------------------------- } PTElCol = ^TElCol; TElCol = object (Tobject) UAbs:longint; constructor init(U:longint); destructor done;virtual; end; {--------------------------------------------------------------------------------------------------- } {Constructor TElCol.... } constructor TElCol.Init(U:longint); begin UAbs:=U; end; {--------------------------------------------------------------------------------------------------- } {Destructor TElCol.... } destructor TElCol.Done; begin end; {--------------------------------------------------------------------------------------------------- } {Constructor TO_RNDBD.... } constructor TO_RNDBD. Init (FN: longint ; FP: double; FNRE: longint); begin if (FP>=0) and (FP<=1) then begin N:=FN; P:=FP; NRE:=FNRE; PColUAbs:=new (PCollection, init(FN+1, 10)); end; end; GenExpBinom; end else begin gotoxy(1, 24); clreol; textcolor(red); textbackground(white+blink); write('The parameter <p> is not in [0,1]!!!'); readkey; halt; end; end; {--------------------------------------------------------------------------------------------------- {Destructor TO_RNDBD.... } destructor TO_RNDBD. Done; begin dispose (PColUAbs, Done); end; {--------------------------------------------------------------------------------------------------- {Procedure simulates a binomial experiment by parameters <n> and <p> given. } procedure TO_RNDBD.GenExpBinom; var I, J :longint; ConApA :longint; NRA: double; MAN: longint; PEICol : PTEICol; begin for I:=0 to N do begin PColUAbs^.Insert (new(PTEICol,init (0))); end; randomize; for I:=1 to NRE do begin ConApA:=0; for J:=1 to N do begin NRA:=random; if NRA<P then inc(ConApA); end; end; D. Bocu / An Algorithm for Generating Random Numbers with Binomial Distribution \[ \text{PElCol} := \text{PColUAbs}^\cdot \text{At} (\text{ConApA}); \\ \text{MAN} := \text{PElCol}^\cdot \text{UAbs}; \\ \text{inc} (\text{MAN}); \\ \text{PElCol}^\cdot \text{UAbs} := \text{MAN}; \\ \text{PColUAbs}^\cdot \text{AtPut} (\text{ConApA}, \text{PElCol}); \] end; Total := 0; for I := 0 to N do begin \[ \text{PElCol} := \text{PColUAbs}^\cdot \text{At} (I); \\ \text{Total} := \text{Total} + \text{PElCol}^\cdot \text{UAbs}; \] end; end; {--------------------------------------------------------------------------------------------------- } {Function returns the numbers which can take values} {from <0> to <n>, binomially distributed.} function TO_RNDBD.RNDBD: longint; var I: integer; Termen: double; GenAl, Suma: double; PElCol : PTElCol; begin GenAl:=random; I:=−1 Suma:=0; repeat \[ \text{inc}(I); \\ \text{PElCol} := \text{PColUAbs}^\cdot \text{At} (I); \\ \text{Termen} := \text{PElCol}^\cdot \text{UAbs}; \\ \text{Suma} := \text{Suma} + (\text{Termen} / \text{Total}); \] until Suma >= GenAl; RNDBD := I; end; end. 4. CONCLUSIONS The present algorithm can be used from any Pascal program which imports unit RNDBD. The relation between the theoretical probability of binomial repartition by \( n, p \) parameters and the frequency with which random numbers are generated by the capabilities of the RNDBD unit will be analyzed in a future paper. REFERENCES
{"Source-Url": "http://scindeks-clanci.ceon.rs/data/pdf/0354-0243/2000/0354-02430001099B.pdf", "len_cl100k_base": 4121, "olmocr-version": "0.1.53", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 20667, "total-output-tokens": 4967, "length": "2e12", "weborganizer": {"__label__adult": 0.0003795623779296875, "__label__art_design": 0.0005373954772949219, "__label__crime_law": 0.0006175041198730469, "__label__education_jobs": 0.0021038055419921875, "__label__entertainment": 0.0001208186149597168, "__label__fashion_beauty": 0.00017750263214111328, "__label__finance_business": 0.0004086494445800781, "__label__food_dining": 0.000637054443359375, "__label__games": 0.00098419189453125, "__label__hardware": 0.0022869110107421875, "__label__health": 0.0014142990112304688, "__label__history": 0.0004444122314453125, "__label__home_hobbies": 0.00022327899932861328, "__label__industrial": 0.0009918212890625, "__label__literature": 0.0003724098205566406, "__label__politics": 0.0004761219024658203, "__label__religion": 0.0006351470947265625, "__label__science_tech": 0.370849609375, "__label__social_life": 0.00014150142669677734, "__label__software": 0.0082244873046875, "__label__software_dev": 0.6064453125, "__label__sports_fitness": 0.0003800392150878906, "__label__transportation": 0.000713348388671875, "__label__travel": 0.00021135807037353516}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 14925, 0.01234]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 14925, 0.4862]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 14925, 0.66289]], "google_gemma-3-12b-it_contains_pii": [[0, 1418, false], [1418, 3844, null], [3844, 5772, null], [5772, 7567, null], [7567, 9078, null], [9078, 10583, null], [10583, 11976, null], [11976, 12944, null], [12944, 14061, null], [14061, 14925, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1418, true], [1418, 3844, null], [3844, 5772, null], [5772, 7567, null], [7567, 9078, null], [9078, 10583, null], [10583, 11976, null], [11976, 12944, null], [12944, 14061, null], [14061, 14925, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 14925, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 14925, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 14925, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 14925, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 14925, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 14925, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 14925, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 14925, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 14925, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 14925, null]], "pdf_page_numbers": [[0, 1418, 1], [1418, 3844, 2], [3844, 5772, 3], [5772, 7567, 4], [7567, 9078, 5], [9078, 10583, 6], [10583, 11976, 7], [11976, 12944, 8], [12944, 14061, 9], [14061, 14925, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 14925, 0.0]]}
olmocr_science_pdfs
2024-12-07
2024-12-07
9443acb0c65e17b8638363b6cd8934dcbb705abc
Top-Down Parsing Algorithms Matthew Dwyer 324E Nichols Hall dwyer@cis.ksu.edu http://www.cis.ksu.edu/~dwyer Implementing parsers • Two approaches – Top-down – Bottom-up • Today: Top-Down – Easier to understand and program manually • Then: Bottom-Up – More powerful and used by most parser generators Intro to Top-Down Parsing • The parse tree is constructed – From the top – From left to right • Terminals are seen in order of appearance in the token stream: ``` t2 3 t9 / \ \ 4 7 \\ / \ \\n t5 t6 t8 ``` Recursive Descent Parsing • Consider the grammar \[ E \rightarrow T + E \mid T \\ T \rightarrow \text{int} \mid \text{int} \ast T \mid (E) \] • Token stream is: \( \text{int}_5 \ast \text{int}_2 \) • Start with top-level non-terminal \( E \) • Try the rules for \( E \) in order Recursive Descent Parsing. Example (Cont.) • Try \( E_0 \rightarrow T_1 + E_2 \) • Then try a rule for \( T_1 \rightarrow ( E_3 ) \) – But \( ( \) does not match input token \( \text{int}_5 \) • Try \( T_1 \rightarrow \text{int} \). Token matches. – But \( + \) after \( T_1 \) does not match input token \( * \) • Try \( T_1 \rightarrow \text{int} * T_2 \) – This will match but \( + \) after \( T_1 \) will be unmatched Recursive Descent Parsing. Example (Cont.) • Has exhausted the choices for $T_1$ – Backtrack to choice for $E_0$ • Try $E_0 \rightarrow T_1$ • Follow same steps as before for $T_1$ – and succeed with $T_1 \rightarrow \text{int} \cdot T_2$ and $T_2 \rightarrow \text{int}$ A Recursive Descent Parser. Preliminaries • Let TOKEN be the type of tokens – Special tokens INT, OPEN, CLOSE, PLUS, TIMES • Let the global next point to the next token A Recursive Descent Parser (2) - Define boolean functions that check the token string for a match of - A given token terminal ``` bool term(TOKEN tok) { return *next++ == tok; } ``` - A given production of S (the n\textsuperscript{th}) ``` bool S_n() { ... } ``` - Any production of S: ``` bool S() { ... } ``` - These functions advance next A Recursive Descent Parser (3) • For production $E \rightarrow T$ ```java bool E1() { return T(); } ``` • For production $E \rightarrow T + E$ ```java bool E2() { return T() && term(PLUS) && E(); } ``` • For all productions of $E$ (with backtracking) ```java bool E() { TOKEN *save = next; return (next = save, E1()) || (next = save, E2()); } ``` CIS 706 Translators I A Recursive Descent Parser (4) • Functions for non-terminal $T$ ```c bool T_1() { return term(OPEN) && E() && term(CLOSE); } bool T_2() { return term(INT) && term(TIMES) && T(); } bool T_3() { return term(INT); } bool T() { TOKEN *save = next; return (next = save, T_1()) || (next = save, T_2()) || (next = save, T_3()); } ``` Recursive Descent Parsing. Notes. • To start the parser – Initialize next to point to first token – Invoke E() • Notice how this simulates our previous example • Easy to implement by hand • But does not always work … When Recursive Descent Does Not Work • Consider a production $S \rightarrow S \ a$ ```cpp def s1(): return s() and term(a) def s(): return s1() ``` • $S()$ will get into an infinite loop • A left-recursive grammar has a non-terminal $S$ $S \rightarrow^+ S\alpha$ for some $\alpha$ • Recursive descent does not work in such cases Elimination of Left Recursion • Consider the left-recursive grammar \[ S \rightarrow S\alpha \mid \beta \] • S generates all strings starting with a \( \beta \) and followed by a number of \( \alpha \) • Can rewrite using right-recursion \[ S \rightarrow \beta S' \] \[ S' \rightarrow \alpha S' \mid \varepsilon \] More Elimination of Left-Recursion • In general \[ S \rightarrow S \alpha_1 \mid \ldots \mid S \alpha_n \mid \beta_1 \mid \ldots \mid \beta_m \] • All strings derived from \( S \) start with one of \( \beta_1, \ldots, \beta_m \) and continue with several instances of \( \alpha_1, \ldots, \alpha_n \) • Rewrite as \[ S \rightarrow \beta_1 \ S' \mid \ldots \mid \beta_m \ S' \] \[ S' \rightarrow \alpha_1 \ S' \mid \ldots \mid \alpha_n \ S' \mid \epsilon \] General Left Recursion • The grammar \[ S \rightarrow A \alpha | \delta \] \[ A \rightarrow S \beta \] • is also left-recursive because \[ S \rightarrow^+ S \beta \alpha \] • This \textit{indirect} left-recursion can also be eliminated • See book for general algorithm Summary of Recursive Descent • Simple and general parsing strategy – Left-recursion must be eliminated first – … but that can be done automatically • Unpopular because of backtracking – Thought to be too inefficient • In practice, backtracking is eliminated by restricting the grammar Predictive Parsers • Like recursive-descent but parser can “predict” which production to use – By looking at the next few tokens (no backtracking) • Predictive parsers accept LL(k) grammars – L means “left-to-right” scan of input – L means “leftmost derivation” – k means “predict based on k tokens of lookahead” • In practice, LL(1) is used LL(1) Languages • In recursive-descent, for each non-terminal and input token there may be a choice of production • LL(1) means that for each non-terminal and token there is only one production • Can be specified via 2D tables – One dimension for current non-terminal to expand – One dimension for next token – A table entry contains one production Predictive Parsing and Left Factoring • Recall the grammar \[ E \rightarrow T + E | T \] \[ T \rightarrow \text{int} | \text{int} \ast T | ( E ) \] • Hard to predict because – For T two productions start with int – For E it is not clear how to predict • A grammar must be *left-factored* before use for predictive parsing Left-Factoring Example • Recall the grammar \[ E \rightarrow T + E \mid T \] \[ T \rightarrow \text{int} \mid \text{int} \ast T \mid (E) \] • Factor out *common prefixes* of productions \[ E \rightarrow T \ X \] \[ X \rightarrow + \ E \mid \varepsilon \] \[ T \rightarrow (E) \mid \text{int} \ Y \] \[ Y \rightarrow * \ T \mid \varepsilon \] LL(1) Parsing Table Example • Left-factored grammar E → T X X → + E | ε T → ( E ) | int Y Y → * T | ε • The LL(1) parsing table: <table> <thead> <tr> <th></th> <th>int</th> <th>*</th> <th>+</th> <th>( )</th> <th>$</th> </tr> </thead> <tbody> <tr> <td>E</td> <td>T X</td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>X</td> <td></td> <td>+ E</td> <td></td> <td>ε</td> <td>ε</td> </tr> <tr> <td>T</td> <td>int Y</td> <td></td> <td></td> <td>( E )</td> <td></td> </tr> <tr> <td>Y</td> <td></td> <td>* T</td> <td></td> <td>ε</td> <td>ε</td> </tr> </tbody> </table> • Consider the \([E, \text{ int}]\) entry – “When current non-terminal is \(E\) and next input is \(\text{int}\), use production \(E \rightarrow T X\) – This production generates an int in the first place • Consider the \([Y, +]\) entry – “When current non-terminal is \(Y\) and current token is +, get rid of \(Y\)” – \(Y\) can be followed by + only in a derivation in which \(Y \rightarrow \varepsilon\) LL(1) Parsing Tables. Errors • Blank entries indicate error situations – Consider the [E,*] entry – “There is no way to derive a string starting with * from non-terminal E” Using Parsing Tables • Method similar to recursive descent, except – For each non-terminal S – look at the next token a – choose the production shown at [S,a] • use a stack to keep track of pending non-terminals • reject when error state • accept when end-of-input ($) LL(1) Parsing Algorithm initialize stack = <S, $> and next repeat case stack of <X, rest> : if T[X,*next] = Y₁…Yₙ then stack ← <Y₁…Yₙ, rest>; else error(); <t, rest> : if t == *next++ then stack ← <rest>; else error(); until stack == < > ## LL(1) Parsing Example <table> <thead> <tr> <th>Stack</th> <th>Input</th> <th>Action</th> </tr> </thead> <tbody> <tr> <td>E $</td> <td>int * int $</td> <td>T X</td> </tr> <tr> <td>T X $</td> <td>int * int $</td> <td>int Y</td> </tr> <tr> <td>int Y X $</td> <td>int * int $</td> <td>terminal</td> </tr> <tr> <td>Y X $</td> <td>* int $</td> <td>* T</td> </tr> <tr> <td>* T X $</td> <td>* int $</td> <td>terminal</td> </tr> <tr> <td>T X $</td> <td>int $</td> <td>int Y</td> </tr> <tr> <td>int Y X $</td> <td>int $</td> <td>terminal</td> </tr> <tr> <td>Y X $</td> <td>$</td> <td>ε</td> </tr> <tr> <td>X $</td> <td>$</td> <td>ε</td> </tr> <tr> <td>$</td> <td>$</td> <td>ACCEPT</td> </tr> </tbody> </table> Constructing Parsing Tables • LL(1) languages are those defined by a parsing table for the LL(1) algorithm • No table entry can be multiply defined • We want to generate parsing tables from CFG • If $A \rightarrow \alpha$, where in the row of $A$ does $\alpha$ go? • In the column of $t$ where $t$ can start a string derived from $\alpha$ \[ \alpha \rightarrow^* t \beta \] – We say that $t \in \text{First}(\alpha)$ • In the column of $t$ if $\alpha$ is $\varepsilon$ and $t$ can follow an $A$ \[ S \rightarrow^* \beta A t \delta \] – We say $t \in \text{Follow}(A)$ Computing First Sets Definition: \( \text{First}(X) = \{ t \mid X \rightarrow^* t\alpha \} \cup \{ \varepsilon \mid X \rightarrow^* \varepsilon \} \) Algorithm sketch (see book for details): 1. for all terminals \( t \) do \( \text{First}(t) \leftarrow \{ t \} \) 2. for each production \( X \rightarrow \varepsilon \) do \( \text{First}(X) \leftarrow \{ \varepsilon \} \) 3. if \( X \rightarrow A_1 \ldots A_n \alpha \) and \( \varepsilon \in \text{First}(A_i), \ 1 \leq i \leq n \) do • add \( \text{First}(\alpha) \) to \( \text{First}(X) \) 4. for each \( X \rightarrow A_1 \ldots A_n \) s.t. \( \varepsilon \in \text{First}(A_i), \ 1 \leq i \leq n \) do • add \( \varepsilon \) to \( \text{First}(X) \) 5. repeat steps 4 & 5 until no \( \text{First} \) set can be grown First Sets. Example • Recall the grammar \[ E \rightarrow T \ X \] \[ T \rightarrow ( \ E \ ) \mid \text{int} \ Y \] \[ X \rightarrow + \ E \mid \varepsilon \] \[ Y \rightarrow * \ T \mid \varepsilon \] • First sets \[ \text{First}( ( ) ) = \{ ( ) \} \] \[ \text{First}( ) ) = \{ ) \} \] \[ \text{First}( \text{int}) = \{ \text{int} \} \] \[ \text{First}( + ) = \{ + \} \] \[ \text{First}( * ) = \{ * \} \] \[ \text{First}( T ) = \{ \text{int}, ( ) \} \] \[ \text{First}( E ) = \{ \text{int}, ( ) \} \] \[ \text{First}( X ) = \{ +, \varepsilon \} \] \[ \text{First}( Y ) = \{ *, \varepsilon \} \] Computing Follow Sets • Definition: \[ \text{Follow}(X) = \{ t \mid S \rightarrow^* \beta \ X \ t \ \delta \} \] • Intuition – If \( S \) is the start symbol then \( \$ \in \text{Follow}(S) \) – If \( X \rightarrow A \ B \) then \( \text{First}(B) \subseteq \text{Follow}(A) \) and \( \text{Follow}(X) \subseteq \text{Follow}(B) \) – If \( B \rightarrow^* \varepsilon \) then \( \text{Follow}(X) \subseteq \text{Follow}(A) \) Computing Follow Sets (Cont.) Algorithm sketch: 1. Follow(S) ← { $ } 2. For each production A → α X β • add First(β) - {ε} to Follow(X) 3. For each A → α X β where ε ∈ First(β) • add Follow(A) to Follow(X) – repeat step(s) until no Follow set grows Follow Sets. Example • Recall the grammar \[\begin{align*} E & \rightarrow T X \\ T & \rightarrow ( E ) \mid \text{int } Y \\ \end{align*}\] \[\begin{align*} X & \rightarrow + E \mid \varepsilon \\ Y & \rightarrow * T \mid \varepsilon \\ \end{align*}\] • Follow sets \[\begin{align*} \text{Follow( + )} & = \{ \text{int, ( } \} \\ \text{Follow( * )} & = \{ \text{int, ( } \} \\ \text{Follow( ( )} & = \{ \text{int, ( } \} \\ \text{Follow( E )} & = \{ \}, \$ \} \\ \text{Follow( X )} & = \{ \$, ) \} \\ \text{Follow( T )} & = \{ +, ) , \$ \} \\ \text{Follow( ) )} & = \{ +, ) , \$ \} \\ \text{Follow( Y )} & = \{ +, ) , \$ \} \\ \text{Follow( int) } & = \{ *, +, ) , \$ \} \\ \end{align*}\] Constructing LL(1) Parsing Tables - Construct a parsing table T for CFG G - For each production \( A \rightarrow \alpha \) in G do: - For each terminal \( t \in \text{First}(\alpha) \) do - \( T[A, t] = \alpha \) - If \( \varepsilon \in \text{First}(\alpha) \), for each \( t \in \text{Follow}(A) \) do - \( T[A, t] = \alpha \) - If \( \varepsilon \in \text{First}(\alpha) \) and \( \$ \in \text{Follow}(A) \) do - \( T[A, \$] = \alpha \) Notes on LL(1) Parsing Tables • If any entry is multiply defined then G is not LL(1) – If G is ambiguous, left-recursive, not left-factored, … • Most programming language grammars are not LL(1) • There are tools that build LL(1) tables Review • For some grammars there is a simple parsing strategy – Predictive parsing • Next time: a more powerful parsing strategy that is commonly used
{"Source-Url": "http://people.cs.ksu.edu/~dwyer/courses/cis706/calendar/resources/topdownparsing.pdf", "len_cl100k_base": 4310, "olmocr-version": "0.1.53", "pdf-total-pages": 36, "total-fallback-pages": 0, "total-input-tokens": 49922, "total-output-tokens": 5627, "length": "2e12", "weborganizer": {"__label__adult": 0.0003247261047363281, "__label__art_design": 0.0002772808074951172, "__label__crime_law": 0.0003185272216796875, "__label__education_jobs": 0.0013828277587890625, "__label__entertainment": 6.258487701416016e-05, "__label__fashion_beauty": 0.00013184547424316406, "__label__finance_business": 0.0001131296157836914, "__label__food_dining": 0.0003917217254638672, "__label__games": 0.0006289482116699219, "__label__hardware": 0.0007376670837402344, "__label__health": 0.0004596710205078125, "__label__history": 0.00018346309661865232, "__label__home_hobbies": 0.00010329484939575197, "__label__industrial": 0.0003731250762939453, "__label__literature": 0.0002796649932861328, "__label__politics": 0.0002155303955078125, "__label__religion": 0.0005064010620117188, "__label__science_tech": 0.01251983642578125, "__label__social_life": 0.0001081228256225586, "__label__software": 0.004253387451171875, "__label__software_dev": 0.9755859375, "__label__sports_fitness": 0.0003783702850341797, "__label__transportation": 0.00045108795166015625, "__label__travel": 0.0001990795135498047}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 12602, 0.00851]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 12602, 0.41336]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 12602, 0.58743]], "google_gemma-3-12b-it_contains_pii": [[0, 109, false], [109, 310, null], [310, 549, null], [549, 833, null], [833, 1265, null], [1265, 1547, null], [1547, 1721, null], [1721, 2122, null], [2122, 2543, null], [2543, 2905, null], [2905, 3129, null], [3129, 3472, null], [3472, 3792, null], [3792, 4262, null], [4262, 4538, null], [4538, 4831, null], [4831, 5184, null], [5184, 5540, null], [5540, 5873, null], [5873, 6229, null], [6229, 6592, null], [6592, 7007, null], [7007, 7185, null], [7185, 7461, null], [7461, 7754, null], [7754, 8356, null], [8356, 8552, null], [8552, 8934, null], [8934, 9718, null], [9718, 10321, null], [10321, 10751, null], [10751, 11016, null], [11016, 11751, null], [11751, 12209, null], [12209, 12448, null], [12448, 12602, null]], "google_gemma-3-12b-it_is_public_document": [[0, 109, true], [109, 310, null], [310, 549, null], [549, 833, null], [833, 1265, null], [1265, 1547, null], [1547, 1721, null], [1721, 2122, null], [2122, 2543, null], [2543, 2905, null], [2905, 3129, null], [3129, 3472, null], [3472, 3792, null], [3792, 4262, null], [4262, 4538, null], [4538, 4831, null], [4831, 5184, null], [5184, 5540, null], [5540, 5873, null], [5873, 6229, null], [6229, 6592, null], [6592, 7007, null], [7007, 7185, null], [7185, 7461, null], [7461, 7754, null], [7754, 8356, null], [8356, 8552, null], [8552, 8934, null], [8934, 9718, null], [9718, 10321, null], [10321, 10751, null], [10751, 11016, null], [11016, 11751, null], [11751, 12209, null], [12209, 12448, null], [12448, 12602, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 12602, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 12602, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 12602, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 12602, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 12602, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 12602, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 12602, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 12602, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 12602, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 12602, null]], "pdf_page_numbers": [[0, 109, 1], [109, 310, 2], [310, 549, 3], [549, 833, 4], [833, 1265, 5], [1265, 1547, 6], [1547, 1721, 7], [1721, 2122, 8], [2122, 2543, 9], [2543, 2905, 10], [2905, 3129, 11], [3129, 3472, 12], [3472, 3792, 13], [3792, 4262, 14], [4262, 4538, 15], [4538, 4831, 16], [4831, 5184, 17], [5184, 5540, 18], [5540, 5873, 19], [5873, 6229, 20], [6229, 6592, 21], [6592, 7007, 22], [7007, 7185, 23], [7185, 7461, 24], [7461, 7754, 25], [7754, 8356, 26], [8356, 8552, 27], [8552, 8934, 28], [8934, 9718, 29], [9718, 10321, 30], [10321, 10751, 31], [10751, 11016, 32], [11016, 11751, 33], [11751, 12209, 34], [12209, 12448, 35], [12448, 12602, 36]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 12602, 0.05521]]}
olmocr_science_pdfs
2024-12-08
2024-12-08
3a5848b9d06279ca14944f8e598fa887b56abc7c
A CYK+ Variant for SCFG Decoding Without a Dot Chart Rico Sennrich School of Informatics University of Edinburgh 10 Crichton Street Edinburgh EH8 9AB Scotland, UK v1rsennr@staffmail.ed.ac.uk Abstract While CYK+ and Earley-style variants are popular algorithms for decoding unbinarized SCFGs, in particular for syntax-based Statistical Machine Translation, the algorithms rely on a so-called dot chart which suffers from a high memory consumption. We propose a recursive variant of the CYK+ algorithm that eliminates the dot chart, without incurring an increase in time complexity for SCFG decoding. In an evaluation on a string-to-tree SMT scenario, we empirically demonstrate substantial improvements in memory consumption and translation speed. 1 Introduction SCFG decoding can be performed with monolingual parsing algorithms, and various SMT systems implement the CYK+ algorithm or a close Earley-style variant (Zhang et al., 2006; Koehn et al., 2007; Venugopal and Zollmann, 2009; Dyer et al., 2010; Vilar et al., 2012). The CYK+ algorithm (Chappelier and Rajman, 1998) generalizes the CYK algorithm to n-ary rules by performing a dynamic binarization of the grammar during parsing through a so-called dot chart. The construction of the dot chart is a major cause of space inefficiency in SCFG decoding with CYK+, and memory consumption makes the algorithm impractical for long sentences without artificial limits on the span of chart cells. We demonstrate that, by changing the traversal through the main parse chart, we can eliminate the dot chart from the CYK+ algorithm at no computational cost for SCFG decoding. Our algorithm improves space complexity, and an empirical evaluation confirms substantial improvements in memory consumption over the standard CYK+ algorithm, along with remarkable gains in speed. This paper is structured as follows. As motivation, we discuss some implementation needs and complexity characteristics of SCFG decoding. We then describe our algorithm as a variant of CYK+, and finally perform an empirical evaluation of memory consumption and translation speed of several parsing algorithms. 2 SCFG Decoding To motivate our algorithm, we want to highlight some important differences between (monolingual) CFG parsing and SCFG decoding. Grammars in SMT are typically several orders of magnitude larger than for monolingual parsing, partially because of the large amounts of training data employed to learn SCFGs, partially because SMT systems benefit from using contextually rich rules rather than only minimal rules (Galley et al., 2006). Also, the same right-hand-side rule on the source side can be associated with many translations, and different (source and/or target) left-hand-side symbols. Consequently, a compact representation of the grammar is of paramount importance. We follow the implementation in the Moses SMT toolkit (Koehn et al., 2007) which encodes an SCFG as a trie in which each node represents a (partial or completed) rule, and a node has outgoing edges for each possible continuation of the rule in the grammar, either a source-side terminal symbol or pair of non-terminal-symbols. If a node represents a completed rule, it is also associated with a collection of left-hand-side symbols and the associated target-side rules and probabilities. A trie data structure allows for an efficient grammar lookup, since all rules with the same pre- fix are compactly represented by a single node. Rules are matched to the input in a bottom-up- fashion as described in the next section. A single rule or rule prefix can match the input many times, either by matching different spans of the input, or by matching the same span, but with different sub- spans for its non-terminal symbols. Each produc- tion is uniquely identified by a span, a grammar trie node, and back-pointers to its subderivations. The same is true for a partial production (dotted item). A key difference between monolingual parsing and SCFG decoding, whose implications on time complexity are discussed by Hopkins and Lang- mead (2010), is that SCFG decoders need to con- sider language model costs when searching for the best derivation of an input sentence. This critically affects the parser’s ability to discard dotted items early. For CFG parsing, we only need to keep one partial production per rule prefix and span, or k for k-best parsing, selecting the one(s) whose sub- derivations have the lower cost in case of ambigu- ity. For SCFG decoding, the subderivation with the higher local cost may be the globally better choice after taking language model costs into ac- tount. Consequently, SCFG decoders need to con- sider multiple possible productions for the same rule and span. Hopkins and Langmead (2010) provide a run- time analysis of SCFG decoding, showing that time complexity depends on the number of choice points in a rule, i.e. rule-initial, consecutive, or rule-final non-terminal symbols. The number of choice points (or scope) gives an upper bound to the number of productions that exist for a rule and span. If we define the scope of a grammar G to be the maximal scope of all rules in the grammar, decoding can be performed in \(O(n^{\text{scope}(G)})\) time. If we retain all partial productions of the same rule prefix, this also raises the space complexity of the dot chart from \(O(n^2)\) to \(O(n^{\text{scope}(G)})\). 2 Crucially, the inclusion of language model costs both increases the space complexity of the dot chart, and removes one of its benefits, namely the ability to discard partial productions early without risking search errors. Still, there is a second way 1Assuming that there is a constant upper bound on the frequency of each symbol in the input sentence, and on the length of rules. 2In a left-to-right construction of productions, a rule pre- fix of a scope-\(x\) rule may actually have scope \(x + 1\), namely if the rule prefix ends in a non-terminal, but the rule does not. Figure 1: Traditional CYK/CYK+ chart traversal order (left) and proposed order (right). 3 Algorithm 3.1 The CYK+ algorithm We here summarize the CYK+ algorithm, originally described by Chappelier and Rajman (1998). 3 3Chappelier and Rajman (1998) add the restriction that rules may not be partially lexicalized; our description of CYK+, and our own algorithm, do not place this restriction. The main data structure during decoding is a chart with one cell for each span of words in an input string \( w_1 \ldots w_n \) of length \( n \). Each cell \( T_{i,j} \) corresponding to the span from \( w_i \) to \( w_j \) contains two lists of items: - a list of type-1 items, which are non-terminals (representing productions). - a list of type-2 items (dotted items), which are strings of symbols \( \alpha \) that parse the sub-string \( w_i \ldots w_j \) and for which there is a rule in the grammar of the form \( A \rightarrow \alpha \beta \), with \( \beta \) being a non-empty string of symbols. Such an item may be completed into a type-1 item at a future point, and is denoted \( \alpha \bullet \). For each cell \( (i,j) \) of the chart, we perform the following steps: 1. if \( i = j \), search for all rules \( A \rightarrow w_i \gamma \). If \( \gamma \) is empty, add \( A \) to the type-1 list of cell \( (i,j) \); otherwise, add \( w_i \bullet \) to the type-2 list of cell \( (i,j) \). 2. if \( j > i \), search for all combinations of a type-2 item \( \bullet \) in a cell \( (i,k) \) and a type-1 item \( B \) in a cell \( (k+1,j) \) for which a rule of the form \( A \rightarrow \alpha B \gamma \) exists.\(^4\) If \( \gamma \) is empty, add the rule to the type-1 list of cell \( (i,j) \); otherwise, add \( \alpha B \bullet \) to the type-2 list of cell \( (i,j) \). 3. for each item \( B \) in the type-1 list of the cell \( (i,j) \), if there is a rule of the form \( A \rightarrow B \gamma \), and \( \gamma \) is non-empty, add \( B \bullet \) to the type-2 list of cell \( (i,j) \). ### 3.2 Our algorithm The main idea behind our algorithm is that we can avoid the need to store type-2 lists if we process the individual cells in a right-to-left, depth-first order, as illustrated in Figure 1. Rules are still completed left-to-right, but processing the rightmost cells first allows us to immediately extend partial productions into full productions instead of storing them in memory. We perform the following steps for each cell. 1. if \( i = j \), if there is a rule \( A \rightarrow w_i \), add \( A \) to the type-1 list of cell \( (i,j) \). 2. if \( j > i \), search for all combinations of a type-2 item \( \alpha \bullet \) and a type-1 item \( B \) in a cell \( (j,k) \), with \( j \leq k \leq n \) for which a rule of the form \( C \rightarrow \alpha B \gamma \) exists. In the initial call, we allow \( \alpha \bullet = A \bullet \) for any type-1 item \( A \) in cell \( (i,j-1) \).\(^5\) If \( \gamma \) is empty, add \( C \) to the type-1 list of cell \( (i,k) \); otherwise, recursively repeat this step, using \( \alpha B \bullet \) as \( \alpha \bullet \) and \( k + 1 \) as \( j \). To illustrate the difference between the two algorithms, let us consider the chart cell \((1,2)\), i.e. the chart cell spanning the substring \( it \) is, in Figure 1, and let us assume the following grammar: \[ S \rightarrow NP \ V \ NP \quad V \rightarrow is \\ NP \rightarrow ART \ NN \quad ART \rightarrow a \\ NP \rightarrow it \quad NN \rightarrow trap \] In both algorithms, we can combine the symbols \( NP \) from cell \((1,1)\) and \( V \) from cell \((2,2)\) to partially parse the rule \( S \rightarrow NP \ V \ NP \). However, in CYK+, we cannot yet know if the rule can be completed with a cell \((3,x)\) containing symbol \( NP \), since the cell \((3,4)\) may be processed after cell \((1,2)\). Thus, the partial production is stored in a type-2 list for later processing. In our algorithm, we require all cells \((3,x)\) to be processed before cell \((1,2)\), so we can immediately perform a recursion with \( \alpha = NP \ V \) and \( j = 3 \). In this recursive step, we search for a symbol \( NP \) in any cell \((3,x)\), and upon finding it in cell \((3,4)\), add \( S \) as type-1 item to cell \((1,4)\). We provide side-by-side pseudocode of the two algorithms in Figure 2.\(^7\) The algorithms are aligned to highlight their similarity, the main difference between them being that type-2 items are added to the dot chart in CYK+, and recursively consumed in our variant. An attractive property of the dynamic binarization in CYK+ is that each partial production is constructed exactly once, and can be re-used to find parses for cells that cover a larger span. Our algorithm retains this property. Note that the chart traversal order is different between the algorithms, as illustrated earlier in Figure 1. While the original CYK+ algorithm works with either chart traversal order, our recursive vari- \(^4\)To allow mixed-terminal rules, we also allow \( \alpha \bullet = w_i \bullet \) if \( j = i + 1 \), and \( B = w_j \bullet \) if \( j = k \). \(^5\)Some implementation details are left out for simplicity. For instance, note that terminal and non-terminal grammar trie edges can be kept separate to avoid iterating over all terminal edges. Algorithm 1: CYK+ **Input:** array \( w \) of length \( N \) initialize \( chart[N, N], collections[N, N], dotchart[N] \) \( root \) ← root node of grammar trie for \( span \) in \([1..N]\): for \( i \) in \([1..(N-span+1)]\): \( j \) ← \( i + span - 1 \) if \( i = j \): #step 1 if \( (w[i], X) \) in \( arc[root] \): addToChart(X, i, j) else: for \( B \) in \( chart[i, j-1] \): #step 3 if \( (B, X) \) in \( arc[root] \): if \( arc[X] \) is not empty: add \((X, j-1)\) to \( dotchart[i] \) for \((a, k)\) in \( dotchart[i] \): #step 2 if \( k + 1 = j \): if \( (w[j], X) \) in \( arc[a] \): addToChart(X, i, j) for \( (B, X) \) in \( chart[k+1, j] \): addToChart(X, i, j) \( chart[i, j] = cube_prune(collections[i, j]) \) **def** addToChart(trie node \( X \), int \( i \), int \( j \), bool \( u \)): if \( X \) has target collection: add \( X \) to \( collections[i, j] \) if \( arc[X] \) is not empty: add \((X, j)\) to \( dotchart[i] \) Algorithm 2: recursive CYK+ **Input:** array \( w \) of length \( N \) initialize \( chart[N, N], collections[N, N] \) \( root \) ← root node of grammar trie for \( i \) in \([N..1]\): for \( j \) in \([i..N]\): if \( i = j \): #step 1 if \( (w[i], X) \) in \( arc[root] \): addToChart(X, i, j, false) else: consume(root, i, i, j-1) \( chart[i, j] = cube_prune(collections[i, j]) \) **def** consume(trie node \( a \), int \( i \), int \( j \), int \( k \)): \( unary \) ← \( i = j \) if \( j = k \): if \( (w[j], X) \) in \( arc[a] \): addToChart(X, i, k, unary) for \( (B, X) \) in \( arc[a] \): if \( B \) in \( chart[j, k] \): addToChart(X, i, k, unary) **def** addToChart(trie node \( X \), int \( i \), int \( j \), bool \( u \)): if \( X \) has target collection and \( u \) is false: add \( X \) to \( collections[i, j] \) if \( arc[X] \) is not empty: for \( k \) in \([j+1..N]\): consume(X, i, j+1, k) Figure 2: side-by-side pseudocode of CYK+ (left) and our algorithm (right). Our algorithm uses a new chart traversal order and recursive consume function instead of a dot chart. ant requires a right-to-left, depth-first chart traversal. With our implementation of the SCFG as a trie, a type-2 is identified by a trie node, an array of back-pointers to antecedent cells, and a span. We distinguish between type-1 items before and after cube pruning. Productions, or specifically the target collections and back-pointers associated with them, are first added to a collections object, either synchronously or asynchronously. Cube pruning is always performed synchronously after all production of a cell have been found. Thus, the choice of algorithm does not change the search space in cube pruning, or the decoder output. After cube pruning, the chart cell is filled with a mapping from a non-terminal symbol to an object that compactly represents a collection of translation hypotheses and associated scores. 3.3 Chart Compression Given a partial production for span \((i, j)\), the number of chart cells in which the production can be continued is linear to sentence length. The recursive variant explicitly loops through all cells starting at position \(j + 1\), but this search also exists in the original CYK+ in the form of the same type-2 item being re-used over time. The guarantee that all cells \((j + 1, k)\) are visited before cell \((i, j)\) in the recursive algorithm allows for a further optimization. We construct a compressed matrix representation of the chart, which can be incrementally updated in \(O(|V| \cdot n^2)\), \(V\) being the vocabulary of non-terminal symbols. For each start position and non-terminal symbol, we maintain an array of possible end positions and the corresponding chart entry, as illustrated in Table 1. The array is compressed in that it does not represent empty chart cells. Using the previous example, instead of searching all cells \((3, x)\) for a symbol NP, we only need to retrieve the array corresponding to start position 3 and symbol NP to obtain the array of cells which can continue the partial production. While not affecting the time complexity of the algorithm, this compression technique reduces computational cost in two ways. If the chart is sparsely populated, i.e. if the size of the arrays is smaller than \(n - j\), the algorithm iterates through fewer elements. Even if the chart is dense, we only perform one chart look-up per non-terminal and partial production, instead of \(n - j\). <table> <thead> <tr> <th>cell</th> <th>S</th> <th>NP</th> <th>V</th> <th>ART</th> <th>NN</th> </tr> </thead> <tbody> <tr> <td>(3,3)</td> <td>0x81</td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>(3,4)</td> <td>0x86</td> <td></td> <td></td> <td></td> <td></td> </tr> </tbody> </table> <table> <thead> <tr> <th>start</th> <th>symbol</th> <th>compressed column</th> </tr> </thead> <tbody> <tr> <td>3</td> <td>ART</td> <td>[3, 0x81]</td> </tr> <tr> <td>3</td> <td>NP</td> <td>[4, 0x86]</td> </tr> <tr> <td>3</td> <td>S, V, NN</td> <td>[]</td> </tr> </tbody> </table> Table 1: Matrix representation of all chart entries starting at position 3 (top), and equivalent compressed representation (bottom). Chart entries are pointers to objects that represent collection of translation hypotheses and their scores. 4 Related Work Our proposed algorithm is similar to the work by Leermakers (1992), who describe a recursive variant of Earley’s algorithm. While they discuss function memoization, which takes the place of charts in their work, as a space-time trade-off, a key insight of our work is that we can order the chart traversal in SCFG decoding so that partial productions need not be tabulated or memoized, without incurring any trade-off in time complexity. Dunlop et al. (2010) employ a similar matrix compression strategy for CYK parsing, but their method is different to ours in that they employ matrix compression on the grammar, which they assume to be in Chomsky Normal Form, whereas we represent n-ary grammars as tries, and use matrix compression for the chart. An obvious alternative to n-ary parsing is the use of binary grammars, and early SCFG models for SMT allowed only binary rules, as in the hierarchical models by Chiang (2007)\(^8\), or binarizable ones as in inversion-transduction grammar (ITG) (Wu, 1997). Whether an n-ary rule can be binarized depends on the rule-internal reorderings between non-terminals; Zhang et al. (2006) describe a synchronous binarization algorithm. Hopkins and Langmead (2010) show that the complexity of parsing n-ary rules is determined by the number of choice points, i.e. non-terminals that are initial, consecutive, or final, since terminal symbols in the rule constrain which cells are possible application contexts of a non-terminal symbol. They propose pruning of the SCFG to rules. \(^8\)Specifically, Chiang (2007) allows at most two non-terminals per rule, and no adjacent non-terminals on the source side. with at most 3 decision points, or scope 3, as an alternative to binarization that allows parsing in cubic time. In a runtime evaluation, SMT with their pruned, unbinarized grammar offers a better speed-quality trade-off than synchronous binarization because, even though both have the same complexity characteristics, synchronous binarization increases both the overall number of rules, and the number of non-terminals, which increases the grammar constant. In contrast, Chung et al. (2011) compare binarization and Earley-style parsing with scope-pruned grammars, and find Earley-style parsing to be slower. They attribute the comparative slowness of Earley-style parsing to the cost of building and storing the dot chart during decoding, which is exactly the problem that our paper addresses. Williams and Koehn (2012) describe a parsing algorithm motivated by Hopkins and Langmead (2010) in which they store the grammar in a compact trie with source terminal symbols or a generic gap symbol as edge labels. Each path through this trie corresponds to a rule pattern, and is associated with the set of grammar rules that share the same rule pattern. Their algorithm initially constructs a secondary trie that records all rule patterns that apply to the input sentence, and stores the position of matching terminal symbols. Then, chart cells are populated by constructing a lattice for each rule pattern identified in the initial step, and traversing all paths through this lattice. Their algorithm is similar to ours in that they also avoid the construction of a dot chart, but they construct two other auxiliary structures instead: a secondary trie and a lattice for each rule pattern. In comparison, our algorithm is simpler, and we perform an empirical comparison of the two in the next section. 5 Empirical Results We empirically compare our algorithm to the CYK+ algorithm, and the Scope-3 algorithm as described by Williams and Koehn (2012), in a string-to-tree SMT task. All parsing algorithms are equivalent in terms of translation output, and our evaluation focuses on memory consumption and speed. 5.1 Data For SMT decoding, we use the Moses toolkit (Koehn et al., 2007) with KenLM for language model queries (Heafield, 2011). We use training data from the ACL 2014 Ninth Workshop on Statistical Machine Translation (WMT) shared translation task, consisting of 4.5 million sentence pairs of parallel data and a total of 120 million sentences of monolingual data. We build a string-to-tree translation system English—German, using target-side syntactic parses obtained with the dependency parser ParZu (Sennrich et al., 2013). A synchronous grammar is extracted with GHKM rule extraction (Galley et al., 2004; Galley et al., 2006), and the grammar is pruned to scope 3. The synchronous grammar contains 38 million rule pairs with 23 million distinct source-side rules. We report decoding time for a random sample of 1000 sentences from the newstest2013/4 sets (average sentence length: 21.9 tokens), and peak memory consumption for sentences of 20, 40, and 80 tokens. We do not report the time and space required for loading the SMT models, which is stable for all experiments. The parsing algorithm only accounts for part of the cost during decoding, and the relative gains from optimizing the parsing algorithm are highest if the rest of the decoder is fast. For best speed, we use cube pruning with language model boundary word grouping (Heafield et al., 2013) in all experiments. We set no limit to the maximal span of SCFG rules, but only keep the best 100 productions per span for cube pruning. The cube pruning limit itself is set to 1000. 5.2 Memory consumption Peak memory consumption for different sentence lengths is shown in Table 2. For sentences of length 80, we observe more than 50 GB in peak memory consumption for CYK+, which makes it impractical for long sentences, especially for multi-threaded decoding. Our recursive variants keep memory consumption small, as does the <table> <thead> <tr> <th>algorithm</th> <th>n = 20</th> <th>n = 40</th> <th>n = 80</th> </tr> </thead> <tbody> <tr> <td>Scope-3</td> <td>0.02</td> <td>0.04</td> <td>0.34</td> </tr> <tr> <td>CYK+</td> <td>0.32</td> <td>2.63</td> <td>51.64</td> </tr> <tr> <td>+ recursive</td> <td>0.02</td> <td>0.04</td> <td>0.15</td> </tr> <tr> <td>+ compression</td> <td>0.02</td> <td>0.04</td> <td>0.15</td> </tr> </tbody> </table> Table 2: Peak memory consumption (in GB) of string-to-tree SMT decoder for sentences of different length n with different parsing algorithms. 9 The language model consumes 13 GB of memory, and the SCFG 37 GB. We leave the task of compacting the grammar to future research. Figure 3: Decoding time per sentence as a function of sentence length for four parsing variants. Regression curves use least squares fitting on cubic function. Table 3: Parse time and total decoding time per sentence (in seconds) of string-to-tree SMT decoder with different parsing algorithms. <table> <thead> <tr> <th>algorithm</th> <th>length 80</th> <th>random</th> <th></th> <th></th> <th></th> </tr> </thead> <tbody> <tr> <td></td> <td>parse</td> <td>total</td> <td>parse</td> <td>total</td> <td></td> </tr> <tr> <td>Scope-3 parser</td> <td>74.5</td> <td>81.1</td> <td>1.9</td> <td>2.6</td> <td></td> </tr> <tr> <td>CYK+</td> <td>358.0</td> <td>365.4</td> <td>8.4</td> <td>9.1</td> <td></td> </tr> <tr> <td>+ recursive</td> <td>33.7</td> <td>40.1</td> <td>1.5</td> <td>2.2</td> <td></td> </tr> <tr> <td>+ compression</td> <td>15.0</td> <td>21.2</td> <td>1.0</td> <td>1.7</td> <td></td> </tr> </tbody> </table> 5.3 Speed While the main motivation for eliminating the dot chart was to reduce memory consumption, we also find that our parsing variants are markedly faster than the original CYK+ algorithm. Figure 3 shows decoding time for sentences of different length with the four parsing variants. Table 3 shows selected results numerically, and also distinguishes between total decoding time and time spent in the parsing block, the latter ignoring the cost of cube pruning and language model scoring. If we consider parse time for sentences of length 80, we observe a speed-up by a factor of 24 between our fastest variant (with recursion and chart compression), and the original CYK+. The gains from chart compression over the recursive variant – a factor 2 reduction in parse time for sentences of length 80 – are attributable to a reduction in the number of computational steps. The large speed difference between CYK+ and the recursive variant is somewhat more surprising, given the similarity of the two algorithms. Profiling results show that the recursive variant is not only faster because it saves the computational overhead of creating and destroying the dot chart, but that it also has a better locality of reference, with markedly fewer CPU cache misses. Time differences are smaller for shorter sentences, both in terms of time spent parsing, and because the time spent outside of parsing is a higher proportion of the total. Still, we observe a factor 5 speed-up in total decoding time on our random translation sample from CYK+ to our fastest variant. We also observe speed-ups over the Scope-3 parser, ranging from a factor 5 speed-up (parsing time on sentences of length 80) to a 50% speed-up (total time on random translation sample). It is unclear to what extent these speed differences reflect the cost of building the auxiliary data structures in the Scope-3 parser, and how far they are due to implementation details. 5.4 Rule prefix scope For the CYK+ parser, the growth of both memory consumption and decoding time exceeds our cubic growth expectation. We earlier remarked that the rule prefix of a scope-3 rule may actually be scope-4 if the prefix ends in a non-terminal, but the rule itself does not. Since this could increase space and time complexity of CYK+ to $O(n^4)$, we did additional experiments in which we prune all scope-3 rules with a scope-4 prefix. This affected 1% of all source-side rules in our model, and only had a small effect on translation quality (19.76 BLEU → 19.73 BLEU on newstest2013). With this additional pruning, memory consumption with CYK+ is closer to our theoretical expectation, with a peak memory consumption of 23 GB for sentences of length 80 ($\approx 2^5$ times more than for length 40). We also observe reductions in parse time as shown in Table 4. While we do see marked reductions in parse time for all CYK+ variants, our recursive variants maintain their efficiency advantage over the original algorithm. Rule prefix scope is irrelevant for the Scope-3 parsing algorithm\(^{10}\), and its \(^{10}\)Despite its name, the Scope-3 parsing algorithm allows grammars of any scope, with a time complexity of $O(n^{\text{scope}(G)})$. 100 speed is only marginally affected by this pruning procedure. 6 Conclusion While SCFG decoders with dot charts are still wide-spread, we argue that dot charts are only of limited use for SCFG decoding. The core contributions of this paper are the insight that a right-to-left, depth-first chart traversal order allows for the removal of the dot chart from the popular CYK+ algorithm without incurring any computational cost for SCFG decoding, and the presentation of a recursive CYK+ variant that is based on this insight. Apart from substantial savings in space complexity, we empirically demonstrate gains in decoding speed. The new chart traversal order also allows for a chart compression strategy that yields further speed gains. Our parsing algorithm does not affect the search space or cause any loss in translation quality, and its speed improvements are orthogonal to improvements in cube pruning (Gesmundo et al., 2012; Heafield et al., 2013). The algorithmic modifications to CYK+ that we propose are simple, but we believe that the efficiency gains of our algorithm are of high practical importance for syntax-based SMT. An implementation of the algorithm has been released as part of the Moses SMT toolkit. Acknowledgements I thank Matt Post, Philip Williams, Marcin Junczys-Dowmunt and the anonymous reviewers for their helpful suggestions and feedback. This research was funded by the Swiss National Science Foundation under grant P2ZHP1_148717. References
{"Source-Url": "http://www.mt-archive.info/10/SSST-2014-Sennrich.pdf", "len_cl100k_base": 7266, "olmocr-version": "0.1.53", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 30200, "total-output-tokens": 8922, "length": "2e12", "weborganizer": {"__label__adult": 0.0007472038269042969, "__label__art_design": 0.0008034706115722656, "__label__crime_law": 0.0008425712585449219, "__label__education_jobs": 0.0019588470458984375, "__label__entertainment": 0.0004723072052001953, "__label__fashion_beauty": 0.0003867149353027344, "__label__finance_business": 0.0003981590270996094, "__label__food_dining": 0.0006175041198730469, "__label__games": 0.002010345458984375, "__label__hardware": 0.0011224746704101562, "__label__health": 0.0012607574462890625, "__label__history": 0.000732421875, "__label__home_hobbies": 0.00011610984802246094, "__label__industrial": 0.0007038116455078125, "__label__literature": 0.00563812255859375, "__label__politics": 0.0007939338684082031, "__label__religion": 0.0011949539184570312, "__label__science_tech": 0.23876953125, "__label__social_life": 0.0002205371856689453, "__label__software": 0.01531982421875, "__label__software_dev": 0.72412109375, "__label__sports_fitness": 0.0006647109985351562, "__label__transportation": 0.0008969306945800781, "__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, 32237, 0.03526]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 32237, 0.34872]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 32237, 0.8464]], "google_gemma-3-12b-it_contains_pii": [[0, 3410, false], [3410, 6361, null], [6361, 11280, null], [11280, 13369, null], [13369, 17955, null], [17955, 22517, null], [22517, 26566, null], [26566, 30439, null], [30439, 32237, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3410, true], [3410, 6361, null], [6361, 11280, null], [11280, 13369, null], [13369, 17955, null], [17955, 22517, null], [22517, 26566, null], [26566, 30439, null], [30439, 32237, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 32237, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 32237, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 32237, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 32237, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 32237, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 32237, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 32237, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 32237, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 32237, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 32237, null]], "pdf_page_numbers": [[0, 3410, 1], [3410, 6361, 2], [6361, 11280, 3], [11280, 13369, 4], [13369, 17955, 5], [17955, 22517, 6], [22517, 26566, 7], [26566, 30439, 8], [30439, 32237, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 32237, 0.09129]]}
olmocr_science_pdfs
2024-12-07
2024-12-07
5b4ca15950f5582f7ecb54e68404d998ce4af6ef
Table Of Contents 1 Executive Summary .......................................................................................................................... 3 2 Introduction......................................................................................................................................... 3 3 IoT Infrastructure................................................................................................................................. 4 3.1 Sensors and Actuators...................................................................................................................... 4 3.2 Communication............................................................................................................................... 4 3.3 Analytics........................................................................................................................................ 5 3.4 Edge Computing............................................................................................................................. 5 3.5 Gateway Aggregation....................................................................................................................... 5 3.6 Direct Connectivity........................................................................................................................ 6 4 IoT Data................................................................................................................................................ 7 4.1 Record Size and Count.................................................................................................................... 7 4.2 Database Growth.............................................................................................................................. 8 4.3 Continuous Data............................................................................................................................. 8 4.4 Various Data Types........................................................................................................................ 10 4.5 Real Time Processing...................................................................................................................... 11 4.6 Batch Processing............................................................................................................................ 12 4.7 Ad-hoc User Queries...................................................................................................................... 13 5 Use Cases.......................................................................................................................................... 14 6 Conclusion........................................................................................................................................... 15 List of Figures Figure 1: Visualization of IoT Models .................................................................................................. 4 Figure 2: Difference in Scalability between GridDB and Cassandra......................................................... 7 Figure 3: GridDB and Cassandra Performance Over Time .................................................................... 8 Figure 4: Autonomous Data Distribution Algorithm ............................................................................. 9 Figure 5 TimeSeries and Collection Containers .................................................................................. 10 Figure 6: GridDB as part of a MapReduce Application. ....................................................................... 12 Figure 7: GridDB Solution to process Smart Meter data. ...................................................................... 14 1 Executive Summary This white paper showcases the requirements of IoT (Internet of Things) databases by examining the architectures of IoT solutions and how the data is generated, transferred, and used after it has been collected. Finally, it demonstrates how GridDB is specifically tailored for these different scenarios and can ease both initial development and ongoing maintenance. 2 Introduction It is estimated that by 2020, there will be 50 billion devices connected to the internet \(^1\). All these devices will be connected to the cloud, each other, and to different services. This will create a new dynamic and global infrastructure known as the “Internet of Things.” This infrastructure will completely transform how individuals and organizations connect to each other. Comprehensive data management is key for many IoT applications as many decisions and services are based on the various ways to combine both real-time and historical, stored data. One major component to consider in designing an IoT data management framework is choosing its database. IoT databases have a much different set of requirements when compared to the enterprise systems of the past. Toshiba’s NoSQL database GridDB was originally designed for IoT workloads and provides the performance, flexibility, reliability, and support needed for such applications. GridDB is a scale-out, partitioned database that features include in-memory storage and processing for high performance and scalability. It has a flexible key-container data model that can be easily adapted for use for a variety of different data types. Its use of partitioning and a hybrid cluster management architecture provides high availability with reliability. It also provides wide support of popular programming languages and third-party software packages to make analyzing data and building applications easier. 3 IoT Infrastructure To understand IoT data, first we should understand the physical components in an IoT solution and how they’re used. ![Diagram of IoT Models] **Figure 1: Visualization of IoT Models** ### 3.1 Sensors and Actuators Sensors can be defined broadly as devices that provide inputs about its current state while actuators are devices that are used to make changes in the environment. IoT devices can range from small inexpensive microcontrollers to expensive industrial machinery. There are thousands if not millions of sensors in a typical IoT platform each generating data on a regular interval. ### 3.2 Communication The communication component of an IoT application transfers all the data between the sensors, gateways, and data center or cloud. The components that are connected to each other and how they are connected can differ. One model involves connecting sensor devices directly to each other for communication. The cloud-to-device model has the IoT device connected directly to a cloud service or private data center to allow for services like remote access. The gateway-to-device model connects sensor devices to an intermediary device known as a gateway. The gateway can add extra interoperability between cloud services and IoT devices. 3.3 Analytics The intelligence component of an IoT application is the portion that stores, analyzes, and process vast amounts of data. It consists of various technologies and frameworks such as databases and data processing frameworks and utilizes cloud computing. The operations of data processing usually consist of aggregation, analysis, and storage. IoT applications can be deployed in a variety of different ways for various domains. The layouts can focus on certain layers or endpoints of the application. Different layouts and architectures have different requirements. The various IoT application structures also differ in their size, scope, and the number of domains that they encompass. The primary structures of an IoT system are Edge Computing, Gateway Aggregation, and Direct Connectivity. 3.4 Edge Computing The edge is the location where all event data and automated action takes place. In edge computing, there are three device types: the edge gateway, the edge device, and the actual edge sensor\(^2\). Edge devices can be thought of as general-purpose devices with full operating systems and processors. These devices do not require internet connectivity and can perform analysis and feedback on their own. Their usefulness come into play when the data volume is so large that a central server cannot handle all the data at once. They are also useful to make data processing as close to real-time as possible. The edge gateway has a full operating system with higher computing resources than the edge device. The gateway acts as the intermediary between the central server and the edge device. An Edge Computing IoT device will process or filter its data before propagating the portion to be stored to the GridDB database. That data can be propagated either using GridDB’s native APIs or via some other messaging framework such as MQTT. 3.5 Gateway Aggregation An intermediary gateway collects information from a set of local sensors and then aggregates their data before sending it to a central server. Gateway devices are useful for bridging different network types and are typically used in tightly coupled systems, for example all the sensors within a building would communicate with the building's gateway which would send the data to the centralized server that receives data from multiple gateways. A gateway device can either directly connect to a GridDB cluster using native APIs or it can send data via a secondary messaging protocol to the datacenter or cloud where the data would be ingested. --- \(^2\) [Link](https://www.ibm.com/blogs/internet-of-things/edge-iot-analytics/) 3.6 Direct Connectivity IoT sensors and devices can directly send their data to the cloud or centralized servers. The centralized infrastructure can exchange data and control message traffic. This style of communication is useful for loosely coupled systems like a network of smart meters. The devices can either directly connect to GridDB via its API or messages can be sent via an application gateway in the centralized infrastructure. --- 4 IoT Data Raw IoT data is unique in that it is typically machine-to-machine data that is generated continuously while being never directly used by a human. Its unique characteristics prioritize transaction count over raw data size while read performance and high-speed search are important to transform data into something useful via real time processing, batch jobs, or ad-hoc queries. 4.1 Record Size and Count Typically, the records created by an IoT device are quite small, generally being only a few bytes in length, but are generated frequently and by a large number of devices. A few bytes per record quickly become a terabyte -- or even petabyte -- level problem requiring both a huge amount of storage and incredibly fast per transaction times. To solve this issue, GridDB uses both in-memory and persistent storage. A singular transaction can be completed in memory very quickly and then grouped together over a defined period to be written to disk as one batch. It aims to keep most or all its data in-memory, using checkpoint intervals to flush its internal memory structure back to disk. Affinity functions make effective use and operation of limited memory areas in a database. GridDB provides the high performance and scalability required by IoT applications through horizontal scalability. Using a memory first architecture helps to maximize performance when ingesting and processing large amounts of data. GridDB’s approach to scale-out support for adding additional nodes online give IoT applications the needed horizontal scalability. These features are further demonstrated in a YSCB benchmark test against Apache Cassandra. ![Figure 2: Difference in Scalability between GridDB and Cassandra](image-url) 4.2 Database Growth When an IoT platform first goes online, there is typically just a subset of sensors and data that it will have at full maturity. As the number of sensors and amount of data increases, the database must also grow, or scale. GridDB uses multiple nodes to provide scalability. As the data set grows, additional nodes can be added to increase both database performance and increase the total amount of storage available. With GridDB Standard Edition, new nodes can be added without interruption while the cluster is online. In a series of benchmark tests performed by Fixstars, GridDB outperformed Apache Cassandra over the entire series of tests. The benchmarks used the YCSB on 1, 8, 16, and 32-node database clusters utilizing the Microsoft Azure Cloud Platform. GridDB showed that it scaled significantly better than Cassandra when new nodes were added. 4.3 Continuous Data IoT sensors generate data 24 hours a day, 365 days per year. Downtime for either failure or maintenance is not an option like it is in applications that only require availability during business hours. After years of operation and trillions of transactions the database must remain as fast as it was immediately after installation. To demonstrate how GridDB’s architecture is best for workloads that cannot have interruption, Fixstars performed a 24-hour time-trial with GridDB and Cassandra that shows how GridDB is able to operate for extended periods with an update-intensive workload without maintenance unlike Cassandra and other log-sorted that require compaction and other maintenance. ![GridDB and Cassandra Performance Over Time](https://www.griddb.net/en/docs/Fixstars_NoSQL_Benchmarks.pdf) --- 4 https://www.griddb.net/en/docs/Fixstars_NoSQL_Benchmarks.pdf The continuous ingestion of data also means that a database must be highly available and reliable which is accomplished through data replication on multiple nodes and fault tolerant algorithms to handle failover. Distributed systems like GridDB systems typically use either a Master-Slave architecture or a Peer-to-Peer architecture for managing their nodes. The “Master” in a Master-Slave distributed system is typically a single point of failure and peer-to-peer systems, all nodes are identical but will incur some communication overhead to provide consistency. GridDB is a hybrid, any node is capable of being the master and in the event of a master-node failure, one of the followers will take over ensuring continuous service. In the event of a failure, the Autonomous Data Distribution Algorithm (ADDA) will re-assign owner or backup roles for a partition and instruct the new nodes to begin synchronization. GridDB uses a hybrid architecture for cluster management. An algorithm is used to determine the master node and in the case of the master failing, a bully algorithm is run again to determine the new master node. Without being able to failover the master, the master becomes a single-point-of-failure (SPOF). This allows for GridDB to retain high reliability and the higher performance associated with master/slave architectures versus peer-to-peer architectures. GridDB can be configured for either immediate or eventual consistency. With immediate consistency, the partition owner handles all read and write requests and propagates them to the backup nodes. In eventual consistency, replicas can respond to read requests. 4.4 Various Data Types Applications regarding traffic, climate, and many other domains need reliable, constant sources of many different types of data including geospatial and temporal data to be effective. Many data objects used in IoT applications have spatial characteristics in multiple dimensions thus databases used for IoT applications should efficiently handle containers, schemas, and indexing of both temporal and spatial characteristics. GridDB’s key-container model of data allows for easy usage of varying types of data. The containers can use any key or a timestamp that allows for easier processing of temporal data. GridDB has built-in aggregation and geometry functions that enable developers to easily build queries without having to build their own complex routines to perform the same functions. Containers can either be a Collection or a TimeSeries; a collection can use any type of data for a key while a TimeSeries Container uses a time stamp for a key. TimeSeries Containers allow for special time functions in dealing with time-stamped data. Timestamps can be used to delete certain data after a set amount of time has passed. TimeSeries containers also support compression allowing more efficient storage of archived data. GridDB’s time-specific queries and functions include time-weighted averages as well as the ability to perform linear interpolation to estimate data values. There is also the ability to set consistent sampling periods setting start and end times and a set time interval between returned values. Time Query Example: ```sql SELECT TIME_SAMPLING(voltage103, TIMESTAMP('2011-07-01T00:00:00Z'), TIMESTAMP('2011-07-02T00:00:00Z'), 1, HOUR) FROM plant1 ``` GridDB SE (Standard Edition) and above can support spatial data as column types for its containers along with geometric queries. For Geometric data, objects can be created through the C and Java APIs or through TQL queries. GridDB accepts objects in WKT (well-known-text) form and supports objects like POINT, POLYGON, LINESTRING, POLYHEDRALSURFACE, and QUADRICSURFACE. GridDB also offers the use of several ST_functions in TQL queries like intersections to be performed on Geometric data. Creating a Geometry Object with the Java API: ```java Geometry coordinate = Geometry.valueOf("POINT(33.651442 -117.744744)"); ``` Geometry objects can be created with TQL through ST_GeomFromText function. Other objects such as rectangles, planes, spheres, cones, and cylinders can also be created with TQL. GIS functions such as generating SRIDBEs and calculating intersections between geometric objects are also supported. The following TQL example returns results with points within the given polygon: ```sql SELECT * WHERE ST_MBRIntersects (geom, ST_GeomFromText ('POLYGON ((0 0,10 0,10 10,0 10,0 0))')) ``` The unique key-container data model used by GridDB has the benefit of providing ACID characteristics that can be guaranteed at the container level. In this model, a KEY can represent one specific sensor out in the field while the VALUE (CONTAINER) can represent all the data incoming from that sensor. The CONTAINER mostly resembles a traditional relational table with columns and rows. Data access uses the key to narrow down and find rows and containers. This type of data access allows temporal, spatial and other kinds of data to be processed quickly. ### 4.5 Real Time Processing IoT applications also require analysis while data is being ingested, such as with high-speed search and pattern recognition. Stream Processing allows applications to collect, integrate, and visualize real-time stream data. This means applications can process and act on their data as soon as it is produced, meaning data can be seen as infinite streams. These types of queries allow analysis on large amounts of data from multiple sources in real-time. This form of processing allows for businesses to adapt and conform to their analytical and business needs at a faster pace. In the context of IoT, a well-developed application that utilizes real-time stream processing can solve many different challenges. TQL combined with Key-Container multi-get queries can be used to perform high-speed searches that will detect anomalies and abnormalities to provide quick responsiveness. Stream processing also allows for live monitoring as well as for automated alerts and notifications. 4.6 Batch Processing Batch processing is defined as the processing of a group or “batch” of transactions at once. No user interaction should be required. Batch or more transactional processing is used to help automate actions and decisions in IoT such as generating reports for a certain period like for monthly billing. Batch processing can be cheaper and more efficient than transactional processing and allows businesses and organizations to carry out large tasks during off the clock periods where the strain on resources is smaller. One of the most popular frameworks used in batch processing is Apache Hadoop which has a layer known as MapReduce. MapReduce is Hadoop’s native batch processing engine. This engine allows effective and inexpensive processing of large data sets when time is not a large factor. GridDB supports batch processing with a connector to MapReduce and the Hadoop File system. GridDB databases can be used as input sources as well as output destinations for MapReduce batch jobs. With GridDB as the storage engine and MapReduce as the processing engine, a foundation is provided to process multiple workloads at a time from many different domains. This connector, when put in combination with GridDB’s high performance from parallel and in-memory processing, allow MapReduce to handle more diverse workloads. 4.7 Ad-hoc User Queries Ad-hoc or user queries are created spontaneously whenever the need to get certain information arises and may involve adjusting ‘WHERE’ clauses or other location or source specific conditions. For example, depending on the choice a user makes in a user-interface, it may change what values in the WHERE clause are set or which containers the database selects from. GridDB provides ad-hoc queries through TQL. TQL is a simplified version of SQL for NoSQL products. Ad-hoc queries can be made through a Query object in GridDB’s APIs. Queries can be generated simply by using TQL strings. These queries can be generic selection queries as well as time-specific aggregations and geometry queries and operations. Those strings contain the keywords, ranges, options, and sources for the query. TQL has the benefit of being created dynamically and can be adjusted depending on the application’s context. Once these strings are made, the query object is created and later fetched. TQL Example (Java API): ```java Query<Row> query = collection.query("SELECT * FROM sensors WHERE volts = "+ voltage + "); ``` GridDB also has a functional Apache Spark with a database connector. Apache Spark is a parallel data processing framework to provide fast data analytics. Using the connector allows a GridDB database to be used as an input source for Spark queries and analytics. Its interactive shell can be used to quickly and easily perform ad-hoc queries by data scientists or developers or can be built into user-facing business applications. 5 Use Cases GridDB has been already implemented in several different IoT projects: An industrial manufacturing company selected GridDB as their database for their global compressor management system. The system provided cloud services to collect, store, analyze, and visualize data from compressors from around the globe. Processing data at this scale allows for comprehensive support and maintenance packages worldwide. In 2015, Toshiba began offering the Building Energy Management Systems (BEMS) with GridDB as its database. BEMS monitors and controls a building's needs, which include heating, ventilation, air conditioning, lighting, and security. GridDB stored 2TB of data from hundreds of buildings with thousands of records being transacted each second. In 2016, GridDB was used to collect data from distributions of smart meters for an electric power company in Japan. The company had a total of 3 million smart meters. Smart meter data would be collected every 30 minutes and stored for 3 months. This resulted in a data set over 13 billion records totaling 2.6TB. Thanks to the GridDB’s fast performance as well as its support for Hadoop MapReduce processing, it takes 40 minutes to analyze 43.2GB of data. This rate improves performance by over 2000 times when compared to the previous implementation. 6 Conclusion GridDB provides high throughput with an in-memory and persistent storage and a fast hybrid master/slave cluster management model. With modifiable containers, GridDB provides flexibility that is able to easily adapt as your data changes. Your data is safe in GridDB with its reliability and consistency features. GridDB is one of only a few ACID-compliant NoSQL databases and its Autonomous Data Distribution Algorithm (ADDA) algorithm ensures data is efficiently replicated in the case of a failure. Meanwhile, developing applications is easy with a SQL-like TQL query language and native Java, Python, Ruby, and C APIs. Working with real world data is made easy using the geometry functions and TimeSeries container. GridDB also offers the ability to integrate with other open source projects such as Kafka, Hadoop MapReduce, Apache Spark, and KairosDB. While selecting a database for an IoT application depends on particular project needs, GridDB is an ideal choice for most workloads because it provides high performance along with the flexibility and reliability required over the lifetime of the project.
{"Source-Url": "https://griddb.net/en/docs/Building_IoT_Apps_with_GridDB-09-28-2017.pdf?x21046", "len_cl100k_base": 4457, "olmocr-version": "0.1.53", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 34399, "total-output-tokens": 5164, "length": "2e12", "weborganizer": {"__label__adult": 0.0003664493560791016, "__label__art_design": 0.0004241466522216797, "__label__crime_law": 0.0005998611450195312, "__label__education_jobs": 0.0007357597351074219, "__label__entertainment": 0.0001289844512939453, "__label__fashion_beauty": 0.00017750263214111328, "__label__finance_business": 0.0011777877807617188, "__label__food_dining": 0.0003898143768310547, "__label__games": 0.0005602836608886719, "__label__hardware": 0.005218505859375, "__label__health": 0.0007505416870117188, "__label__history": 0.0004572868347167969, "__label__home_hobbies": 0.0001405477523803711, "__label__industrial": 0.0015363693237304688, "__label__literature": 0.00025653839111328125, "__label__politics": 0.00034117698669433594, "__label__religion": 0.0004780292510986328, "__label__science_tech": 0.413330078125, "__label__social_life": 0.0001004934310913086, "__label__software": 0.08428955078125, "__label__software_dev": 0.487060546875, "__label__sports_fitness": 0.00025463104248046875, "__label__transportation": 0.0008029937744140625, "__label__travel": 0.0002453327178955078}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 25096, 0.02389]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 25096, 0.67063]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 25096, 0.87857]], "google_gemma-3-12b-it_contains_pii": [[0, 0, null], [0, 3790, false], [3790, 5791, null], [5791, 7065, null], [7065, 9682, null], [9682, 10227, null], [10227, 11959, null], [11959, 13730, null], [13730, 15373, null], [15373, 17078, null], [17078, 19754, null], [19754, 21096, null], [21096, 22653, null], [22653, 23971, null], [23971, 25096, null]], "google_gemma-3-12b-it_is_public_document": [[0, 0, null], [0, 3790, true], [3790, 5791, null], [5791, 7065, null], [7065, 9682, null], [9682, 10227, null], [10227, 11959, null], [11959, 13730, null], [13730, 15373, null], [15373, 17078, null], [17078, 19754, null], [19754, 21096, null], [21096, 22653, null], [22653, 23971, null], [23971, 25096, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 25096, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 25096, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 25096, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 25096, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 25096, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 25096, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 25096, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 25096, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 25096, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 25096, null]], "pdf_page_numbers": [[0, 0, 1], [0, 3790, 2], [3790, 5791, 3], [5791, 7065, 4], [7065, 9682, 5], [9682, 10227, 6], [10227, 11959, 7], [11959, 13730, 8], [13730, 15373, 9], [15373, 17078, 10], [17078, 19754, 11], [19754, 21096, 12], [21096, 22653, 13], [22653, 23971, 14], [23971, 25096, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 25096, 0.0]]}
olmocr_science_pdfs
2024-12-07
2024-12-07
e1659a6e6ed18c312b4d325e8a8de22bdd189390
Pointers 3. Pointers 1. Table of Contents 2. Dynamic Variables 3. Memory and Addresses 4. Pointer Declaration 5. Pointer References 6. Pointer References (cont) 7. Pointer Manipulation 8. Pointers and Type 9. Addressing: Direct & Indirect 10. Record Pointers 11. Pointer Expressions 12. Dynamic Storage 13. Allocating Arrays 14. Allocating Arrays (cont) 15. Resizing an Array 16. Allocation Failure 17. Allocation Failure (cont) 18. Reference Pointer Parameters 19. Value Pointer Parameters 20. const Pointer Parameters 21. const Pointers 22. const Summary 23. Pointer Array Arithmetic 24. Incrementing Pointers 25. Array of Structs Pointer 26. Pointer Incrementing Abuse 27. Arrays of Pointers 28. Dynamic Memory Problems 29. Reference Variables Dynamic Variables 2. Dynamic Variables - Created during execution † "dynamic allocation" - No space allocated at compilation time - Size may vary † Structures are created and destroyed during execution. - Knowledge of structure size not needed - Memory is not wasted by non-used allocated space. - Storage is required for addresses. Example of Pointers - Assume: Houses represent data Addresses represent the locations of the houses. - Notice: To get to a house you must have an address. No houses can exist without addresses. An address can exist without a house (vacant lot / NULL pointer) 3. Pointers Memory and Addresses On modern computers, memory is organized in a manner similar to a one-dimensional array: - Memory is a sequence of bytes (8 bits) - Each byte is assigned a numerical address, similar to array indexing - Addresses are nonnegative integers; valid range is determined by physical system and OS memory management scheme - OS (should) keep track of which addresses each process (executing program) is allowed to access, and attempts to access addresses that are not allocated to a process should result in intervention by the OS - OS usually reserves a block of memory starting at address 0 for its own use - Addresses are usually expressed in hexadecimal (base 16), typically indicated by use of a prefix: 0xF4240 Memory Organization - Run-time stack used for statically allocated storage - Heap used for dynamically allocated storage 3. Pointers Ptr Declaration Pointer Type - Simple type of variables for storing the memory addresses of other memory locations Pointer Variables Declarations - The asterisk ‘*’ character is used for pointer variable declarations: ``` int* iptr; float* fptr; ``` - `iptr` is a pointer to an integer - `fptr` is a pointer to a real - Given the equivalent declaration: ``` int* iptr1, iptr2; ``` - Declares `iptr1` to be a pointer variable, but `iptr2` is a simple integer variable. - Typedef declaration: ``` typedef int* intPtr; ``` ``` intPtr iptr1; ``` - Declare all pointer variables in separate declaration statements. - Pointer Type Definitions: ``` int* iptr1; ``` ``` int iptr2; ``` - Strong type declaration (preferred) ### Pointer References #### 3. Pointers **Address Operator: & (ampersand)** Unary operator that returns the hardware memory location address of its operand. **Address Assignment:** ```cpp int* iptr1; int* iptr2; int numa, numb; numa = 1; numb = 2; ``` **Dereference / Indirection Operator:** * (asterisk) Unary ‘pointer’ operator that returns the memory contents at the address contained in the pointer variable. **Pointer Output:** ```cpp cout << iptr1 << *iptr1 << endl; cout << iptr2 << *iptr2 << endl; ``` (Possible) results: | 0xF4240 | 1 | | 0x3B9ACA00 | 2 | **NULL Pointer** - Pointer constant, address 0 - Named constant in the `<cstdlib>` include header (`<stddef.h>` old style header). - Represents the empty pointer ➔ points nowhere, unique pointer/address value - Illegal: NEVER dereference a pointer that equals NULL ![Error Message] The instruction at "0x04B646" referenced memory at "0x00000001". The memory could not be "read". - Click on OK to terminate the program. - Click on OK to debug the program. 3. Pointers **Pointers and Type** Pointers have type: - the type of a pointer is determined by the type of target that is specified in the pointer declaration. ```c #include <cstddef> void main() { int* iptr1 = NULL; int* iptr2 = NULL; int numa, numb; numa = 1; numb = 2; ... } ``` - here, `iptr1` and `iptr2` are pointers to `int` (type `int*`). - it is a compile-time error to assign a non-pointer value to a pointer: ```c *iptr2 = *iptr1; // error: assign int to int* ``` or vice versa: ```c *iptr1 = iptr2; // error: assign int* to int ``` **Typecasts and pointers:** - the assignments above would be legal if an explicit typecast were used: ```c iptr2 = (int*) *iptr1; // legal ``` ```c typedef int* iPtr; ``` ```c #define iPtr (*iptr1); // legal ``` ```c *iptr1 = int(iptr2); // legal ``` **However,** be very cautious with this sort of code. It rarely, if ever, makes much sense to assign a pointer a value that's not either another pointer, or obtained by using the dereference operator. 3. Pointers Direct Addressing normal variable access non-pointer variables represent one-level of addressing non-pointer variables are addresses to memory locations containing data values. compilers store variable information in a “symbol table”: <table> <thead> <tr> <th>symbol</th> <th>type</th> <th>address</th> </tr> </thead> <tbody> <tr> <td>x</td> <td>int</td> <td>0xF4240</td> </tr> <tr> <td>iptr</td> <td>int*</td> <td>0xF4244</td> </tr> </tbody> </table> compilers replace non-pointer variables with their addresses & fetch/store operations during code generation. Indirect Addressing accessing a memory location’s contents thru a pointer pointer variables represent two-levels of addressing pointer variables are addresses to memory locations containing addresses. compilers replace pointer variables with their addresses & double fetch/store operations during code generation. Note: indirect addressing required to dereference pointer variable. Record Pointers Pointers to structures: - Given: ```c const int f3size = 20; struct rectype { int field1; float field2; char field3[f3size]; }; typedef rectype *recPtr; rectype recl = (1, 3.1415f, "pi"); recPtr r1ptr; r1ptr = &recl; ``` Member Access - Field Access Examples: ```c cout << (*r1ptr).field1 << (*r1ptr).field2 << (*r1ptr).field3; ``` Note: parentheses are required due to operator precedence; without () compiler attempts to dereference fields. ```c cout << *r1ptr.field1 << *r1ptr.field2 << *r1ptr.field3; ``` ```c cout << r1ptr->field1 << r1ptr->field2 << r1ptr->field3; ``` Note: -> is an ANSI “C” pointer member selection operator. Equivalent to: (*pointer).member Arrow Operator - Short-hand notation: ```c out << r1ptr->field1 << r1ptr->field2 << r1ptr->field3; ``` 3. Pointers Arrays == Pointers Non-indexed Array variables are considered pointers in C Array names as pointers contain the address of the zero element (termed the base address of the array). Given: ``` const int size = 20; char name[size]; char *person; ``` ``` person = name; person = &name[0]; ``` Pointer Indexing All pointers can be indexed, (logically meaningful only if the pointer references an array). Example: ``` person[0] = ' '; //true if pointers reference the same memory address person[size-2] = '.'; ``` Logical Expressions NULL tests: ``` if (!person) //true if (person == NULL) ``` Equivalence Tests: ``` if (person == name) //true if pointers reference the same memory address ``` Dynamic Storage Heap (Free Store, Free Memory) Area of memory reserved by the compiler for allocating & deallocating to a program during execution. Operations: ``` C++ function C new type allocation malloc(# bytes) delete pointer deallocation free pointer ``` With most compilers, `name` is returned if the heap is empty. However, see slide 3.16 for a caveat ... Allocation ``` char* name; int* iptr; ``` ``` //C++ // C name = new(nothrow)char; name = (char *) malloc(sizeof(char)); ``` ``` iptr = new(nothrow) int [20]; ``` ``` //initialization name = new char ('A'); iptr = ``` ``` //C++ // C delete name; free(name); delete [] iptr; free(iptr); ``` ``` //delete [20] iptr; ``` ``` //dynamic array allocation ``` Deallocation ``` //C++ // C delete name; name = NULL; ``` ``` delete [] iptr; iptr = NULL; ``` ``` delete [20] iptr; ``` ``` //free(iptr); ``` Pointers are undefined after deallocation and should be set to NULL. 3. Pointers Declaration Syntax ```c int Size; cin >> Size; // dynamic value // use as array dim char* Name = new (nothrow) char[Size]; int* Scores; Scores = new (nothrow) int[Size]; Size = 4 * Size + 1; // does NOT change array ``` Effect of array allocation via `new` - **Scores**: 3F42740 - **Address returned by new; value of Scores**: 3F42740, 3F42744, 3F42748, 3F42750 - **Storage space is allocated contiguously in memory** Use like any statically-allocated array ```c strcpy(Name, "Fred G Flintstone"); // static size ``` ``` for (int Idx = 0; Idx < Size; Size++) Scores[Idx] = 0; SortScores(Scores, Size); ``` Deallocation ```c delete [] Name; delete [] Scores; delete [20] Scores; // including dim is optional ``` Failure to explicitly `delete` a dynamic variable will result in that memory **NOT** being returned to the system, even if the pointer to it goes out of scope. This is called a “**memory leak**” and is evidence of poor program implementation. If large dynamic structures are used (or lots of little ones), a memory leak can result in depletion of available memory. ```c // WARNING delete Name; // May not release array memory, undefined results ``` ### Resizing an Array Growing a dynamically-allocated array ```c int* newArray = new int[newSize]; // copy contents of old array into new one for (int Idx = 0; Idx < oldCapacity; Idx++) newArray[Idx] = Scores[Idx]; // delete old array delete [] Scores; // retarget old array pointer to new array Scores = newArray; // clean up alias newArray = NULL; ``` ### Allocation Failure An invocation of operator `new` will fail if the heap does not contain enough free memory to grant the request. Traditionally, the value `NULL` has been returned in that situation. However, the C++ Standard changes the required behavior. By the Standard, when an invocation of `new` fails, the value returned may or may not be `NULL`; what is required is that an `exception` be thrown. We do not cover catching and responding to exceptions in this course. Fortunately, for the present, most C++ language implementations will continue to guarantee that `NULL` is returned in this case. Better still, the Standard provides a way to force a `NULL` return instead of an exception throw: ```c const int Size = 20; int* myList = new(nothrow) int[Size]; ``` Use of this syntax will guarantee that `myList` will be assigned `NULL` if the allocation fails. ```c #pragma warning (disable:4291) ``` // to turn off noexcept warning The following program attempts to allocate an array, initialize it, and then display its contents. However, the allocation will almost certainly fail. ```cpp #include <cstdlib> #include <iostream> #include <iomanip> using namespace std; int main() { int Count; int* t; const int Size = 900000000; int* myList = new(nothrow) int[Size]; if (myList == NULL) { cout << "Allocation failed!!" << endl; return( EXIT_FAILURE ); } for (t = myList, Count = 0; Count < Size; Count++, t++) *t = Count; for (t = myList, Count = 0; Count < Size; Count++, t++) cout << t << setw(5) << *t << endl; return( EXIT_SUCCESS ); } ``` The following program attempts to allocate an array, initialize it, and then display its contents. However, the allocation will almost certainly fail. ```cpp #include <cstdlib> #include <iostream> #include <iomanip> using namespace std; int main() { int Count; int* t; const int Size = 900000000; int* myList = new(nothrow) int[Size]; if (myList == NULL) { cout << "Allocation failed!!" << endl; return( EXIT_FAILURE ); } for (t = myList, Count = 0; Count < Size; Count++, t++) *t = Count; for (t = myList, Count = 0; Count < Size; Count++, t++) cout << t << setw(5) << *t << endl; return( EXIT_SUCCESS ); } ``` In C++, all function parameters are, by default, passed by value. When passing a pointer as a parameter to a function, you must decide how to pass the pointer. If the called function needs to modify the value of the pointer, you must pass the pointer by reference: ```cpp void growArray(int*& Array, const int oldSize, const int newSize) { assert(newSize > oldSize); int* tempArray = new int[newSize]; Copy(tempArray, Array, oldSize); delete[] Array; Array = tempArray; // modifies VALUE of Array tempArray = NULL; // is this statement necessary? } ``` In C++, all function parameters are, by default, passed by value. When passing a pointer as a parameter to a function, you must decide how to pass the pointer. If the called function needs to modify the value of the pointer, you must pass the pointer by reference: ```cpp void growArray(int*& Array, const int oldSize, const int newSize) { assert(newSize > oldSize); int* tempArray = new int[newSize]; Copy(tempArray, Array, oldSize); delete[] Array; Array = tempArray; // modifies VALUE of Array tempArray = NULL; // is this statement necessary? } ``` 3. Pointers Value Pointer Parameters If the called function only needs to modify the value of the target of the pointer, you may pass the pointer by value: ```c void Copy(int* Target, int* Source, const int Dim) { for (int Idx = 0; Idx < Dim; Idx++) Target[Idx] = Source[Idx]; } ``` Copy() copies the target of one pointer to the target of another pointer. Neither pointer is altered. This is termed a side-effect. Considered poor practice. Better to pass pointers by reference to indicate the change of target, (or better still to explicitly pass the pointer by const but not the target). ```c void Copy(int* const Target, const int* const Source, const int Dim); ``` `const` Pointer Parameters Passing a pointer by value is somewhat dangerous. As shown in the implementation of Copy() on the previous slide, if you pass a pointer to a function by value, the function does have the ability to modify the value of the target of the pointer. (The called function receives a local copy of the pointer’s value.) This is objectionable if the function has no need to modify the target. The question is: how can we pass a pointer to a function and restrict the function from modifying the target of that pointer? ```c void Print(const int* Array, const int Size) { for (int Idx = 0; Idx < Size; Idx++) { cout << setw(5) << Idx << setw(8) << Array[Idx] << endl; } } ``` The use of “`const`” preceding a pointer parameter specifies that the value of the target of the pointer cannot be modified by the called function. So, in the code above, `Print()` is forbidden to modify the value of the target of the pointer `Array`. `Print()` also cannot modify the value of the actual pointer parameter since that parameter is passed by value. 3. Pointers If “const int* iPtr” means that the TARGET of iPtr is to be treated as a const object, how would we specify that a pointer is itself to be a const? ```cpp const int* const cPtr = new int(42); ``` Here, the value stored in the target of iPtr can be changed, but the address stored in iPtr cannot be changed. So, iPtr will always point to the same location in memory, but the contents of that location may change. (Array variables are essentially const pointers.) Given the declaration of iPtr above: ```cpp *iPtr = 17; // legal int anInt = 55; iPtr = &anInt; // illegal ``` Finally we can have a constant pointer to a constant target: ```cpp const int* const cPtr = new int(42); ``` **Summary** Courtesy of Bjarne Stroustrup, “The C++ Programming Language” ```cpp void f1(char* p) { char s[] = "Gorm"; // pointer to char const char* pc = s; // pointer to constant char pc[3] = 'g'; // error: target is constant pc = p; // legal: pointer is malleable char* const cp = s; // constant pointer cp[3] = 'g'; // legal: target is malleable cp = p; // error: pointer is constant const char* const cpc = s; // constant pointer to constant target cpc[3] = 'g'; // error: target is constant cpc = p; // error: pointer is constant } ``` How to keep it straight? Stroustrup suggests reading the declarations backwards (right to left): ```cpp char* const cp = s; ``` **cp is a constant pointer to a char** 3. Pointers Pointer Array Arithmetic If a pointer targets an array, it is possible to navigate the array by performing arithmetic operations on the pointer: ``` #include <iostream> #include <iomanip> #include <cstring> using namespace std; void main() { char s[] = "Gorm"; char* p = s; for (int Idx = 0; Idx < strlen(s); Idx++, p++) { cout << setw(3) << Idx << " " << *p << endl; } } ``` produces the output: ``` 0 G 1 o 2 r 3 m ``` Consider the update section of the for loop. At the end of each pass through the loop, we increment the value of the pointer `p`: - `p++;` // increments the value of `p` - `(*p)++` // increments the value of the target of `p` The mystery here is: why does incrementing the value of `p` cause `p` to step through the array of characters, one-by-one? ### Array of Structs Pointer ```c++ #include <iostream> #include <iomanip> using namespace std; struct Complex { double Real; double Imaginary; }; void main() { const int SIZE = 5; Complex cArray[SIZE]; Complex* cPtr = cArray; cout << "cPtr: " << cPtr << endl; cPtr++; cout << "cPtr: " << cPtr << endl; } ``` **produces:** ``` cPtr: 006AFD78 ``` ``` cPtr: 006AFD88 ``` Be very careful with code such as this…. …. the logic makes sense only if the target of the pointer is an array…. …. but, the syntax is legal no matter what the target of the pointer happens to be…. ### Pointer Incrementing Abuse ```c++ #include <iostream> #include <iomanip> using namespace std; void main() { double x = 3.14159; double* dPtr = &x; cout << " dPtr: " << dPtr << endl << " *dPtr: " << *dPtr << endl; dPtr++; cout << " dPtr: " << dPtr << endl << " *dPtr: " << *dPtr << endl; } ``` **produces:** ``` dPtr: 006AFDC0 ``` ``` *dPtr: 3.14159 ``` ``` dPtr: 006AFDC8 ``` ``` *dPtr: 1.20117e-306 ``` Incrementing `dPtr` makes no sense (logically) since that will simply make the target of `dPtr` the 8 bytes of memory that follow `x`. 3. Pointers Arrays of Pointers Declarations: ```c const int size = 20; struct rectype { int field1; float field2; char field3[size]; }; typedef rectype *rectPtr; rectype rec1 = {1, 3.1415f, "pi"}; rectPtr rayPtrs[size-1] = &rec1; ``` Member Access Field Access Examples: ```c cout << (*rayPtrs[size-1]).field1 << (*rayPtrs[size-1]).field2 << (*rayPtrs[size-1]).field3; ``` Arrow Operator Short-hand notation: ```c cout << rayPtrs[size-1]->field1 << rayPtrs[size-1]->field2 << rayPtrs[size-1]->field3; ``` Using the same sorting algorithm, why is sorting an array of pointers to records faster than sorting an array of records? Dynamic Memory Problems Given: ```c typedef int *intPtr; intPtr iptr1, iptr2; ``` Garbage - Previously allocated memory that is inaccessible thru any program pointers or structures. - Example: ``` before *iptr1 during iptr1 = NULL; after *iptr1 ``` Aliases - Two or more pointers referencing the same memory location. - Example: ``` iptr1 = new int (6); iptr1 = NULL; iptr2 = iptr1; delete iptr1; ``` Dangling Pointers - Pointers that reference memory locations previously deallocated. - Example: ``` iptr1 = new int (6); iptr2 = iptr1; delete iptr1; ``` Memory leaks 3. Pointers Reference Variables Reference Variable Declarations The ampersand ‘&’ character is used for reference variable declarations: ```c int& iptr; float &fptr1, &fptr2; ``` Pointer Differences Reference variables do NOT use the address and dereference operators (& *). Compiler dereferences reference variables transparently. Reference variables are constant addresses, assignment can only occur as initialization or as parameter passing, reassignment is NOT allowed. Examples: ```c char achar = 'A'; char& chref = achar; //char* chptr = &achar; chref = 'B'; //achar = 'B'; //*chptr = 'B'; ``` Purpose Frees programmers from explicitly dereferencing accessing, (in the same way nonpointer variables do). ‘Cleans up the syntax’ for standard C arguments and parameters. Reference Returns Return by Value Normally most function returns are by value: ```c int f(int a) { int b = a; // ... return( b ); } //f ``` The function does not actually return b, it returns a copy of b. Return by Reference Functions can return references: ```c int& f(int& a) { int b = a; // ... return( b ); } //f *** bad *** ``` Good compilers will issue a warning for returning a reference to a local variable. ```c int& f(int& a) { int b = a; // ... return( a ); } //f *** alias *** ``` Do NOT return references to private data members of a class. This violates the encapsulation of the class.
{"Source-Url": "http://courses.cs.vt.edu:80/~cs1704/fall02/Notes/C03.Pointers.pdf", "len_cl100k_base": 5786, "olmocr-version": "0.1.50", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 33894, "total-output-tokens": 7003, "length": "2e12", "weborganizer": {"__label__adult": 0.0003838539123535156, "__label__art_design": 0.00031828880310058594, "__label__crime_law": 0.0002419948577880859, "__label__education_jobs": 0.0002446174621582031, "__label__entertainment": 5.4836273193359375e-05, "__label__fashion_beauty": 0.00013840198516845703, "__label__finance_business": 7.56978988647461e-05, "__label__food_dining": 0.0003962516784667969, "__label__games": 0.0005846023559570312, "__label__hardware": 0.0014209747314453125, "__label__health": 0.0002751350402832031, "__label__history": 0.0001723766326904297, "__label__home_hobbies": 9.137392044067384e-05, "__label__industrial": 0.00030231475830078125, "__label__literature": 0.0001659393310546875, "__label__politics": 0.00016391277313232422, "__label__religion": 0.0004379749298095703, "__label__science_tech": 0.004077911376953125, "__label__social_life": 5.263090133666992e-05, "__label__software": 0.0036106109619140625, "__label__software_dev": 0.98583984375, "__label__sports_fitness": 0.0003185272216796875, "__label__transportation": 0.0004730224609375, "__label__travel": 0.00020575523376464844}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 21453, 0.02279]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 21453, 0.82164]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 21453, 0.76474]], "google_gemma-3-12b-it_contains_pii": [[0, 1360, false], [1360, 3023, null], [3023, 4063, null], [4063, 5096, null], [5096, 6768, null], [6768, 8427, null], [8427, 9616, null], [9616, 10933, null], [10933, 13458, null], [13458, 15245, null], [15245, 16778, null], [16778, 17608, null], [17608, 18800, null], [18800, 20052, null], [20052, 21453, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1360, true], [1360, 3023, null], [3023, 4063, null], [4063, 5096, null], [5096, 6768, null], [6768, 8427, null], [8427, 9616, null], [9616, 10933, null], [10933, 13458, null], [13458, 15245, null], [15245, 16778, null], [16778, 17608, null], [17608, 18800, null], [18800, 20052, null], [20052, 21453, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 21453, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 21453, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 21453, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 21453, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 21453, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 21453, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 21453, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 21453, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 21453, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 21453, null]], "pdf_page_numbers": [[0, 1360, 1], [1360, 3023, 2], [3023, 4063, 3], [4063, 5096, 4], [5096, 6768, 5], [6768, 8427, 6], [8427, 9616, 7], [9616, 10933, 8], [10933, 13458, 9], [13458, 15245, 10], [15245, 16778, 11], [16778, 17608, 12], [17608, 18800, 13], [18800, 20052, 14], [20052, 21453, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 21453, 0.00847]]}
olmocr_science_pdfs
2024-11-30
2024-11-30
3e13e350f71f80a891c65572d96803ab2a37ba5d
Chapter 8 Synchronization So far, we have mainly studied synchronous algorithms. Generally, asynchronous algorithms are more difficult to obtain. Also it is substantially harder to reason about asynchronous algorithms than about synchronous ones. For instance, computing a BFS tree (Chapter 2) efficiently requires much more work in an asynchronous system. However, many real systems are not synchronous, and we therefore have to design asynchronous algorithms. In this chapter, we will look at general simulation techniques, called synchronizers, that allow running synchronous algorithms in asynchronous environments. 8.1 Basics A synchronizer generates sequences of clock pulses at each node of the network satisfying the condition given by the following definition. Definition 8.1 (valid clock pulse). We call a clock pulse generated at a node \( v \) valid if it is generated after \( v \) received all the messages of the synchronous algorithm sent to \( v \) by its neighbors in the previous pulses. Given a mechanism that generates the clock pulses, a synchronous algorithm is turned into an asynchronous algorithm in an obvious way: As soon as the \( i \)th clock pulse is generated at node \( v \), \( v \) performs all the actions (local computations and sending of messages) of round \( i \) of the synchronous algorithm. Theorem 8.2. If all generated clock pulses are valid according to Definition 8.1, the above method provides an asynchronous algorithm that behaves exactly the same way as the given synchronous algorithm. Proof. When the \( i \)th pulse is generated at a node \( v \), \( v \) has sent and received exactly the same messages and performed the same local computations as in the first \( i - 1 \) rounds of the synchronous algorithm. The main problem when generating the clock pulses at a node \( v \) is that \( v \) cannot know what messages its neighbors are sending to it in a given synchronous round. Because there are no bounds on link delays, \( v \) cannot simply wait “long enough” before generating the next pulse. In order satisfy Definition 8.1, nodes have to send additional messages for the purpose of synchronization. The total complexity of the resulting asynchronous algorithm depends on the overhead introduced by the synchronizer. For a synchronizer $S$, let $T(S)$ and $M(S)$ be the time and message complexities of $S$ for each generated clock pulse. As we will see, some of the synchronizers need an initialization phase. We denote the time and message complexities of the initialization by $T_{\text{init}}(S)$ and $M_{\text{init}}(S)$, respectively. If $T(A)$ and $M(A)$ are the time and message complexities of the given synchronous algorithm $A$, the total time and message complexities $T_{\text{tot}}$ and $M_{\text{tot}}$ of the resulting asynchronous algorithm then become $$T_{\text{tot}} = T_{\text{init}}(S) + T(A) \cdot (1 + T(S)) \quad \text{and} \quad M_{\text{tot}} = M_{\text{init}}(S) + M(A) + T(A) \cdot M(S),$$ respectively. Remarks: - Because the initialization only needs to be done once for each network, we will mostly be interested in the overheads $T(S)$ and $M(S)$ per round of the synchronous algorithm. Definition 8.3 (Safe Node). A node $v$ is safe with respect to a certain clock pulse if all messages of the synchronous algorithm sent by $v$ in that pulse have already arrived at their destinations. Lemma 8.4. If all neighbors of a node $v$ are safe with respect to the current clock pulse of $v$, the next pulse can be generated for $v$. Proof. If all neighbors of $v$ are safe with respect to a certain pulse, $v$ has received all messages of the given pulse. Node $v$ therefore satisfies the condition of Definition 8.1 for generating a valid next pulse. \qed Remarks: - In order to detect safety, we require that all algorithms send acknowledgements for all received messages. As soon as a node $v$ has received an acknowledgement for each message that it has sent in a certain pulse, it knows that it is safe with respect to that pulse. Note that sending acknowledgements does not increase the asymptotic time and message complexities. 8.2 The Local Synchronizer $\alpha$ Algorithm 33 Synchronizer $\alpha$ (at node $v$) 1. wait until $v$ is safe 2. send SAFE to all neighbors 3. wait until $v$ receives SAFE messages from all neighbors 4. start new pulse Synchronizer $\alpha$ is very simple. It does not need an initialization. Using acknowledgements, each node eventually detects that it is safe. It then reports this fact directly to all its neighbors. Whenever a node learns that all its neighbors are safe, a new pulse is generated. Algorithm 33 formally describes the synchronizer $\alpha$. Theorem 8.5. The time and message complexities of synchronizer $\alpha$ per synchronous round are $$T(\alpha) = O(1) \quad \text{and} \quad M(\alpha) = O(m).$$ Proof. Communication is only between neighbors. As soon as all neighbors of a node $v$ become safe, $v$ knows of this fact after one additional time unit. For every clock pulse, synchronizer $\alpha$ sends at most four additional messages over every edge: Each of the nodes may have to acknowledge a message and reports safety. Remarks: - Synchronizer $\alpha$ was presented in a framework, mostly set up to have a common standard to discuss different synchronizers. Without the framework, synchronizer $\alpha$ can be explained more easily: 1. Send message to all neighbors, include round information $i$ and actual data of round $i$ (if any). 2. Wait for message of round $i$ from all neighbors, and go to next round. - Although synchronizer $\alpha$ allows for simple and fast synchronization, it produces awfully many messages. Can we do better? Yes. 8.3 The Global Synchronizer $\beta$ Algorithm 34 Synchronizer $\beta$ (at node $v$) 1: \textbf{wait} until $v$ is safe 2: \textbf{wait} until $v$ receives SAFE messages from all its children in $T$ 3: \textbf{if} $v \neq \ell$ \textbf{then} 4: \hspace{1em} \textbf{send} SAFE message to parent in $T$ 5: \hspace{1em} \textbf{wait} until PULSE message received from parent in $T$ 6: \textbf{end if} 7: \textbf{send} PULSE message to children in $T$ 8: start new pulse Synchronizer $\beta$ needs an initialization that computes a leader node $\ell$ and a spanning tree $T$ rooted at $\ell$. As soon as all nodes are safe, this information is propagated to $\ell$ by a convergecast. The leader then broadcasts this information to all nodes. The details of synchronizer $\beta$ are given in Algorithm 34. Theorem 8.6. The time and message complexities of synchronizer $\beta$ per synchronous round are $$T(\beta) = O(\text{diameter}(T)) \leq O(n) \quad \text{and} \quad M(\beta) = O(n).$$ The time and message complexities for the initialization are $$T_{\text{init}}(\beta) = O(n) \quad \text{and} \quad M_{\text{init}}(\beta) = O(m + n \log n).$$ Proof. Because the diameter of $T$ is at most $n - 1$, the convergecast and the broadcast together take at most $2n - 2$ time units. Per clock pulse, the synchronizer sends at most $2n - 2$ synchronization messages (one in each direction over each edge of $T$). With the improved variant of the GHS algorithm (Algorithm 11) mentioned in Chapter 2, it is possible to construct an MST in time $O(n)$ with $O(m + n \log n)$ messages in an asynchronous environment. Once the tree is computed, the tree can be made rooted in time $O(n)$ with $O(n)$ messages. Remarks: - We now got a time-efficient synchronizer ($\alpha$) and a message-efficient synchronizer ($\beta$), it is only natural to ask whether we can have the best of both worlds. And, indeed, we can. How is that synchronizer called? Quite obviously: $\gamma$. 8.4 The Hybrid Synchronizer $\gamma$ Figure 8.1: A cluster partition of a network: The dashed cycles specify the clusters, cluster leaders are black, the solid edges are the edges of the intracluster trees, and the bold solid edges are the intercluster edges Synchronizer $\gamma$ can be seen as a combination of synchronizers $\alpha$ and $\beta$. In the initialization phase, the network is partitioned into clusters of small diameter. In each cluster, a leader node is chosen and a BFS tree rooted at this leader node is computed. These trees are called the intracluster trees. Two clusters $C_1$ and $C_2$ are called neighboring if there are nodes $u \in C_1$ and $v \in C_2$ for which $(u, v) \in E$. For every two neighboring clusters, an intercluster edge is chosen, which will serve for communication between these clusters. Figure 8.1 illustrates this partitioning into clusters. We will discuss the details of how to construct such a partition in the next section. We say that a cluster is safe if all its nodes are safe. 8.4. Synchronizer $\gamma$ Synchronizer $\gamma$ works in two phases. In a first phase, synchronizer $\beta$ is applied separately in each cluster by using the intrachannel trees. Whenever the leader of a cluster learns that its cluster is safe, it reports this fact to all the nodes in the clusters as well as to the leaders of the neighboring clusters. Now, the nodes of the cluster enter the second phase where they wait until all the neighboring clusters are known to be safe and then generate the next pulse. Hence, we essentially apply synchronizer $\alpha$ between clusters. A detailed description is given by Algorithm 35. Algorithm 35 Synchronizer $\gamma$ (at node $v$) 1: wait until $v$ is safe 2: wait until $v$ receives SAFE messages from all children in intrachannel tree 3: if $v$ is not cluster leader then 4: send SAFE message to parent in intrachannel tree 5: wait until CLUSTERSAFE message received from parent 6: end if 7: send CLUSTERSAFE message to all children in intrachannel tree 8: send NEIGHBORSAFE message over all interchannel edges of $v$ 9: wait until $v$ receives NEIGHBORSAFE messages from all adjacent interchannel edges and all children in intrachannel tree 10: if $v$ is not cluster leader then 11: send NEIGHBORSAFE message to parent in intrachannel tree 12: wait until PULSE message received from parent 13: end if 14: send PULSE message to children in intrachannel tree 15: start new pulse Theorem 8.7. Let $m_C$ be the number of interchannel edges and let $k$ be the maximum cluster radius (i.e., the maximum distance of a leaf to its cluster leader). The time and message complexities of synchronizer $\gamma$ are $$T(\gamma) = O(k) \quad \text{and} \quad M(\gamma) = O(n + m_C).$$ Proof. We ignore acknowledgements, as they do not affect the asymptotic complexities. Let us first look at the number of messages. Over every intrachannel tree edge, exactly one SAFE message, one CLUSTERSAFE message, one NEIGHBORSAFE message, and one PULSE message is sent. Further, one NEIGHBORSAFE message is sent over every interchannel edge. Because there are less than $n$ intrachannel tree edges, the total message complexity therefore is at most $4n + 2m_C = O(n + m_C)$. For the time complexity, note that the depth of each intrachannel tree is at most $k$. On each intrachannel tree, two convergecasts (the SAFE and NEIGHBORSAFE messages) and two broadcasts (the CLUSTERSAFE and PULSE messages) are performed. The time complexity for this is at most $4k$. There is one more time unit needed to send the NEIGHBORSAFE messages over the interchannel edges. The total time complexity therefore is at most $4k + 1 = O(k)$. $\square$ 8.5 Network Partition We will now look at the initialization phase of synchronizer $\gamma$. Algorithm 36 describes how to construct a partition into clusters that can be used for synchronizer $\gamma$. In Algorithm 36, $B(v, r)$ denotes the ball of radius $r$ around $v$, i.e., $B(v, r) = \{ u \in V : d(u, v) \leq r \}$ where $d(u, v)$ is the hop distance between $u$ and $v$. The algorithm has a parameter $\rho > 1$. The clusters are constructed sequentially. Each cluster is started at an arbitrary node that has not been included in a cluster. Then the cluster radius is grown as long as the cluster grows by a factor more than $\rho$. Algorithm 36 Cluster construction 1: while unprocessed nodes do 2: select an arbitrary unprocessed node $v$; 3: $r := 0$; 4: while $|B(v, r + 1)| > \rho |B(v, r)|$ do 5: $r := r + 1$ 6: end while 7: makeCluster($B(v, r)$) \hspace{1cm} // all nodes in $B(v, r)$ are now processed 8: end while Remarks: - The algorithm allows a trade-off between the cluster diameter $k$ (and thus the time complexity) and the number of intercluster edges $m_C$ (and thus the message complexity). We will quantify the possibilities in the next section. - Two very simple partitions would be to make a cluster out of every single node or to make one big cluster that contains the whole graph. We then get synchronizers $\alpha$ and $\beta$ as special cases of synchronizer $\gamma$. Theorem 8.8. Algorithm 36 computes a partition of the network graph into clusters of radius at most $\log_\rho n$. The number of intercluster edges is at most $(\rho - 1) \cdot n$. Proof. The radius of a cluster is initially 0 and does only grow as long as it grows by a factor larger than $\rho$. Since there are only $n$ nodes in the graph, this can happen at most $\log_\rho n$ times. To count the number of intercluster edges, observe that an edge can only become an intercluster edge if it connects a node at the boundary of a cluster with a node outside a cluster. Consider a cluster $C$ of size $|C|$. We know that $C = B(v, r)$ for some $v \in V$ and $r \geq 0$. Further, we know that $|B(v, r + 1)| \leq \rho \cdot |B(v, r)|$. The number of nodes adjacent to cluster $C$ is therefore at most $|B(v, r + 1) \setminus B(v, r)| \leq \rho \cdot |C| - |C|$. Because there is only one intercluster edge connecting two clusters by definition, the number of intercluster edges adjacent to $C$ is at most $(\rho - 1) \cdot |C|$. Summing over all clusters, we get that the total number of intercluster edges is at most $(\rho - 1) \cdot n$. \qed Corollary 8.9. Using $\rho = 2$, Algorithm 36 computes a clustering with cluster radius at most $\log_2 n$ and with at most $n$ intercluster edges. Corollary 8.10. Using \( \rho = n^{1/k} \), Algorithm 36 computes a clustering with cluster radius at most \( k \) and at most \( O(n^{1+1/k}) \) intercluster edges. Remarks: - Algorithm 36 describes a centralized construction of the partitioning of the graph. For \( \rho \geq 2 \), the clustering can be computed by an asynchronous distributed algorithm in time \( O(n) \) with \( O(m + n \log n) \) (reasonably sized) messages (showing this will be part of the exercises). - It can be shown that the trade-off between cluster radius and number of intercluster edges of Algorithm 36 is asymptotically optimal. There are graphs for which every clustering into clusters of radius at most \( k \) requires \( n^{1+c/k} \) intercluster edges for some constant \( c \). The above remarks lead to a complete characterization of the complexity of synchronizer \( \gamma \). Corollary 8.11. The time and message complexities of synchronizer \( \gamma \) per synchronous round are \[ T(\gamma) = O(k) \quad \text{and} \quad M(\gamma) = O(n^{1+1/k}). \] The time and message complexities for the initialization are \[ T_{\text{init}}(\gamma) = O(n) \quad \text{and} \quad M_{\text{init}}(\gamma) = O(m + n \log n). \] Remarks: - In Chapter 2, you have seen that by using flooding, there is a very simple synchronous algorithm to compute a BFS tree in time \( O(D) \) with message complexity \( O(m) \). If we use synchronizer \( \gamma \) to make this algorithm asynchronous, we get an algorithm with time complexity \( O(n + D \log n) \) and message complexity \( O(m + n \log n + Dn) \) (including initialization). - The synchronizers \( \alpha, \beta, \) and \( \gamma \) achieve global synchronization, i.e. every node generates every clock pulse. The disadvantage of this is that nodes that do not participate in a computation also have to participate in the synchronization. In many computations (e.g. in a BFS construction), many nodes only participate for a few synchronous rounds. In such scenarios, it is possible to achieve time and message complexity \( O(\log^3 n) \) per synchronous round (without initialization). - It can be shown that if all nodes in the network need to generate all pulses, the trade-off of synchronizer \( \gamma \) is asymptotically optimal. - Partitions of networks into clusters of small diameter and coverings of networks with clusters of small diameters come in many variations and have various applications in distributed computations. In particular, apart from synchronizers, algorithms for routing, the construction of sparse spanning subgraphs, distributed data structures, and even computations of local structures such as a MIS or a dominating set are based on some kind of network partitions or covers. CHAPTER 8. SYNCHRONIZATION 8.6 Clock Synchronization “A man with one clock knows what time it is – a man with two is never sure.” Synchronizers can directly be used to give nodes in an asynchronous network a common notion of time. In wireless networks, for instance, many basic protocols need an accurate time. Sometimes a common time in the whole network is needed, often it is enough to synchronize neighbors. The purpose of the time division multiple access (TDMA) protocol is to use the common wireless channel as efficiently as possible, i.e., interfering nodes should never transmit at the same time (on the same frequency). If we use synchronizer $\beta$ to give the nodes a common notion of time, every single clock cycle costs $D$ time units! Often, each (wireless) node is equipped with an internal clock. Using this clock, it should be possible to divide time into slots, and make each node send (or listen, or sleep, respectively) in the appropriate slots according to the media access control (MAC) layer protocol used. However, as it turns out, synchronizing clocks in a network is not trivial. As nodes’ internal clocks are not perfect, they will run at speeds that are time-dependent. For instance, variations in temperature or supply voltage will affect this clock drift. For standard clocks, the drift is in the order of parts per million, i.e., within a second, it will accumulate to a couple of microseconds. Wireless TDMA protocols account for this by introducing guard times. Whenever a node knows that it is about to receive a message from a neighbor, it powers up its radio a little bit earlier to make sure that it does not miss the message even when clocks are not perfectly synchronized. If nodes are badly synchronized, messages of different slots might collide. In the clock synchronization problem, we are given a network (graph) with $n$ nodes. The goal for each node is to have a logical clock such that the logical clock values are well synchronized, and close to real time. Each node is equipped with a hardware clock, that ticks more or less in real time, i.e., the time between two pulses is arbitrary between $[1 - \epsilon, 1 + \epsilon]$, for a constant $\epsilon \ll 1$. Similarly as in our asynchronous model, we assume that messages sent over the edges of the graph have a delivery time between $[0, 1]$. In other words, we have a bounded but variable drift on the hardware clocks and an arbitrary jitter in the delivery times. The goal is to design a message-passing algorithm that ensures that the logical clock skew of adjacent nodes is as small as possible at all times. Theorem 8.12. The global clock skew (the logical clock difference between any two nodes in the graph) is $\Omega(D)$, where $D$ is the diameter of the graph. Proof. For a node $u$, let $t_u$ be the logical time of $u$ and let $(u \rightarrow v)$ denote a message sent from $u$ to a node $v$. Let $t(m)$ be the time delay of a message $m$ and let $u$ and $v$ be neighboring nodes. First consider a case where the message delays between $u$ and $v$ are $1/2$. Then all the messages sent by $u$ and $v$ at time $i$ according to the clock of the sender arrive at time $i + 1/2$ according to the clock of the receiver. Then consider the following cases - $t_u = t_v + 1/2$, $t(u \rightarrow v) = 1$, $t(v \rightarrow u) = 0$ - $t_u = t_v - 1/2$, $t(u \rightarrow v) = 0$, $t(v \rightarrow u) = 1$, \end{document} 8.6. CLOCK SYNCHRONIZATION where the message delivery time is always fast for one node and slow for the other and the logical clocks are off by $1/2$. In both scenarios, the messages sent at time $i$ according to the clock of the sender arrive at time $i + 1/2$ according to the logical clock of the receiver. Therefore, for nodes $u$ and $v$, both cases with clock drift seem the same as the case with perfectly synchronized clocks. Furthermore, in a linked list of $D$ nodes, the left- and rightmost nodes $l, r$ cannot distinguish $t_l = t_r + D/2$ from $t_l = t_r - D/2$. Remarks: - From Theorem 8.12, it directly follows that all the clock synchronization algorithms we studied have a global skew of $\Omega(D)$. - Many natural algorithms manage to achieve a global clock skew of $O(D)$. As both the message jitter and hardware clock drift are bounded by constants, it feels like we should be able to get a constant drift between neighboring nodes. As synchronizer $\alpha$ pays most attention to the local synchronization, we take a look at a protocol inspired by the synchronizer $\alpha$. A pseudo-code representation for the clock synchronization protocol $\alpha$ is given in Algorithm 37. Algorithm 37 Clock synchronization $\alpha$ (at node $v$) 1: \textbf{repeat} 2: \hspace{1em} \textbf{send} logical time $t_v$ to all neighbors 3: \hspace{1em} \textbf{if} Receive logical time $t_u$, where $t_u > t_v$, from any neighbor $u$ \textbf{then} 4: \hspace{2em} $t_v := t_u$ 5: \hspace{1em} \textbf{end if} 6: \textbf{until} done Lemma 8.13. The clock synchronization protocol $\alpha$ has a local skew of $\Omega(n)$. Proof. Let the graph be a linked list of $D$ nodes. We denote the nodes by $v_1, v_2, \ldots, v_D$ from left to right and the logical clock of node $v_i$ by $t_i$. Apart from the left-most node $v_1$ all hardware clocks run with speed $1$ (real time). Node $v_1$ runs at maximum speed, i.e. the time between two pulses is not $1$ but $1 - \epsilon$. Assume that initially all message delays are $1$. After some time, node $v_1$ will start to speed up $v_2$, and after some more time $v_2$ will speed up $v_3$, and so on. At some point of time, we will have a clock skewed of $1$ between any two neighbors. In particular $t_1 = t_D + D - 1$. Now we start playing around with the message delays. Let $t_1 = T$. First we set the delay between the $v_1$ and $v_2$ to $0$. Now node $v_2$ immediately adjusts its logical clock to $T$. After this event (which is instantaneous in our model) we set the delay between $v_2$ and $v_1$ to $0$, which results in $v_3$ setting its logical clock to $T$ as well. We perform this successively to all pairs of nodes until $v_{D-2}$ and $v_{D-1}$. Now node $v_{D-1}$ sets its logical clock to $T$, which indicates that the difference between the logical clocks of $v_{D-1}$ and $v_D$ is $T - (T - (D - 1)) = D - 1$. \qed Remarks: - The introduced examples may seem cooked-up, but examples like this exist in all networks, and for all algorithms. Indeed, it was shown that any natural clock synchronization algorithm must have a bad local skew. In particular, a protocol that averages between all neighbors is even worse than the introduced $\alpha$ algorithm. This algorithm has a clock skew of $\Omega(D^2)$ in the linked list, at all times. - It was shown that the local clock skew is $\Theta(\log D)$, i.e., there is a protocol that achieves this bound, and there is a proof that no algorithm can be better than this bound! - Note that these are worst-case bounds. In practice, clock drift and message delays may not be the worst possible, typically the speed of hardware clocks changes at a comparatively slow pace and the message transmission times follow a benign probability distribution. If we assume this, better protocols do exist. Chapter Notes The idea behind synchronizers is quite intuitive and as such, synchronizers $\alpha$ and $\beta$ were implicitly used in various asynchronous algorithms [Gal76, Cha79, CL85] before being proposed as separate entities. The general idea of applying synchronizers to run synchronous algorithms in asynchronous networks was first introduced by Awerbuch [Awe85a]. His work also formally introduced the synchronizers $\alpha$ and $\beta$. Improved synchronizers that exploit inactive nodes or hypercube networks were presented in [AP90, PU87]. Naturally, as synchronizers are motivated by practical difficulties with local clocks, there are plenty of real life applications. Studies regarding applications can be found in, e.g., [SM86, Awe85b, LTC89, AP90, PU87]. Synchronizers in the presence of network failures have been discussed in [AP88, HS94]. It has been known for a long time that the global clock skew is $\Theta(D)$ [LL84, ST87]. The problem of synchronizing the clocks of nearby nodes was introduced by Fan and Lynch in [LF04]; they proved a surprising lower bound of $\Omega(\log D/\log \log D)$ for the local skew. The first algorithm providing a non-trivial local skew of $O(\sqrt{D})$ was given in [LW06]. Later, matching upper and lower bounds of $\Theta(\log D)$ were given in [LLW10]. The problem has also been studied in a dynamic setting [KLO09, KLLO10]. Clock synchronization is a well-studied problem in practice, for instance regarding the global clock skew in sensor networks, e.g. [EGE02, GKS03, MKSL04, PSJ04]. One more recent line of work is focussing on the problem of minimizing the local clock skew [BvRW07, SW09, LSW09, FW10, FZTS11]. Bibliography
{"Source-Url": "http://ac.informatik.uni-freiburg.de/teaching/ss_16/netalg/LectureNotes/chapter8.pdf", "len_cl100k_base": 6494, "olmocr-version": "0.1.53", "pdf-total-pages": 14, "total-fallback-pages": 0, "total-input-tokens": 38982, "total-output-tokens": 8784, "length": "2e12", "weborganizer": {"__label__adult": 0.0004138946533203125, "__label__art_design": 0.0004191398620605469, "__label__crime_law": 0.0004224777221679687, "__label__education_jobs": 0.00079345703125, "__label__entertainment": 0.00015461444854736328, "__label__fashion_beauty": 0.0002162456512451172, "__label__finance_business": 0.0003955364227294922, "__label__food_dining": 0.0004968643188476562, "__label__games": 0.0009613037109375, "__label__hardware": 0.005481719970703125, "__label__health": 0.0011148452758789062, "__label__history": 0.000583648681640625, "__label__home_hobbies": 0.00022840499877929688, "__label__industrial": 0.0010128021240234375, "__label__literature": 0.00034737586975097656, "__label__politics": 0.0003986358642578125, "__label__religion": 0.0007228851318359375, "__label__science_tech": 0.45361328125, "__label__social_life": 0.00011551380157470704, "__label__software": 0.01000213623046875, "__label__software_dev": 0.52001953125, "__label__sports_fitness": 0.0005202293395996094, "__label__transportation": 0.0012483596801757812, "__label__travel": 0.0003349781036376953}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 30962, 0.03082]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 30962, 0.57816]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 30962, 0.87245]], "google_gemma-3-12b-it_contains_pii": [[0, 2184, false], [2184, 4712, null], [4712, 6890, null], [6890, 8745, null], [8745, 11412, null], [11412, 14119, null], [14119, 16875, null], [16875, 20312, null], [20312, 23202, null], [23202, 26020, null], [26020, 28408, null], [28408, 30731, null], [30731, 30962, null], [30962, 30962, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2184, true], [2184, 4712, null], [4712, 6890, null], [6890, 8745, null], [8745, 11412, null], [11412, 14119, null], [14119, 16875, null], [16875, 20312, null], [20312, 23202, null], [23202, 26020, null], [26020, 28408, null], [28408, 30731, null], [30731, 30962, null], [30962, 30962, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 30962, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 30962, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 30962, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 30962, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 30962, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 30962, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 30962, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 30962, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 30962, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 30962, null]], "pdf_page_numbers": [[0, 2184, 1], [2184, 4712, 2], [4712, 6890, 3], [6890, 8745, 4], [8745, 11412, 5], [11412, 14119, 6], [14119, 16875, 7], [16875, 20312, 8], [20312, 23202, 9], [23202, 26020, 10], [26020, 28408, 11], [28408, 30731, 12], [30731, 30962, 13], [30962, 30962, 14]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 30962, 0.0]]}
olmocr_science_pdfs
2024-12-07
2024-12-07
1cfb1b5e0b937a55ff3361d999a01c828adb7835
TABLE OF CONTENTS Chapter 1. NVIDIA Software License Agreement.......................................................... 1 Chapter 2. Third Party Licenses............................................................................. 11 2.1. Microsoft Detours........................................................................................11 2.2. Protobuf...................................................................................................11 2.3. libbacktrace.............................................................................................. 12 Chapter 1. NVIDIA SOFTWARE LICENSE AGREEMENT NVIDIA CORPORATION NVIDIA SOFTWARE LICENSE AGREEMENT IMPORTANT — READ BEFORE DOWNLOADING, INSTALLING, COPYING OR USING THE LICENSED SOFTWARE This Software License Agreement ("SLA"), made and entered into as of the time and date of click through action ("Effective Date"), is a legal agreement between you and NVIDIA Corporation ("NVIDIA") and governs the use of the NVIDIA computer software and the documentation made available for use with such NVIDIA software. By downloading, installing, copying, or otherwise using the NVIDIA software and/or documentation, you agree to be bound by the terms of this SLA. If you do not agree to the terms of this SLA, do not download, install, copy or use the NVIDIA software or documentation. IF YOU ARE ENTERING INTO THIS SLA ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE ENTITY TO THIS SLA, IN WHICH CASE "YOU" WILL MEAN THE ENTITY YOU REPRESENT. IF YOU DON'T HAVE SUCH AUTHORITY, OR IF YOU DON'T ACCEPT ALL THE TERMS AND CONDITIONS OF THIS SLA, THEN NVIDIA DOES NOT AGREE TO LICENSE THE LICENSED SOFTWARE TO YOU, AND YOU MAY NOT DOWNLOAD, INSTALL, COPY OR USE IT. 1. LICENSE. 1.1 License Grant. Subject to the terms of the AGREEMENT, NVIDIA hereby grants you a non-exclusive, non-transferable license, without the right to sublicense (except as expressly set forth in a Supplement), during the applicable license term unless earlier terminated as provided below, to have Authorized Users install and use the Software, including modifications (if expressly permitted in a Supplement), in accordance with the Documentation. You are only licensed to activate and use Licensed Software for which you have a valid license, even if during the download or installation you are presented with other product options. No Orders are binding on NVIDIA until accepted by NVIDIA. Your Orders are subject to the AGREEMENT. SLA Supplements: Certain Licensed Software licensed under this SLA may be subject to additional terms and conditions that will be presented to you in a Supplement for acceptance prior to the delivery of such Licensed Software under this SLA and the applicable Supplement. Licensed Software will only be delivered to you upon your acceptance of all applicable terms. 1.2 Limited Purpose Licenses. If your license is provided for one of the purposes indicated below, then notwithstanding contrary terms in Section 1.1 or in a Supplement, such licenses are for internal use and do not include any right or license to sub-license and distribute the Licensed Software or its output in any way in any public release, however limited, and/or in any manner that provides third parties with use of or access to the Licensed Software or its functionality or output, including (but not limited to) external alpha or beta testing or development phases. Further: (i) Evaluation License. You may use evaluation licenses solely for your internal evaluation of the Licensed Software for broader adoption within your Enterprise or in connection with a NVIDIA product purchase decision, and such licenses have an expiration date as indicated by NVIDIA in its sole discretion (or ninety days from the date of download if no other duration is indicated). (ii) Educational/Academic License. You may use educational/academic licenses solely for educational purposes and all users must be enrolled or employed by an academic institution. If you do not meet NVIDIA’s academic program requirements for educational institutions, you have no rights under this license. (iii) Test/Development License. You may use test/development licenses solely for your internal development, testing and/or debugging of your software applications or for interoperability testing with the Licensed Software, and such licenses have an expiration date as indicated by NVIDIA in its sole discretion (or one year from the date of download if no other duration is indicated). NVIDIA Confidential Information under the AGREEMENT includes output from Licensed Software developer tools identified as "Pro" versions, where the output reveals functionality or performance data pertinent to NVIDIA hardware or software products. 1.3 Pre-Release Licenses. With respect to alpha, beta, preview, and other pre-release Software and Documentation ("Pre-Release Licensed Software") delivered to you under the AGREEMENT you acknowledge and agree that such Pre-Release Licensed Software (i) may not be fully functional, may contain errors or design flaws, and may have reduced or different security, privacy, accessibility, availability, and reliability standards relative to commercially provided NVIDIA software and documentation, and (ii) use of such Pre-Release Licensed Software may result in unexpected results, loss of data, project delays or other unpredictable damage or loss. THEREFORE, PRE-RELEASE LICENSED SOFTWARE IS NOT INTENDED FOR USE, AND SHOULD NOT BE USED, IN PRODUCTION OR BUSINESS-CRITICAL SYSTEMS. NVIDIA has no obligation to make available a commercial version of any Pre-Release Licensed Software and NVIDIA has the right to abandon development of Pre-Release Licensed Software at any time without liability. 1.4 Enterprise and Contractor Usage. You may allow your Enterprise employees and Contractors to access and use the Licensed Software pursuant to the terms of the AGREEMENT solely to perform work on your behalf, provided further that with respect to Contractors: (i) you obtain a written agreement from each Contractor which contains terms and obligations with respect to access to and use of Licensed Software no less protective of NVIDIA than those set forth in the AGREEMENT, and (ii) such Contractor’s access and use expressly excludes any sublicensing or distribution rights... NVIDIA Software License Agreement for the Licensed Software. You are responsible for the compliance with the terms and conditions of the AGREEMENT by your Enterprise and Contractors. Any act or omission that, if committed by you, would constitute a breach of the AGREEMENT shall be deemed to constitute a breach of the AGREEMENT if committed by your Enterprise or Contractors. 1.5 Services. Except as expressly indicated in an Order, NVIDIA is under no obligation to provide support for the Licensed Software or to provide any patches, maintenance, updates or upgrades under the AGREEMENT. Unless patches, maintenance, updates or upgrades are provided with their separate governing terms and conditions, they constitute Licensed Software licensed to you under the AGREEMENT. 2. LIMITATIONS. 2.1 License Restrictions. Except as expressly authorized in the AGREEMENT, you agree that you will not (nor authorize third parties to): (i) copy and use Software that was licensed to you for use in one or more NVIDIA hardware products in other unlicensed products (provided that copies solely for backup purposes are allowed); (ii) reverse engineer, decompile, disassemble (except to the extent applicable laws specifically require that such activities be permitted) or attempt to derive the source code, underlying ideas, algorithm or structure of Software provided to you in object code form; (iii) sell, transfer, assign, distribute, rent, loan, lease, sublicense or otherwise make available the Licensed Software or its functionality to third parties (a) as an application services provider or service bureau, (b) by operating hosted/virtual system environments, (c) by hosting, time sharing or providing any other type of services, or (d) otherwise by means of the internet; (iv) modify, translate or otherwise create any derivative works of any Licensed Software; (v) remove, alter, cover or obscure any proprietary notice that appears on or with the Licensed Software or any copies thereof; (vi) use the Licensed Software, or allow its use, transfer, transmission or export in violation of any applicable export control laws, rules or regulations; (vii) distribute, permit access to, or sublicense the Licensed Software as a stand-alone product; (viii) bypass, disable, circumvent or remove any form of copy protection, encryption, security or digital rights management or authentication mechanism used by NVIDIA in connection with the Licensed Software, or use the Licensed Software together with any authorization code, serial number, or other copy protection device not supplied by NVIDIA directly or through an authorized reseller; (ix) use the Licensed Software for the purpose of developing competing products or technologies or assisting a third party in such activities; (x) use the Licensed Software with any system or application where the use or failure of such system or application can reasonably be expected to threaten or result in personal injury, death, or catastrophic loss including, without limitation, use in connection with any nuclear, avionics, navigation, military, medical, life support or other life critical application ("Critical Applications"), unless the parties have entered into a Critical Applications agreement; (xi) distribute any modification or derivative work you make to the Licensed Software under or by reference to the same name as used by NVIDIA; or (xii) use the Licensed Software in any manner that would cause the Licensed Software to become subject to an Open Source License. Nothing in the AGREEMENT shall be construed to give you a right to use, or otherwise obtain access to, any source code from which the Software or any portion thereof is compiled or interpreted. You acknowledge that NVIDIA does not design, test, manufacture or certify the Licensed Software for use in the context of a Critical Application and NVIDIA shall not be liable to you or any third party, in whole or in part, for any claims or damages arising from such use. You agree to defend, indemnify and hold harmless NVIDIA and its Affiliates, and their respective employees, contractors, agents, officers and directors, from and against any and all claims, damages, obligations, losses, liabilities, costs or debt, fines, restitutions and expenses (including but not limited to attorney’s fees and costs incident to establishing the right of indemnification) arising out of or related to you and your Enterprise, and their respective employees, contractors, agents, distributors, resellers, end users, officers and directors use of Licensed Software outside of the scope of the AGREEMENT or any other breach of the terms of the AGREEMENT. 2.2 Third Party License Obligations. You acknowledge and agree that the Licensed Software may include or incorporate third party technology (collectively “Third Party Components”), which is provided for use in or with the Software and not otherwise used separately. If the Licensed Software includes or incorporates Third Party Components, then the third-party pass-through terms and conditions (“Third Party Terms”) for the particular Third Party Component will be bundled with the Software or otherwise made available online as indicated by NVIDIA and will be incorporated by reference into the AGREEMENT. In the event of any conflict between the terms in the AGREEMENT and the Third Party Terms, the Third Party Terms shall govern. Copyright to Third Party Components are held by the copyright holders indicated in the copyright notices indicated in the Third Party Terms. Audio/Video Encoders and Decoders. You acknowledge and agree that it is your sole responsibility to obtain any additional third party licenses required to make, have made, use, have used, sell, import, and offer for sale your products or services that include or incorporate any Third Party Components and content relating to audio and/or video encoders and decoders from, including but not limited to, Microsoft, Thomson, Fraunhofer IIS, Sisvel S.p.A., MPEG-LA, and Coding Technologies as NVIDIA does not grant to you under the AGREEMENT any necessary patent or other rights with respect to audio and/or video encoders and decoders. 2.3 Limited Rights. Your rights in the Licensed Software are limited to those expressly granted under the AGREEMENT and no other licenses are granted whether by implication, estoppel or otherwise. NVIDIA reserves all rights, title and interest in and to the Licensed Software not expressly granted under the AGREEMENT. 3. CONFIDENTIALITY. Neither party will use the other party’s Confidential Information, except as necessary for the performance of the AGREEMENT, nor will either party disclose such Confidential Information to any third party, except to personnel of NVIDIA and its Affiliates, you, your Enterprise, your Enterprise Contractors, and each party’s legal and financial advisors that have a need to know such Confidential Information for the performance of the AGREEMENT, provided that each such personnel, employee and Contractor is subject to a written agreement that includes confidentiality obligations consistent with those set forth herein. Each party will use all reasonable efforts to maintain the confidentiality of all of the other party’s Confidential Information in its possession or control, but in no event less than the efforts that it ordinarily uses with respect to its own Confidential Information of similar nature and importance. The foregoing obligations will not restrict either party from disclosing the other party’s Confidential Information or the terms and conditions of the AGREEMENT as required under applicable securities regulations or pursuant to the order or requirement of a court, administrative agency, or other governmental body, provided that the party required to make such disclosure (i) gives reasonable notice to the other party to enable it to contest such order or requirement prior to its disclosure (whether through protective orders or otherwise), (ii) uses reasonable effort to obtain confidential treatment or similar protection to the fullest extent possible to avoid such public disclosure, and (iii) discloses only the minimum amount of information necessary to comply with such requirements. 4. OWNERSHIP. You are not obligated to disclose to NVIDIA any modifications that you, your Enterprise or your Contractors make to the Licensed Software as permitted under the AGREEMENT. As between the parties, all modifications are owned by NVIDIA and licensed to you under the AGREEMENT unless otherwise expressly provided in a Supplement. The Licensed Software and all modifications owned by NVIDIA, and the respective Intellectual Property Rights therein, are and will remain the sole and exclusive property of NVIDIA or its licensors, whether the Licensed Software is separate from or combined with any other products or materials. You shall not engage in any act or omission that would impair NVIDIA’s and/or its licensors’ Intellectual Property Rights in the Licensed Software or any other materials, information, processes or subject matter proprietary to NVIDIA. NVIDIA’s licensors are intended third party beneficiaries with the right to enforce provisions of the AGREEMENT with respect to their Confidential Information and/or Intellectual Property Rights. 5. FEEDBACK. You have no obligation to provide Feedback to NVIDIA. However, NVIDIA and/or its Affiliates may use and include any Feedback that you provide to improve the Licensed Software or other NVIDIA products, technologies or materials. Accordingly, if you provide Feedback, you agree that NVIDIA and/or its Affiliates, at their option, may, and may permit their licensees, to make, have made, use, have used, reproduce, license, distribute and otherwise commercialize the Feedback in the Licensed Software or in other NVIDIA products, technologies or materials without the payment of any royalties or fees to you. All Feedback becomes the sole property of NVIDIA and may be used in any manner NVIDIA sees fit, and you hereby assign to NVIDIA all of your right, title and interest in and to any Feedback. NVIDIA has no obligation to respond to Feedback or to incorporate Feedback into the Licensed Software. 6. NO WARRANTIES. THE LICENSED SOFTWARE AND ANY OTHER CONFIDENTIAL INFORMATION AND/OR SERVICES ARE PROVIDED BY NVIDIA "AS IS" AND "WITH ALL FAULTS," AND NVIDIA EXPRESSLY DISCLAIMS ALL OTHER WARRANTIES OF ANY KIND OR NATURE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTIES OF OPERABILITY, CONDITION, VALUE, ACCURACY OF DATA, OR QUALITY, AS WELL AS ANY WARRANTIES OF MERCHANTABILITY, SYSTEM INTEGRATION, WORKMANSHIP, SUITABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR THE ABSENCE OF ANY DEFECTS THEREIN, WHETHER LATENT OR PATENT. NO WARRANTY IS MADE BY NVIDIA ON THE BASIS OF TRADE USAGE, COURSE OF DEALING OR COURSE OF TRADE. NVIDIA DOES NOT WARRANT THAT THE LICENSED SOFTWARE OR ANY OTHER CONFIDENTIAL INFORMATION AND/OR SERVICES PROVIDED BY NVIDIA UNDER THE AGREEMENT WILL MEET YOUR REQUIREMENTS OR THAT THE OPERATION THEREOF WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ALL ERRORS WILL BE CORRECTED. YOU ACKNOWLEDGE THAT NVIDIA’S OBLIGATIONS UNDER THE AGREEMENT ARE FOR THE BENEFIT OF YOU ONLY. Nothing in this warranty section affects any statutory rights of consumers or other recipients to the extent that they cannot be waived or limited by contract under applicable law. 7. LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY LAW, NVIDIA OR ITS LICENSORS SHALL NOT BE LIABLE FOR ANY SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL DAMAGES, OR ANY LOST PROFITS, LOSS OF USE, LOSS OF DATA OR LOSS OF GOODWILL, OR THE COSTS OF PROCURING SUBSTITUTE PRODUCTS, ARISING OUT OF OR IN CONNECTION WITH THE AGREEMENT OR THE USE OR PERFORMANCE OF THE LICENSED SOFTWARE AND ANY OTHER CONFIDENTIAL INFORMATION AND/OR SERVICES PROVIDED BY NVIDIA UNDER THE AGREEMENT, WHETHER SUCH LIABILITY ARISES FROM ANY CLAIM BASED UPON BREACH OF CONTRACT, BREACH OF WARRANTY, TORT (INCLUDING NEGLIGENCE), PRODUCT LIABILITY OR ANY OTHER CAUSE OF ACTION OR THEORY OF LIABILITY. IN NO EVENT WILL NVIDIA’S TOTAL CUMULATIVE LIABILITY UNDER OR ARISING OUT OF THE AGREEMENT EXCEED THE NET AMOUNTS RECEIVED BY NVIDIA FOR YOUR USE OF THE PARTICULAR LICENSED SOFTWARE DURING THE TWELVE (12) MONTHS BEFORE THE LIABILITY AROSE (or up to US$10.00 if you acquired the Licensed Software for no charge). THE NATURE OF THE LIABILITY, THE NUMBER OF CLAIMS OR SUITS OR THE NUMBER OF PARTIES WITHIN YOUR ENTERPRISE THAT ACCEPTED THE TERMS OF THE AGREEMENT SHALL NOT ENLARGE OR EXTEND THIS LIMIT. THE FOREGOING LIMITATIONS SHALL APPLY REGARDLESS OF WHETHER NVIDIA OR ITS LICENSORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND REGARDLESS OF WHETHER ANY REMEDY FAILS ITS ESSENTIAL PURPOSE. The disclaimers, exclusions and limitations of liability set forth in the AGREEMENT form an essential basis of the bargain between the parties, and, absent any such disclaimers, exclusions or limitations of liability, the provisions of the AGREEMENT, including, without limitation, the economic terms, would be substantially different. 8. TERM AND TERMINATION. 8.1 AGREEMENT, Licenses and Services. This SLA shall become effective upon the Effective Date, each Supplement upon their acceptance, and both this SLA and Supplements shall continue in effect until your last access or use of the Licensed Software and/or services hereunder, unless earlier terminated as provided in this “Term and Termination” section. Each Licensed Software license ends at the earlier of (a) the expiration of the applicable license term, or (b) termination of such license or the AGREEMENT. Each service ends at the earlier of (x) the expiration of the applicable service term, (y) termination of such service or the AGREEMENT, or (z) expiration or termination of the associated license and no credit or refund will be provided upon the expiration or termination of the associated license for any service fees paid. 8.2 Termination and Effect of Expiration or Termination. NVIDIA may terminate the AGREEMENT in whole or in part: (i) if you breach any term of the AGREEMENT and fail to cure such breach within thirty (30) days following notice thereof from NVIDIA (or immediately if you violate NVIDIA’s Intellectual Property Rights); (ii) if you become the subject of a voluntary or involuntary petition in bankruptcy or any proceeding relating to insolvency, receivership, liquidation or composition for the benefit of creditors, if that petition or proceeding is not dismissed with prejudice within sixty (60) days after filing, or if you cease to do business; or (iii) if you commence or participate in any legal proceeding against NVIDIA, with respect to the Licensed Software that is the subject of the proceeding during the pendency of such legal proceeding. If you or your authorized NVIDIA reseller fail to pay license fees or service fees when due then NVIDIA may, in its sole discretion, suspend or terminate your license grants, services and any other rights provided under the AGREEMENT for the affected Licensed Software, in addition to any other remedies NVIDIA may have at law or equity. Upon any expiration or termination of the AGREEMENT, a license or a service provided hereunder, (a) any amounts owed to NVIDIA become immediately due and payable, (b) you must promptly discontinue use of the affected Licensed Software and/or service, and (c) you must promptly destroy or return to NVIDIA all copies of the affected Licensed Software and all portions thereof in your possession or control, and each party will promptly destroy or return to the other all of the other party's Confidential Information within its possession or control. Upon written request, you will certify in writing that you have complied with your obligations under this section. Upon expiration or termination of the AGREEMENT all provisions survive except for the license grant provisions. 9. CONSENT TO COLLECTION AND USE OF INFORMATION. You hereby agree and acknowledge that the Software may access, collect non-personally identifiable information about your Enterprise computer systems in order to properly optimize such systems for use with the Software. To the extent that you use the Software, you hereby consent to all of the foregoing, and represent and warrant that you have the right to grant such consent. In addition, you agree that you are solely responsible for maintaining appropriate data backups and system restore points for your Enterprise systems, and that NVIDIA will have no responsibility for any damage or loss to such systems (including loss of data or access) arising from or relating to (a) any changes to the configuration, application settings, environment variables, registry, drivers, BIOS, or other attributes of the systems (or any part of such systems) initiated through the Software; or (b) installation of any Software or third party software patches initiated through the Software. In certain systems you may change your system update preferences by unchecking "Automatically check for updates" in the "Preferences" tab of the control panel for the Software. In connection with the receipt of the Licensed Software or services you may receive access to links to third party websites and services and the availability of those links does not imply any endorsement by NVIDIA. NVIDIA encourages you to review the privacy statements on those sites and services that you choose to visit so that you can understand how they may collect, use and share personal information of individuals. NVIDIA is not responsible or liable for: (i) the availability or accuracy of such links; or (ii) the products, services or information available on or through such links; or (iii) the privacy statements or practices of sites and services controlled by other companies or organizations. To the extent that you or members of your Enterprise provide to NVIDIA during registration or otherwise personal information, you acknowledge that such information will be collected, used and disclosed by NVIDIA in accordance with NVIDIA's privacy 10. GENERAL. This SLA, any Supplements incorporated hereto, and Orders constitute the entire agreement of the parties with respect to the subject matter hereto and supersede all prior negotiations, conversations, or discussions between the parties relating to the subject matter hereto, oral or written, and all past dealings or industry custom. Any additional and/or conflicting terms and conditions on purchase order(s) or any other documents issued by you are null, void, and invalid. Any amendment or waiver under the AGREEMENT must be in writing and signed by representatives of both parties. The AGREEMENT and the rights and obligations thereunder may not be assigned by you, in whole or in part, including by merger, consolidation, dissolution, operation of law, or any other manner, without written consent of NVIDIA, and any purported assignment in violation of this provision shall be void and of no effect. NVIDIA may assign, delegate or transfer the AGREEMENT and its rights and obligations hereunder, and if to a non-Affiliate you will be notified. Each party acknowledges and agrees that the other is an independent contractor in the performance of the AGREEMENT, and each party is solely responsible for all of its employees, agents, contractors, and labor costs and expenses arising in connection therewith. The parties are not partners, joint ventures or otherwise affiliated, and neither has any authority to make any statements, representations or commitments of any kind to bind the other party without prior written consent. Neither party will be responsible for any failure or delay in its performance under the AGREEMENT (except for any payment obligations) to the extent due to causes beyond its reasonable control for so long as such force majeure event continues in effect. The AGREEMENT will be governed by and construed under the laws of the State of Delaware and the United States without regard to the conflicts of law provisions thereof and without regard to the United Nations Convention on Contracts for the International Sale of Goods. The parties consent to the personal jurisdiction of the federal and state courts located in Santa Clara County, California. You acknowledge and agree that a breach of any of your promises or agreements contained in the AGREEMENT may result in irreparable and continuing injury to NVIDIA for which monetary damages may not be an adequate remedy and therefore NVIDIA is entitled to seek injunctive relief as well as such other and further relief as may be appropriate. If any court of competent jurisdiction determines that any provision of the AGREEMENT is illegal, invalid or unenforceable, the remaining provisions will remain in full force and effect. Unless otherwise specified, remedies are cumulative. The Licensed Software has been developed entirely at private expense and is "commercial items" consisting of "commercial computer software" and "commercial computer software documentation" provided with RESTRICTED RIGHTS. Use, duplication or disclosure by the U.S. Government or a U.S. Government subcontractor is subject to the restrictions set forth in the AGREEMENT pursuant to DFARS 227.7202-3(a) or as set forth in subparagraphs (c)(1) and (2) of the Commercial Computer Software - Restricted Rights clause at FAR 52.227-19, as applicable. Contractor/manufacturer is NVIDIA, 2701 San Tomas Expressway, Santa Clara, CA 95050. You acknowledge that the Licensed Software described under the AGREEMENT is subject to export control under the U.S. Export Administration Regulations (EAR) and economic sanctions regulations administered by the U.S. Department of Treasury’s Office of Foreign Assets Control (OFAC). Therefore, you may not export, reexport or transfer in-country the Licensed Software without first obtaining any license or other approval that may be required by BIS and/or OFAC. You are responsible for any violation of the U.S. or other applicable export control or economic sanctions laws, regulations and requirements related to the Licensed Software. By accepting this SLA, you confirm that you are not a resident or citizen of any country currently embargoed by the U.S. and that you are not otherwise prohibited from receiving the Licensed Software. Any notice delivered by NVIDIA to you under the AGREEMENT will be delivered via mail, email or fax. Please direct your legal notices or other correspondence to NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, California 95050, United States of America, Attention: Legal Department. GLOSSARY OF TERMS Certain capitalized terms, if not otherwise defined elsewhere in this SLA, shall have the meanings set forth below: a. "Affiliate" means any legal entity that Owns, is Owned by, or is commonly Owned with a party. "Own" means having more than 50% ownership or the right to direct the management of the entity. b. "AGREEMENT" means this SLA and all associated Supplements entered by the parties referencing this SLA. c. "Authorized Users" means your Enterprise individual employees and any of your Enterprise’s Contractors, subject to the terms of the “Enterprise and Contractors Usage” section. d. "Confidential Information" means the Licensed Software (unless made publicly available by NVIDIA without confidentiality obligations), and any NVIDIA business, marketing, pricing, research and development, know-how, technical, scientific, financial status, proposed new products or other information disclosed by NVIDIA to you which, at the time of disclosure, is designated in writing as confidential or proprietary (or like written designation), or orally identified as confidential or proprietary or is otherwise reasonably identifiable by parties exercising reasonable business judgment, as confidential. Confidential Information does not and will not include information that: (i) is or becomes generally known to the public through no fault of or breach of the AGREEMENT by the receiving party; (ii) is rightfully known by the receiving party at the time of disclosure without an obligation of confidentiality; (iii) is independently developed by the receiving party without use of the disclosing party’s Confidential Information; or (iv) is rightfully obtained by the receiving party from a third party without restriction on use or disclosure. e. "Contractor" means an individual who works primarily for your Enterprise on a contractor basis from your secure network. f. "Documentation" means the NVIDIA documentation made available for use with the Software, including (without limitation) user manuals, datasheets, operations instructions, installation guides, release notes and other materials provided to you under the AGREEMENT. g. "Enterprise" means you or any company or legal entity for which you accepted the terms of this SLA, and their subsidiaries of which your company or legal entity owns more than fifty percent (50%) of the issued and outstanding equity. h. "Feedback" means any and all suggestions, feature requests, comments or other feedback regarding the Licensed Software, including possible enhancements or modifications thereto. i. "Intellectual Property Rights" means all patent, copyright, trademark, trade secret, trade dress, trade names, utility models, mask work, moral rights, rights of attribution or integrity service marks, master recording and music publishing rights, performance rights, author's rights, database rights, registered design rights and any applications for the protection or registration of these rights, or other intellectual or industrial property rights or proprietary rights, howsoever arising and in whatever media, whether now known or hereafter devised, whether or not registered, (including all claims and causes of action for infringement, misappropriation or violation and all rights in any registrations and renewals), worldwide and whether existing now or in the future. j. "Licensed Software" means Software, Documentation and all modifications owned by NVIDIA. k. "Open Source License" includes, without limitation, a software license that requires as a condition of use, modification, and/or distribution of such software that the Software be (i) disclosed or distributed in source code form; (ii) be licensed for the purpose of making derivative works; or (iii) be redistributable at no charge. l. "Order" means a purchase order issued by you, a signed purchase agreement with you, or other ordering document issued by you to NVIDIA or a NVIDIA authorized reseller (including any on-line acceptance process) that references and incorporates the AGREEMENT and is accepted by NVIDIA. m. "Software" means the NVIDIA software programs licensed to you under the AGREEMENT including, without limitation, libraries, sample code, utility programs and programming code. n. "Supplement" means the additional terms and conditions beyond those stated in this SLA that apply to certain Licensed Software licensed hereunder. Chapter 2. THIRD PARTY LICENSES 2.1. Microsoft Detours Microsoft Detours is used under the Professional license (http://research.microsoft.com/en-us/projects/detours/). NVIDIA agrees to include in all copies of the NVIDIA Applications a proprietary rights notice that includes a reference to Microsoft software being included in such applications. NVIDIA shall not remove or obscure, but shall retain in the Software, any copyright, trademark, or patent notices that appear in the Software. 2.2. Protobuf Copyright © 2014, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Code generated by the Protocol Buffer compiler is owned by the owner of the input file used when generating it. This code is not standalone and requires a support library to be linked with it. This support library is itself covered by the above license. 2.3. libbacktrace Copyright (C) 2012-2016 Free Software Foundation, Inc. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. (3) The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Notice ALL NVIDIA DESIGN SPECIFICATIONS, REFERENCE BOARDS, FILES, DRAWINGS, DIAGNOSTICS, LISTS, AND OTHER DOCUMENTS (TOGETHER AND SEPARATELY, "MATERIALS") ARE BEING PROVIDED "AS IS." NVIDIA MAKES NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. Information furnished is believed to be accurate and reliable. However, NVIDIA Corporation assumes no responsibility for the consequences of use of such information or for any infringement of patents or other rights of third parties that may result from its use. No license is granted by implication of otherwise under any patent rights of NVIDIA Corporation. Specifications mentioned in this publication are subject to change without notice. This publication supersedes and replaces all other information previously supplied. NVIDIA Corporation products are not authorized as critical components in life support devices or systems without express written approval of NVIDIA Corporation. Trademarks NVIDIA and the NVIDIA logo are trademarks or registered trademarks of NVIDIA Corporation in the U.S. and other countries. Other company and product names may be trademarks of the respective companies with which they are associated. Copyright © 2019-2021 NVIDIA Corporation and affiliates. All rights reserved. This product includes software developed by the Syncro Soft SRL (http://www.sync.ro/).
{"Source-Url": "https://docs.nvidia.com/compute-sanitizer/pdf/CopyrightAndLicenses.pdf", "len_cl100k_base": 7476, "olmocr-version": "0.1.53", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 30708, "total-output-tokens": 8123, "length": "2e12", "weborganizer": {"__label__adult": 0.0017604827880859375, "__label__art_design": 0.0015954971313476562, "__label__crime_law": 0.0243072509765625, "__label__education_jobs": 0.0018596649169921875, "__label__entertainment": 0.0011653900146484375, "__label__fashion_beauty": 0.0006699562072753906, "__label__finance_business": 0.10015869140625, "__label__food_dining": 0.0008974075317382812, "__label__games": 0.014007568359375, "__label__hardware": 0.0087738037109375, "__label__health": 0.0007786750793457031, "__label__history": 0.0002818107604980469, "__label__home_hobbies": 0.0003635883331298828, "__label__industrial": 0.0010318756103515625, "__label__literature": 0.0012149810791015625, "__label__politics": 0.0009131431579589844, "__label__religion": 0.0009484291076660156, "__label__science_tech": 0.00417327880859375, "__label__social_life": 0.00016188621520996094, "__label__software": 0.38525390625, "__label__software_dev": 0.447021484375, "__label__sports_fitness": 0.0006990432739257812, "__label__transportation": 0.0012521743774414062, "__label__travel": 0.0006017684936523438}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 38762, 0.01138]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 38762, 0.01979]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 38762, 0.92055]], "google_gemma-3-12b-it_contains_pii": [[0, 0, null], [0, 588, false], [588, 2798, null], [2798, 6408, null], [6408, 10305, null], [10305, 14167, null], [14167, 17694, null], [17694, 21147, null], [21147, 24831, null], [24831, 28557, null], [28557, 31603, null], [31603, 33615, null], [33615, 35251, null], [35251, 37252, null], [37252, 38762, null]], "google_gemma-3-12b-it_is_public_document": [[0, 0, null], [0, 588, true], [588, 2798, null], [2798, 6408, null], [6408, 10305, null], [10305, 14167, null], [14167, 17694, null], [17694, 21147, null], [21147, 24831, null], [24831, 28557, null], [28557, 31603, null], [31603, 33615, null], [33615, 35251, null], [35251, 37252, null], [37252, 38762, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 38762, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 38762, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 38762, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 38762, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 38762, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 38762, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 38762, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 38762, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 38762, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 38762, null]], "pdf_page_numbers": [[0, 0, 1], [0, 588, 2], [588, 2798, 3], [2798, 6408, 4], [6408, 10305, 5], [10305, 14167, 6], [14167, 17694, 7], [17694, 21147, 8], [21147, 24831, 9], [24831, 28557, 10], [28557, 31603, 11], [31603, 33615, 12], [33615, 35251, 13], [35251, 37252, 14], [37252, 38762, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 38762, 0.0]]}
olmocr_science_pdfs
2024-12-06
2024-12-06
98ee1915e7adc0b52957032a37a3604a437316cf
We will be programming in C in lab and in class. C is different from most programming languages in that it is useful for writing very complex software, but it can also be used to control minute hardware details of a processor, and thus interact with the real world efficiently. In lab we will use it to control hardware. In class you will learn higher-level capabilities. In lab, I will only discuss a very small subset of the language. If you know C, feel free to use more than is described here. You will also, eventually, learn more C in class. A simple C program ```c void main(void) { int i, j, k; i=3; //Set i=3 j=4; //Set j=4 k = i * j / 2; //Calculate k } ``` Every program needs a "main" routine (between braces) Declare i, j and k to be integer variables. All variable must be declared. (In this lab we will use only integers) Give the value 3 to the variable "i" Give the value 4 to the variable "j" Calculate k = 3 * 4 / 2 = 6 Anything after "//" is a comment. It is ignored by the computer, but describes what the code is doing. Individual lines end with ";" Note: • "int" variables have a range of -32768→32767 (16 bit, -(2\(^{15}\)) →2\(^{15}-1\)) • "unsigned int" variables have a range of 0→65535 (0→ 2\(^{16}-1\)) # C Operators ## (Arithmetic) <table> <thead> <tr> <th>Arithmetic Operator</th> <th>Syntax</th> </tr> </thead> <tbody> <tr> <td>Basic assignment</td> <td>a = b</td> </tr> <tr> <td>Addition</td> <td>a + b</td> </tr> <tr> <td>Subtraction</td> <td>a - b</td> </tr> <tr> <td>Unary minus</td> <td>-a</td> </tr> <tr> <td>Multiplication</td> <td>a * b</td> </tr> <tr> <td>Division</td> <td>a / b</td> </tr> <tr> <td>Bitwise NOT</td> <td>~a</td> </tr> <tr> <td>Bitwise AND</td> <td>a &amp; b</td> </tr> <tr> <td>Bitwise OR</td> <td>a</td> </tr> <tr> <td>Bitwise XOR</td> <td>a ^ b</td> </tr> </tbody> </table> *Use with great caution!* ## C Comparisons ### (Result is logical - True or False) <table> <thead> <tr> <th>Relational Operator</th> <th>Syntax</th> </tr> </thead> <tbody> <tr> <td>Equal to</td> <td>a == b</td> </tr> <tr> <td>Not equal to</td> <td>a != b</td> </tr> <tr> <td>Greater than</td> <td>a &gt; b</td> </tr> <tr> <td>Less than</td> <td>a &lt; b</td> </tr> <tr> <td>Greater than or equal to</td> <td>a &gt;= b</td> </tr> <tr> <td>Less than or equal to</td> <td>a &lt;= b</td> </tr> </tbody> </table> This is just a subset. If you know “C” feel free to use others, but they won’t be necessary. ## C Operators ### (logical – True or False) <table> <thead> <tr> <th>Logical Operator</th> <th>Syntax</th> </tr> </thead> <tbody> <tr> <td>Logical negation (NOT)</td> <td>!a</td> </tr> <tr> <td>Logical AND</td> <td>a &amp;&amp; b</td> </tr> <tr> <td>Logical OR</td> <td>a</td> </tr> </tbody> </table> Making Simple Decisions in C if...then...else if (condition) statement; else statement; Find absolute value of difference between i and j. if (i>j) k = i - j; else k = j - i; The “else” clause is optional. An equivalent code segment. k = j - i; if (i>j) k = i - j; Statements in C Statements • a simple statement is a single statement that ends in a ";" • a compound statement is several statements inside braces: ```c { statement; ... statement; } ``` Find absolute value of difference between i and j, and set lower one to zero (both if equal). ```c if (i>j) { k = i - j; j = 0; } else { k = j - i; if (j>i) i=0; else { i=0; j=0; } } ``` Iteration in C **While loop** ``` while (condition) { statement; } ``` // calculate k = j * i by repetitive addition k = 0; while (j != 0) { k = k + i; j = j - 1; } **for loop** ``` for (statement 1; condition; statement 2) { statements...; } ``` **for loop is equivalent to:** ``` statement 1; while (condition) { statements...; statement 2; } ``` Common use of “for loop” is to count through values: ``` for (i = 0; i < 10; i = i + 1) { statements...; } Making Complicated Decisions in C **switch (one choice of many)** ``` switch (<expression>) { case <label1> : statements 1; break; case <label2> : statements 2; break; case <label3> : case <label4> : statements 3; break; default : statements 4> } ``` - `<expression>` is compared against each label, and appropriate statements are executed, until a “break” statement is encountered. - All labels must be unique. - If expression matches no label, the “default” statements are executed. - Don’t forget “break” statements, otherwise execution continues from one label to the next. Indenting in C Indenting There are no rules about indenting code, but if you don’t adopt a standard style, your code becomes unreadable. Choose a style and stick to it. Your code will be graded partly on readability. Three possibilities ```c while (x == y) { something(); somethingelse(); if (some_error) do_correct(); else continue_as_usual(); } ``` ```c while (x == y) { something(); somethingelse(); } finalthing(); ``` ```c if (x < 0) { printf("Negative"); negative(x); } else { printf("Positive"); positive(x); } ``` Manipulating Bits in C <table> <thead> <tr> <th>Hex</th> <th>Bit 7</th> <th>6</th> <th>5</th> <th>4</th> <th>3</th> <th>2</th> <th>1</th> <th>Bit 0</th> </tr> </thead> <tbody> <tr> <td>BIT0 = 0x01</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>1</td> <td></td> </tr> <tr> <td>BIT1 = 0x02</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>1</td> <td>0</td> <td></td> </tr> <tr> <td>BIT2 = 0x04</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>1</td> <td>0</td> <td>0</td> </tr> <tr> <td>BIT3 = 0x08</td> <td>0</td> <td>0</td> <td>0</td> <td>1</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> </tr> <tr> <td>BIT4 = 0x10</td> <td>0</td> <td>0</td> <td>0</td> <td>1</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> </tr> <tr> <td>BIT5 = 0x20</td> <td>0</td> <td>1</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> </tr> <tr> <td>BIT6 = 0x40</td> <td>0</td> <td>1</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> </tr> <tr> <td>BIT7 = 0x80</td> <td>1</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> </tr> </tbody> </table> Setting bits \[ x = \text{BIT0} \mid \text{BIT3} \mid \text{BIT6} = 0100\ 1001_{\text{binary}} = 49_{\text{hex}} = 0x49 \ (C \ syntax) \] \[ x = \text{BIT0} + \text{BIT3} + \text{BIT6} = 0100\ 1001_{\text{binary}} = 49_{\text{hex}} \] \[ x = x \mid \text{BIT4} = 0101\ 1001_{\text{binary}} = 59_{\text{hex}} \] Clearing bits (assume \( x = 0101\ 1001_{\text{binary}} = 59_{\text{hex}} \) to start = 0x59 (C syntax)) \[ y = x \& \sim\text{BIT3} = 0101\ 0001_{\text{binary}} = 51_{\text{hex}} \quad \sim\text{BIT3} = 1111\ 0111_{\text{binary}} = F7_{\text{hex}} \] \[ y = x \& \sim(\text{BIT3} \mid \text{BIT4}) = 0100\ 0001_{\text{binary}} = 41_{\text{hex}} \] Programming a microcontroller Potential uses: smoke detector, touch screen interface, scale, glass breakage sensor, thermostat, ... Notes: - Pins have multiple functions. - In this lab we only do digital I/O (the P1.0-P1.7 and P2.6 and P2.7 functions). - We control the pins through registers. # Simple Program to Blink an LED P1.0 is attached to LED (BIT0 = 0x01) ```c #include <msp430x20x2.h> void main(void) { int i; WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P1SEL = 0; P2SEL = 0; P1DIR = P1DIR | 0x01; // Set P1.0 to output while (1) { //Do this forever P1OUT = P1OUT ^ 0x01; // Toggle P1.0 using exclusive-OR for (i=1; i<30000; i=i+1) {} //Delay } } ``` - XOR with 1 inverts bit: - `1 ^ 1 = 0` - `0 ^ 1 = 1` ## Bit Table <table> <thead> <tr> <th>Bit#</th> <th>P1.7</th> <th>P1.6</th> <th>P1.5</th> <th>P1.4</th> <th>P1.3</th> <th>P1.2</th> <th>P1.1</th> <th>P1.0</th> </tr> </thead> <tbody> <tr> <td>P1SEL</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> </tr> <tr> <td>P1DIR</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>1</td> </tr> <tr> <td>P1OUT</td> <td>x</td> <td>x</td> <td>x</td> <td>x</td> <td>x</td> <td>x</td> <td>x</td> <td>0/1</td> </tr> <tr> <td>P1IN</td> <td>x</td> <td>x</td> <td>x</td> <td>x</td> <td>x</td> <td>x</td> <td>x</td> <td>x</td> </tr> </tbody> </table> Simple Program to Control LED P1.0 is attached to LED (BIT0 = 0x01), P1.4 is attached to push button (BIT4 = 0x10) while (1) { //Do this forever if (!(P1IN & 0x10)) { // If button pushed (P1.4 is low) P1OUT = P1OUT | 0x01; // ... turn on LED } else { P1OUT = P1OUT & ~0x01; // ... else turn it off. } } When button is pushed: • P1IN bit 4 is 0, • P1IN & 0x10 is 0, • !(P1IN & 0x10) is true. When button is not pushed: • P1IN bit 4 is 1, • P1IN & 0x10 is 0x10, • !(P1IN & 0x10) is false. <table> <thead> <tr> <th>Bit#</th> <th>P1.7</th> <th>P1.6</th> <th>P1.5</th> <th>P1.4</th> <th>P1.3</th> <th>P1.2</th> <th>P1.1</th> <th>P1.0</th> </tr> </thead> <tbody> <tr> <td>P1SEL</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> </tr> <tr> <td>P1DIR</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>1</td> </tr> <tr> <td>P1OUT</td> <td>x</td> <td>x</td> <td>x</td> <td>x</td> <td>x</td> <td>x</td> <td>x</td> <td>0/1</td> </tr> <tr> <td>P1IN</td> <td>x</td> <td>x</td> <td>x</td> <td>0/1</td> <td>x</td> <td>x</td> <td>x</td> <td>x</td> </tr> </tbody> </table> 0 = digital I/O 1 = output 0/1 = Control LED Sense Switch Functions in C (and #define) Functions are a useful way to separate a program into functional units, and to reuse code. ```c #include <msp430x20x2.h> #define LED 0x01 #define PB 0x10 void LED_on(int ledval) { if (ledval) P1OUT = P1OUT | LED; else P1OUT = P1OUT & ~LED; } void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P1SEL = 0; P2SEL = 0; P1DIR = P1DIR | LED; // Set P1.0 to output while (1) { //Do this forever if (!((P1IN & PB))) { // If button is pushed (P1.4 is low) LED_on(1); // ... turn on LED } else { LED_on(0); // ... else turn it off. } } } ``` Define constants to make code easier to read (PB signifies PushButton) Function is defined before “main” routine. All input arguments must be defined. Turn on LED if argument (ledval) is 1. Turn off LED if argument (ledval) is 0. Code is same as before, but function calls are used instead. State Machines A method to define behavior of time dependent systems On to the lab! • To do lab: – Go to my web page (in Firefox, type “Erik Cheever” into address bar). – Go to E15 Labs (http://www.swarthmore.edu/NatSci/echeeve1/Class/e15/e15_labs.html) – Go to lab 2 – Start with tutorial, then do lab • Lab write-up: – Due next time you come to lab.
{"Source-Url": "http://www.swarthmore.edu/NatSci/echeeve1/Class/e15/E15Lab2/E15Lab2Prelab.pdf", "len_cl100k_base": 4103, "olmocr-version": "0.1.53", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 28474, "total-output-tokens": 4248, "length": "2e12", "weborganizer": {"__label__adult": 0.0007624626159667969, "__label__art_design": 0.0008058547973632812, "__label__crime_law": 0.0006060600280761719, "__label__education_jobs": 0.0172119140625, "__label__entertainment": 0.00014352798461914062, "__label__fashion_beauty": 0.00033402442932128906, "__label__finance_business": 0.00025391578674316406, "__label__food_dining": 0.0011844635009765625, "__label__games": 0.0010690689086914062, "__label__hardware": 0.0046539306640625, "__label__health": 0.0008816719055175781, "__label__history": 0.0004322528839111328, "__label__home_hobbies": 0.0004529953002929687, "__label__industrial": 0.0012788772583007812, "__label__literature": 0.0005083084106445312, "__label__politics": 0.00042724609375, "__label__religion": 0.001026153564453125, "__label__science_tech": 0.024383544921875, "__label__social_life": 0.0002472400665283203, "__label__software": 0.003997802734375, "__label__software_dev": 0.9365234375, "__label__sports_fitness": 0.00084686279296875, "__label__transportation": 0.0016546249389648438, "__label__travel": 0.000438690185546875}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 9695, 0.03804]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 9695, 0.273]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 9695, 0.71694]], "google_gemma-3-12b-it_contains_pii": [[0, 552, false], [552, 1273, null], [1273, 2465, null], [2465, 2797, null], [2797, 3230, null], [3230, 3719, null], [3719, 4376, null], [4376, 4961, null], [4961, 6164, null], [6164, 6460, null], [6460, 7389, null], [7389, 8371, null], [8371, 9331, null], [9331, 9401, null], [9401, 9695, null]], "google_gemma-3-12b-it_is_public_document": [[0, 552, true], [552, 1273, null], [1273, 2465, null], [2465, 2797, null], [2797, 3230, null], [3230, 3719, null], [3719, 4376, null], [4376, 4961, null], [4961, 6164, null], [6164, 6460, null], [6460, 7389, null], [7389, 8371, null], [8371, 9331, null], [9331, 9401, null], [9401, 9695, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 9695, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 9695, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 9695, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 9695, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 9695, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 9695, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 9695, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 9695, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, true], [5000, 9695, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 9695, null]], "pdf_page_numbers": [[0, 552, 1], [552, 1273, 2], [1273, 2465, 3], [2465, 2797, 4], [2797, 3230, 5], [3230, 3719, 6], [3719, 4376, 7], [4376, 4961, 8], [4961, 6164, 9], [6164, 6460, 10], [6460, 7389, 11], [7389, 8371, 12], [8371, 9331, 13], [9331, 9401, 14], [9401, 9695, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 9695, 0.1541]]}
olmocr_science_pdfs
2024-12-06
2024-12-06
356ab059dd684332dc24933a48c554ae7a57dece
Handling of Arrays, Strings and Other Data Structures Up to this point, we have studied simple data types and basic arrays built on those simple data types. Some of the simple data types studied include. a) Integers: both halfword and fullword. b) Packed decimal c) Character data. This lecture will cover the following: 1. A generalized “self describing” array that includes limits on the permitted index values. Only 1–D and 2–D arrays will be considered. 2. Options for a string data type and how that differs from a character array. 3. Use of indirect addressing with pointer structures generalized to include descriptions of the data item pointed to. Structures of Arrays We first consider the problem of converting an index in a one–dimensional array into an byte displacement. We then consider two ways of organizing a two–dimensional array, and proceed to convert the index pair into a byte displacement. The simple array type has two variants: 0–based: The first element in the array is either AR[0] for a singly dimensioned array or AR[0][0] for a 2–D array. 1–based: The first element in the array is either AR[1] for a singly dimensioned array or AR[1][1] for a 2–D array. We shall follow the convention of using only 0–based arrays. One reason is that it allows for efficient conversion from a set of indices into a displacement from the base address. By definition, the base address of an array will be the address of its first element: either the address of AR[0] or AR[0][0]. Byte Displacement and Addressing Array Elements The General Case We first consider addressing issues for an array that contains either character halfword, or fullword data. It will be constrained to one of these types. The addressing issue is well illustrated for a singly dimensioned array. <table> <thead> <tr> <th>Byte Offset</th> <th>0</th> <th>1</th> <th>2</th> <th>3</th> <th>4</th> <th>5</th> <th>6</th> <th>7</th> <th>8</th> <th>9</th> <th>10</th> <th>11</th> </tr> </thead> </table> For each of these examples, suppose that the array begins at address X. In other words, the address declared for the array is that of its element 0. The character entries would be: C[0] at X, C[1] at X + 1, C[2] at X + 2, etc. The halfword entries would be: HW[0] at X, HW[1] at X + 2, etc. The fullword entries would be: FW[0] at X, FW[1] at X + 4, etc. Byte Displacement and Addressing Array Elements Our Case I have decided not to write macros that handle the general case, but to concentrate on arrays that store 4-byte fullwords. The goal is to focus on array handling and not macro writing. The data structure for such an array will be designed under the following considerations. 1. It must have a descriptor specifying the maximum allowable index. In this data structure, I store the size and derive the maximum index. 2. It might store a descriptor specifying the minimum allowable index. For a 0–based array, that index is 0. 3. It should be created by a macro that allows the size to be specified at assembly time. Once specified, the array size will not change. What Do We Need to Know About a 1–D Array? Here, I assume the following: 1. The array is statically allocated; once loaded, its size is set. 2. The array is “zero based”; its first element has index 0. I decide to include this “base value” in the array declaration, just to show how to do it. 3. The array is self-describing for its maximum size. Here is an example of the proposed data structure as it would be written in System 370 Assembler. The array is named “ARRAY”. ``` ARBASE DC F‘0’ THE FIRST INDEX IS 0 ARSIZE DC F‘100’ SIZE OF THE ARRAY ARRAY DC 100F‘0’ STORAGE FOR THE ARRAY ``` I want to generalize this to allow for a macro construction that will specify both the array name and its size. The Constructor for a One–Dimensional Array Here is the macro I used to construct a one–dimensional array while following the design considerations listed above. ``` 33 MACRO 34 &L1 ARMAKE &NAME,&SIZE 35 &L1 B X&SYSNDX 36 &NAME.B DC F'0' ZERO BASED ARRAY 37 &NAME.S DC F'&SIZE' 38 &NAME.V DC &SIZE.F'0' 39 X&SYSNDX SLA R3,0 40 MEND ``` Line 34: The macro is named “ARMAKE” for “Array Make”. It takes two arguments: the array name and array size. A typical invocation: `ARMAKE XX,20` creates an array called `XX`. Note the “&L1” on line 34 and repeated on line 35. This allows a macro definition to be given a label that will persist into the generated code. More on the 1-D Constructor 33 MACRO 34 &L1 ARMAKE &NAME,&SIZE 35 &L1 B X&SYSNDX 36 &NAME.B DC F'0' ZERO BASED ARRAY 37 &NAME.S DC F'&SIZE' 38 &NAME.V DC &SIZE.F'0' 39 X&SYSNDX SLA R3,0 40 MEND Line 35: A macro is used to generate a code sequence. Since I am using it to create a data structure, I must provide code to jump around the data, so that the data will not be executed. While it might be possible to place all invocations of this macro in a program location that will not be executed, I do not assume that. Line 36: I put in the lower bound on the index just to show what such a declaration might look like. Line 37 This holds the size of the array. Label Concatenations in the Constructor 33 MACRO 34 &L1 ARMAKE &NAME,&SIZE 35 &L1 B X&SYSNDX 36 &NAME.B DC F'0' ZERO BASED ARRAY 37 &NAME.S DC F'&SIZE' 38 &NAME.V DC &SIZE.F'0' 39 X&SYSNDX SLA R3,0 40 MEND Recall that the system variable symbol &SYSNDX in a counter that contains a four digit number unique to the macro expansion. Line 39 uses one style of concatenation to produce a unique label. Suppose that this is the third macro expansion; the label would be “X0003”. Lines 36, 37, and 38 use another type of concatenation, based on the dot. If &NAME is XX, then the labels are XXB, XXS, and XXV. Sample Expansions of the 1–D Constructor Macro <table> <thead> <tr> <th>Address</th> <th>Opcode</th> <th>Bytes</th> <th>Address</th> <th>Opcode</th> <th>Bytes</th> </tr> </thead> <tbody> <tr> <td>000014</td> <td>47F0</td> <td>C06A</td> <td>00070</td> <td>91+</td> <td>B X0003</td> </tr> <tr> <td>000018</td> <td>00000000</td> <td></td> <td>92+XXB</td> <td>DC F'0'</td> <td></td> </tr> <tr> <td>00001C</td> <td>00000014</td> <td></td> <td>93+XXS</td> <td>DC F'20'</td> <td></td> </tr> <tr> <td>000020</td> <td>0000000000000000</td> <td></td> <td>94+XXV</td> <td>DC 20F'0'</td> <td></td> </tr> <tr> <td>000070</td> <td>8B30</td> <td>0000</td> <td>00000</td> <td>95+X0003</td> <td>SLA R3,0</td> </tr> <tr> <td>000074</td> <td>47F0</td> <td>C11A</td> <td>00120</td> <td>97+</td> <td>B X0004</td> </tr> <tr> <td>000078</td> <td>00000000</td> <td></td> <td>98+YYB</td> <td>DC F'0'</td> <td></td> </tr> <tr> <td>00007C</td> <td>00000028</td> <td></td> <td>99+YYS</td> <td>DC F'40'</td> <td></td> </tr> <tr> <td>000080</td> <td>0000000000000000</td> <td></td> <td>100+YYV</td> <td>DC 40F'0'</td> <td></td> </tr> <tr> <td>000120</td> <td>8B30</td> <td>0000</td> <td>00000</td> <td>101+X0004</td> <td>SLA R3,0</td> </tr> </tbody> </table> Notice the labels generated. Two More Macros for 1-D Arrays I now define two macros to use the data structure defined above. I call these **ARPUT** and **ARGET**. Each will use **R4** as a working register. Macro **ARPUT &NAME, &INDX** stores the contents of register R4 into the indexed element of the named 1-D array. Consider the high-level language statement \( A2[10] = Y \). This becomes \[ \text{L R4,} Y \quad \text{ARPUT A2,=}F`10` \quad \text{GET ELEMENT 10} \] Consider the high-level language statement \( Y = A3[20] \). This becomes \[ \text{ARGET A3,=}F`20` \quad \text{CHANGE ELEMENT 20} \] \[ \text{ST} \ R4,Y \] **NOTE:** For some reason, I decided to implement the index as a fullword when I wrote the code. I just continue the practice in this slide. Design of the Macros The two macros, **ARPUT** and **ARGET**, share much of the same design. Much is centered on proper handling of the index, which is passed as a fullword. It would probably make more sense to use a halfword for the index. Here are the essential processing steps. 1. The index value is examined. If it is negative, the macro exits. 2. If the value in the index is not less than the number of elements in the array, the macro exits. For N elements, valid indices are \( 0 \leq K < N \). 3. Using the **SLA** instruction, the index value is multiplied by 4 in order to get a byte offset from the base address. 4. **ARPUT** stores the value in R4 into the indexed address. **ARGET** retrieves the value at the indexed address and loads R4. The ARPUT Macro Here is the macro definition. ``` 44 MACRO 45 &L2 ARPUT &NAME, &INDX 46 &L2 ST R3, S&SYSNDX 47 L R3, &INDX 48 C R3, &NAME.B 49 BL Z&SYSNDX 50 C R3, &NAME.S 51 BNL Z&SYSNDX 52 SLA R3, 2 53 ST R4, &NAME.V(R3) 54 B Z&SYSNDX 55 S&SYSNDX DC F'0' 56 Z&SYSNDX L R3, S&SYSNDX 57 MEND ``` Note the two labels, `S&SYSNDX` and `Z&SYSNDX`, generated by concatenation with the System Variable Symbol `&SYSNDX`. This allows the macro to use conditional branching. ARPUT Expanded Here is an invocation of ARPUT and its expansion. <table> <thead> <tr> <th>ARPUT XX, =F'10'</th> <th>107</th> </tr> </thead> <tbody> <tr> <td>000126 5030 C146</td> <td>0014C 108+</td> </tr> <tr> <td>00012A 5830 C46A</td> <td>00470 109+</td> </tr> <tr> <td>00012E 5930 C012</td> <td>00018 110+</td> </tr> <tr> <td>000132 4740 C14A</td> <td>00150 111+</td> </tr> <tr> <td>000136 5930 C016</td> <td>0001C 112+</td> </tr> <tr> <td>00013A 47B0 C14A</td> <td>00150 113+</td> </tr> <tr> <td>00013E 8B30 0002</td> <td>00002 114+</td> </tr> <tr> <td>000142 5043 C01A</td> <td>00020 115+</td> </tr> <tr> <td>000146 47F0 C14A</td> <td>00150 116+</td> </tr> <tr> <td>00014A 0000</td> <td></td> </tr> <tr> <td>00014C 00000000</td> <td>117+S0005 118+Z0005</td> </tr> <tr> <td>000150 5830 C146</td> <td>0014C 118+Z0005</td> </tr> </tbody> </table> Note the **labels generated** by use of the System Variable Symbol `SYSNDX`. Actions for This Macro Invocation We now examine the actions of the macro **ARPUT**. 108+ \texttt{ST R3, S0005} Register R3 will be used to hold the index into the array. This line saves the value so that it can be restored at the end of the macro. 109+ \texttt{L R3, =F'10'} Register R3 is loaded with the index to be used for the macro. As the index was specified as a literal in the invocation, this is copied in the macro expansion. ARPUT: Checking the Index Value The value of the array index is now in register R3. 110+ C R3, XXB 111+ BL Z0005 112+ C R3, XXS 113+ BNL Z0005 This code checks that the index value is within permissible bounds. The requirement is that $XXB \leq \text{Index} < XXS$. If this is not met, the macro restores the value of R3 and exits. If the requirement is met, the index is multiplied by 4 in order to convert it into a byte displacement from element 0. 114+ SLA R3, 2 ARPUT: Storing the Value Here is the code to store the value into the array, called xxv. 115+ ST R4, xxv (R3) 116+ B Z0005 117+S0005 DC F'0' 118+Z0005 L R3, S0005 Line 115 This is the actual store command. Line 116 Note the necessity of branching around the stored value, so that the data will not be executed as if it were code. Line 117 The save area for the macro. Line 118 This restores the original value of R3, the register used to hold the index value. The ARGET Macro Here is the macro definition. 61 MACRO 62 &L3 ARGET &NAME, &INDX 63 &L3 ST R3, S&SYSNDX 64 L R3, &INDX 65 C R3, &NAME.B 66 BL Z&SYSNDX 67 C R3, &NAME.S 68 BNL Z&SYSNDX 69 SLA R3, 2 70 L R4, &NAME.V(R3) 71 B Z&SYSNDX 72 S&SYSNDX DC F'0' 73 Z&SYSNDX L R3, S&SYSNDX 74 MEND ARGET Expanded Here is an invocation of the macro and its expansion. <p>| | | | | | | |</p> <table> <thead> <tr> <th></th> <th></th> <th></th> <th></th> <th></th> <th></th> <th></th> </tr> </thead> <tbody> <tr> <td></td> <td></td> <td>000154 5030 C172</td> <td>00178 120+</td> <td>ST</td> <td>R3, S0006</td> <td></td> </tr> <tr> <td></td> <td></td> <td>000158 5830 C46E</td> <td>00474 121+</td> <td>L</td> <td>R3, =F'20'</td> <td></td> </tr> <tr> <td></td> <td></td> <td>00015C 5930 C072</td> <td>00078 122+</td> <td>C</td> <td>R3, YYB</td> <td></td> </tr> <tr> <td></td> <td></td> <td>000160 4740 C176</td> <td>0017C 123+</td> <td>BL</td> <td>Z0006</td> <td></td> </tr> <tr> <td></td> <td></td> <td>000164 5930 C076</td> <td>0007C 124+</td> <td>C</td> <td>R3, YYS</td> <td></td> </tr> <tr> <td></td> <td></td> <td>000168 47B0 C176</td> <td>0017C 125+</td> <td>BNL</td> <td>Z0006</td> <td></td> </tr> <tr> <td></td> <td></td> <td>00016C 8B30 0002</td> <td>00002 126+</td> <td>SLA</td> <td>R3, 2</td> <td></td> </tr> <tr> <td></td> <td></td> <td>000170 5843 C07A</td> <td>00080 127+</td> <td>L</td> <td>R4, YYV (R3)</td> <td></td> </tr> <tr> <td></td> <td></td> <td>000174 47F0 C176</td> <td>0017C 128+</td> <td>B</td> <td>Z0006</td> <td></td> </tr> <tr> <td></td> <td></td> <td>000178 00000000</td> <td>129+S0006</td> <td>DC</td> <td>F'0'</td> <td></td> </tr> <tr> <td></td> <td></td> <td>00017C 5830 C172</td> <td>00178 130+Z0006</td> <td>L</td> <td>R3, S0006</td> <td></td> </tr> </tbody> </table> The only difference between this macro and ARPUT occurs in line 127 of the expansion. Here the value is loaded into register R4. Row–Major and Column–Major 2–D Arrays The mapping of a one–dimensional array to linear address space is simple. How do we map a two–dimensional array? There are three standard options. Two are called row–major and column–major order. In this array the first index can have values 0 or 1 and the second 0, 1, or 2. Suppose the first element is found at address A. The following table shows the allocation of these elements to the linear address space. <table> <thead> <tr> <th>Address</th> <th>Row Major</th> <th>Column Major</th> </tr> </thead> <tbody> <tr> <td>A</td> <td>A[0][0]</td> <td>A[0][0]</td> </tr> <tr> <td>A + 4</td> <td>A[0][1]</td> <td>A[1][0]</td> </tr> <tr> <td>A + 8</td> <td>A[0][2]</td> <td>A[0][1]</td> </tr> <tr> <td>A + 12</td> <td>A[1][0]</td> <td>A[1][1]</td> </tr> <tr> <td>A + 16</td> <td>A[1][1]</td> <td>A[0][2]</td> </tr> </tbody> </table> The mechanism for Java arrays is likely to be somewhat different. Addressing Elements in Arrays of 32–Bit Fullwords Consider first a singly dimensioned array that holds 4–byte fullwords. The addressing is simple. \[ \text{Address ( } A[K] \text{ )} = \text{Address ( } A[0] \text{ )} + 4\cdot K. \] Suppose that we have a two dimensional array declared as \( A[M][N] \), where each of \( M \) and \( N \) has a fixed positive integer value. Again, we assume 0–based arrays and ask for the address of an element \( A[K][J] \), assuming that \( 0 \leq K < M \) and \( 0 \leq J < N \). At this point, I must specify either row–major or column–major ordering. As FORTRAN is the only major language to use column–major ordering, I shall assume row–major. The formula is as follows. Element offset = \( K\cdot N + J \), which leads to \[ \text{Address ( } A[K][J] \text{ )} = \text{Address ( } A[0][0] \text{ )} + 4\cdot (K\cdot N + J) \] Example: Declare A[2][3] Suppose that element A[0] [0] is at address A. Address (A[K] [J]) = Address (A[0] [0]) + 4•(K•3 + J). Element A[0] [0] is at offset 4•(0•3 + 0) = 0, or address A + 0. Element A[0] [1] is at offset 4•(0•3 + 1) = 4, or address A + 4. Element A[0] [2] is at offset 4•(0•3 + 2) = 8, or address A + 8. Element A[1] [0] is at offset 4•(1•3 + 0) = 12, or address A + 12. Element A[1] [1] is at offset 4•(1•3 + 1) = 16, or address A + 16. Element A[1] [2] is at offset 4•(1•3 + 1) = 20, or address A + 20. 2–D Arrays: An Example Data Structure Here is a first cut at what we might want the data structure to look like. ARRB DC F’0’ ROW INDEX STARTS AT 0 ARRCNT DC F’30’ NUMBER OF ROWS ARCB DC F’0’ COLUMN INDEX STARTS AT 0 ARCCNT DC F’20’ NUMBER OF COLUMNS ARRAY DC 600F’0’ STORAGE FOR THE ARRAY NOTE: The number 600 in the declaration of the storage for the array is not independent of the row and column count. It is the product of the row and column count. We need a way to replace the number 600 by 30•20, indicating that the size of the array is a computed value. This leads us to the Macro feature called “SET Symbols”. SET Symbols The feature called “SET Symbols” allows for computing values in a macro, based on the values or attributes of the symbolic parameters. There are three basic types of SET symbols. 1. Arithmetic These are 32-bit numeric values, initialized to 0. 2. Binary These are 1-bit values, initialized to 0. 3. Character These are strings of characters, initialized to the null string. Each of these comes in two varieties: Local and Global. The local SET symbols have meaning only within the macro in which they are defined. Declarations in different macro expansions are independent. The global SET symbols specify values that are to be known in other macro expansions within the same assembly. A proper use of a global SET symbol demands the use of conditional assembly to insure that the symbol is defined once and only once. Local and Global Set Declarations Here are the instructions used to declare the SET symbols. <table> <thead> <tr> <th>Type</th> <th>Local</th> <th>Example</th> <th>Global</th> <th>Example</th> </tr> </thead> <tbody> <tr> <td></td> <td>Instruction</td> <td></td> <td>Instruction</td> <td>Example</td> </tr> <tr> <td>Arithmetic</td> <td>LCLA</td> <td>LCLA &amp;F1</td> <td>GBLA</td> <td>GBLA &amp;G1</td> </tr> <tr> <td>Binary</td> <td>LCLB</td> <td>LCLB &amp;F2</td> <td>GBLB</td> <td>GBLB &amp;G2</td> </tr> <tr> <td>Character</td> <td>LCLC</td> <td>LCLC &amp;F3</td> <td>GBLC</td> <td>GBLC &amp;G3</td> </tr> </tbody> </table> Each of these instructions declares a SET symbol that can have its value assigned by one of the SET instructions. There are three SET instructions. - **SETA** SET Arithmetic Use with LCLA or GBLA SET symbols. - **SETB** SET Binary Use with LCLB or GBLB SET symbols. - **SETC** SET Character String Use with LCLC or GBLC SET symbols. Placing the Conditional Assembly Instructions The requirements for placement of these instructions depend on the Operating System being run. The following standards have two advantages: 1. They are the preferred practice for clear programming, and 2. They seem to be accepted by every version of the Operating System. Here is the sequence of declarations. 1. The macro prototype statement. 2. The global declarations used: GBLA, GBLB, or GBLC 3. The local declarations used: LCLA, LCLB, or LCLC 4. The appropriate SET instructions to give values to the SET symbols 5. The macro body. Example of the Preferred Sequence The following silly macro is not even complete. It illustrates the sequence for declaration, but might be incorrect in some details. MACRO &NAME HEDNG &HEAD, &PAGE GBLC &DATES HOLDS THE DATE GBLB &DATEP HAS DATES BEEN DEFINED LCLA &LEN, &MID AIF (&DATEP).N20 IS DATE DEFINED? &DATES DC C‘&SYSDATE’ SET THE DATE &DATEP SETB (1) DECLARE IT SET .N20 ANOP &LEN SETA L’&HEAD LENGTH OF THE HEADER &MID SETA (120–&LEN)/2 MID POINT &NAME Start of macro body. A Constructor Macro for the 2–D Array This macro uses one arithmetic SET symbol to calculate the array size. This has no line numbers because it has yet to be tested by assembling it. MACRO &L1 ARMAK2D &NAME,&ROWS,&COLS LCLA &SIZE &SIZE SETA (&ROWS*&COLS) &L1 B X&SYSNDX &NAME.RB DC F'0' ROW INDEX &NAME.RS DC F'&ROWS' &NAME.CB DC F'0' COL INDEX &NAME.CS DC F'&COLS' &NAME.V DC &SIZE.F'0' X&SYSNDX SLA R3,0 MEND Strings vs. Arrays of Characters While a string may be considered an array of characters, this is not the normal practice. A string is a sequence of characters with a fixed length. A string is stored in “string space”, which may be considered to be a large dynamically allocated array that contains all of the strings used. There are two ways to declare the length of a string. 1. Allot a special “end of string” character, such as the character with code \texttt{X'00'}, as done in C and C++. 2. Store an explicit string length code, usually as a single byte that prefixes the string. A single byte can store an unsigned integer in the range 0 through 255 inclusive. In this method, the maximum string length is 255 characters. There are variants on these two methods; some are worth consideration. Example String In this example, I used strings of digits that are encoded in EBCDIC. The character sequence “12345” would be encoded as F1 F2 F3 F4 F5. This is a sequence of five characters. In either of the above methods, it would require six bytes to be stored. Here is the string, as would be stored by C++. <table> <thead> <tr> <th>Byte number</th> <th>0</th> <th>1</th> <th>2</th> <th>3</th> <th>4</th> <th>5</th> </tr> </thead> <tbody> <tr> <td>Contents</td> <td>F1</td> <td>F2</td> <td>F3</td> <td>F4</td> <td>F5</td> <td>00</td> </tr> </tbody> </table> Here is the string, as would be stored by Visual Basic Version 6. <table> <thead> <tr> <th>Byte number</th> <th>0</th> <th>1</th> <th>2</th> <th>3</th> <th>4</th> <th>5</th> </tr> </thead> <tbody> <tr> <td>Contents</td> <td>05</td> <td>F1</td> <td>F2</td> <td>F3</td> <td>F4</td> <td>F5</td> </tr> </tbody> </table> Each method has its advantages. The main difficulty with the first approach, as it is implemented in C and C++, is that the programmer is responsible for the terminating X’00’. Failing to place it leads to strange run–time errors. Sharing String Space String variables usually are just pointers into string space. Consider the following example in the style of Visual Basic. Here, each of the symbols C1, C2, and C3 references a string of length 4. C1 references the string “1301” C2 references the string “1302” C3 references the string “2108” Using Indirect Pointers with Attributes Another string storage method uses indirect pointers, as follows. Here the intermediate node has the following structure. 1. A reference count 2. The string length 3. A pointer into string space. There are two references to the first string, of length 8: “CPSC 2105”. There are three references to the second string, also of length 8: “CPSC 2108”. There are many advantages to this method of indirect reference, with attributes stored in the intermediate node. It is likely the method used by Java.
{"Source-Url": "http://www.edwardbosworth.com/My3121_LectureSlides_PDF/ArrayAndStringHandling.pdf", "len_cl100k_base": 7224, "olmocr-version": "0.1.50", "pdf-total-pages": 31, "total-fallback-pages": 0, "total-input-tokens": 47442, "total-output-tokens": 8345, "length": "2e12", "weborganizer": {"__label__adult": 0.00029349327087402344, "__label__art_design": 0.00030350685119628906, "__label__crime_law": 0.00020110607147216797, "__label__education_jobs": 0.0004291534423828125, "__label__entertainment": 4.756450653076172e-05, "__label__fashion_beauty": 0.00012230873107910156, "__label__finance_business": 8.845329284667969e-05, "__label__food_dining": 0.0003962516784667969, "__label__games": 0.0004224777221679687, "__label__hardware": 0.002044677734375, "__label__health": 0.0003025531768798828, "__label__history": 0.00017452239990234375, "__label__home_hobbies": 0.0001137852668762207, "__label__industrial": 0.00046706199645996094, "__label__literature": 0.00013697147369384766, "__label__politics": 0.00015652179718017578, "__label__religion": 0.00043702125549316406, "__label__science_tech": 0.01184844970703125, "__label__social_life": 5.46574592590332e-05, "__label__software": 0.004459381103515625, "__label__software_dev": 0.9765625, "__label__sports_fitness": 0.0002627372741699219, "__label__transportation": 0.00043392181396484375, "__label__travel": 0.0001761913299560547}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 20773, 0.09357]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 20773, 0.59224]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 20773, 0.82408]], "google_gemma-3-12b-it_contains_pii": [[0, 669, false], [669, 1513, null], [1513, 2515, null], [2515, 3241, null], [3241, 3963, null], [3963, 4661, null], [4661, 5326, null], [5326, 5974, null], [5974, 6682, null], [6682, 7431, null], [7431, 8200, null], [8200, 8760, null], [8760, 9371, null], [9371, 9814, null], [9814, 10288, null], [10288, 10755, null], [10755, 11128, null], [11128, 12056, null], [12056, 12960, null], [12960, 13835, null], [13835, 14366, null], [14366, 15004, null], [15004, 15841, null], [15841, 16731, null], [16731, 17319, null], [17319, 17818, null], [17818, 18243, null], [18243, 19054, null], [19054, 19910, null], [19910, 20229, null], [20229, 20773, null]], "google_gemma-3-12b-it_is_public_document": [[0, 669, true], [669, 1513, null], [1513, 2515, null], [2515, 3241, null], [3241, 3963, null], [3963, 4661, null], [4661, 5326, null], [5326, 5974, null], [5974, 6682, null], [6682, 7431, null], [7431, 8200, null], [8200, 8760, null], [8760, 9371, null], [9371, 9814, null], [9814, 10288, null], [10288, 10755, null], [10755, 11128, null], [11128, 12056, null], [12056, 12960, null], [12960, 13835, null], [13835, 14366, null], [14366, 15004, null], [15004, 15841, null], [15841, 16731, null], [16731, 17319, null], [17319, 17818, null], [17818, 18243, null], [18243, 19054, null], [19054, 19910, null], [19910, 20229, null], [20229, 20773, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 20773, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 20773, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 20773, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 20773, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 20773, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 20773, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 20773, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 20773, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 20773, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 20773, null]], "pdf_page_numbers": [[0, 669, 1], [669, 1513, 2], [1513, 2515, 3], [2515, 3241, 4], [3241, 3963, 5], [3963, 4661, 6], [4661, 5326, 7], [5326, 5974, 8], [5974, 6682, 9], [6682, 7431, 10], [7431, 8200, 11], [8200, 8760, 12], [8760, 9371, 13], [9371, 9814, 14], [9814, 10288, 15], [10288, 10755, 16], [10755, 11128, 17], [11128, 12056, 18], [12056, 12960, 19], [12960, 13835, 20], [13835, 14366, 21], [14366, 15004, 22], [15004, 15841, 23], [15841, 16731, 24], [16731, 17319, 25], [17319, 17818, 26], [17818, 18243, 27], [18243, 19054, 28], [19054, 19910, 29], [19910, 20229, 30], [20229, 20773, 31]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 20773, 0.16931]]}
olmocr_science_pdfs
2024-12-02
2024-12-02
137f8a2a15f11300e007d0cc280e828f1de8661d
Your Name: Kazuto Kirigaya (because Kirito is always right) SID: 13371337 TA Name: Asuna Yuuki Discussion Section Time: 7-8pm, Funday General Information: This is a closed book and one 2-sided handwritten note examination. You have 80 minutes to answer as many questions as possible. The number in parentheses at the beginning of each question indicates the number of points for that question. You should read all of the questions before starting the exam, as some of the questions are substantially more time consuming. Write all of your answers directly on this paper. Make your answers as concise as possible. If there is something in a question that you believe is open to interpretation, then please ask us about it! Good Luck!! <table> <thead> <tr> <th>QUESTION</th> <th>POINTS ASSIGNED</th> <th>POINTS OBTAINED</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>24</td> <td></td> </tr> <tr> <td>2</td> <td>18</td> <td></td> </tr> <tr> <td>3</td> <td>18</td> <td></td> </tr> <tr> <td>4</td> <td>20</td> <td></td> </tr> <tr> <td>5</td> <td>20</td> <td></td> </tr> <tr> <td>TOTAL</td> <td>100</td> <td></td> </tr> </tbody> </table> P1 (24 points total) True/False and Why? CIRCLE YOUR ANSWER. For each question: 1 point for true/false correct, 2 points for explanation. An explanation cannot exceed 2 sentences. a) Adding a TLB will always improve memory access latency. **TRUE** Why? Any workload that doesn’t visit the same page twice within the TLB’s capacity (or less if N-way associative) will make the workload perform worse than not having a TLB. We also accepted answers explaining on single TLB misses, the added overhead of the TLB check would result in worse latency. b) Memory protection can be implemented without using an address translation mechanism. **TRUE** Why? Each process can be associated a BaseAddr and a LimitAddr, and the CPU or OS can check every access of the process whether it falls between BaseAddr and LimitAddr (see slide 15 in lecture 12). c) Segmentation does not change the value of the bits in the offset field of the virtual address when translating to a physical address. **TRUE** Why? With segmentation we add base to virtual address, which can modify the offset (unlike in paging). d) Two distinct page tables can have the same page table entry despite existing in separate processes. **TRUE** Why? This happens when processes share pages with each other. e) Priority scheduling can lead to starvation. **TRUE** **FALSE** Why? Yes, if there are enough high priority threads, the lower priority threads will be denied the service for ever. f) Under demand paging, if we think of memory as a cache for disk, conflict misses are not possible. **TRUE** **FALSE** Why? Any page can be placed anywhere in memory, making the “cache” fully-associative. g) Each syscall has its own unique entry in the interrupt vector in Pintos. **TRUE** **FALSE** Why? All syscalls share the single interrupt 0x30, and are distinguished in the syscall handler by the syscall number passed as an argument. h) Priority donation is a method of preventing deadlocks. **TRUE** **FALSE** Why? Priority donation prevents priority inversion, not deadlocks (it does not prevent circular wait). **P2** (18 points) **Synch Art Online II – Lawyer's Rosario:** In the dining lawyers problem, four lawyers sit around a table, with IDs A-D from left to right. There is a chopstick between each lawyer, so that chopstick a is to the left of lawyer A, and so on. The chopsticks loop around (e.g. the right chopstick of lawyer D is chopstick a). Each lawyer thinks and then eats, repeatedly. To eat, each lawyer needs two chopsticks. Each lawyer can only reach the chopstick immediately to their left and right (e.g., lawyer A needs chopsticks a and b). <table> <thead> <tr> <th>Total resources</th> </tr> </thead> <tbody> <tr> <td>Chopstick a</td> </tr> <tr> <td>1</td> </tr> </tbody> </table> <table> <thead> <tr> <th>Lawyer ID</th> <th>Current chopstick allocation</th> <th>Maximum chopstick allocation</th> </tr> </thead> <tbody> <tr> <td></td> <td>a</td> <td>b</td> </tr> <tr> <td>A</td> <td>1</td> <td>0</td> </tr> <tr> <td>B</td> <td>0</td> <td>1</td> </tr> <tr> <td>C</td> <td>0</td> <td>0</td> </tr> <tr> <td>D</td> <td>0</td> <td>0</td> </tr> </tbody> </table> a) (5 points) Fill out the maximum chopstick allocation table (aka only the right, shaded half of the table). More precisely, for every lawyer indicate the chopsticks it needs to acquire in order to eat. b) (5 points) Fill out the current chopstick allocation table (the left half of the table) so that we are in an unsafe state, that is, a state in which none of the lawyers can proceed, so all are starving. In addition, give a sequence of requests that will lead to the unsafe state you filled in in the table. Each request should be a pair of a lawyer and the requested chopstick. **Lawyer A requests chopstick a** -> **Lawyer B requests chopstick b** -> **Lawyer C requests chopstick c** -> **Lawyer D requests chopstick d** (aka everyone requests left, then right) **ALTERNATIVELY:** **Lawyer D requests chopstick a.** **Lawyer C requests chopstick d.** **Lawyer B requests chopstick c.** **Lawyer A requests chopstick b.** (aka right, then left) The table is filled in for the left->right solution, the right->left solution for the table would be valid as well. c) (5 points) Consider the order of requests that led to the unsafe state at point (b), but now use the Banker algorithm to avoid getting into the unsafe state. Give the order in which the lawyers will finish eating. C → B → A → D Alternatively: B → C → D → A d) (3 points) Suppose we implemented each lawyer as a thread and we use a critical section for every chopstick (i.e., a chopstick can be picked or dropped only within its critical section). Suppose we do not use the banker’s algorithm, and instead detect the deadlock and break it by abruptly “killing” a thread (lawyer). However, to our surprise this doesn’t break the deadlock. What happened? Chopstick acquisition is most likely implemented with a synchronization primitive. Shooting one of the lawyers will leave the system in an inconsistent state. For example, if chopsticks are implemented with semaphores, then the killed lawyer can’t up the semaphore that another lawyer is waiting on. P3 (18 points) **Address Translation for RAM (& Rem):** Suppose we have split our 64-bit Virtual Address Space as follows: <table> <thead> <tr> <th>Y bits</th> <th>X bits</th> <th>X bits</th> <th>X bits</th> <th>X bits</th> <th>12 bits</th> </tr> </thead> <tbody> <tr> <td>[Seg. Index]</td> <td>[Table Index]</td> <td>[Table Index]</td> <td>[Table Index]</td> <td>[Page Index]</td> <td>[offset]</td> </tr> </tbody> </table> a) (2 points) How big is a page in this system? We have 12 offset bits, so a page can have $2^{12} = 4K$ bytes. b) (4 points) Assume that the page tables are divided into page-sized chunks (so that they can be paged to disk). How many PTEs are fit in a page table? What is the value of X? A PTE should contain one address, so its length is 8 bytes (64 bits). A page table has $2^{12}/2^3 = 2^9 = 512$ entries. We also gave full points to the following alternative answer: If the PTE was assumed to be 7 bytes (as PPN = 52 bits) then $X=2^{12}/7=10$ (rounded up from 9.19), and the corresponding number of PTEs = $2^{10}=1024$. c) (3 points) What is the size of the segment index (Y)? How many segments can the system have? If answer to part b was $X=9$, then $Y=64-12-4*9=16$ bits. number of segments = $2^Y = 2^{16} = 64K$ If answer to part b was $X=10$, then $Y=64-12-4*10=12$ number of segments = $2^Y = 2^{12} = 4KB$ a) (4 points) What would be the format of a PTE (page table entry)? Show the format of including bits required to support the clock algorithm for page replacement and copy-on-write optimizations, i.e., a dirty bit, a valid bit, and used bit. (Assume: 64-bit Physical Address space) We have 12-bit offset, so in a 64-bit physical address space, we will have $2^{64}/2^{12} = 2^{52}$ pages. Hence, we will need 52 (64-12) bits to index one of those pages. b) (5 points) If a user’s heap segment is completely full, how much space is taken up by the page tables for this segment? (It is fine if you just provide the numerical expression without calculating the final result.)? Number of pages taken by the page table across different levels $= 1 \text{ (top-level)} + 2^X \text{ (second-level)} + 2^X * 2^X \text{ (third-level)} + 2^X * 2^X * 2^X \text{ (fourth-level)}$ So, the page table for the heap segment in this case will occupy $(1 + 2^X + 2^X * 2^X + 2^X * 2^X * 2^X)$ pages. And the size of the heap segment will be $= \text{(number of pages in the corresponding page table)} * \text{size of a page}$ $= (1 + 2^X + 2^X * 2^X + 2^X * 2^X * 2^X) * 2^{12}$ bytes **P4 (20 points total) Caching – Bad Day at Work:** Your company designs caches for servers with 32-bit addresses. You are designing a 1KB cache with 32B blocks, and your hardware designer suggests a 64-way set associative cache. a) (4 points) Why would 64-way set associativity not make sense for the cache? The total number of cache blocks is 1KB/32B = 32. Therefore it doesn’t make sense to have a 64-way set associative cache, since \#cache blocks < associativity. In fact, the cache will already be fully associative if you have 32-way set associativity. b) (4 points) You decide to design a fully associative cache instead, and have to come up with a replacement algorithm. Given that the common use-case is repeatedly iterating through arrays that are only slightly larger than the cache capacity, which of LRU (Least Recently Used) or MRU (Most Recently Used) policies yield higher hit rates and why? As the names implies MRU replaces the entry that was accessed last. Answer in at most 2 sentences. MRU; with LRU, we would keep evicting entries earlier in the array, resulting in cache misses for repeated iterations. With MRU, we would evict entries later in the array, leaving most of the earlier array entries in the cache, resulting in better hit rates for repeated iterations. c) (4 points) Unfortunately, the hardware engineer introduced a bug in the cache where the cache tag comparison always yields a mismatch. How would this bug impact (i) correctness of end-to-end memory lookups and (ii) effective access time for memory lookups, regardless of correctness? Answer in at most 2 sentences. The bug would not impact the correctness of end-to-end memory lookups, since tag mismatches in the cache be corrected by lookups to the memory. The bug would increase effective access time, since every access would result in a cache miss. d) (4 points) Your hardware engineer fixes the bug in (c), but introduces another bug where the cache only compares the first N-1 bits of the N-bit cache tag. How would this bug impact (i) the correctness of end-to-end memory lookups and (ii) effective access time for memory lookups, regardless of correctness? Answer in at most 2 sentences. The bug would result in an incorrect lookup for a requested address whose tag matches N-1 bits but not all N bits with the tag corresponding to a cache entry. The bug would reduce effective access time, since it is now twice as likely to find entries in the cache due to partial (and potentially incorrect) tag matches. e) (4 points) Your hardware engineer fixes the bug in (d) but quite unsurprisingly, introduces yet another bug, where the cache randomly reads the valid bit of any cache entry as 0 with probability p. In other words, if a cache entry is valid, the cache will assume this entry is invalid with probability p. On the other hand, if the cache entry is invalid, the cache will correctly assume it is invalid. The memory access time is 40 ns, cache access time is 10 ns, and probability of finding an entry in cache (before reading valid bit) is 0.9. If effective access time (after reading the valid bit) is 41 ns, what is the value of probability p? Cache hit rate = Probability of finding the entry in the cache * Probability of reading valid bit as 1 = 0.9 * (1-p) = 0.9 - 0.9p Cache miss rate = 1 - Cache hit rate = 0.1 + 0.9p Effective Access Time = (0.9 - 0.9p) * 10 + (0.1 + 0.9p) * (10 + 40) = 41 => p = 0.75 f) (0 points) Would you fire your hardware engineer? Think of their family. Have mercy. P5 (20 points) **Real-Time Exam Scheduling:** Assume 3 threads with period (P) and computation time per period (C) defined as below: <table> <thead> <tr> <th>Period (P)</th> <th>Computation Time (C)</th> </tr> </thead> <tbody> <tr> <td>T1</td> <td>5</td> </tr> <tr> <td>T2</td> <td>6</td> </tr> <tr> <td>T3</td> <td>3</td> </tr> </tbody> </table> Assume all threads arrive at time 0. a) (5 points) Fill out the table below according to the the Earliest Deadline First scheduling algorithm. As the name implies, EDF schedules the ready thread with the earliest deadline, where a thread is ready, if the requested computation, C, in the current period has not been satisfied yet. Fill out a box with an ‘X’ if the thread of that row is running at the time of the column. If two threads have the same deadline, break ties in numerical order i.e., T1 takes precedence before T2. A time slice is one time unit (the table below shows the first 15 time slices). Threads can only be preempted at time slice boundaries. <table> <thead> <tr> <th></th> <th>1</th> <th>2</th> <th>3</th> <th>4</th> <th>5</th> <th>6</th> <th>7</th> <th>8</th> <th>9</th> <th>10</th> <th>11</th> <th>12</th> <th>13</th> <th>14</th> <th>15</th> </tr> </thead> <tbody> <tr> <td>T1</td> <td>X</td> <td>X</td> <td></td> <td>X</td> <td>X</td> <td></td> <td></td> <td></td> <td></td> <td>X</td> <td></td> <td>X</td> <td></td> <td></td> <td></td> </tr> <tr> <td>T2</td> <td></td> <td>X</td> <td>X</td> <td></td> <td></td> <td>X</td> <td>X</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>T3</td> <td>X</td> <td></td> <td>X</td> <td>X</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td>X</td> <td></td> <td></td> <td>X</td> </tr> </tbody> </table> b) (1 point) Were any of the deadlines missed? If so, give the thread(s) and time period(s) during which the deadline was not met. None were missed. c) (5 points) Now consider Rate Monotonic (RM), another real-time scheduler which always schedules the thread with the highest ratio C/P. In other words RM is a fixed priority scheduler where the priority of a thread is C/P, and highest priority thread are scheduled first, i.e., T1 is scheduled before T2 if C1/P1 > C2/P2. Given the RM scheduler, fill in the table below assuming the same threads as in (a). Ties are again broken by the thread number with the lower number running first, and threads can be preempted at the time slice boundaries. <table> <thead> <tr> <th></th> <th>1</th> <th>2</th> <th>3</th> <th>4</th> <th>5</th> <th>6</th> <th>7</th> <th>8</th> <th>9</th> <th>10</th> <th>11</th> <th>12</th> <th>13</th> <th>14</th> <th>15</th> </tr> </thead> <tbody> <tr> <td>T1</td> <td></td> <td>X</td> <td>X</td> <td></td> <td>X</td> <td></td> <td>X</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>T2</td> <td></td> <td></td> <td>X</td> <td>X</td> <td></td> <td>X</td> <td>X</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>T3</td> <td></td> <td></td> <td></td> <td>X</td> <td>X</td> <td></td> <td>X</td> <td>X</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> </tbody> </table> d) (1 point) Were any of the deadlines in the previous part missed? If so, give the thread(s) and time period(s) during which the deadline was not met. Yes. The deadlines of T3 were missed during every time period. e) (5 points) Now consider Round-Robin (RR), where each thread is scheduled for a time slices in a round-robin fashion, T1, T2, T3, T1, T2, … If a thread is not ready (i.e., its request in a time period has been already satisfied), the thread is simply skipped and the next time slice is allocated to the next ready thread. Fill in the table below assuming the same threads as in (a). <table> <thead> <tr> <th></th> <th>1</th> <th>2</th> <th>3</th> <th>4</th> <th>5</th> <th>6</th> <th>7</th> <th>8</th> <th>9</th> <th>10</th> <th>11</th> <th>12</th> <th>13</th> <th>14</th> <th>15</th> </tr> </thead> <tbody> <tr> <td>T1</td> <td>X</td> <td></td> <td>X</td> <td></td> <td>X</td> <td></td> <td>X</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>T2</td> <td>X</td> <td>X</td> <td></td> <td>X</td> <td></td> <td>X</td> <td></td> <td>X</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>T3</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> </tbody> </table> f) (1 point) Were any of the deadlines in the previous part missed? If so, give the thread(s) and time period(s) during which the deadline was not met. T1 misses its 3rd period deadline in the time interval [11, 15]. g) (2 points) Assume the three tasks at A are running forever. Does EDF guarantee that all the deadlines will be always met? Why, or why not? No more than 2 sentences. No. Consider time 3*6*5 = 90. By time 90 we need to schedule T1 18 times so we need 2*18 = 36 time slices, T2 15 times so we need 30 times slices, and T3 30 times so we need 30 time slices. Thus, to meet all their deadlines the threads need to run for a total of 36+30+30 times slices during 90 time slices, which is impossible.
{"Source-Url": "https://cs162.eecs.berkeley.edu/static/exams/fa17-mt2-solutions.pdf", "len_cl100k_base": 5162, "olmocr-version": "0.1.50", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 22362, "total-output-tokens": 5164, "length": "2e12", "weborganizer": {"__label__adult": 0.0006327629089355469, "__label__art_design": 0.00054168701171875, "__label__crime_law": 0.0007143020629882812, "__label__education_jobs": 0.00888824462890625, "__label__entertainment": 0.00015246868133544922, "__label__fashion_beauty": 0.0002918243408203125, "__label__finance_business": 0.0005154609680175781, "__label__food_dining": 0.0006546974182128906, "__label__games": 0.0026149749755859375, "__label__hardware": 0.01351165771484375, "__label__health": 0.0009589195251464844, "__label__history": 0.0005083084106445312, "__label__home_hobbies": 0.0003330707550048828, "__label__industrial": 0.0017948150634765625, "__label__literature": 0.00039005279541015625, "__label__politics": 0.0003981590270996094, "__label__religion": 0.0008130073547363281, "__label__science_tech": 0.1707763671875, "__label__social_life": 0.00018358230590820312, "__label__software": 0.0124969482421875, "__label__software_dev": 0.78076171875, "__label__sports_fitness": 0.0007710456848144531, "__label__transportation": 0.0010499954223632812, "__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, 16522, 0.03874]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 16522, 0.29431]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 16522, 0.9119]], "google_gemma-3-12b-it_contains_pii": [[0, 1126, false], [1126, 2479, null], [2479, 3299, null], [3299, 5506, null], [5506, 6464, null], [6464, 8903, null], [8903, 10758, null], [10758, 12429, null], [12429, 13931, null], [13931, 16522, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1126, false], [1126, 2479, null], [2479, 3299, null], [3299, 5506, null], [5506, 6464, null], [6464, 8903, null], [8903, 10758, null], [10758, 12429, null], [12429, 13931, null], [13931, 16522, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 16522, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 16522, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 16522, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 16522, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 16522, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 16522, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 16522, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 16522, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, true], [5000, 16522, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 16522, null]], "pdf_page_numbers": [[0, 1126, 1], [1126, 2479, 2], [2479, 3299, 3], [3299, 5506, 4], [5506, 6464, 5], [6464, 8903, 6], [8903, 10758, 7], [10758, 12429, 8], [12429, 13931, 9], [13931, 16522, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 16522, 0.28767]]}
olmocr_science_pdfs
2024-12-01
2024-12-01
29fa9f60657b6ddca0d8a37c406581fc47894cc6
Using the i.MXRT L1 Cache 1. Introduction i.MXRT series takes advantage of the ARM Cortex-M7 core with 32K/32K L1 I/D-Cache. This delivers extremely high performance regardless the code is executed from on-chip RAM, external Flash or external memory. This documentation introduces the basic technology of the cache system that includes the L1 cache, memory types, attributes and MPU (Memory Protection Unit). It guides user on how to use cache to develop applications running in a correct and high-performance way. It does not intend to dig into details of the cache system, for more detailed information, please refer to ARM Cortex-M7 Processor User Guide. The software used for example in this documentation are based on the i.MXRT1050 SDK release with ARM’s CMSIS implementation. The development environment is IAR Embedded Workbench 8.11. The hardware used to verify the example is MIMXRT1050-EVK board. 2. Overview This chapter introduces i.MXRT system architecture with cache related parts. It talks about the L1 cache behavior, ARM cortex-M7 defined memory types/attributes and the MPU (Memory Protection Unit) system. This gives an overview of the i.MXRT cache system and how they affect the application use cases. 2.1. i.MXRT system architecture (cache related) ![i.MXRT1050 core and system block diagram](image) Figure 1. i.MXRT1050 core and system block diagram The i.MXRT series implement a CPU core platform described in Figure 1. The L1 I/D-Cache is embedded in the core platform. The data cache is 4-way set-associative and instruction cache is 2-way set-associative with cache line size of 32 bytes. It connects with the SIM_M7 bus fabric master port by AXI bus. The subsystem of internal/external memory like OCRAM (FlexRAM banks configured as OCRAM), FlexSPI (Serial NOR, NAND Flash and Hyper Flash/RAM etc.) and SEMC (SDRAM, PNOR Flash, NAND Flash etc.) are connected to the bus fabric slave port. CPU core access the subsystem through this bus fabric by L1 cache. Since the access to the subsystem of those memory can take multiple cycles (especially on the external memory interfaces with multiple wait states), the L1 cache is designed to speed up the read/write operation to the memory. This brings a big performance boost. The I/DTCM (FlexRAM banks configured as TCM) is accessed directly by CPU core, bypass the L1 cache. Therefore, put the critical code and data into the TCM is recommended, like the vector table. 2.2. L1 Cache behavior Any access that is not for a TCM is handled by the appropriate cache controller. If the access is to non-shared cacheable memory, and the cache is enabled, a lookup is performed in the cache and, if found, that is, a cache hit, the data is fetched from or written into the cache. When the cache is not enabled and for non-cacheable or shared memory the accesses are performed using the AXI bus. Both caches allocate a memory location to a cache line on a cache miss because of a read, that is, all cacheable locations are Read-Allocate. In addition, the data cache can allocate on a write access if the memory location is marked as Write-Allocate. When a cache line is allocated, the appropriate memory is fetched into a linefill buffer by the AXI bus before being written to the cache. Writes accesses that hit in the data cache are written into the cache RAMs. If the memory location is marked as Write-Through, the write is also performed on the AXI bus, so that the data stored in the RAM remains coherent with the external memory system. If the memory is Write-Back, the cache line is marked as dirty, and the write is only performed on the AXI bus when the line is evicted. When a dirty cache line is evicted, the data is passed to the write buffer in the AXI bus to be written to the external memory system. 2.3. Memory types and attributes The memory map and the programming of the MPU splits the memory map into regions. Each region has a defined memory type, and some regions have additional memory attributes. The memory type and attributes determine the behavior of accesses to the region. The memory types are: - **Normal** – The processor can re-order transactions for efficiency, or perform speculative reads. - **Device and Strongly-Ordered** – The processor preserves transaction order relative to other transactions to Device or Strongly-Ordered Memory. The different ordering requirements for Device and Strongly-Ordered Memory mean that the external memory system can buffer a write to Device memory, but must not buffer a write to Strongly-Ordered Memory. The memory attributes include: • **Shareable (S)** – For a shareable memory region, the memory system provides data synchronization between bus masters in a system with multiple bus masters, for example, a processor with a DMA controller. For i.MXRT, shareable means **non-cacheable** by default. • **Execute Never (XN)** – Means that the processor prevents instruction accesses. A fault exception is generated only on execution of an instruction that is executed from an XN region. • **TEX, Cacheable (C), Bufferable (B)** – Identify the memory type and cache policy used by this region of memory. • **Access permission (AP)** – access permissions for privileged and unprivileged software. Value can be “No access”, RW, RO. The *memory type, S, TEX, C, B* attributes determine the cache policy that application should take care of. See the next section about the cache policy. ### 2.3.1. Cache Policy The TEX/C/B attributes defines the memory type and cache policy applied to the region of memory, here list commonly used combination of these bits: <table> <thead> <tr> <th>TEX</th> <th>C</th> <th>B</th> <th>Memory Type</th> <th>Cache Policy</th> </tr> </thead> <tbody> <tr> <td>0b000</td> <td>0</td> <td>0</td> <td>Strongly Ordered</td> <td>Non-cacheable</td> </tr> <tr> <td></td> <td>0</td> <td>1</td> <td>Device</td> <td>Non-cacheable</td> </tr> <tr> <td></td> <td>1</td> <td>0</td> <td>Normal</td> <td>WT, No WA</td> </tr> <tr> <td></td> <td>1</td> <td>1</td> <td>Normal</td> <td>WB, No WA</td> </tr> <tr> <td>0b001</td> <td>0</td> <td>0</td> <td>Normal</td> <td>Non-cacheable</td> </tr> <tr> <td></td> <td>1</td> <td>1</td> <td>Normal</td> <td>WB, WA</td> </tr> </tbody> </table> Cache policy is fixed to Non-cacheable when Shareable bit is set, no matter what’s the TEX/C/B value. A full cache policy settings table can be found in **ARM Cortex-M7 Processor User Guide**. Each of the cache policy is described here: • **Write allocation (WA)** – A cache line is allocated on a write miss. This means that executing a store instruction on the processor might cause a burst read to occur. • **Write-back (WB)** – A write updates the cache only and marks the cache line as dirty. External memory is updated only when the line is evicted or explicitly cleaned. • **Write-through (WT)** – A write updates both the cache and the external memory system. This does not mark the cache line as dirty. 2.3.2. i.MXRT1050 Memory Map The default memory map of important regions with memory types and cache policy is listed below Table 2. Application can use MPU to configure different memory type and cache policy to overwrite the default. <table> <thead> <tr> <th>Start</th> <th>End</th> <th>Size</th> <th>Modules</th> <th>Memory type</th> <th>Cache Policy</th> </tr> </thead> <tbody> <tr> <td>C000_0000</td> <td>DFFF_FFFF</td> <td>512MB</td> <td>SEMC3</td> <td>Device</td> <td>Non-Cacheable</td> </tr> <tr> <td>A000_0000</td> <td>BFFF_FFFF</td> <td>512MB</td> <td>SEMC2</td> <td>Device</td> <td>Non-Cacheable</td> </tr> <tr> <td>9000_0000</td> <td>9FFF_FFFF</td> <td>256MB</td> <td>SEMC1</td> <td>Normal</td> <td>Cacheable/WT (no WA)</td> </tr> <tr> <td>8000_0000</td> <td>8FFF_FFFF</td> <td>256MB</td> <td>SEMC0</td> <td>Normal</td> <td>Cacheable/WT (no WA)</td> </tr> <tr> <td>7FC0_0000</td> <td>7FFF_FFFF</td> <td>4MB</td> <td>FlexSPI RX FIFO</td> <td>Normal</td> <td>Cacheable/WB/WA</td> </tr> <tr> <td>7F80_0000</td> <td>7FBF_FFFF</td> <td>4MB</td> <td>FlexSPI TX FIFO</td> <td>Normal</td> <td>Cacheable/WB/WA</td> </tr> <tr> <td>6000_0000</td> <td>7F7F_FFFF</td> <td>504MB</td> <td>FlexSPI / FlexSPI cipher text</td> <td>Normal</td> <td>Cacheable/WB/WA</td> </tr> <tr> <td>2020_0000</td> <td>2027_FFFF</td> <td>512KB</td> <td>OCRAM</td> <td>Normal</td> <td>Cacheable/WB/WA</td> </tr> <tr> <td>2000_0000</td> <td>2007_FFFF</td> <td>512KB</td> <td>DTCM</td> <td>Normal</td> <td>-</td> </tr> <tr> <td>0000_0000</td> <td>0007_FFFF</td> <td>512KB</td> <td>ITCM</td> <td>Normal</td> <td>-</td> </tr> </tbody> </table> DTCM/ITCM is Tightly-Coupled Memories, core can access it directly (cache is not involved). Which SEMC memory region used by application is decided by the Chip-Select in the board design. For example, SDRAM use SEMC_CS0, then we access SDRAM by SEMC0 memory region. 2.4. MPU (Memory Protection Unit) The Memory Protection Unit (MPU) divides the memory map into a few regions, and defines the location, size, access permissions, and memory attributes of each region. It supports: - Independent attribute settings for each region - Overlapping regions - Export of memory attributes to the system The memory attributes affect the behavior of memory accesses to the region. The i.MXRT MPU defines: - 16 separate memory regions, 0-15 - A background region When memory regions overlap, a memory access is affected by the attributes of the region with the highest number. For example, the attributes for region 15 take precedence over the attributes of any region that overlaps region 15. The background region has the same memory access attributes as the default memory map, but is accessible from privileged software only. The MPU memory map is unified. This means instruction accesses and data accesses have same region settings. If a program accesses a memory location that is prohibited by the MPU, the processor generates a MemManage fault. This causes a fault exception, and might cause termination of the process in an OS environment. Typically, application or embedded OS uses the MPU for memory protection and memory cache policy configurations. Please see the section 4.2 for how to use MPU to configure memory region for different cache policy. ### 2.5. Hardware L1 I-cache prefetching The speculative fetch is likely caused by branch prediction in Cortex-M7, when the branch predictor is enabled, the core will attempt to fetch ahead of the current execution point, while the branch predictor is disabled, then the core will still do a small amount of prediction (backwards direct branches will be predicted to be taken, forwards direct branches will be predicted to be not taken), so even when branch prediction is disabled, there's a small chance that the core can start fetching to unexpected locations. **NOTE** Speculative fetch will be performed to Normal Memory, but has no affect to Strongly Ordered or Device memory, and speculative instruction fetches will never be performed to XN memory (refer to 2.3 for memory type). ### 3. Cache operation There are three types of cache operations: - **Cache Enable/Disable** — Cache on/off - **Cache Clean** — Writes back dirty cache lines to the memory (sometimes called a flush) - **Cache Invalidate** — Marks the contents in cache as invalid (basically, a delete operation) i.MXRT SDK provides two ways to do the cache operations #### 3.1. Accessing the cache using CMSIS **Table 3. CMSIS cache functions** <table> <thead> <tr> <th>CMSIS function</th> <th>Descriptions</th> </tr> </thead> <tbody> <tr> <td>void SCB_EnableICache (void)</td> <td>Invalidate and then enable instruction cache</td> </tr> <tr> <td>void SCB_DisableICache (void)</td> <td>Disable instruction cache and invalidate its contents</td> </tr> <tr> <td>void SCB_InvalidateICache (void)</td> <td>Invalidate instruction cache</td> </tr> <tr> <td>void SCB_EnableDCache (void)</td> <td>Invalidate and then enable data cache</td> </tr> <tr> <td>void SCB_DisableDCache (void)</td> <td>Disable data cache and then clean and invalidate its contents</td> </tr> <tr> <td>void SCB_InvalidateDCache (void)</td> <td>Invalidate data cache</td> </tr> <tr> <td>void SCB_CleanDCache (void)</td> <td>Clean data cache</td> </tr> <tr> <td>void SCB_CleanInvalidateDCache (void)</td> <td>Clean and invalidate data cache</td> </tr> </tbody> </table> Using the i.MXRT L1 Cache, Application Note, Rev. 1, 12/2017 3.2. Accessing the cache using SDK i.MXRT SDK provides a cache driver for L1 cache operations, which is a wrapper to the CMSIS cache functions: ```c void L1CACHE_DisableICache(void) void L1CACHE_InvalidateICache(void) void L1CACHE_InvalidateICacheByRange(uint32_t address, uint32_t size_byte) void L1CACHE_EnableDCache(void) void L1CACHE_DisableDCache(void) void L1CACHE_InvalidateDCacheByRange(uint32_t address, uint32_t size_byte) void L1CACHE_CleanDCacheByRange(uint32_t address, uint32_t size_byte) void L1CACHE_CleanInvalidateDCacheByRange(uint32_t address, uint32_t size_byte) ``` For more details, please refer to the SDK RM. 4. Cache maintenance and data coherency The cache brings a great performance boost, but the user must pay attention to the cache maintenance for data coherency. 4.1. Typical use case To get better understanding on the cache maintenance and data coherency, this section describes a typical use case as an example: Playback an audio file stored in the external Flash. The subsystem inter-connection and program data flow is as below: Data flow & Subsystem diagram The CPU reads the audio file content in SRC buffer through the L1 D-Cache, and decodes the PCM frame data, writes into OCRAM’s USER buffer. After USER buffer is full, eDMA is started to copy the PCM frame data into the FIFO inside the SAI IP module. Then SAI shifts out the FIFO data to SAI bus for audio playback. When CPU writes the frame data to OCRAM with L1 cache enabled, the data may only be written to the cache as default cache policy for OCRAM is Write-Back. Then eDMA transfers the data to SAI FIFO is incorrect, and the data coherency problem occurs. To avoid such data coherency issue, here are some solutions: 1. Perform a D-Cache clean operation after CPU writing data to OCRAM. 2. Configure the OCRAM memory region cache policy from Write-Back to Write-Through in MPU before this write started. 3. Configure the OCRAM memory region cache policy to non-cacheable in MPU. 4. Configure the OCRAM memory region as shareable in MPU, which means non-cacheable. 4.2. Cache maintenance in SDK Driver The following drivers in the SDK maintain the data coherency of the cache: 1. Ethernet In the ENET, a unified DMA (uDMA) engine is designed, it optimizes data transfer between the ENET core and the SoC, and supports an enhanced buffer descriptor programming model to support IEEE 1588 functionality. 2. uSDHC In the SD Host Controller Standard, a new DMA transfer algorithm called the ADMA (Advanced DMA) is designed. User can pass cacheable buffers to those drivers, drivers takes care of the data coherency. For other cases that uses DMA, user should take care of the data coherency by cache operations. Please refer to the next section. 4.3. Cache maintenance by application There’re two ways to do cache maintenance in application. 4.3.1. Use cacheable buffers Normally buffers on the OCRAM, SDRAM are Cacheable and Write-Back. It can be in the stack, static section or allocated from heap. To use such buffer as DMA source, user must perform a DCACHE clean operation is done before DMA started, this makes sure all of the data are committed to the memory from cache. If buffer is used as DMA receive destination, a DCACHE invalidate operation must be done after DMA completed and before CPU or other masters read. The buffer address should be L1 cache line size aligned (32 bytes in i.MXRT). 4.3.2. Use non-cacheable buffers Use non-cacheable buffer would make life easier, which can avoid the cache data coherency problem. But the side-effect is the performance of accessing the buffer is not good as cacheable ones if CPU access them multiple times. To make buffers non-cacheable, user must configure at least one region of memory as non-cacheable attribute in MPU, and put the buffers into this region by the linker of toolchain. Steps to do in application: 1. Buffer definition SDK provides the below two macros for application to define buffers (variable) in the “Noncacheable” section of the program: ``` AT_NONCACHEABLE_SECTION_ALIGN(var, alignbytes) AT_NONCACHEABLE_SECTION(var) ``` The first macro is to define the buffer (var) with start address aligned by alignbytes. The second macro is to define the buffer (var) with start address aligned by compiler automatically, normally 4- Cache maintenance and data coherency bytes aligned. Some use cases need application to explicit define the buffer aligned with special bytes. Like the framebuffer for eLCDIF, 8-bytes aligned is required, e.g.: ``` AT_NONCACHEABLE_SECTION_ALIGN(static uint8_t buffer[256], 8); ``` 2. Linker file Add the NCACHE_VAR block (NonCacheable section) with size for user buffers size requirement. Put this NCACHE_VAR block into the SDRAM region, e.g. very beginning of the SDRAM. ``` define symbol m_sdram_start = 0x80000000; define symbol m_sdram_end = 0x80FFFFFF; define region SDRAM_region = mem:[from m_sdram_start to m_sdram_end]; define block NCACHE_VAR with size = 2*1024*1024, alignment = 1024*1024 { section NonCacheable }; place in SDRAM_region { first block NCACHE_VAR }; ``` 3. MPU configurations Before the user can configure any regions, the MPU must be disable first by ARM_MPU_Disable() function. To configure the region, ARM_MPU_SetRegionEx() function take first parameter as Region Number, second parameter as base address of the memory want to configure. The third parameter is the Region Attributes and Size, the macro is defined as below: ``` ARM_MPU_RASR(XN, AP, TEX, S, C, B, SRD, Size) ``` - XN/AP/TEX/S/C/B parameters are exactly same as the attributes defined in section 2.2 - SRD means disable the Subregion, which used in the region overlap case. Here just ignore it and set to 0. - Size is defined as: \( Region \text{ size in bytes} = 2^{(SIZE+1)} \) The base address of the region passed to ARM_MPU_SetRegionEx() must be aligned with the size in bytes. ARM_MPU_SetRegionEx() can be called multiple times to configure for different memory regions with unique Region Number. The MPU supports up to 16 regions. After memory regions been configured, the ARM_MPU_Enable() is called to enable MPU. The parameter of ARM_MPU_Enable() is set to 0x4, which enables use of the default memory map as background region. For example, configure the SDRAM (start from 0x80000000) first 2MB region as non-cacheable: ``` AT_NONCACHEABLE_SECTION_ALIGN(static uint8_t buffer[256], 8); ``` 5. Constraint Speculative Prefetch As Cortex-M7 support speculative prefetch feature, which can do speculative accesses to memory locations with Normal Memory attribute at any time, and if prefetching happens on invalid address, it will generate bus fault, so it must to avoid this issue occur. Since speculative fetch will never be performed to Strongly Ordered or Device Memory (refer to 2.3 for memory type), so it is way to configure the MPU to constraint its behavior. Need to consider MPU configuration as below: - Configure the used memory as Normal Memory I.MXRT reserves memory address for some device, need configure the used address space as Normal Memory. such as, for SDRAM, need to configure the valid address space with Normal Memory, and MPU configuration as below: ```c /* Region 7 setting */ ARM_MPU_SetRegion ( ARM_MPU_RBAR ( 7 , 0x80000000U ) , ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 0, 0, ARM_MPU_REGION_SIZE_32MB )); ``` - Configure all unused address space as Device Memory. As not all memory is used to one application, it requires to configure all unused memory to Device Memory, for example, if it don’t install external flash (by FlexSPI interface) on board, need to configure corresponding address region to Device Memory type as below. ```c /* Region 2 setting */ ARM_MPU_SetRegion ( ARM_MPU_RBAR ( 2 , 0x60000000U ) , ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_512MB )); ``` - Need to ensure all memory space get the correct configuration on MPU. Please configure correct memory attribute according to application, check the used/unused memory and valid address space, assign the correct memory type to avoid issue caused by speculative prefetch, also i.MXRT SDK provide the MPU initialization driver(BOARD_ConfigMPU(void)), which is an example to configure MPU. 6. Conclusion In summary, to use i.MXRT L1 Cache in a correct and efficient way, there are several recommendations and tips: - Put critical code and data into TCM, like vector table. Which is the fastest way for CPU to access the code and data. - Always call the CMSIS cache function or SDK cache driver API to cache operations. This make sure cache is cleaned before disabled, and invalided before enabled, to avoid unpredictable issue. - If the software is using cacheable memory regions for the DMA source/or destination buffers. The software must trigger a cache clean before starting a DMA operation to ensure that all the data are committed to the subsystem memory. After the DMA transfer complete, when reading the data from the peripheral, the software must perform a cache invalidate before reading the DMA updated memory region. - Always recommended to use non-cacheable regions for DMA buffers. The software can use the MPU to configure a non-cacheable memory region to use as a shared buffer between the CPU and DMA. For example: - The frame buffer for eLCDIF display - The input and output buffer for PXP channel - When using FlexSPI for external NOR Flash read by AHB bus, cacheable memory would cause problem. Because the Flash erase and program operation is go through the IP command, but not AHB bus. A cache invalid operation is needed before CPU read the FlexSPI memory map after any erase and program completed. 7. Reference - ARM Cortex-M7 Processor User Guide (Revision: r1p1) - ARM Cortex-M7 Processor Technical Reference Manual (Revision: r1p1) - i.MX RT1050 Processor Reference Manual - Kinetis SDK v.2.2 API Reference Manual (In the SDK release package) ### 8. Revision history <table> <thead> <tr> <th>Revision number</th> <th>Date</th> <th>Substantive changes</th> </tr> </thead> <tbody> <tr> <td>0</td> <td>08/2017</td> <td>Initial release</td> </tr> <tr> <td>1</td> <td>12/2017</td> <td>Add chapter 5 and 2.5</td> </tr> </tbody> </table> Table 4. Revision history
{"Source-Url": "https://www.nxp.com/docs/en/application-note/AN12042.pdf", "len_cl100k_base": 5771, "olmocr-version": "0.1.53", "pdf-total-pages": 14, "total-fallback-pages": 0, "total-input-tokens": 28529, "total-output-tokens": 6095, "length": "2e12", "weborganizer": {"__label__adult": 0.00066375732421875, "__label__art_design": 0.0007138252258300781, "__label__crime_law": 0.0006284713745117188, "__label__education_jobs": 0.0004892349243164062, "__label__entertainment": 0.00012552738189697266, "__label__fashion_beauty": 0.00034356117248535156, "__label__finance_business": 0.00029587745666503906, "__label__food_dining": 0.0006155967712402344, "__label__games": 0.0011701583862304688, "__label__hardware": 0.08953857421875, "__label__health": 0.0006742477416992188, "__label__history": 0.0004239082336425781, "__label__home_hobbies": 0.00030040740966796875, "__label__industrial": 0.0019779205322265625, "__label__literature": 0.0002276897430419922, "__label__politics": 0.0003261566162109375, "__label__religion": 0.0008649826049804688, "__label__science_tech": 0.1529541015625, "__label__social_life": 6.890296936035156e-05, "__label__software": 0.018798828125, "__label__software_dev": 0.7265625, "__label__sports_fitness": 0.000629425048828125, "__label__transportation": 0.0012359619140625, "__label__travel": 0.0002696514129638672}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 22314, 0.03461]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 22314, 0.57223]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 22314, 0.82279]], "google_gemma-3-12b-it_contains_pii": [[0, 912, false], [912, 1853, null], [1853, 4592, null], [4592, 6774, null], [6774, 9202, null], [9202, 11982, null], [11982, 13054, null], [13054, 14185, null], [14185, 16310, null], [16310, 18413, null], [18413, 20134, null], [20134, 22030, null], [22030, 22314, null], [22314, 22314, null]], "google_gemma-3-12b-it_is_public_document": [[0, 912, true], [912, 1853, null], [1853, 4592, null], [4592, 6774, null], [6774, 9202, null], [9202, 11982, null], [11982, 13054, null], [13054, 14185, null], [14185, 16310, null], [16310, 18413, null], [18413, 20134, null], [20134, 22030, null], [22030, 22314, null], [22314, 22314, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 22314, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 22314, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 22314, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 22314, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 22314, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 22314, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 22314, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 22314, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 22314, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 22314, null]], "pdf_page_numbers": [[0, 912, 1], [912, 1853, 2], [1853, 4592, 3], [4592, 6774, 4], [6774, 9202, 5], [9202, 11982, 6], [11982, 13054, 7], [13054, 14185, 8], [14185, 16310, 9], [16310, 18413, 10], [18413, 20134, 11], [20134, 22030, 12], [22030, 22314, 13], [22314, 22314, 14]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 22314, 0.16038]]}
olmocr_science_pdfs
2024-12-10
2024-12-10
fc2de00be5965cbd6f19de8b48177b6524e87f12
Enterprise Metadata Management Table of Contents Introduction ................................................................................................................................................. 2 Rochade Features: ....................................................................................................................................... 2 Rochade Strengths ....................................................................................................................................... 4 Rochade Benefits ......................................................................................................................................... 4 Rochade Solutions Overview ...................................................................................................................... 4 Rochade Metadata Management Solution Architecture .................................................................................. 5 Rochade Solution: Enterprise Architecture .................................................................................................. 6 Rochade Solution: Enterprise Transformation ............................................................................................. 7 Rochade Solution: Enterprise Data Management and Integration ..................................................................... 8 Rochade Solution: Enterprise Data Warehouse ............................................................................................. 8 Rochade Solution: Enterprise Application Portfolio Management ...................................................................... 9 Introduction Rochade manages all types of metadata, from any sources, enterprise-wide. Rochade, widely recognized as “The World’s Most Powerful Metadata Engine,” is used by some of the most demanding Global 5000 firms, as well as several large Federal Government agencies. Gartner Group rates Rochade as the technology and implementation leader in the enterprise-class metadata management repository market. Yphise, an independent, ISO-9001 software research firm, ranked Rochade as its #1 enterprise metadata management solution - the best product on the market and one in which executives can invest with confidence. Rochade is an “industrial strength” technology for managing metadata about every aspect of the enterprise: data, information, systems, applications, processes, stakeholders, infrastructure, etc. Rochade Features: - Rochade is ideally suited for integrating diverse tools, repositories and data stores feeding an enterprise metadata repository so that all metadata is managed in a cohesive manner that helps ensure integrity and consistency. - Rochade is unique in its ability to support any data type and relate anything-to-anything. This is particularly important in metadata management environments where there are a lot of relationships between objects that need to be understood from a variety of perspectives. Rochade’s metadata-focused database design enables complex relationships to be defined, managed and reported with high efficiency and performance. - As the enterprise continuously goes through change, clients are able to use Rochade to very quickly understand the impact of change as it potentially ripples through the Metadata Management Environment. This allows for environment to be easily maintained given the integrated, single point of understanding that spans the enterprise. For example, when changes are requested/recommended, architects can perform impact analysis of Repository contents to determine the scope of the change. Then they can send automatically generated messages to the “owners” or stewards of the potentially impacted objects. - Rochade is further unique in its ability to support business/technical user understanding across the enterprise by providing a customizable abstraction layer on top of the repository they can use to find information using the business/technical context they are familiar. Users never need to know they are interfacing with a repository, which not only empowers these users, but also removes some support burden from the IT staff. It’s not uncommon for Rochade customers to have thousands of business users interfacing with the product. - Rochade’s web-based interface supports full role/permission-based read and write access to the repository opening up many options for updates and other work to be easily accomplished from any web browser. - Business reports are a key element of an environment, and Rochade’s user interface has been built to support business as well as technical users. It supports the setting of a preference allowing business users to see business definitions and technical users to see technical definitions of the same item. This means that the understanding of definitions, relationships, and audit trails, etc. can be exploited by the whole organization, rather than just IT. - Rochade also has all the capabilities to create and publish scorecards or metrics. As an example, our customers in the healthcare area use Rochade to provide standard quality metrics to address internal and external performance measures reporting as required by the National Committee of Quality Assurance (NCQA). The Health Plan Employers Data and Information Set, (HEDIS®), is designed to help employers evaluate and compare health plans and related offerings through a set of predefined performance measures addressing the quality of care; member access and satisfaction; membership... and utilization; and related information for healthcare providers and/or insurers. The extensibility of the Rochade platform provides an excellent environment for managing these types of measures. Below is the technical architecture of our proposed Rochade repository solution. More detailed information is available at [http://www.rochade.com](http://www.rochade.com). **Figure 1 -- Rochade Product Architecture** Rochade can capture, store, configure, and **integrate** metadata from multiple sources. It can also disseminate metadata reports and models to consumers and applications in formats customized to individual needs and perspectives. Rochade can be deployed using central, distributed and federated architectures. Rochade effectively **governs** and facilitates data and information management processes. The Rochade repository acts as the "data authority" and proactively monitors data quality before, during, and after ETL (extraction, transformation, and load) and information delivery. Rochade also provides structure and standards for information delivery. This benefits key decision-makers by increasing their level of confidence in the information they use for enterprise management. Rochade’s metadata repository becomes the single “**version of truth**” every enterprise data element (including attributes and relationships). It can track each data element from its source application to its use(s) in data warehouse reports and portals. In fact, the Rochade repository can also manage portal, data warehouse and data mart models. Rochade lets you **integrate** metadata from a variety of different tools, languages, data base management systems, and infrastructures. This **flexibility** is due, in part, to the ability to exchange metadata via XML/XMI along with extensive busses and scanners. Rochade can even be configured to automatically “harvest” metadata from tools, databases and other repositories at regular intervals. Rochade provides complete end-to-end data **visibility** and the ability to perform multi-dimensional impact analysis. The Rochade Environment supports **multiple hierarchies** and networks of metadata defined and related - “anything-to-anything” **Rochade Strengths** - Can be tailored to your vision and needs - Metadata management functions include versioning, impact analysis, project management, linking and discovery - Can be implemented across multiple infrastructures - mainframe, client-server, PC - Provides “intelligence community” levels of security - Interfaces with numerous metadata sources “out-of-the-box” and creating new interfaces is simple - Has open APIs (Java, XML, etc.) for integrating with other applications - Access to the contents of Rochade’s metadata repository is both client-server and web based. - Access is role-based - different sets of users can have different views and graphical interfaces - Excellent built-in reporting capabilities are enhanced by the ability to export repository content to other reporting applications - Modular, scaleable and extensible - grows with you - Product development and management is backed by depth of Allen Systems Group - ASG provides just-in-time and just-enough training including web-enabled training management - 24-hour hotline and global technical support - Established user groups **Rochade Benefits** - Reduced cost and time involved in metadata change process. Impact analysis reports enable stakeholders and stewards to thoroughly understand the effect of proposed changes to the all environments and help control the effect of these changes. - Reduced cost of new systems integration and development by storing documentation on the data transformation rules, data sources, data structures and type of data. Rochade is critical, because without the repository this information may be scattered throughout the organization or may reside only in staff memory. - Promotion of information standards that allow for better data standardization, sharing, and reuse. - Management of data as a strategic asset. Rochade can help ensure data is relevant, pertinent, and understood by everyone and delivered in a timely, correct, consistent, and usable manner. **Rochade Solutions Overview** Rochade customers use its unique capabilities as part of their solutions for wide range of business problems. Some examples are: - Enterprise Architecture (integrating tools, methodologies, and frameworks) - Enterprise Transformation (managing change) - Enterprise Data Integration (information asset management, data interoperability, XML management) - Enterprise Data Warehouse (strategic information management) Enterprise Metadata Management - Enterprise Application Modernization (evolution, replacement, reengineering) - Enterprise Application Management (operational programs, objects, components, services) These solutions range from strategic and conceptual enterprise-wide to project-based and technical. Rochade is unique in its ability to not only support all of these solutions (and others), but also support them all at the same time. Figure 2 -- Rochade Solution Architecture **Rochade Metadata Management Solution Architecture** The basis for Rochade’s flexibility and capability is its solution architecture - illustrated in Figure 2. Every metadata application/solution is supported by a methodology or process that defines the workflow, task structures and deliverables for implementing metadata management within application. Rochade supports and facilitates any methodology. Regardless of the solution or methodology, metadata are typically represented by “models,” which are created using “modeling techniques.” In many cases the models are the metadata. Rochade concurrently stores many types of models, built using multiple tools, in multiple notations. Many Rochade clients even use Rochade to transform model content from one technique/notation/tool to another. All metadata in Rochade is managed and integrated by means of a repository schema or meta-model, called a repository information model (RIM). A RIM is internally coherent, infinitely extensible, and broadly transformable into natural, graphical, or machine languages of choice. Rochade has the unique capability to have multiple RIMs, representing physical, logical, and conceptual perspectives of metadata, coexist in the same repository. Not only can they coexist, the can be linked to one another in multiple ways; e.g., point-to-point, hierarchy, network, concentric, etc. Metadata defined by the repository meta-model(s) may be periodically harvested from a wide variety of sources and physically stored in the repository. Rochade has many “out-of-the-box” interfaces to databases, tools, data stores and other products. It is also quite simple to develop customized interfaces using one of the Rochade API’s. Metadata may also be accessed directly and immediately if API’s exist in the target technology - and the metadata can even be re-exported in “round-trip” processes where appropriate. “Built in” repository functions are powerful and robust and designed to handle vast quantities of metadata, harvested from multiple sources, linked in scores of ways, all while administering and maintaining security, versions, configurations, and user interfaces. Described below are many of the metadata-intensive solutions for which Rochade is the key enabling and facilitating technology. **Rochade Solution: Enterprise Architecture** Every Enterprise Architecture (EA) will eventually reach a level of maturity and complexity that requires a repository-based EA environment integrating EA tools, frameworks, methodologies, models, and artifacts. Rochade lets you manage models and artifacts from multiple EA frameworks and methodologies - even in the same repository. This allows you to manage the artifacts of your methodology along with any other. Most EA frameworks provide structure but not process (or methodology). Rochade supports both. Rochade allows all EA artifacts, models and model elements to be linked to one another. These relationships form the basis for work product production and provide the ability to trace requirements and business rules, from strategic to implemented, in an “adaptable” EA. These links also allow detailed impact analysis as part of an enterprise change management program. Rochade provides the ability to integrate and manage multiple hierarchies of models. This means that the EA models for an enterprise and all its subordinate elements can be managed both independently and interoperably. Figure 3 -- Rochade EA Environment -- illustrates the major components of a Rochade-powered EA environment. The Rochade EAE is ‘tool agnostic’; i.e., any tools used to create and modify EA artifacts can be seamlessly integrated into the environment. The Rochade EAE facilitates capturing, storing, integrating, managing, and disseminating complex information, including EA artifacts, from multiple sources, internal and external. Consumers are able to see at a glance what artifacts are available, when they were captured/versioned, and how they are related. They are also able to see both simple and complex artifacts in a form and format with which they are familiar. The figure further illustrates access to the same EAE repository content using either a Federal Enterprise Architecture Framework (FEAF) view or a Department of Defense Architecture Framework (DoDAF) view. Enterprise transformation is an imperative today, when adaptability, mobility, and swiftness of response to competitive pressures and changes in customer expectations are mandatory. At the same time, enterprises are becoming much more complex, from both the organizational and information technology perspectives. Bringing order to this chaos is what enterprise transformation is all about. The key to establishing order is to get control over the metadata that defines the enterprise. This requires an industrial strength metadata repository with built in features including metadata harvesting technology, version control, impact analysis of changes, security, and integration, in a word: Rochade. Figure 4 -- Enterprise Transformation Environment - illustrates the various elements that are typically involved in enterprise transformation. You’ll note that this activity encompasses all the other solutions described in this document plus a number of others. Rochade Solution: Enterprise Data Management and Integration Over the last 10 years, CIO’s have invested heavily in targeted data management-related technologies: database management systems, data dictionaries, data warehouses, data marts, data cleansing software, knowledge management systems, knowledge gardens, digital libraries, information architectures, intranet portals, XML registries and the like. Yet, while each of these investments is intended to transform data into a true enterprise asset, none of the technologies, by itself, is robust enough to bring it all together. In fact, many of the technologies only make the problem worse by creating even more “islands” or “silos” of data and metadata. Often this is because decisions concerning data management are made by “technologists” and not by the individuals who have an enterprise view of the value and need for data. The result is that while a particular business area or technical solution may be satisfied with their data management solutions, the enterprise prays for enterprise-wide data integration. The prayer can only be answered by getting control over enterprise metadata, and that requires an enterprise-class technology such as Rochade. In most enterprise information environments, metadata is used both within an application and between applications. There is little difficulty with metadata management when the metadata is homogeneous - that is, it is created and managed by a single application or by software from a single vendor - and any tool will suffice. When an enterprise has complex, heterogeneous metadata, an “industrial strength” solution is necessary. Integration of data from multiple sources requires rigorous attention to the metadata and business logic that populated the source data elements. Rochade becomes the heart of an enterprise metadata management environment, which is the key to enterprise data and information integration and management. All metadata, no matter where it comes from or where it is used is managed using Rochade. Rochade is both the source and target for tools that create and need metadata. Rochade Solution: Enterprise Data Warehouse Metadata management is a critical enabler and complimentary technology for data warehousing. Maintaining high data quality can be the single most difficult problem facing your data warehouse engineering and implementation activities. Rochade serves as the “data authority” and can proactively manage quality during all processes, particularly extract, transform and load (ETL) and reporting. The result is an increase in data integrity that benefits key decision-makers by increasing their level of confidence in the information they use for enterprise management. One of the most important parts of a Data Warehouse is its metadata — or contextual information that describes the structure, relationships and contents of enterprise data. Also called Data Warehouse architecture, metadata is integral to all levels of the Data Warehouse, but exists and functions in a different dimension from other warehouse data. Metadata that is used by Data Warehouse developers to manage and control Data Warehouse creation and maintenance resides outside the Data Warehouse. Metadata for Data Warehouse consumers is part of the Data Warehouse itself and controls access and analysis of the Data Warehouse contents. To a Data Warehouse consumer, metadata is like a “card catalog” to the subjects available. Data warehouse engineering is easier and less costly when based upon an accurate architectural model of the enterprise – this too is metadata. Further, a data warehouse is easier to use and consistently produces desired outcomes when decision-makers have access to enterprise metadata that accurately reflects enterprise infrastructure. As with previously described solutions, Rochade is the heart of the Data Warehouse Environment. It is the integrating technology that allows all DW engineering tools to work together and provides visibility to all DW metadata (including processes, strategies and metrics) from a single “source of truth.” Most enterprise data warehouses fail because data is not traceable for initial source to ultimate report or because the data is not understood or is of poor quality. Lack of content credibility will kill a DW. Rochade provides traceability, credibility, and comprehension. This solution also applies to other “strategic information management” activities such as Enterprise Information Portals, Business Intelligence, Knowledge Management, Executive Information Systems, and Decision Support Systems. **Rochade Solution: Enterprise Application Portfolio Management** Most enterprises recognize that the majority of IT problems stem from legacy applications that don’t work together, create too much data and not enough information; create incompatible and incorrect data; and have excessive maintenance costs. Correcting these problems, while capitalizing on existing assets, requires application portfolio management. Rochade provides the ability to manage applications across the enterprise by linking strategic requirements and priorities with applications in both legacy and modernized environments. The result is streamlined, non-redundant, architecture-driven application portfolio management to meet current and future business needs. Figure 7 -- Rochade Enterprise Portfolio management Environment A Rochade-powered application portfolio management environment is a tool suite that supports the entire portfolio management life cycle. Enterprise application portfolio management solutions differ from enterprise to enterprise depending upon their business requirements, the nature and seriousness of their problem, and the skills and availability of their staff. Most variations include the following activities: - Reverse engineer existing applications and databases to document and model the existing application architecture (it exists whether or not it is documented) - Define and model business information and data requirements (current and future) - Define and model business functional requirements (current and future) - Compare application architecture models with requirements and perform gap analysis - Choose appropriate portfolio management and integration method(s) - Integrate current applications (data and function) that meet requirements - Reengineer using new technologies - Remove redundant and unnecessary applications - Develop or purchase applications to meet new/changed requirements A Rochade-powered application portfolio management environment allows enterprise needs and measures to be linked directly to a strategic information model, enterprise data dictionary, legacy database models, data integration and transformation process models, and data warehouse and data mart database design models -- all in a single repository. The result is a detailed enterprise architecture composed of enterprise metadata artifacts. Using the architecture as the blueprint for application portfolio management enables consistently successful development or acquisition and implementation of high-quality enterprise applications. It also allows quick reaction to changes in environment, policy, or customer requirements. In addition, Enterprise Application Portfolio Management consistently allows quality information systems to be developed from quality software components. Quality information systems are more than just error-free code. They also have the following characteristics: - Support Enterprise Strategic Objectives - Meet Business Area Requirements • Are Reliable, Flexible, and Scaleable • Share Corporate Data and Standards • Built from Reusable Components • Delivered On Time and On Budget This solution involves Rochade and its companion product, becubic. As with other solutions, Rochade serves as the repository for all strategic and tactical metadata related to applications, their architecture and their components. In addition, becubic provides the capability to capture and manage detailed operational metadata about the applications, their environment, and their relationships. Figure 8 – Rochade & becubic becubic collects, parses, and manages large numbers of programs and data sources (databases as well as other file structures) at a very detailed level. It is packed with special capabilities to support sophisticated GUI presentation and flexible query functions in order to be a very capable analysis, and programming tool. Rochade is an extremely versatile global metadata repository capable of collecting, parsing, and managing large amounts of metadata artifacts from a wide variety of sources. It provides support for many open APIs (C, Java, XML, REXX) to allow anyone to import any metadata from anywhere. It provides a flexible user interface for representing this information (in various forms) to a wide variety of users (Business and IT). Although Rochade also captures metadata from programs (which may seem to overlap with becubic), it does so at a higher level (understanding data dependencies and relationships between program/databases without referencing their implementation details) versus at a line of code level. Related to standard UML modeling concepts, Rochade would be more apt to provide views of UML diagrams to a planned specification level, while becubic would additionally drill down to implementation and even deployment details. In fact, becubic can actively discover deployed implementations of code and data by server and record these discovered details as traceable history. For those instances where appropriate, becubic and Rochade can exchange/link metadata to provide a complete path of metadata from the Rochade global view drilled down all the way to an becubic program line of code reference. We can do this with XML/XMI, or with plug-ins. This allows (typically architectural-level) metadata to be exchanged from becubic to Rochade, and to drill down from a planned architectural specification in Rochade to the corresponding implementation in becubic. There are a number of solutions that becubic can support independently. These include: - Application Discovery and Understanding - Service Oriented Architecture - XML Registry - Quality Software Engineering The becubic solutions are documented in another ASG paper. The Rochade/becubic solution wheel represents the ASG strategy for integration of the two products.
{"Source-Url": "http://sitav.co.il/Resources/Enterprise_Metadata_Management.pdf", "len_cl100k_base": 4627, "olmocr-version": "0.1.50", "pdf-total-pages": 14, "total-fallback-pages": 0, "total-input-tokens": 27033, "total-output-tokens": 5174, "length": "2e12", "weborganizer": {"__label__adult": 0.00036978721618652344, "__label__art_design": 0.0008835792541503906, "__label__crime_law": 0.0006384849548339844, "__label__education_jobs": 0.0012111663818359375, "__label__entertainment": 0.00012302398681640625, "__label__fashion_beauty": 0.00019419193267822263, "__label__finance_business": 0.01378631591796875, "__label__food_dining": 0.00034117698669433594, "__label__games": 0.0006761550903320312, "__label__hardware": 0.00115966796875, "__label__health": 0.00036787986755371094, "__label__history": 0.000293731689453125, "__label__home_hobbies": 0.00015163421630859375, "__label__industrial": 0.001224517822265625, "__label__literature": 0.00027942657470703125, "__label__politics": 0.00026607513427734375, "__label__religion": 0.000339508056640625, "__label__science_tech": 0.024200439453125, "__label__social_life": 0.00010383129119873048, "__label__software": 0.205810546875, "__label__software_dev": 0.74658203125, "__label__sports_fitness": 0.0002052783966064453, "__label__transportation": 0.0004394054412841797, "__label__travel": 0.00022411346435546875}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 26388, 0.00215]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 26388, 0.11419]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 26388, 0.89345]], "google_gemma-3-12b-it_contains_pii": [[0, 31, false], [31, 1654, null], [1654, 5549, null], [5549, 7753, null], [7753, 10191, null], [10191, 12048, null], [12048, 14989, null], [14989, 15952, null], [15952, 18411, null], [18411, 21018, null], [21018, 23550, null], [23550, 25828, null], [25828, 26388, null], [26388, 26388, null]], "google_gemma-3-12b-it_is_public_document": [[0, 31, true], [31, 1654, null], [1654, 5549, null], [5549, 7753, null], [7753, 10191, null], [10191, 12048, null], [12048, 14989, null], [14989, 15952, null], [15952, 18411, null], [18411, 21018, null], [21018, 23550, null], [23550, 25828, null], [25828, 26388, null], [26388, 26388, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 26388, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 26388, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 26388, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 26388, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 26388, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 26388, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 26388, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 26388, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 26388, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 26388, null]], "pdf_page_numbers": [[0, 31, 1], [31, 1654, 2], [1654, 5549, 3], [5549, 7753, 4], [7753, 10191, 5], [10191, 12048, 6], [12048, 14989, 7], [14989, 15952, 8], [15952, 18411, 9], [18411, 21018, 10], [21018, 23550, 11], [23550, 25828, 12], [25828, 26388, 13], [26388, 26388, 14]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 26388, 0.0]]}
olmocr_science_pdfs
2024-11-30
2024-11-30
20a721eb7ccdc4af9f3554e2bda676c834166328
A programmable client-server model: Robust extensibility via DSLs Charles Consel, Laurent Réveillère To cite this version: HAL Id: hal-00350051 https://hal.archives-ouvertes.fr/hal-00350051 Submitted on 5 Jan 2009 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 Programmable Client-Server Model: Robust Extensibility via DSLs Charles Consel Laurent Réveillère INRIA/LaBRI ENSEIRB 1, avenue du docteur Albert Schweitzer, Domaine universitaire - BP 99 F-33402 Talence Cedex, France E-mail: {consel,reveillere}@labri.fr Abstract The client-server model has been successfully used to support a wide variety of families of services in the context of distributed systems. However, its server-centric nature makes it insensitive to fast changing client characteristics like terminal capabilities, network features, user preferences and evolving needs. To overcome this key limitation, we present an approach to enabling a server to adapt to different clients by making it programmable. A service-description language is used to program server adaptations. This language is designed as a domain-specific language to offer expressiveness and conciseness without compromising safety and security. We show that our approach makes servers adaptable without requiring the deployment of new protocols or server implementations. We illustrate our approach with the Internet Message Access Protocol (IMAP). An IMAP server is made programmable and a language, named Pems, is introduced to program robust variations of e-mail services. Our approach is uniformly used to develop a platform for multimedia communication services. This platform is composed of programmable servers for telephony services, e-mail processing, remote-document processing and stream adapters. 1. Introduction The client-server model is a software architecture commonly used to support a family of services in the context of a distributed system. A server implements a set of services. Clients, connected to the server’s system with a network, send requests to access these services. When the server has processed a request, it sends a response to the correspond- 1.1. Why is the Client-Server Model Limited? Although successful, the client-server model is limited in that it offers little, if any, sensitivity to the client needs and requirements. Indeed, in this model, the server consists of a fixed implementation of a set of services which greatly limits its ability to adapt to a client. Let us review instances of this insensitivity and illustrate them with the IMAP case. • **Insensitivity to client terminal capabilities** (e.g., audio, video, computing power, energy consumption, ...). Insensitivity to the display capabilities of the client terminal may cause the server to deliver inappropriately formatted data to the client. For example, a colored message body, sent to a black-and-white display, is a waste of bandwidth and computing power. • **Insensitivity to network features** (e.g., available bandwidth, billing policy, ...). Insensitivity to network bandwidth makes it impossible for the server to adjust the volume of information sent to the client when needed. For example, when the available bandwidth is low, a high-quality audio file (e.g., 16-bit stereo sampled at 44.1 kHz), attached to a message, should be degraded to avoid overloading the network. • **Insensitivity to client preferences**. This insensitivity causes all clients, regardless of their client terminal, to have the same view on their mailbox. For example, when a client wants to access the messages of a mailbox, the server sends an exhaustive summary of all messages. There is no mechanism to minimize this summary with respect to some user-defined filters when this request comes from a client terminal with limited capabilities (e.g., a cell phone). • **Insensitivity to rapidly evolving market needs**. Fierce competition among telecommunication companies and hardware manufacturers, compounded with highly volatile user trends, should result in rapid service development and deployment. However, the services offered by a server are frozen by a protocol and thus cannot keep pace with market opportunities. As illustrated by the IMAP case, the insensitivity of the client-server model can be a major limiting factor for its applicability to fast changing requirements and needs. This insensitivity has long been identified and solutions has been proposed. The first common approach to remedy this deficiency consists of customizing an existing protocol with respect to the requirements of a new usage context. This approach leads to a proliferation of protocols which causes obvious compatibility problems. Consequently, it works against major standardization efforts most notably made by the telecommunication and networking communities. Recent protocols, like RTSP [25], and new versions of traditional ones, like HTTP/1.1 [10] acknowledge the fact that a protocol should cope with evolving needs and that it should be sensitive to client requirements. Their strategy to address this issue mainly consists of offering three possible extensions: new headers in requests/responses, new error codes and, new requests. Again, this strategy defeats the idea of standardizing interactions between a server and, independently developed, clients. Besides, it is a server-centric approach whereas adaptability often needs to be defined with respect to the client. Another approach consists of enabling code to be introduced on the server side in the form of scripts (e.g., CGI scripts [4]) parameterized with respect to some client data. Again, this strategy is server-centric because scripts can only be introduced by the server administrator. Consequently, it is limited to the scope of adaptability foreseen by the owner of the server. An alternative aims to leave the server unchanged but to rely on the client to adapt its behavior to the needs and requirements of the user. In this strategy the server remains insensitive to the client, with the drawbacks mentioned earlier; the client devotes computing power and time to adjust to the user’s needs. This strategy is illustrated by the latest version of Mozilla (version 1.3 Alpha) [16] where messages are being processed locally to fit the client preferences. A related approach consists of introducing a proxy server that runs client scripts and invokes the unchanged server. Because the client scripts are *a priori* untrusted by the server administrator, the proxy needs to run as a different process, or even, on a different machine. In this context, not only does a request trigger computations in the server, but it also requires the proxy to execute the client script to process the response. In addition, if the proxy and the server run on different machine, they consume bandwidth to communicate. None of the above approaches satisfactorily allow client needs and requirements to be propagated to the server. They are limited to addressing the needs and requirements expected by the protocol developer. 1.2. Our Approach To make the client-server model sensitive to client requirements and needs, we propose to make the set of services supported by a server programmable. To do so, our strategy consists of enabling a client (or a third-party developer) to provide the server with a specific implementation for the processing of a request. By varying the implementation of a request, one can vary the definition of a specific service. As an example, in the IMAP case, a client could re- define the request aimed to list the messages of a mailbox to only report on the ones coming from a particular domain, so as to minimize the volume of information. Yet, providing arbitrary implementations for a request obviously compromises the robustness of the server: one could attempt to upload erroneous, inappropriate, or even, malicious implementations. To alleviate these risks, we propose to introduce a service-description language to specify new services. Following the generative programming approach [8], service implementations are automatically generated from their description. A service-description language is a domain-specific language (DSL) in that it offers appropriate abstractions and notations, and it is restricted such that critical properties can be checked [6]. Indeed, making specific properties decidable is a key parameter in the design of most DSLs. Examples of DSL properties include linear usage of resources [18], termination [6], and deadlock-free schedulers [3]. These properties often go beyond the scope of general-purpose checking techniques, whether dynamic, such as sand-boxing [29], or static, such as type checking [1]. Because such properties are undecidable in general, in the context of general-purpose languages (GPLs), both static and dynamic program analysis produce unpredictable results. DSLs have been studied in the context of various application domains for many years and have shown benefits in terms of expressiveness, conciseness, safety and performance [28]. We argue that, just like DSLs are a well-recognized solution to address families of programs [6, 28], they can be uniformly used to model families of services with similar benefits. We propose a systematic approach to making servers programmable. This approach is based on a software architecture for servers where each request is a potential point at which programmability can be introduced. The scope of programmability corresponds to the scope of the services which can be designated. Some properties, critical to a family of services, can be guaranteed by definition of the DSL (e.g., termination and predictable resource usage). 1.3. Contributions Most families of services are bound to evolve, often rapidly and unpredictably in emerging domains such as multimedia communications. To address this key issue, our contributions can be summarized as follows. - We identify where the client-server model can be made adaptable, namely, in the treatment of requests. This choice is motivated and illustrated. - We demonstrate that making requests programmable allows a service to adapt to unforeseen needs and requirements, without deploying new protocols and server implementations. - We show that DSLs enable server programmability to be controlled and disciplined without compromising robustness. - We illustrate our approach with the IMAP protocol and an IMAP server. The server has been modified to make it programmable; new services are safely defined in a DSL called Pems. - Finally, we argue that combining programmable servers leads to rich, yet robust services. This combination is illustrated by the IMAP programmable server combined with a new server aimed to process documents remotely. Our approach is uniformly used to develop a platform for multimedia communication services. This platform, named Nova, consists of programmable servers to define telephony services, e-mail services, remote-document processing services, and stream adapters. Overview Section 2 introduces the notion of a programmable client-server model. Section 3 describes how to develop a programmable server from a given protocol. Section 4 shows how it scales up to a complete platform for communication services. Section 5 assesses our approach based on some experimental data collected in the context of the IMAP case. Section 6 gives concluding remarks and discusses future work. 2. The Programmable Client-Server Model: What In this section, we present the main stages of our approach to introducing the notion of programmability in the client-server model. In this approach, a developer first determines variations for the family of services underlying a protocol definition. Then, he studies the mapping of the identified variations into the protocol by determining where programmability requires the protocol to be generalized. 2.1. Service Variations This study of service variations is done from the client’s viewpoint, to address his needs and requirements. A starting point consists of collecting existing variants of a protocol and integrating them as variations of generic services. A complementary strategy aims to extrapolate on technological evolution. Yet, in contrast with protocols, our approach is not aimed to exhaustively determine potential variations. Rather, it delimits a scope of variations. Specific points within this scope will later be designated by particular DSL programs. In the IMAP case, our goal is to identify a set of variations characterizing a scope of customized accesses to a mailbox. We explore these variations systematically by considering the various levels involved in accessing a mailbox, namely, an access-point, a mailbox, a message, and its fields (i.e., message headers and parts). At each level of this hierarchical schema, we study what programmability could be introduced. We refer to the programmability of each level as a view. - At the top-level, an access-point view should define coarse-grained parameters such as the client terminal features, the characteristics of the link layer, and a mailbox view. - A mailbox view should enable one to only consider messages which go through a user-defined filter. This should prevent information from flooding a limited client terminal. Each retained message should be assigned a message view for further customization. - A message view should define the layout of a message, that is, the fields involved in a message. It should drop fields that are irrelevant with respect to a given message view. Each retained field should be assigned a field view for specific processing. - A field view should define the layout of a field value, that is, the value of a message header, a message attribute or a message part (e.g., the From header, the total message size, and the message body, respectively). It should appropriately format field values with respect to the client needs and requirements. This process should include such treatments as erasing voluminous values, condensing values, and converting the format of field values. 2.2. Mapping Service Variations into a Protocol Once the variations have been identified, the protocol can be examined to determine how to map these variations into the protocol. A protocol defines the requests/responses exchanged between the client and the server. Each request is an abstraction corresponding to a given service (or a part of it). The service variations, identified in the previous phase, need to be associated with specific requests. Different kinds of association can occur between variations and requests. Let us illustrate this phase with the IMAP example. Some requests may be out of scope with regard to the service variations previously identified. For example, IMAP manages multiple mailboxes and thus offers requests (a.k.a. commands) to create and delete a mailbox. None of the identified service variations are concerned with these requests. A service variation may impact several requests. The number of recent messages, for instance, is part of the response of three requests (i.e., Select, Status and Examine). These requests are thus affected by a mailbox view since they should now only report on recent messages according to the current mailbox view (i.e., a user-defined filter). For another example, consider the Search request. It determines which messages in the currently selected mailbox match a list of criteria. Again, the message list that matches a search should take into account the mailbox view. Some service variations can in fact be considered as extensions in that they open up a new family of services within the one under study. This is the case for the field view, and more specifically, views of attachments. Here, our goal is to allow attached documents to be converted into a different format to better adapt to needs and requirements. As discussed in Section 4, this particular functionality is obtained by composing the programmable IMAP server with another programmable server dedicated to remote-document processing. After having determined the requests impacted by the service variations, we need to enable programmers to write service variations. 3. The Programmable Client-Server Model: How Enabling service variations to be introduced in a server by a client requires addressing two main issues: (1) How to easily express a variation? (2) How to preserve the integrity of the server? Both issues are addressed in this section. Additionally, the implementation of a programmable server is discussed. 3.1. DSL Design Issues (1) and (2) can be addressed by using a DSL approach. The idea is to design a language targeted toward specific service variations. The DSL should thus be concise and easy to use because of the dedicated nature of syntactic constructs and data types. Furthermore, programs in the DSL should be restricted enough to enable critical properties to be checked. In the context of the IMAP case, we have designed a DSL that enables a client to define views on a mailbox. This language, called Pems, defines views at four different levels: access-point, mailbox, message, and message field. Access-point view. A view can be defined for a type of access-point. An access-point consists of a set of parameters such as the client terminal features, the characteristics of the link layer, and a mailbox view. ``` view accesspoint PDA { Mobility = YES; Screen = 320 * 240; Color = NO; Bandwidth = 10MB/s; Mailbox_view = nomadic(1MB); } ``` The above example defines an access-point named PDA. It declares the features of the link layer and the client terminal. Also, it specifies which mailbox view to use, that is, nomadic. This mailbox view is invoked with an argument setting a size limit for filtering purposes. Note that parameters omitted in an access-point declaration are given a default value. Mailbox view. This part aims to select the messages that belong to a view. A mailbox view consists of a list of pairs condition-action, sequentially executed for a given message. ``` view mailbox nomadic(size s) { if (From == "joe@mail.fr") bind boss; if (Size > s) ignore; bind tiny; } ``` This simple example defines a view where messages coming from a given user (joe@mail.fr) are systematically retained and further processed by the bind boss view. If the message size exceeds the argument value, the message is dropped. Otherwise, the message is assigned the category tiny and gets processed accordingly. Message view. The idea is to define a set of fields, relevant to the client, for a given category of messages. Also, a view may be assigned to some fields to trigger specific treatments. ``` view message boss { From as cst("The Boss!"); Date; Subject; Body; Attachment[] as bwImages(30KB); } ``` The message view shown above consists of five fields and assigns a specific treatment to fields From and Attachment[] (via construct as); the other field values are reproduced verbatim. The treatment of the field From is defined by the view cst. It assigns the constant value "The Boss!" to the field From; its definition is omitted. The view bwImages defines the treatment of the field Attachment[]. It is parameterized with some size, and is applied to an attachment sequence, as indicated by the square brackets. Field view. It aims to convert field values into some representation appropriate to the access-point. This conversion is performed by a library of functions, each taking a value, in the original format, and producing a value in a target format. These functions are local to the server and are trusted. The example shown below includes a call to the library function blackwhite which converts a colored image into a black-and-white one. ``` view field Attachment bwImages(size s) { if (Attachment.size > s) return "Attachment too big:" + Attachment.size; if (Attachment.type in "image/.*") return blackwhite(Attachment.value); ignore; } ``` A field view is implicitly passed the value of the field. This value is accessed using the attribute value (e.g., Attachment.value). Unlike other field views, the Attachment view consists of two additional attributes, namely, size and type, to access the size and the type of an attachment, respectively. Another specific aspect of the Attachment view is that it is applied to each element of an attachment sequence of a message, as illustrated above. The return construct is invoked to conclude the treatment of this bottom-level view. 3.2. DSL Verifications Our approach assumes that service developers may not be trusted by the server. Furthermore, when the target family of services is related to the end-user, as in the IMAP case, the developer may not be an experienced programmer. As a consequence, the DSL should guarantee specific properties so as to both preserve the integrity of the server and prevent a faulty service to corrupt or destroy user data. Notice that, most of these requirements would not be achievable in the context of GPLs because of their unrestricted expressiveness [6]. This is mainly why untrusted (possibly buggy) services written in a GPL are usually executed on a remote machine and communicate with the server via the network. Let us examine the requirements imposed on a DSL both from the server’s side and from an end-user’s side. The Server Side Important requirements should be fulfilled from the server’s viewpoint. Resource usage. A DSL program should use appropriate amounts of resources like CPU, memory, storage, or bandwidth. This assumes that a DSL program terminates. Although, termination is undecidable in general, the DSL can be designed so that this property be guaranteed, as illustrated by various existing DSLs (e.g., Plan-P [27] and Devil [23, 22]). In the case of Pems, programs are guaranteed to terminate because the language does not include an iteration construct; the traversing of a sequence of attachments is performed implicitly. Bandwidth could be an issue because Pems programs build messages which are then sent by the server to the client. However, these programs can only drop message fields or transform them. The latter operation only invokes trusted primitives. Non-Interference. A DSL program should not be able to examine other users’ data or modify arbitrary files on the server. Non-interference with other aspects of the server is guaranteed by an appropriate usage of resources as mentioned above. For example, a Pems program is invoked on a specific mailbox; the only possible operations are those that select and manipulate messages. Well-Behaved. As much as possible, the DSL should enable verifications to be performed statically, at deployment time. This is to ensure that (1) programs can be run efficiently because they require a minimum of run-time checks and (2) the server execution will not be disrupted by repetitive crashes of programs. The End-User Side Two main requirements are needed from the end-user’s viewpoint. Well-Behaved. Like the server, the end-user needs the DSL program to be checked statically, as much as possible. However, the reason is different: an ill-behaving program may, in general, corrupt or lose his data. Because a program cannot be checked against the programmer’s intention, misbehavior may not always be detected. Nevertheless, in designing a DSL, special care can be taken to appropriately restrict the semantics of some constructs, or require the programmer to supply extra declarations at some critical places. In designing Pems, we have paid attention to expressions selecting messages and the operations dropping fields. If misused, these aspects may overly filter out too many messages or drop too many fields. Confidentiality. DSL programs may expose user preferences and possibly other confidential information. Consequently, the deployment process should be secure. Furthermore, it should be ensured that only the end-user (or some authorized administrator) can modify the services of an end-user. To do so, standard encryption and authentication techniques can be used. 3.3. Programmable Server Implementation This section discusses approaches to implementing a DSL and presents a strategy to deploy services. DSL Implementation There are two main approaches to implement a DSL: interpretation or compilation. As discussed in Consel and Marlet [6], developing an interpreter is the easiest approach. Furthermore, it is known to be flexible, which is a key aspect when prototyping languages. However, interpretation entails a run-time overhead which may be incompatible with performance requirements of the target domain. Traditional compilation techniques are applicable to DSLs. In fact, DSL features can even enable drastic optimizations, not possible in a GPL, and lead to better performance than equivalent programs written in a general-purpose language [9]. An hybrid approach may be used in specific cases, as advocated by Thibault et al. [26]. This approach relies on program specialization to remove the overhead incurred by the use of an interpreter [17]. The idea is to customize the interpreter for a given DSL program. Interestingly, specialization can occur at both compile time and run time [7]. The latter case is useful in application domains where services need to be changed frequently, calling for the use of an interpreter, at the expense of performance. This conflict between flexibility and performance can be solved by using some sort of just-in-time (JIT) compilers. Thibault et al. demonstrate that the effect of a JIT compiler can be achieved by specializing an interpreter at run time. The implementation of Pems is traditional; it consists of a compiler and a run-time system. The compiler is a program generator that takes a Pems program and performs a number of verifications to fulfill the requirement on both the server and client sides, as discussed in Section 3.2. Then, it generates a C program corresponding to the implementation of the user-defined services. This code will be loaded in a server when needed, as explained below. This implementation strategy is chosen because it is assumed that users will not define new services frequently. Consequently, deploying new services may consist of a thorough static processing. Service Deployment Whether interpreted or compiled, new services can be safely and efficiently executed directly in the programmable server, provided the DSL has been suitably designed and implemented. A remaining key issue is the binding of new services to a particular context. Indeed, the programmable server should be sensitive to such contextual aspects as the client terminal capabilities and the network features. To address this issue our approach consists of grouping these contextual aspects under the notion of access-point; a set of services is defined and tuned for a particular access-point. Yet, we need a mechanism to bind an access-point to a particular user context so as to invoke the appropriate set of services. To do so, we use the Session Initiation Protocol (SIP) [13]. This protocol is a client-server signaling protocol, mostly known for Internet telephony. It allows a user to establish his presence and location via the so-called registrar server. In our approach, an extra parameter is added to the registration process, to indicate the particular access-point to be considered for each programmable server. When a programmable server initiates a session with a user, it looks up its access-point at the location server. Note that this server was originally limited to storing the current location of a user. In the context of the IMAP case, the Pems compiler produces an implementation of services for each access-point defined in a Pems program. Each implementation is registered in the programmable IMAP server under a particular access-point. To start a session, a wrapper of the IMAP client first contacts the location server to obtain the user’s current access-point, in addition to enough information for the user to log into the server. It communicates this information to the programmable IMAP server so that the server can activate the appropriate set of services for the user’s requests. Finally, the wrapper of the IMAP client invokes a standard IMAP client to access the mailbox. As discussed previously, programmability of the server has no impact on the client: its implementation is unchanged. In the Nova platform, we use an IMAP client named Althea that is well-suited for embedded systems. 4. Scaling Up The Programmable Client-Server Model An important issue to cover is whether our programmable client-server model scales up. Let us address this issue by studying how programmable servers compose on a concrete case, and by presenting the families of services we tackled in the context of the Nova platform. 4.1. Composability When developing a software system, a programmer typically delegates some treatments to specific software components. Similarly, when developing a programmable server, one would like to delegate a sub-family of services to the appropriate programmable server, if there exists one. One instance of this situation occurred while developing the Nova platform. We independently developed a programmable version of the IMAP server and a new programmable server for remote-document processing (RDP). The latter server, and its underlying protocol, aim to enable a user to define a variety of transformations on a remote document before redirecting it to some physical or virtual output device, called a sink. Such a server is particularly useful to adapt the format of remote documents to a limited access-point. As a simple example, a user can define a service to transform a Word document into a black-and-white PDF file so as to display it on a terminal that neither runs the Word processor nor offers a color screen. Another example consists of converting a text document into an audio file which is then played on a cell phone. Notice that, we have developed this last example and actually combined RDP with yet another server to stream the audio file. This strategy avoids uploading the audio file in the cell phone and incurring some latency. An RDP program consists of conversion rules and sinks. Conversion rules describe a graph of format conversions, whose nodes are formats (e.g., PDF and Postscript) and whose edges are primitives performing conversions. Sinks are output devices, either physical (e.g., a Fax machine and a printer) or virtual (e.g., a Web site). Sinks are defined by a number of attributes such as the input format they require. In the example of audio files mentioned above, the streaming server is defined as a sink. When developing the programmable version of IMAP, we realized that it could use the RDP server to process documents attached to a message, and thus, further adapt e-mail processing to the access-point. To combine both servers, a clause devoted to document processing is introduced in the Pems language. Specifically, the field view of attachments includes a clause defining conversion rules applicable to the attached documents. To account for this coupling of programmable servers, we modified the Pems compiler to process the new clause and to generate an RDP program. Furthermore, we added to the deployment process of a Pems program, the ability to deploy a RDP program. 4.2. The Nova Platform We have developed a programmable platform for multimedia services, named Nova. This platform enables networking and telecommunication experts to quickly develop robust multimedia services. It consists of a programmable server and a DSL for each target application area. Four application areas are currently covered by Nova: e-mail processing (Pems), remote document processing, telephony services, and stream adapters. Let us briefly present the last two application areas, not discussed yet. Telephony services are built upon the SIP signaling platform. We have designed a dialect of C program to call processing services. In contrast to the XML-based language called CPL, developed by Rosenberg et al. [24], our DSL is a full-fledged programming language based on familiar syntax and semantics. Yet, it conforms with the features and requirements of a call processing language as listed in the RFC 2824 [12]. In fact, our DSL goes even further because it introduces domain-specific types and constructs that allow verifications beyond the reach of both CPL and general-purpose languages. Once a session is initiated, audio communication is ensured by an appropriate tool such as the Robust Audio Tool (RAT) developed by UCL [15]. The other application area covered by Nova is stream adaptation. We have developed a language aimed to specify multimedia stream processing, named Spidle [2]. This language is used to program a server that adapts a stream to particular features of a target access-point like terminal features and the link reliability. This programmable server is a useful building block to develop other multimedia services as illustrated by the RDP server converting a text document into an audio file and piping to the streaming server to be played to the user. The client terminals used in the Nova platform are IPaq Personal Digital Assistants with a Wi-Fi connection to an IP network. Various services have been developed for the four application areas covered by the platform. 5 Assessment In this section, we consider the programmable version of the IMAP server to assess our approach. To do so, we studied both the server and the client side. On the client side, we assessed the benefits of some scenarios of customized accesses to a mailbox. We measured a key quantitative benefit, namely, the reduction in size of the messages fetched by the client (e.g., to cope with a limited bandwidth). The choice of these scenarios is obviously subjective, therefore we tried to cover various situations that introduce different degrees of adaptation. Running these scenarios, we observed reduction factors in the server responses that range from 15 to 40. As such, these Pems programs illustrate how much can be gained by defining simple adaptation strategies, concisely expressed in a DSL. On the server side, our assessment aims to determine the overhead of running Pems programs. To do so, we wrote Pems programs to implement the following scenarios of customized accesses to a mailbox. **Trivial.** This scenario corresponds to a trivial identity function: it unconditionally keeps all mailbox messages. This Pems program makes it possible to measure the overhead of programmability in our IMAP server. **Complex.** This scenario also keeps all mailbox messages but, before doing so, it performs 100 operations on each message. As such it gives us some kind of upper bound on the complexity of Pems programs. **Misc.** We consider a set of scenarios defining various adaptation strategies and compute an average of their execution time. We measured the total execution time of the programmable server running the above Pems programs, including loading the Pems program, selecting the mailbox and fetching all message headers in a mailbox. We compared these execution times to those of both the original IMAP server and a proxy-based programmable IMAP server. The latter server is an IMAP programmable server accessing mailboxes via requests to the original IMAP server. As such this strategy mimics a situation where programmability relies on untrusted scripts and thus requires the server to run in a separate process, or even a separate machine. The execution times are shown in Figure 1. As can be noticed, the execution time of the trivial scenario is very close to the performance of the original IMAP server, indicating that programmability does not introduce much overhead. The average execution time of the miscellaneous scenarios (misc) is also very close to the performance of the original IMAP server. The complex scenario is about 2.5 slower than the original IMAP server. This may be seen as the worst possible slowdown considering the extensive number of operations included in complex. Finally, the proxy-based programmable server introduces an average overhead of 25%. It should noticed that this is the most favorable case. Indeed, user-defined scripts are usually run on a separate machine, especially if they are untrusted. This 6 Conclusions and Future Work The client-server model is greatly insensitive to client needs and requirements, in that, a server behaves the same regardless of the client’s terminal capabilities, network features, user preferences and evolving needs. To make the client-server model sensitive to clients, we have developed a methodology aimed to introduce programmability in a server in the form of a DSL. Our approach allows clients to program service variations in the server and to adapt it to their characteristics. We have designed and implemented a platform, named Nova, uniformly based on programmable servers. Nova is currently composed of four programmable servers providing service programming in telephony, e-mail, remote-document processing and stream adaptation. Nova has successfully demonstrated that our approach can capture a wide spectrum of services variations without compromising robustness. Furthermore, we showed that, once made programmable, a server can adapt to a client without requiring the deployment of a new protocol or a new server implementation. We have conducted some experiments to measure the benefits of programmable servers over existing approaches to extending servers (e.g., scripts) in terms of performance and bandwidth usage. Because DSL programs do not compromise robustness, they can be executed on the same machine as the server. Furthermore, this execution requires little, if any, run-time checks. As a result, the performance of a programmable server do not introduce any significant overhead compared to its original version, as illustrated by the IMAP case. This first step in the development of Nova has opened a number of research tracks we intend to explore. We would like to develop accurate resource usage models and analyzes supported by DSL design rules. This would be useful to introduce some admission control procedure when service variations are deployed and invoked. Resource usage would also be a useful input to some cost estimation process for service variations. Finally, there are a number of other application areas to explore in the future, including HTTP and instant messaging. These new application areas should further refine our methodology to make a server programmable and to design a DSL to program services. Acknowledgment. We thank Julia Lawall from DIKU, Valérie Issarny from INRIA and the other members of the Compose group for helpful comments and discussions on earlier versions of this paper. We also thank the anonymous reviewers for their valuable inputs. References
{"Source-Url": "https://hal.archives-ouvertes.fr/hal-00350051/file/Consel-Reveillere_ase03.pdf", "len_cl100k_base": 7715, "olmocr-version": "0.1.50", "pdf-total-pages": 11, "total-fallback-pages": 0, "total-input-tokens": 32013, "total-output-tokens": 9795, "length": "2e12", "weborganizer": {"__label__adult": 0.0002701282501220703, "__label__art_design": 0.0002834796905517578, "__label__crime_law": 0.00023746490478515625, "__label__education_jobs": 0.0004429817199707031, "__label__entertainment": 6.878376007080078e-05, "__label__fashion_beauty": 0.00011938810348510742, "__label__finance_business": 0.00025773048400878906, "__label__food_dining": 0.00023818016052246096, "__label__games": 0.0003964900970458984, "__label__hardware": 0.0013217926025390625, "__label__health": 0.0003418922424316406, "__label__history": 0.0002312660217285156, "__label__home_hobbies": 5.7578086853027344e-05, "__label__industrial": 0.00028443336486816406, "__label__literature": 0.00020492076873779297, "__label__politics": 0.0001920461654663086, "__label__religion": 0.0003833770751953125, "__label__science_tech": 0.028900146484375, "__label__social_life": 5.644559860229492e-05, "__label__software": 0.01163482666015625, "__label__software_dev": 0.953125, "__label__sports_fitness": 0.0001685619354248047, "__label__transportation": 0.0004181861877441406, "__label__travel": 0.0001747608184814453}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 44026, 0.02404]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 44026, 0.29121]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 44026, 0.89617]], "google_gemma-3-12b-it_contains_pii": [[0, 977, false], [977, 2854, null], [2854, 8250, null], [8250, 12939, null], [12939, 17884, null], [17884, 22131, null], [22131, 26879, null], [26879, 31936, null], [31936, 37186, null], [37186, 41206, null], [41206, 44026, null]], "google_gemma-3-12b-it_is_public_document": [[0, 977, true], [977, 2854, null], [2854, 8250, null], [8250, 12939, null], [12939, 17884, null], [17884, 22131, null], [22131, 26879, null], [26879, 31936, null], [31936, 37186, null], [37186, 41206, null], [41206, 44026, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 44026, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 44026, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 44026, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 44026, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 44026, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 44026, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 44026, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 44026, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 44026, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 44026, null]], "pdf_page_numbers": [[0, 977, 1], [977, 2854, 2], [2854, 8250, 3], [8250, 12939, 4], [12939, 17884, 5], [17884, 22131, 6], [22131, 26879, 7], [26879, 31936, 8], [31936, 37186, 9], [37186, 41206, 10], [41206, 44026, 11]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 44026, 0.0]]}
olmocr_science_pdfs
2024-11-29
2024-11-29
07e1d8b25ebed4b557ed9118b13a5e84a3216120
First:________________ Middle Initial: _____ Last:____________________ This is a closed book exam. You must put your answers in the space provided. You have 3 hours, so allocate your time accordingly. Please read the entire exam before starting. (4) Question 1. An embedded system will use an ADC to measure a parameter. The measurement system range is 0.0 to 199.9 and a resolution of 0.1. What is the smallest number of ADC bits that can be used? (4) Question 2. An 8-bit ADC (different from the 9S12C32) has an input range of 0 to +2.5 volts and an output range of 0 to 255. What digital value will be returned when an input of +0.625 volts is sampled? (2) Question 3. Consider the result of executing the following two 6812 assembly instructions: ldaa #160 suba #140 What will be the value of the carry (C) bit? (2) Question 4. Consider the result of executing the following two 6812 assembly instructions: ldaa #-90 adda #-40 What will be the value of the overflow (V) bit? (4) Question 5. A signed 16-bit binary fixed-point number system has a $\Delta$ resolution of 1/256. What is the corresponding value of the number if the integer part stored in memory is 1152? (hint: 1152=1024+128) For questions 6, 7 A) Software performs a read SCISR1 with bit set followed by read SCIDRL B) Software performs a read SCISR1 with bit set followed by write SCIDRL C) Hardware sets it when there is data in the receive shift register D) Hardware sets it when there is data in the receive data register E) Hardware sets it when there is no data in the receive shift register F) Hardware sets it when there is no data in the receive data register G) Hardware sets it when there is data in the transmit shift register H) Hardware sets it when there is data in the transmit data register I) Hardware sets it when there is no data in the transmit shift register J) Hardware sets it when there is no data in the transmit data register (4) Question 6. What sets the TDRE bit in the SCI? Choose a letter A-J (4) Question 7. What sets the RDRF bit in the SCI? Choose a letter A-J (4) Question 8. Assume the ADC sequence length is 3 (ATDCTL3 equals $18$) and $85$ is written into ATDCTL5. What happens? A) Channel 5 is sampled and the result is placed in ATDDR0 B) Channel 5 is sampled and the result is placed in ATDDR5 C) Channel 5 is sampled three times and the results are placed in ATDDR0-ATDDR2 D) Channel 5 is sampled three times and the results are placed in ATDDR5-ATDDR7 E) Channels 5, 6, 7 are sampled and the results are placed in ATDDR0-ATDDR2 F) Channels 5, 6, 7 are sampled and the results are placed in ATDDR5-ATDDR7 (4) Question 9. Which three events cause an interrupt to occur? Specify three letters in any order. A) The software disarms the interrupt (e.g., RTIE=0) B) The I bit in the CCR is set C) The I bit in the CCR is clear D) The software arms the interrupt (e.g., RTIE=1) E) The software acknowledges the interrupt, clearing the flag (e.g., RTIF=0) F) The software sets the flag bit (e.g., RTIF=1) G) The hardware sets the flag bit (e.g., RTIF=1) H) The hardware acknowledges the interrupt, clearing the flag (e.g., RTIF=0) (4) Question 10. Assuming the variables are 16-bit integers, and all operations are 16-bit integer functions, what error might occur in the following operation? The goal is to multiply N times 0.123 and store the result into M. \[ M = \frac{(123 \times N)}{1000} \] A) dropout B) floor C) overflow D) promotion E) demotion F) no error can occur because M will be less than N (4) Question 11. What is the machine code for the following instruction? ``` std 5, sp ``` (5) Question 12. Give the simplified memory cycles produced when the following one instruction is executed. Assume the PC contains $4000, Register X contains $3900, Register A contains $45 and Register B is $67. Just show R/W=Read or Write, Address, and Data for each cycle. Memory locations $3900 through $390F contain $00 to $0F respectively. $4000 6C31 std 2, x+ <table> <thead> <tr> <th>R/W</th> <th>Addr</th> <th>Data</th> </tr> </thead> <tbody> <tr> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> </tr> </tbody> </table> (5) Question 13. You are given an LED with a 2V 20mA operating point. Interface this LED to the 9S12C32, such that the LED is on when PM0 is high (5V) and the LED is off when PM0 is low (0V). The output low voltage of the 7405 is 0.5V. Label all resistor values. No software is required. (5) Question 14. Interface this switch to the 9S12C32, such that PM1 is high (5V) if the switch is not pressed and PM1 is low (0V) if the switch is pressed. You do not need to debounce the switch. Label all chip numbers and resistor values. No software is required. (15) Question 15. In this problem you will implement two unsigned 16-bit local variables on the stack using register Y stack frame addressing and symbolic binding. Call one variable front and the other back. The code in this question is part of a subroutine, which ends in rts. Part a) Show the assembly code that saves RegY, setups up RegY to point into the stack, and allocates the two 16-bit local variables. Part b) Assume the stack pointer is equal to $3F00, and then this subroutine is called. Draw a stack picture showing the return address, the two variables, RegY and the SP. ($3800 is towards the top, and $3FFF is towards the bottom of the picture). Shade elements that are on the stack. Part c) Show the symbolic binding for front and back. Part d) Show code that explicitly implements back=2000; Part e) Show code that explicitly implements front = 2*back; Part f) Show the assembly code that deallocates the two 16-bit local variables, and restores Y. (15) Question 16. Implement the following one-input four-output Mealy finite state machine. The input is on Port T bit 0 and the output is on Port M bits 3,2,1,0. The initial state is happy. You do not need to show the stack initialization or the reset vector. Part a) Show the ROM-based FSM data structure Part b) Show the initialization and controller software. Initialize the direction registers, making all code friendly. You may add variables in any appropriate manner (registers, stack, or global RAM). The repeating execution sequence is …input, output (depends on the input and state), next (depends on the input and state)… . Please make your code that accesses Port M friendly. (15) Question 17. Design a software system that uses the RTI periodic interrupt to create the following repeating waveform on PT7 output. ``` PT7 5.12ms 10.24ms 5.12ms 10.24ms ``` The RTI vector is located at $FFF0. The reset vector is located at $FFFE. For example, a value of $40 written to RTICTL will specify a 1.024ms interrupt period. Show all the software for this system: direction registers, global variables, stack initialization, RTI initialization, main program, RTI ISR, RTI vector and reset vector. The main program initializes the system, then executes a do-nothing loop. The RTI ISR performs output to Port T. Please make your code that accesses Port T friendly. Variables you need should be allocated in the appropriate places. aba 8-bit add RegY=RegY+RegB dab 8-bit add with carry to RegA dbc 8-bit add with carry to RegB dda 8-bit add to RegA add 8-bit add to RegB addb 8-bit add to RegB addx 8-bit add to RegX adddx 16-bit add to RegD adand 8-bit decrement logical and to RegA adandb 8-bit decrement and to RegB adcb 8-bit decrement and to RegA adca 8-bit decrement and to RegB adcs 16-bit decrement and to RegA adcsd 16-bit decrement and to RegD addcx 16-bit decrement add with carry and branch if result≠0 addcxo 16-bit decrement add with carry and branch if result=0 adcc 8-bit logical decrement and complement to RegC adccs 16-bit logical decrement and complement to RegC adce 8-bit logical decrement and branch if result≠0 adceo 8-bit logical decrement and branch if result=0 decb 8-bit decrement RegB dec 8-bit decrement memory decc 8-bit decrement RegC decb 8-bit decrement RegB decss 16-bit decrement RegD decsss 16-bit decrement RegD deca 8-bit decrement RegA deca 8-bit decrement RegA decss 16-bit decrement RegA decsss 16-bit decrement RegA decy 16-bit decrement RegY decx 16-bit decrement RegX decs 16-bit decrement RegD decss 16-bit decrement RegD decsr 8-bit decrement RegR decssr 16-bit decrement RegR decsx 16-bit decrement RegX decssx 16-bit decrement RegX decsy 16-bit decrement RegY decssy 16-bit decrement RegY orcc 8-bit logical or to RegCC psha push 8-bit RegA onto stack pshb push 8-bit RegB onto stack pshc push 8-bit RegCC onto stack pshd push 16-bit RegD onto stack pshx push 16-bit RegX onto stack pshy push 16-bit RegY onto stack pula pop 8 bits off stack into RegA pulb pop 8 bits off stack into RegB pulc pop 8 bits off stack into RegCC puld pop 16 bits off stack into RegD pulx pop 16 bits off stack into RegX puly pop 16 bits off stack into RegY rev Fuzzy logic rule evaluation revw weighted Fuzzy rule evaluation rol 8-bit roll shift left Memory rola 8-bit roll shift left RegA rolb 8-bit roll shift left RegB ror 8-bit roll shift right Memory ror a 8-bit roll shift right RegA ror b 8-bit roll shift right RegB rtc return sub in expanded memory rti return from interrupt rts return from subroutine sba 8-bit subtract RegA-RegB sbca 8-bit sub with carry from RegA sbcb 8-bit sub with carry from RegB sec set carry bit, C=1 sei set I=1, disable interrupts sev set overflow bit, V=1 sex sign extend 8-bit to 16-bit reg sex B,D staa 8-bit store memory from RegA stab 8-bit store memory from RegB Freescale 6812 addressing modes <table> <thead> <tr> <th>Pseudo op</th> <th>meaning</th> </tr> </thead> <tbody> <tr> <td>org</td> <td>Specific absolute address to put subsequent object code</td> </tr> <tr> <td>=</td> <td>equ</td> </tr> <tr> <td>set</td> <td>=equ</td> </tr> <tr> <td>dc.b</td> <td>db fcb</td> </tr> <tr> <td>fcc</td> <td>.byte</td> </tr> <tr> <td>dc.w</td> <td>dw fdb</td> </tr> <tr> <td>dc.l</td> <td>dl .long</td> </tr> <tr> <td>ds</td> <td>ds.b rmb</td> </tr> <tr> <td>ds.w</td> <td>.blkw</td> </tr> <tr> <td>ds.l</td> <td>.blkl</td> </tr> </tbody> </table> Address | Bit 7 | 6 | 5 | 4 | 3 | 2 | 1 | Bit 0 | Name --- | --- | --- | --- | --- | --- | --- | --- | --- | --- $0240$ | PT7 | PT6 | PT5 | PT4 | PT3 | PT2 | PT1 | PT0 | PTT $0242$ |DDR7 | DDR6 | DDR5 | DDR4 | DDR3 | DDR2 | DDR1 | DDR0 | DDR $0250$ | PM7 | PM6 | PM5 | PM4 | PM3 | PM2 | PM1 | PM0 | PM $0252$ | DDRM7 | DDRM6 | DDRM5 | DDRM4 | DDRM3 | DDRM2 | DDRM1 | DDRM0 | DDRM $0282$ | ADPU | AFFC | AWA1 | ETRIGLE | ETRIGP | ETRIG | ASCIE | ASCIF | ATDCTL2 $0283$ | 0 | S8C | S4C | S2C | S1C | SIC | FIF0 | FRZ1 | FRZ0 $0284$ | SRE8 | SMPL | SMP0 | PRS4 | PRS3 | PRS2 | PRS1 | PRS0 | ATDCTL4 $0285$ | DJM | DSGN | SCAN | MULT | 0 | CC | CB | CA | ATDCTL5 $0286$ | SCF | 0 | ETORF | FIFOR | 0 | CC2 | CC1 | CC0 | ATDSTAT0 $0288$ | CCF7 | CCF6 | CCF5 | CCF4 | CCF3 | CCF2 | CCF1 | CCF0 | ATDSTAT1 $028D$ | Bit 7 | 6 | 5 | 4 | 3 | 2 | 1 | Bit 0 | ATDDIEN $0270$ | PAD7 | PAD6 | PAD5 | PAD4 | PAD3 | PAD2 | PAD1 | PAD0 | PTAD $0272$ | DDRAD7 | DDRAD6 | DDRAD5 | DDRAD4 | DDRAD3 | DDRAD2 | DDRAD1 | DDRAD0 | DDRAD Address | msb | lb | Name --- | --- | --- | --- $0090$ | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | ATADDR0 $0092$ | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | ATADDR1 $0094$ | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | ATADDR2 $0096$ | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | ATADDR3 $0098$ | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | ATADDR4 $009A$ | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | ATADDR5 $009C$ | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | ATADDR6 $009E$ | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | ATADDR7 Addr | Bit 7 | 6 | 5 | 4 | 3 | 2 | 1 | Bit 0 | Name --- | --- | --- | --- | --- | --- | --- | --- | --- | --- $00C8$ | BTST | BSPL | BRLD | SBR12 | SBR11 | SBR10 | SBR9 | SBR8 | SCIBD $00C9$ | SBR7 | SBR6 | SBR5 | SBR4 | SBR3 | SBR2 | SBR1 | SBR0 | SCICR2 $00CB$ | TIE | TCIE | RIE | ILIE | TE | RE | RWU | SBK | SCISR1 $00CC$ | TDRE | TC | RDRF | IDLE | OR | NF | FE | PF | SCIDRL $00CF$ | R7T7 | R6T6 | R5T5 | R4T4 | R3T3 | R2T2 | R1T1 | R0T0 | SCIDR let $RTR6$, $RTR5$, $RTR4$ be $n$, which is a 3-bit number ranging from 0 to 7 let $RTR3$, $RTR2$, $RTR1$, $RTR0$ be $m$, which is a 4-bit number ranging from 0 to 15 RTI interrupt frequency (Hz) = $15625 \times 2^{-n} / (m+1)$ RTI interrupt period (ms) = $0.064 \times (m+1) \times 2^n$ **STD** Operation: $(A \cdot B) \Rightarrow M \cdot M + 1$ Description: Stores the content of double accumulator $D$ in memory location $M \cdot M + 1$. The content of $D$ is unchanged. <table> <thead> <tr> <th>Source Form</th> <th>Address Mode</th> <th>Object Code</th> </tr> </thead> </table> | STD opr8a | DIR | $sc\ dd$ | STD opr16a | EXT | $7c\ hh\ 11$ | STD oprnO_ysxp | IDX | $6c\ xb$ | STD oprn0_ysxp | IDX1 | $6c\ xb\ ff$ | STD oprn16_ysxp | IDX2 | $6c\ xb\ ee\ ff$ | STD [O,ysxp] | [D,IDX] | $6c\ xb$ | STD [opr16,ysxp] | [IDX2] | $6c\ xb\ ee\ ff$
{"Source-Url": "http://users.ece.utexas.edu/~valvano/EE319K/FinalF06.pdf", "len_cl100k_base": 4557, "olmocr-version": "0.1.53", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 22041, "total-output-tokens": 5091, "length": "2e12", "weborganizer": {"__label__adult": 0.0007882118225097656, "__label__art_design": 0.0008535385131835938, "__label__crime_law": 0.0008144378662109375, "__label__education_jobs": 0.015289306640625, "__label__entertainment": 0.00016427040100097656, "__label__fashion_beauty": 0.00040268898010253906, "__label__finance_business": 0.0005292892456054688, "__label__food_dining": 0.0009279251098632812, "__label__games": 0.0016794204711914062, "__label__hardware": 0.042724609375, "__label__health": 0.0009508132934570312, "__label__history": 0.0006875991821289062, "__label__home_hobbies": 0.0005331039428710938, "__label__industrial": 0.00368499755859375, "__label__literature": 0.00039005279541015625, "__label__politics": 0.0006661415100097656, "__label__religion": 0.0012149810791015625, "__label__science_tech": 0.1436767578125, "__label__social_life": 0.00018012523651123047, "__label__software": 0.01006317138671875, "__label__software_dev": 0.7705078125, "__label__sports_fitness": 0.0009131431579589844, "__label__transportation": 0.0019817352294921875, "__label__travel": 0.00033783912658691406}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 13368, 0.0623]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 13368, 0.0837]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 13368, 0.78705]], "google_gemma-3-12b-it_contains_pii": [[0, 1216, false], [1216, 3631, null], [3631, 4687, null], [4687, 5659, null], [5659, 6348, null], [6348, 7099, null], [7099, 8413, null], [8413, 10357, null], [10357, 10357, null], [10357, 13368, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1216, true], [1216, 3631, null], [3631, 4687, null], [4687, 5659, null], [5659, 6348, null], [6348, 7099, null], [7099, 8413, null], [8413, 10357, null], [10357, 10357, null], [10357, 13368, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 13368, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 13368, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 13368, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 13368, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 13368, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 13368, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 13368, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 13368, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, true], [5000, 13368, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 13368, null]], "pdf_page_numbers": [[0, 1216, 1], [1216, 3631, 2], [3631, 4687, 3], [4687, 5659, 4], [5659, 6348, 5], [6348, 7099, 6], [7099, 8413, 7], [8413, 10357, 8], [10357, 10357, 9], [10357, 13368, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 13368, 0.09302]]}
olmocr_science_pdfs
2024-12-06
2024-12-06
cf568098338bce60fe1a251e3ba7ce78118120da
Package ‘iNZightTS’ October 13, 2022 Type Package Title Time Series for ‘iNZight’ Version 1.5.9 Depends R (>= 3.2) Imports colorspace, dplyr,forcats, ggplot2, ggtext, glue, graphics, grDevices, grid, gridExtra, magrittr, methods, patchwork, rlang, stats, tidyr, utils Suggests covr, testthat BugReports https://github.com/iNZightVIT/iNZightTS/issues Contact inzight_support@stat.auckland.ac.nz URL http://inzight.nz LazyData true License GPL-3 Encoding UTF-8 Language en-GB RoxygenNote 7.1.2 NeedsCompilation no Author Tom Elliott [aut, cre] (<https://orcid.org/0000-0002-7815-6318>), Junjie Zeng [ctb], Simon Potter [aut], David Banks [aut], Marco Kuper [ctb], Dongning Zhang [ctb] Description The iNZightTS package provides some simple analysis tools for exploring time series data. It is used in the iNZight software. Author(s) Tom Elliott (previously: Marco Kuper, Simon Potter, and David Banks) See Also iNZight compareplot **Comparison plot - depreciated** **Description** Comparison plot - depreciated **Usage** ```r compareplot(x, ...) ``` **Arguments** - `x`: an iNZightTS object - `...`: additional arguments passed to `plot()` **Value** No return value, called for the side effect of drawing a plot. --- decompose **Decompose a time series object** **Description** Decompose a time series object **Usage** ```r decompose( obj, multiplicative = FALSE, t = 10, model.lim = NULL, data.name = NULL, ... ) ``` --- ```r ## S3 method for class 'inzdecomp' plot( x, recompose.progress = c(0, 0), recompose = any(recompose.progress > 0), ylab = x$currVar, xlab = "Date", ``` title = NULL, xlim = c(NA, NA), colour = c("#1B9E46", "#45a8ff", "orangered"), ... ) Arguments obj an iNZightTS object multiplicative fit a multiplicative time series model? t the smoothing parameter model.lim limits for the time series model data.name the name of the data ... additional arguments (ignored) x an inzdecomp object (from decompose(ts)) recompose.progress if recompose is TRUE, this shows how much to show (for animation!). Length 2 numeric: the first is 0 for seasonal, and 1 for residual; second component is how many observations have been recomposed so far recompose logical as to whether the recomposition is shown or not ylab the label for the y axis xlab the label for the x axis title the title for the plot xlim the x axis limits colour vector of three colours for trend, seasonal, and residuals, respectively Value an inzdecomp object (this is the original object with an additional decompVars component) Invisibly returns the original decomposition object. Mainly called to plot the decomposition. Methods (by generic) • plot: Plot a time series decomposition References Examples t <- iNZightTS(visitorsQ) decomp.ts <- decompose(t, data.name = "Visitors") plot(decomp.ts) decompositionplot Plot a Time Series Decomposition Description Decomposes a time series into trend, seasonal and residual components using loess. Usage decompositionplot(...) Arguments ... additional arguments, ignored Details If the frequency is greater than 1, the components are found using the stl function with s.window set to TRUE (effectively replacing smoothing by taking the mean). If the frequency is 1, the trend component is found directly by using loess and the residuals are the difference between trend and actual values. The trend, seasonal and residual components are plotted on the same scale allowing for easy visual analysis. Value The original iNZightTS object with an item decompVars appended, containing results from the decomposition. References See Also stl, loess, iNZightTS **forecastplot** *Forecast plot - DEPRECATED* **Description** Plot a raw time series together with its fitted curve and add forecasts and prediction intervals to the end. **Usage** ```r forecastplot(x, ...) ``` **Arguments** - `x` : iNZightTS object - `...` : additional arguments passed on **Details** The predictions and prediction intervals are the result of models fitted by the Holt-Winters method. The amount of predicted observations is calculated by $2 \times \text{freq}$, where `freq` is the frequency of the time series object. **Value** Called for the side effect of drawing a plot. The constructed ggplot object is returned invisibly. --- **iNZightTS** *iNZightTS (Time-Series) Objects* **Description** The function `iNZightTS` is used to create time-series objects used in iNZight. **Usage** ```r iNZightTS( data, start = 1, end, freq = 1, var = 2, time.col = grep("time", names(data), ignore.case = TRUE)[1], ... ) ``` Arguments data a data.frame containing time information and observation or a path to a .csv file with such information or a ts object start the time of the first observation. Either a single number or a vector of two integers, which specify a natural time unit and a (1-based) number of samples into the time unit end the time of the last observation, specified in the same way as start freq the number of observations per unit of time var the column number or name for the observations used from data in the actual time series time.col which column contains the time variable ... additional information passed to read.csv() and used when data is a path ignore.case logical, ignore the case? Details The function iNZightTS is used to create time-series objects. Unlike ts objects, these are lists containing information about the time-series as well as the data and the time-series (ts object) itself. If a ts object is used to create the iNZightTS object, all the domain information is extracted from that object. The function recognises the following time variable formats without case sensitive: - "(Y)yyyy" annually data e.g."(Y)1991" - "(Y)yyyyMmm" monthly data e.g."(Y)1991M01" - "(Y)yyyyQqq" quarterly data e.g."(Y)1991Q01" - "(Y)yyyyWww" weekly data with yearly seasonality e.g."(Y)1991W01" - "(Y)yyyyDdd" daily data with yearly seasonality e.g."(Y)1991D01" - "WwwDdd" daily data with weekly seasonality e.g. "W01D01" - "DddHhh" hourly data with daily seasonality e.g. "D01H01" The length of digits of each time unit could be flexible and allowing space between the time unit In case of data being a data.frame or path to a .csv file and start being omitted, the starting date and the freq is extracted from the column that includes the time information. This column is either named "Time" or is the first column. If end is omitted, all of the data will be used for the time-series. Value a iNZightTS object. If multiple variables are requested, the iNZightMTS class is added to the result. The result object contains the original data as a time series object, as well as information on the series start, end, and frequency. multiseries Compare multiple time series - DEPRECATED Description Compare multiple time series - DEPRECATED Usage multiseries(x, ...) Arguments x iNZightMTS object containing data ... Further arguments to be passed to `plot()` Value No return value, called for the side effect of drawing a plot. Examples # create from a ts object z <- iNZightTS(UKgas) plot(z) # create from a data.frame x <- iNZightTS(data.frame(Return = rnorm(100), Time = 1900:1999), var = "Return") # or specify a time column x <- iNZightTS(data.frame(Return = rnorm(100), Year = 1900:1999), var = "Return", time.col = "Year") # create from a data.frame with modified time frame y <- iNZightTS(data.frame(Return = rnorm(100)), start = c(1990, 1), end = c(1993, 5), freq = 12, var = 1) plot(y) See Also ts, print.iNZightTS, Description Plot a multiple time series object to compare several series Usage ## S3 method for class 'iNZightMTS' plot( x, compare = TRUE, multiplicative = FALSE, ylab = "Value", xlab = "Date", title = "%var", t = 10, smoother = TRUE, aspect = 2, xlim = c(NA, NA), model.lim = NULL, ... ) Arguments x Multiple time series object compare logical, if true, the series will be graphed in a single plot; otherwise graphed in individual rows multiplicative logical, if TRUE multiplicative series will be used; otherwise additive ylab y axis label xlab x axis label title the title for the plot t smoothing parameter smoother logical, if TRUE the smoother will be drawn aspect aspect ratio (width:height) for the time series xlim limits to control how much of series is shown model.lim time limits to use for modelling ... additional arguments Value No return value, called for the side effect of drawing a plot. Author(s) Tom Elliott Examples ```r tm <- iNZightTS(visitorsQ, var = 2:5) plot(tm) plot(tm, compare = FALSE) ``` --- **plot.iNZightTS** *Draw a simple time series plot* **Description** Draws a plot of a given iNZightTS object with the trend superimposed. **Usage** ```r ## S3 method for class 'iNZightTS' plot( x, multiplicative = FALSE, ylab = obj$currVar, xlab = "Date", title = "%var", animate = FALSE, t = 10, smoother = TRUE, aspect = 3, plot = TRUE, col = ifelse(forecast > 0, "#0e8c07", "red"), xlim = c(NA, NA), model.lim = NULL, seasonal.trend = FALSE, forecast = 0, ... ) ``` **Arguments** - `x`: an iNZightTS object - `multiplicative`: logical. If TRUE, a multiplicative model is used, otherwise an additive model is used by default. - `ylab`: a title for the y axis - `xlab`: a title for the x axis plot.iNZightTS <table> <thead> <tr> <th>Parameter</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td>title</td> <td>a title for the graph</td> </tr> <tr> <td>animate</td> <td>logical, if true the graph is animated</td> </tr> <tr> <td>t</td> <td>smoothing parameter</td> </tr> <tr> <td>smoother</td> <td>logical, if TRUE the smoother will be drawn</td> </tr> <tr> <td>aspect</td> <td>the aspect ratio of the plot; it will be about ASPECT times wider than it is high</td> </tr> <tr> <td>plot</td> <td>logical, if FALSE, the graph isn’t drawn</td> </tr> <tr> <td>col</td> <td>the colour of the smoothed trend line</td> </tr> <tr> <td>xlim</td> <td>axis limits, specified as dates</td> </tr> <tr> <td>model.lim</td> <td>limits of the series to use for modelling/forecast</td> </tr> <tr> <td>seasonal.trend</td> <td>logical, if TRUE seasonal+trend curve added</td> </tr> <tr> <td>forecast</td> <td>numeric, how many observations ahead to forecast (default is 0, no forecast)</td> </tr> <tr> <td>...</td> <td>additional arguments (not used)</td> </tr> </tbody> </table> **Details** If animate is set to TRUE, a scatterplot of all points in the time series will appear followed by slowly drawn lines connecting the points, simulating the drawing of a time series by hand. **Value** a time series plot (constructed with ggplot2) is returned invisibly, which can be added to if desired. **Forecast** The predictions and prediction intervals are the result of models fitted by the Holt-Winters method. The amount of predicted observations is specified by the value of ‘forecast’. **References** **Examples** ```r t <- iNZightTS(visitorsQ) plot(t) # Forecast plot (8 quarterly forecasts): plot(t, forecast = 8) ``` **pred** *Get forecast prediction values* **Description** Get forecast prediction values **Usage** `pred(x)` **Arguments** - `x` the forecast object (a plot with predictions) **Value** A time series forecasts object --- **print.iNZightTS** *Print an iNZightTS object* **Description** Print method for iNZightTS (time series) objects. **Usage** ```r ## S3 method for class 'iNZightTS' print(x, full = FALSE, ...) ``` **Arguments** - `x` the iNZightTS object to be printed - `full` whether to print all the underlying data - `...` Unused arguments. Only here for consistency with the base S3 method. **Details** The `full` argument controls whether to print all the data from which the `iNZightTS` object has been created. The default is set to `FALSE` and only the `head()` of the data will be printed. **Value** No return value, called for side effect. rawplot See Also print, iNZightTS Examples iNZightTS(UKgas) --- **rawplot** *Time series plot - depreciated* --- **Description** Time series plot - depreciated **Usage** ``` rawplot(...) ``` **Arguments** ``` ... ``` **Value** Called to draw a plot. Invisibly returns a ggplot object. --- **recompose** *Recompose a decomposed time series* --- **Description** Recompose a time series object, with optional animation. **Usage** ``` recompose(...) ``` **Arguments** ``` ... ``` **Value** the recomposed series **Author(s)** iNZight **Description** A dataset containing sea ice measurements from 1990 to 2011. **Usage** ```r seaice ``` **Format** A data frame with 265 rows and 3 variables: - **Time** The time variable - **Arctic** Sea ice measurement for the Arctic - **Antarctica** Sea ice measurement for Antarctica --- **seasonplot** *Plot Seasonal Subseries from a Time Series* **Description** This function plots the seasonal components of a time series together with the estimated seasonal effects of that series. **Usage** ```r seasonplot(obj, ...) ``` **Arguments** - `obj` an iNZightTS object - `...` Further arguments to be passed onto specific methods. **Details** The resulting window will contain two plots. On the left, every seasonal subseries of the time series is plotted. On the right will be the average seasonal effect of the series. **Value** No return value, called for the side effect of drawing a plot. See Also iNZightTS Examples ts <- iNZightTS(visitorsQ) seasonplot(ts) visitorsA2 Visitors (annual) Description A dataset containing annual visitor numbers for several countries. Usage visitorsA2 Format A data frame with 13 rows and 5 variables: Time The time variable (year) Australia Visitor counts for Australia China..Peoples.Republic.of Visitor counts for China Japan Visitor counts for Japan United.Kingdom Visitor counts for the UK visitorsM2 Visitors (monthly) Description A dataset containing monthly visitor numbers for several countries. Usage visitorsM2 Format A data frame with 164 rows and 5 variables: - **Time** The time variable (year/month) - **Australia** Visitor counts for Australia - **China..People.s.Republic.of** Visitor counts for China - **Japan** Visitor counts for Japan - **United.Kingdom** Visitor counts for the UK Description A dataset containing quarterly visitor numbers for several countries. Usage visitorsQ Format A data frame with 54 rows and 5 variables: - **Date** The time variable (year/quarter) - **Australia** Visitor counts for Australia - **China..People.s.Republic.of** Visitor counts for China - **Japan** Visitor counts for Japan - **United.Kingdom** Visitor counts for the UK Index * datasets seaice, 14 visitorsA2, 15 visitorsM2, 15 visitorsQ, 16 * iNZight iNZightTS-package, 2 * timeseries plot.iNZightTS, 10 compareplot, 3 decompose, 3 decompositionplot, 5 forecastplot, 6 iNZightMTS (iNZightTS), 6 iNZightTS, 5, 6, 13, 15 iNZightTS-package, 2 loess, 5 muliseries, 8 plot.inzdecomp (decompose), 3 plot.iNZightMTS, 9 plot.iNZightTS, 10 pred, 12 print, 13 print.iNZightTS, 8, 12 rawplot, 13 recompose, 13 seaice, 14 seasonplot, 14 stl, 5 ts, 8 visitorsA2, 15 visitorsM2, 15 visitorsQ, 16
{"Source-Url": "https://cran.r-project.org/web/packages/iNZightTS/iNZightTS.pdf", "len_cl100k_base": 4244, "olmocr-version": "0.1.53", "pdf-total-pages": 17, "total-fallback-pages": 0, "total-input-tokens": 31847, "total-output-tokens": 5562, "length": "2e12", "weborganizer": {"__label__adult": 0.0003659725189208984, "__label__art_design": 0.0010709762573242188, "__label__crime_law": 0.0005402565002441406, "__label__education_jobs": 0.004573822021484375, "__label__entertainment": 0.0002789497375488281, "__label__fashion_beauty": 0.00020134449005126953, "__label__finance_business": 0.000885009765625, "__label__food_dining": 0.0005211830139160156, "__label__games": 0.0012025833129882812, "__label__hardware": 0.0013637542724609375, "__label__health": 0.0004515647888183594, "__label__history": 0.0009918212890625, "__label__home_hobbies": 0.0003509521484375, "__label__industrial": 0.0010156631469726562, "__label__literature": 0.0005087852478027344, "__label__politics": 0.0005297660827636719, "__label__religion": 0.0005359649658203125, "__label__science_tech": 0.2371826171875, "__label__social_life": 0.00035262107849121094, "__label__software": 0.268798828125, "__label__software_dev": 0.477294921875, "__label__sports_fitness": 0.0004124641418457031, "__label__transportation": 0.0004067420959472656, "__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, 16278, 0.02019]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 16278, 0.4048]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 16278, 0.76187]], "google_gemma-3-12b-it_contains_pii": [[0, 1304, false], [1304, 1543, null], [1543, 2259, null], [2259, 3664, null], [3664, 4655, null], [4655, 5622, null], [5622, 7780, null], [7780, 8634, null], [8634, 9560, null], [9560, 10384, null], [10384, 12092, null], [12092, 12994, null], [12994, 13560, null], [13560, 14482, null], [14482, 15072, null], [15072, 15752, null], [15752, 16278, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1304, true], [1304, 1543, null], [1543, 2259, null], [2259, 3664, null], [3664, 4655, null], [4655, 5622, null], [5622, 7780, null], [7780, 8634, null], [8634, 9560, null], [9560, 10384, null], [10384, 12092, null], [12092, 12994, null], [12994, 13560, null], [13560, 14482, null], [14482, 15072, null], [15072, 15752, null], [15752, 16278, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 16278, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 16278, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 16278, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 16278, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 16278, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 16278, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 16278, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 16278, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 16278, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 16278, null]], "pdf_page_numbers": [[0, 1304, 1], [1304, 1543, 2], [1543, 2259, 3], [2259, 3664, 4], [3664, 4655, 5], [4655, 5622, 6], [5622, 7780, 7], [7780, 8634, 8], [8634, 9560, 9], [9560, 10384, 10], [10384, 12092, 11], [12092, 12994, 12], [12994, 13560, 13], [13560, 14482, 14], [14482, 15072, 15], [15072, 15752, 16], [15752, 16278, 17]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 16278, 0.02966]]}
olmocr_science_pdfs
2024-12-11
2024-12-11
0359ef393889d72764544607d2056ef950912983
Comparison of two approaches to processing long aggregates lists in spatial data warehouses Marcin Gorawski*, Rafał Malczok Institute of Computer Science, Silesian University of Technology, Akademicka 16, 44-100 Gliwice, Poland Abstract In this paper we present a comparison of two approaches for storing and processing of long aggregates lists in a spatial data warehouse. An aggregates list contains aggregates, calculated from the data stored in the database. Our comparative criteria are: the efficiency of retrieving the aggregates and the consumed memory. The first approach assumes using a modified Java list supported with materialization mechanism. In the second approach we utilize a table divided into pages. For this approach we present three different multi-thread page-filling algorithms used when the list is browsed. When filled with aggregates, the pages are materialized. We also present test results comparing the efficiency of the two approaches. 1. Introduction Data warehouses store and process huge amounts of data. We work in the field of spatial data warehousing. Our system (Distributed Spatial Data Warehouse-DSDW) presented in [1] is a data warehouse gathering and processing huge amounts of telemetric information generated by the telemetric system of integrated meter readings. The readings of water, gas and energy meters are sent via radio through the collection nodes to the telemetric server. A single reading sent from a meter to the server contains a timestamp, a meter identifier, and the reading values. Periodically the extraction system loads the data to the database of our warehouse. The data gathered in the database provide information about a given utility consumption. Thanks to this information we can analyze an average consumption of a given medium and appropriately control its production and distribution. When we want to analyze utility consumption we have to investigate consumption history. That is when the aggregates lists are useful. In the case of electrical energy providers, meter reading, analysis, and decision making is highly time sensitive. For example, in order to take stock of energy consumption all meters should be read and the *Corresponding author: e-mail address: Marcin.Gorawski@polsl.pl spatial data analyzed every thirty minutes. The data warehouse operation must be interactive. Query evaluation time in the relational data warehouse implementations can be improved by applying proper indexing and materialization techniques. View materialization consists of first processing and then storing partial aggregates, which later allows the query evaluation cost to be minimized, performed with respect to a given load and disk space limitation [2]. In [3,4] materialization is characterized by workload and disk space limitation. Indexes can be created on every materialized view. In order to reduce problem complexity, materialization and indexing are often applied separately. For a given space limitation the optimal indexing schema is chosen after defining the set of views to be materialized [5]. In [6] the authors proposed a set of heuristic criteria for choosing the views and indices for data warehouses. They also addressed the problem of space balancing but did not formulate any useful conclusions. [7] presents a comparative evaluation of benefits resulting from applying views materialization and data indexing in data warehouses focusing on query properties. Next, a heuristic evaluation method was proposed for a given workload and global disk space limitation. In our current research we are trying to find the ways to improve the DSDW efficiency and scalability. After different test series (with variations of aggregation periods, numbers of telemetric objects etc.) we found that the most crucial problem is to create and manage long aggregates lists. The aggregates list is a list of meter reading values aggregated according to appropriate time windows. A time window is the amount of time in which we want to investigate the utility consumption. The aggregator is comprised of the timestamp and aggregated values (Fig. 1). <table> <thead> <tr> <th>TIMESTAMP</th> <th>ZONE 1</th> <th>ZONE 2</th> </tr> </thead> <tbody> <tr> <td>2004-01-01 00:30:00</td> <td>0.786</td> <td>0.13</td> </tr> <tr> <td>2004-01-01 01:00:00</td> <td>0.97</td> <td>0.65</td> </tr> <tr> <td>2004-01-01 01:30:00</td> <td>1.034</td> <td>0.453</td> </tr> </tbody> </table> Fig. 1. The example of an aggregates list for time window of 30 minutes In the system presented in [1] aggregates lists are used in the indexing structure, aggregation tree, that is a modification of an aR-Tree [8]. Every index node encompasses some part of the region where the meters are located and has as many aggregates lists as types of meters featured in its region. If there are several meters of the same type, the aggregates lists of the meters are merged (aggregated) into one list of the parent node (Fig. 2). In the following sections we present and compare two different approaches for storing and managing long aggregates lists. First we present the theoretical background and then we discuss the efficiency test results. Finally we conclude the paper choosing the more efficient and scalable solution. ![Fig. 2. A hypothetical indexing structure](image) ### 2. First approach—materialized Java list The first approach assumes using a standard Java language list (like `LinkedList` or `ArrayList`, see [9]) to store the aggregates. Created aggregates are added to the list; the list is sorted according to the timestamp. The aggregates lists are stored in the main computer memory. Memory overflow problems may occur when one wants to analyze long aggregation periods for many utility meters. If we take into consideration the fact that the meter readings should be analyzed every thirty minutes, simple calculations reveal that the aggregates list grows very quickly with the extension of an aggregation period. For instance, for single energy meter an aggregates list for one year has $365 \times 48 = 17520$ elements. In order to protect the system from this failure we designed a memory management algorithm. The algorithm operation is unnoticeable for a system user. When the system starts, the algorithm evaluates the memory capacity by creating artificially generated aggregates lists. Each allocated aggregates list is counted. The action is continued until there is no more free memory. The next step is to remove the allocated lists and compute the value indicating the maximal amount of lists in the memory during system operation. That value is computed as 50% of the all of allocated lists. The 50% margin is set in order to leave enough memory for other system needs, e.g. user interface and insurance against memory fragmentation. Memory overflow may occur when new aggregates lists are created. When the previously mentioned limit is exceeded (too many aggregates lists in the memory) then some aggregates lists have to be removed from the memory. In order to determine which lists to remove, we applied a mechanism that uses a lists reading counter. Every indexing structure node has the reading counter increasing each time the lists are read. The memory managing mechanism searches for the nodes with the smallest value of the reading counter and removes them from the memory. Aggregates removal is proceeded by the materialization operation. In Figure 3 we present a flowchart illustrating the memory managing algorithm operation supported by the materialization mechanism. Fig. 3. The memory managing algorithm operation 2.1. Materialization In order to save time spent on raw data processing we decided to apply the idea of aggregates lists materialization. When a given aggregates list is created for the first time, a set of queries must be executed and the resulting raw data processed. Once calculated, the data is stored for further use. The materialization mechanism combines the Java streams and the Oracle BLOB table column. The created aggregates are stored in a table consisting of two columns, the first being NUMBER storing node’s identifier and the second is BLOB storing materialized binary data of a given node’s aggregates list. Figure 4 shows a simple schema of the materialization mechanism. The presented approach of storing a single aggregates list as one stream has two main drawbacks: the list must always be read starting from the beginning which, if not necessary, can be very time-expensive, and the list cannot be easily updated (to attach new aggregators we must restore, update and store whole long list). In the next section we present a different solution to the list materialization problem. 3. Second approach – Materialized Aggregate List The second approach is called a Materialized Aggregate List (MAL). Our main goal when designing the MAL was to create a list that could be used as a tool for mining data from the database as well as a component of indexing structure nodes (Fig. 5). In this paper we focus mainly on the differences between the previously and currently applied solutions. For more theoretical and practical details on the Materialized Aggregate List please refer to [10]. The list interface is identical to the standard Java list so the MAL can easily replace the previously described aggregates list. We also suppose that the applied multi-thread page-filling algorithms and selective materialization will result in the MAL being more efficient when compared to the standard Java list. Our main intention when designing the MAL was to build an efficient solution free of memory overflows which would allow aggregates list handling with no length limitations. The MAL structure and operation are based on the following approach: every list iterator uses a table divided into pages (the division is purely conventional). When an iterator is created some of the pages are filled with aggregators (which pages and how many is defined by the applied page-filling algorithm, see description below). Applying a multi-thread approach allows filling pages while the list is being browsed. The solution also uses an aggregates materialization mechanism to store once created aggregates. The actual list operation begins when a new iterator is created (iterator() function call). Every iterator is characterized by two dates: - border date. The border date is used for managing the materialized data. The border date is equal to the timestamp of the first aggregator in the page. - starting index. In the case that starting date given as a parameter in the iterator() function call is different from the calculated border date, the iterator index is adjusted so that the first next() function call returns the aggregator with the timestamp nearest to the given starting date. Consider the following: we have the install date 2004-01-01 00:00:00, an aggregation window width of 30 minutes and page size of 240. So, as can be easily calculated, on one page we have aggregates from five days (48 aggregates from one day, 240/48 = 5). Next we create an iterator with the starting date 2004-01-15 13:03:45. The calculated border date will be 2004-01-11 00:00:00, starting index 218 and the first returned aggregator will have the timestamp 2004-01-15 13:30:00 and will contain the medium consumption between 13:00:00 and 13:30:00. 3.1. Page-filling algorithms The iterator table pages are filled by separate threads. Regardless of the applied page-filling algorithm an individual thread, characterized by a page border date, operates according to the following steps: 1. Check whether some other thread filling a page with an identical border date is currently running. If yes, register in the set of waiting threads and wait. 2. If no, check if the required aggregates were previously calculated and materialized. If yes, restore the data and go to 4. 3. If no, fill the page with aggregates. Materialize the page. 4. Browse the set of waiting threads for threads with the specified border date. Transfer the data and notify them. In the subsections below we present three different page-filling algorithms used for retrieving aggregates from the database. Their operation is illustrated with figures that use the symbols described in Figure 6. ![Symbols used in the page-filling algorithms descriptions](http://ai.annales.umcs.pl) 3.1.1. Algorithm SPARE Two first pages of the table are filled when a new iterator is being created and the SPARE algorithm is used as a page-filling algorithm. Then, during the list browsing, the algorithm checks in the `next()` function if the current page (let’s mark it $n$) is exhausted. If the last aggregator from the $n$ page was retrieved, the algorithm calls the page-filling function to fill the $n+2$ page while the main thread retrieves the aggregates from the $n+1$ page. One page is always kept as a “reserve”, being a spare page (Fig. 7). This algorithm brings almost no overhead-only one page is filled in advance. If the page size is set appropriately so that the page-filling and page-consuming times are similar, the usage of this algorithm should result in fluent and efficient list browsing. ![Fig. 7. Operation of the SPARE algorithm](image) 3.1.2. Algorithm RENEW When the RENEW algorithm is used, all the pages are filled during creation of the new iterator. Then, as the aggregates are retrieved from the page, the algorithm checks if the retrieved aggregator is the last from the current page (let’s mark it $n$). If the condition is true, the algorithm calls the page-filling function to refill the $n$ page while the main thread explores the $n+1$ page. Each time a page is exhausted it is refilled (renewed) immediately (Fig. 8). One may want to use this algorithm when the page consuming time is very short (for instance the aggregators are used only for drawing a chart) and the list browsing should be fast. On the other hand, all the pages are kept valid all the time, so there is a significant overhead; if the user wants to browse the aggregates from a short time period but the MAL is configured so that the iterators have many big pages – all the pages are filled but the user does not use all of the created aggregates. ![Fig. 8. Operation of the RENEW algorithm](image) 3.1.3. Algorithm TRIGG During new iterator creation by means of the TRIGG algorithm, only the first page is filled. When during \( n \) page browsing the one before last aggregator is retrieved from the page the TRIGG algorithm calls the page-filling function to fill the \( n + 1 \) page. No pages are filled in advance. Retrieving the next to last aggregator from the \( n \) page triggers filling the \( n + 1 \) page (Fig. 9). The usage of this algorithm brings no overhead. Only the necessary pages are filled. But if the page consumption time is short the list-browsing thread may be frequently stopped because the required page is not completely filled. Fig. 9. Operation of the TRIGG algorithm 3.2. MAL in indexing structure The idea of the page-filling algorithm in the MAL running as a component of a higher-level node is the same as in the TRIGG algorithm for the database iterator. The difference is in aggregates creating because the aggregates are created using aggregates of lower-level nodes. The creation process can be divided into two phases. In the first phase the aggregates of the lower-level nodes are created. This operation consists of creating the aggregates and materialization. In the second phase, the aggregates of the higher-level node are created through merging all the available materialized pages of the lower-level nodes created in the first phase into pages of the higher-level node. The second phase is performed using the materialized data created in the first phase and its execution takes less than 10% of the whole time required for creating the aggregates of the higher-level node. To control the number of concurrently running threads we use a resource pool storing the iterator tables. Thanks to such approach we are able to easily control the amount of memory consumed by the system (configuring the pool we decide how many tables it will contain at maximum) and the number of running threads (if no table is available in the pool a new iterator will not start its page-filling threads until some other iterator returns a table to the pool). 3.3. Materialization Page-filling thread operation description shows that the MAL applies materialization. For the MAL we use a table with three columns storing the following values: the object identifier (telemetric object or indexing structure node), page border date and aggregators in the binary form (Fig. 10). The page materialization mechanism operates identically for each page-filling algorithm. The MAL can automatically process new data added by the extraction process. If some page was materialized but it is not complete, then the page-filling thread starts retrieving aggregates from the point where the data was not available. ![Materialized data table](image) Fig. 10. A schema of the materialization mechanism applied in the MAL 4. Test results This section contains a description of the tests performed for the both presented approaches. The aggregates were created for 3, 6, 9, and 12 months with a time window of 30 minutes. The created aggregates were not used in the test program; the program only sequentially browsed the list. Aggregates browsing was performed twice: during the first run the list has no access to the materialized data, and during the second run a full set of materialized data was available. The tests were executed on a machine equipped with Pentium IV 2.8 GHz and 512 MB RAM. The software environment was Windows XP Professional, Java Sun 1.5 and Oracle 9i. In the case of the first presented approach we have little influence on the list configuration. But in the case of MAL we can change the following configuration parameters to make the list operation most efficient: - page size defines how many aggregates are stored on a single list page, - page number defines the amount of pages creating the iterator table, - page-filling algorithm defines which algorithm is to be used for filling the pages. In order to compare the two presented approaches we first analyze operation of the MAL to find the best combination of the configuration parameters. The choice criterion consisted of two aspects: the efficiency measured as a time of completing the list-browsing task and memory complexity (amount of the memory consumed by the iterator table). ### 4.1. MAL configuration The tests were performed for the three page-filling algorithms, size of a single page varied from 48 aggregates (1 day) to 4464 (93 days – 3 months) and number of pages $2 \div 10$. The number of tables available in the table pool was limited to 1 because increasing this number brought no benefit. We first analyze the results of completing the list-browsing task during the first run (no materialized data available) focusing on the influence of the page number and the size of a single page. We investigated the relations between these parameters for all three algorithms, and we can state that in all the cases their influence is very similar; graphs of the relations are very convergent. The list browsing times for small pages are very diverse. For a page of size 48 the times vary from 30 to 160 seconds depending on the amount of pages. MAL operation for a page of size 240 is more stable; the differences resulting from the different number of pages do not exceed 25 seconds. For pages of size 672 and more we observe very stable operation of the MAL. A page size of 672 seems to be the best choice. Extending the page size brings very small efficiency gain but results in much more memory consumption. After choosing the best pair of page size and page number parameters, we compared the time efficiency of the page-filling algorithms. Figure 11 shows a graph comparing efficiency of the algorithms applied in the child nodes for browsing the list of aggregates for 3, 6, 8 and 12 months. Fig. 11. Page-filling algorithms operation for index iterator The lists were configured to use 6 pages, each of size 672. In the graph we observe that the SPARE and the TRIGG algorithms show similar efficiency. Along with extending the aggregation period the operation time increases; for the TRIGG algorithm the increase is purely linear. The RENEW algorithm shows worse efficiency, especially for long aggregation periods of 6 and 12 months. Filling and merging the pages not used during the list browsing results in worse performance. Therefore, to summarize the parameters selection we can state that the MAL works efficiently for the following configuration: number of pages 4÷6, size of a single page 672 and TRIGG as the page-filling algorithm. 4.2. Efficiency comparison In this subsection we compare efficiency of the two presented approaches. The scenario concerns operation of the lists when applied in a theoretical indexing structure. The structure consisted of one parent node and 5÷20 child nodes; the query concerned parent aggregates but obviously resulted in creating the aggregates of all the child nodes. As first we compare the results of the lists operation during the first run when no materialized data was available. Figures 12 and 13 present the graphs for gathering aggregates from respectively 5 and 20 child nodes. In the both cases the MAL shows better efficiency. It operates about 40% faster than the standard Java list supported by the materialization mechanism. Further graph analysis reveals that extending the aggregation period results in operation time growth. The growth is significantly greater in the case of the Java list. The conclusion is that the MAL solution is more scalable. ![Fig. 12. Comparison of efficiency of the Java list and the MAL for 5 meters](image) The aspect last investigated was materialization influence on system efficiency. The test results interpretation reveals that materialization strongly improves efficiency of both approaches. Thanks to materialization both lists operate from 6 to 8 times faster than when no materialized data is available. The longer the aggregation period and the more meter readings are to be aggregated the greater the benefit of materialization. ![Comparison of efficiency of the Java list and the MAL for 20 meters](image) **Fig. 13. Comparison of efficiency of the Java list and the MAL for 20 meters** ## 5. Final conclusions and future plans In this paper we presented a comparative study of two approaches for storing long aggregates lists in spatial data warehouse. The first approach is a standard Java list supported by aggregates materialization mechanism. The second solution is called Materialized Aggregate List (MAL) and is a data structure for storing long aggregates lists. The MAL also uses the materialization mechanism. After presenting the theoretical background for both approaches we discussed test results proving the MAL being more efficient and scalable. The MAL operates about 40% faster than a standard Java list. The data warehouse structure described in [1] applies distributed processing. We suppose that in this aspect introducing the MAL to our system will bring benefits in efficiency. The current approach to sending complete aggregates lists as a partial result from a server to a client results in high, single client module load. When we divide the server response into MAL pages, the data transfer and the overall system operation will presumably be more fluent. Implementation and testing of those theoretical assumptions are our future plans. ### References
{"Source-Url": "https://journals.umcs.pl/ai/article/download/3051/2247", "len_cl100k_base": 4852, "olmocr-version": "0.1.53", "pdf-total-pages": 13, "total-fallback-pages": 0, "total-input-tokens": 25360, "total-output-tokens": 5851, "length": "2e12", "weborganizer": {"__label__adult": 0.0002772808074951172, "__label__art_design": 0.0004315376281738281, "__label__crime_law": 0.0004367828369140625, "__label__education_jobs": 0.0008835792541503906, "__label__entertainment": 6.639957427978516e-05, "__label__fashion_beauty": 0.00015985965728759766, "__label__finance_business": 0.0005249977111816406, "__label__food_dining": 0.00034356117248535156, "__label__games": 0.00041747093200683594, "__label__hardware": 0.0012607574462890625, "__label__health": 0.0005640983581542969, "__label__history": 0.000339508056640625, "__label__home_hobbies": 0.00012791156768798828, "__label__industrial": 0.0008673667907714844, "__label__literature": 0.0002135038375854492, "__label__politics": 0.0003173351287841797, "__label__religion": 0.0003571510314941406, "__label__science_tech": 0.1256103515625, "__label__social_life": 9.59634780883789e-05, "__label__software": 0.02752685546875, "__label__software_dev": 0.83837890625, "__label__sports_fitness": 0.00020492076873779297, "__label__transportation": 0.0004987716674804688, "__label__travel": 0.00022745132446289065}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 24856, 0.04506]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 24856, 0.3392]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 24856, 0.89906]], "google_gemma-3-12b-it_contains_pii": [[0, 2269, false], [2269, 5040, null], [5040, 6697, null], [6697, 8599, null], [8599, 10110, null], [10110, 12257, null], [12257, 14172, null], [14172, 16265, null], [16265, 18120, null], [18120, 20056, null], [20056, 22035, null], [22035, 24134, null], [24134, 24856, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2269, true], [2269, 5040, null], [5040, 6697, null], [6697, 8599, null], [8599, 10110, null], [10110, 12257, null], [12257, 14172, null], [14172, 16265, null], [16265, 18120, null], [18120, 20056, null], [20056, 22035, null], [22035, 24134, null], [24134, 24856, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 24856, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 24856, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 24856, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 24856, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 24856, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 24856, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 24856, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 24856, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 24856, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 24856, null]], "pdf_page_numbers": [[0, 2269, 1], [2269, 5040, 2], [5040, 6697, 3], [6697, 8599, 4], [8599, 10110, 5], [10110, 12257, 6], [12257, 14172, 7], [14172, 16265, 8], [16265, 18120, 9], [18120, 20056, 10], [20056, 22035, 11], [22035, 24134, 12], [24134, 24856, 13]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 24856, 0.05618]]}
olmocr_science_pdfs
2024-12-06
2024-12-06
4f6f4852a187f53817707573daed24eda56394c7
[REMOVED]
{"Source-Url": "http://www.researchgate.net/profile/Leonel_Morgado/publication/269105683_Model-Driven_Generation_of_Multi-user_and_Multi-domain_Choreographies_for_Staging_in_Multiple_Virtual_World_Platforms/links/5480f4330cf22525dcb6067c.pdf", "len_cl100k_base": 6312, "olmocr-version": "0.1.50", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 43499, "total-output-tokens": 8598, "length": "2e12", "weborganizer": {"__label__adult": 0.000530242919921875, "__label__art_design": 0.002681732177734375, "__label__crime_law": 0.00058746337890625, "__label__education_jobs": 0.023406982421875, "__label__entertainment": 0.00044345855712890625, "__label__fashion_beauty": 0.00036454200744628906, "__label__finance_business": 0.0007295608520507812, "__label__food_dining": 0.0005998611450195312, "__label__games": 0.0030918121337890625, "__label__hardware": 0.00104522705078125, "__label__health": 0.001049041748046875, "__label__history": 0.0009436607360839844, "__label__home_hobbies": 0.0002340078353881836, "__label__industrial": 0.0009083747863769532, "__label__literature": 0.0014066696166992188, "__label__politics": 0.0005092620849609375, "__label__religion": 0.0008711814880371094, "__label__science_tech": 0.318603515625, "__label__social_life": 0.00037598609924316406, "__label__software": 0.03472900390625, "__label__software_dev": 0.60498046875, "__label__sports_fitness": 0.0005884170532226562, "__label__transportation": 0.0009899139404296875, "__label__travel": 0.00046133995056152344}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 33945, 0.0394]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 33945, 0.49415]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 33945, 0.88389]], "google_gemma-3-12b-it_contains_pii": [[0, 2521, false], [2521, 5744, null], [5744, 8721, null], [8721, 10612, null], [10612, 12555, null], [12555, 14130, null], [14130, 16330, null], [16330, 18685, null], [18685, 20995, null], [20995, 23176, null], [23176, 25992, null], [25992, 26724, null], [26724, 28363, null], [28363, 31151, null], [31151, 33945, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2521, true], [2521, 5744, null], [5744, 8721, null], [8721, 10612, null], [10612, 12555, null], [12555, 14130, null], [14130, 16330, null], [16330, 18685, null], [18685, 20995, null], [20995, 23176, null], [23176, 25992, null], [25992, 26724, null], [26724, 28363, null], [28363, 31151, null], [31151, 33945, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 33945, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 33945, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 33945, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 33945, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 33945, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 33945, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 33945, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 33945, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 33945, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 33945, null]], "pdf_page_numbers": [[0, 2521, 1], [2521, 5744, 2], [5744, 8721, 3], [8721, 10612, 4], [10612, 12555, 5], [12555, 14130, 6], [14130, 16330, 7], [16330, 18685, 8], [18685, 20995, 9], [20995, 23176, 10], [23176, 25992, 11], [25992, 26724, 12], [26724, 28363, 13], [28363, 31151, 14], [31151, 33945, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 33945, 0.0]]}
olmocr_science_pdfs
2024-11-29
2024-11-29
e3bc645cf7b167a541deca83ee1e5b9b0d01fa22
Tutorial on Modeling VAT Rules Using OWL-DL Nielsen, Morten Ib; Simonsen, Jakob Grue; Larsen, Ken Friis Publication date: 2007 Document Version Publisher's PDF, also known as Version of record Citation for published version (APA): Tutorial on Modeling VAT rules using OWL-DL Morten Ib Nielsen, Jakob Grue Simonsen and Ken Friis Larsen Department of Computer Science University of Copenhagen Email: {mortenib|simonsen|kflarsen}@diku.dk August 28, 2007 Total number of pages: 16 Abstract This paper reports on work in progress. We present a methodology for constructing an OWL-DL model of a subset of Danish VAT rules. It is our intention that domain experts without training in formal modeling or computer science should be able to create and maintain the model using our methodology. In an ERP setting such a model could reduce the Total Cost of Ownership (TCO) and increase the quality of the system. We have selected OWL-DL because we believe that description logic is suited for modeling VAT rules due to the decidability of important inference problems that are key to the way we plan to use the model and because OWL-DL is relatively intuitive to use. 1 Introduction Imagine an ERP system where domain experts can create and implement changes in e.g. VAT rules without the help of programmers. The benefits would be shorter development time and fewer mistakes due to misinterpretation of specifications which lead to reduced TCO and increased quality of the software. On a coarse-grained scale such a system consists of three parts: A model of the rules, a tool to edit the model and the core ERP system using the model. In this paper we focus on the first part - the model. A priori two requirements exist. First the modeling language must be strong enough to express the rules in question and second it must be easy to use without training in formal modeling or computer science. In a more general setting the model can be used as a VAT knowledge system which external programs can query through an interface. In the long run we envision that authorities such as SKAT (Danish tax administration) can provide online access to the model e.g. using web services such that applications always use the newest version of the model. In this paper we describe a methodology we have used to develop a model of a subset of Danish VAT rules using the general purpose Web Ontology Language (OWL) editor Protégé-OWL\(^1\) and we report on our experiences in doing so. We selected a subset of Danish VAT rules consisting of flat VAT (25%) plus a set of exceptions where goods and services are free of VAT, chosen because they seem representative. Further the rules are accessible to us by way of an official guideline by the Danish tax administration. Our study is focusing on the feasibility \(^1\)http://protege.stanford.edu/overview/protege-owl.html. of using OWL to model VAT rules and not on the usability of the Protégé-OWL tool itself. By feasibility we mean how easy or difficult it is (for a human) to express and understand VAT rules in OWL, in particular this does not cover issues such as modularization. The methodology presented here is inspired by the article [1] together with our own experience. Readers of this guide are assumed to have user experience of Protégé-OWL corresponding to [2] but not of computer science nor of modeling in general. 1.1 Motivation One of the overall goals of the strategic research project 3gERP is to reduce the TCO of Enterprise Resource Planning (ERP) systems. We believe that a VAT model helps to this end in two ways. First we envision that domain experts create and update the model thus eliminating a layer of interpretation (the programmer) where errors can be introduced. Second a VAT model can change handling of VAT from being a customization task into being a configuration task, meaning that no code needs to be changed when the model is updated. VAT and legal rules in general deal with frequent transactions between legal entities. Transactions are typically triggered when certain conditions are fulfilled and therefore dynamic checks on these conditions are needed. The idea is to use the model to automatically infer what actions should be taken based on the conditions. In the case of VAT rules we can ask the model whether a delivery is subject to VAT or not based on the information we know about the delivery. The answer from the model will be Yes, No or Maybe and can be used to trigger an appropriate transaction. In a broader perspective the model is supposed to work as a VAT knowledge system that given a context and a question can tell other systems what to do, e.g. guide accounting systems and if required indicate that authorities should be contacted etc. 1.2 Roadmap The remainder of this paper is structured as follows. In Section 2 we give a short account of description logic and OWL. In Section 3, 4 and 5 we present our methodology by giving examples. Finally we outline future work in Section 6 and we conclude in Section 7. 2 Description Logic and OWL In this section we give a short introduction to description logic (DL) and OWL. This introduction can be skipped, if you are already familiar with the concepts. Description logics are knowledge representation languages that can be used to structure terminological knowledge in knowledge systems which are formally well-understood. A knowledge system typically consists of a knowledge base together with a reasoning service. The knowledge base is often split into a set of concept axioms the TBox, a set of assertions the Abox and a Role hierarchy. These constitute the explicit knowledge in the knowledge system. The reasoning service is a program that can check the consistency of the knowledge base and make implicit knowledge explicit, e.g. decide equivalence of concepts. Since the reasoning service is a pluggable component knowledge systems separate the technical task of reasoning from the problem of constructing the knowledge base. \[2\] In the case where insufficient information is provided in order to answer the question. 2.1 OWL OWL which is short for Web Ontology Language is an ontology language designed to be compatible with the World Wide Web and the Semantic Web. The most important abstraction in OWL is concept axioms which are called classes. Each class has a list of necessary conditions and zero or more equivalent lists of necessary and sufficient conditions \[2\]. A list of necessary conditions is a list of conditions that every member of the class must satisfy. In the same way a list of necessary and sufficient conditions is a list of conditions that must be satisfied by every member of the class and if satisfied guarantees membership in the class. OWL is based on XML, RDF and RDF-S and can be used to represent information in a way that is more accessible to applications than traditional web pages. In addition OWL has a formal semantics, which enables logic reasoning. OWL comes in three variants: OWL-Lite $\subseteq$ OWL-DL $\subseteq$ OWL-Full of increasing expressive power. The variants OWL-Lite and OWL-DL are based on the description logics $\mathcal{SHLF(D)}$ and $\mathcal{SHOIN(D)}$ respectively \[3\], which guarantees that important inference problems such as satisfiability and subsumption are decidable. Since OWL is XML based we need an editor to create OWL ontologies. We have used the general purpose OWL editor Protégé developed by Stanford Medical Informatics at the Stanford University School of Medicine. 3 VAT Exemption 1: Sales outside EU Our methodology is aimed at modeling VAT rules as described in guidelines instead of the raw law text itself. This choice was made because guidelines are more accessible to us, and because these are the rules that small companies adhere to in practice. Further the investigation of the feasibility of using OWL to model VAT rules concerns the ease with which rules can be formalized and not so much from where the rules are extracted\(^3\). In what follows we refer to the guideline as the legal source. In order to ease reading we have used the word concept only when we speak about the legal source. The corresponding concept in the model (OWL) is called a class. A concept in the legal source is modeled as one or more classes in the model. Here we present the steps we took in order to make our model of Danish VAT rules. 3.1 Pre-modeling 1. Download Protégé-OWL from [http://protege.stanford.edu/download/release/full/](http://protege.stanford.edu/download/release/full/) and install. Make sure you can start Protégé in OWL-mode (logic view). When started and if you select the Class tab it should look like Figure 1. 2. Download [2] and read it. This is important because many of the constructions we use are explained herein. 3.2 Modeling First you must decide which legal source(s) you want to model. \(^3\)Since we have used the official guidelines by SKAT (Danish tax administration) we believe that the content of the guidelines is in accordance with the law. Figure 1: Protégé-OWL class-tab, logic view. 3.2 Modeling In our case we used the official guideline Moms - fakturering, regnskab mv, E nr. 27, Version 5.2 digital, 19. januar 2005. ### 3.2.1 Overall framework Modeling should start with a read through of the legal source. Based on this general (to be refined later) classes such as Location, Goods, Services and FreeOfVAT together with attributes such as hasDeliveryType and hasSalesPrice can be created as subclasses of the built-in top-level class owl:Thing. An attribute can usually take on at most a finite number of values. In that case we use value partitions to model them as described in [2][p. 73-76]. If the domain is not finite we use data type properties instead. Deciding on the overall framework helps to structure the capturing of rules in a homogeneous way and enables working in parallel (which can be needed if the legal source is large). After our read through of the legal source we arrived at the overall framework in Figure 2. ![Figure 2: Overall framework.](image) **Naming Convention.** All classes, properties, individuals etc. should be given names picked from or inspired of the legal source. All names should be in the same language as the legal source (in our case Danish). Using the naming convention supported by Protégé-OWL class and individual names should be written in Pascal Notation, e.g. InternationalOrganization not internationalOrganization or InternationalOrganization, while property names are written in Camel Hump Notation, e.g. someProperty. Typically a property is used to assign an attribute to a class. In this case we prefix the name of the property with a verb describing the kind of relation the class has along that property, e.g. hasNumberOfSides or isFragile. ### 3.2.2 Rule modeling - step I Having modeled the overall framework it is time to go through the legal source one section at a time looking for rules that should be modeled. Here we give an elaborate description of how to model a single rule from the legal source starting from the overall framework in Figure 4. --- 4An exception is the domain of truth values, which is built-in as a data type. 3.2 Modeling Table 1 Extract from the legal source and its translation into English. [4][p. 9] And translated into English: Sales outside EU (3rd countries). No VAT should be added to goods delivered to destinations outside the European Union, or to the Faroe Islands or Greenland. This fact ordinarily also applies to services, but VAT should be added to certain services. Translated from [4][p. 9] Table 2 Necessary & sufficient conditions for application of the rule in Table 1. - The rule concerns sales. - The rule concerns both goods and services. - The place of delivery must be outside the European Union, or the Faroe Islands or Greenland. 2. In Section 4 and 5 we give a brief description of how to model other rules. Together the modeling of these rules cover all the constructions we have used in our VAT model. Since our legal source is in Danish we present the rules in their original Danish phrasing together with a translation into English. Now let us consider the rule shown in Table 1. Since our model is only a prototype we make a slight simplification and assume that the rule also applies to all services. With this simplification we can identify the necessary and sufficient conditions for application of the rule. These are shown in Table 2. In order to model the necessary and sufficient conditions in Table 2 we must add some attributes to VarerOgYdelser. The first and second condition in Table 2 tell us that we must be able to model that goods and services are sold. We do that by adding an attribute to the class VarerOgYdelser (translates into GoodsAndServices) which already exists in our overall framework. Attributes are modeled using functional properties. In accordance with our naming convention we select the name harLeveranceType (translates into hasDeliveryType). Since there is a finite number of delivery types we model this attribute as a value partition, i.e. an enumeration. Value partitions can be created using a built-in wizard. Just as in [2] we store value partitions as subclasses of the class ValuePartitions. The reason plain enumerations are not used is that they cannot be sub-partitioned. Using value partitions we retain the possibility of further refining the concepts the value partitions model. 5 Instead of being sold goods can also be used as e.g. a trade sample. See [4][p. 8-9] for other examples. 6 Menu▷Tools▷Patterns▷Value Partition... Remark. Technically enumerations are constructed by defining a class in terms of a finite set of individuals plus a functional property that has this class as its range. Since individuals are atoms they cannot be subdivided. On the other hand a value partition is defined using a functional property having as its range a class defined as the union of its subclasses all of which are distinct. These subclasses can (because they are classes) be partitioned into more subclasses if needed. Having created the value partition harLeveranceType which can have Salg (translates into Sale) as a value we need to add it as an attribute to the class VarerOgYdelser. This is done by adding to the necessary conditions an existential quantification over the corresponding property having the value partition (or data type in case of data type attribute) as its range. Thus we add \( \exists \text{harLeveranceType some LeveranceType} \) to VarerOgYdelser. The third condition tells us that we must be able to model that goods and services have a place of delivery. A read through of the legal source tells us that only three places are needed namely Denmark, EU and non-EU. Thus this attribute which we name harLeveranceSted (translates into hasPlaceOfDelivery) must be modeled as a value partition. Having modeled these attributes the class VarerOgYdelser looks as shown in Figure 3. 3.2.3 Rule modeling - step II Now we are ready to model the rule itself. Since the rule describes a situation where you do not have to pay VAT we model it as a subclass of Momsfritaget (translates into FreeOfVAT). Following our naming convention we name the class MomsfritagetSalgAfVarerOgYdelserTilIkke-EU (translates into VATFreeSalesOfGoodsAndServicesInNon-EU). Then we add a textual description of the rule and a reference to where in the legal source the rule stems from to the rdfs:comment field. Next we must specify necessary and sufficient conditions on membership in MomsfritagetSalgAfVarerOgYdelserTilIkke-EU. It is important to remember that if a class has two sets of necessary and sufficient conditions then they must imply each other, see [2][p. 98]. Based on the necessary and sufficient conditions captured in Table 2 we add the following necessary and sufficient conditions to MomsfritagetSalgAfVarerOgYdelserTilIkke-EU: - VarerOgYdelser - \( \exists \text{harLeveranceSted some Ikke-EU} \) - \( \exists \text{harLeveranceType some Salg} \) The result is shown in Figure 4. 4 VAT Exemption 2: Sales to Embassies In this section and onwards we will not mention when to add references to the legal source in rdfs:comment fields of classes and properties. The rule of thumb is that this should always be done. Now let us consider the rule in Table 3. We identify the necessary and sufficient conditions for application of the rule. These are shown in Table 4. Figure 3: Class and property view after adding attributes. Table 3 Extract from the legal source and its translation into English. *Salg til ambassader. Du skal ikke beregne moms af varer og transportydelser, som du leverer til ambassader og internationale organisationer i andre EU-lande.* [4][p. 9] And translated into English: *Sales to embassies. VAT should not be added to goods and transport services delivered to embassies and international organizations in countries within the European Union.* Translated from [4][p. 9] Table 4 Necessary & Sufficient conditions for application of the rule in Table 3. - The rule concerns sales. - The rule concerns goods and transport services. - The place of delivery must be in the European Union. - The buyer must be an embassy or an international organization. 4.1 Rule modeling - step I We are already able to model that the rule concerns sale and that the place of delivery must be in EU. We cannot model the specific service transportation yet. Therefore we must add it to our model. Since it is a service it should be modeled as a subclass of Services. We name the class modeling the service transportation Transport (translates into Transportation). Now we can model that something belongs to the set of goods and transport services by requiring membership of Varer ⊔ Transport. Finally we must be able to model that the buyer is an embassy or an international organization. Since there are only finitely many different kinds of buyers we model this as a value partition, and because this attribute applies to both Varer and Transport we add it to their most specific common super-class which is VarerOgYdelser. We name this attribute harKøberType (translates into hasKindOfBuyer). After having done all this the model looks as shown in Figure 5. 4.2 Rule modeling - step II Having added all the necessary classes and attributes to the model we are ready to model the rule itself. Since the rule describes a situation where you do not have to pay VAT we model it as a subclass of Momsfritaget. Following our naming convention we name the class MomsfritagetSalgTilAmbassaderOgInternationaleOrganisationerIEU (translates into VATFreeSalesToEmbassiesAndInternationalOrganizationsInEU). Based on the necessary and sufficient conditions captured in Table 4 we add the following necessary and sufficient conditions to MomsfritagetSalgTilAmbassaderOgInternationaleOrganisationerIEU: - harLeveranceType some Salg - Varer ⊔ Transport - harLeveranceSted some EU - harKøberType some AmbassadeOgPersonaleMedDiplomatiskReettighed The result is shown in Figure 6. 5 VAT Exemption 3: Sales in other EU countries In this section we consider one final rule, the rule in Table 5. We identify the necessary and sufficient conditions for application of the rule. These are shown in Table 6. 5.1 Rule modeling - step I We are already able to model that the rule concerns sale of goods delivered inside the European Union. The new thing is that we must be able to indicate whether a buyer is registered for VAT and if so, we must register the buyers VAT registration number. We use a functional data type property named erKøberMomsregistreret (translates into isTheBuyerRegisteredForVAT) with the data type xsd:boolean as its range to model whether the buyer is registered for VAT. Similarly we use a functional data type property named erKøbersMomsnummer (translates into isBuyersVATRegistrationNumber) with the data type xsd:string as its range to register the buyers VAT registration number if he has one. 5.1 Rule modeling - step 5 VAT EXEMPTION 3: SALES IN OTHER EU COUNTRIES Figure 5: The model after adding classes and attributes as described in Section 4.1. 5.1 Rule modeling - step 5 VAT EXEMPTION 3: SALES IN OTHER EU COUNTRIES Figure 6: Asserted Conditions of our model of the legal rule in Table 3. Table 5 Extract from the legal source and its translation into English. <table> <thead> <tr> <th>Danish</th> <th>English</th> </tr> </thead> <tbody> <tr> <td>Salg til andre EU-lande. Du skal ikke beregne dansk moms, når du sælger varer til momsregistrerede virksomheder i andre EU-lande. Du skal derfor sørge for at få virksomhedens momsnummer.</td> <td>Sales in other EU countries. No VAT should be added to goods delivered to companies in other EU countries, provided that the companies are registered for VAT. In this case you must acquire the VAT registration number of the company.</td> </tr> </tbody> </table> And translated into English: Sales in other EU countries. No VAT should be added to goods delivered to companies in other EU countries, provided that the companies are registered for VAT. In this case you must acquire the VAT registration number of the company. Translated from [4][p. 8] Table 6 Necessary & Sufficient conditions for application of the rule in Table 5. - The rule concerns sales. - The rule concerns goods. - The place of delivery must be in the European Union. - The buyer must be registered for VAT. - You must acquire the VAT registration number of the company. A read through of [4] will reveal that you must register the VAT registration number of the buyer exactly when the buyer is registered for VAT. Thus we model this as a property of VarerOgYdelser and not of Varer (as indicated by the rule). The requirement can be modeled as follows: \[ ((\text{erKøberMomsregistreret has true}) \land (\text{erKøbersMomsnummer exactly 1})) \lor ((\text{erKøberMomsregistreret has false}) \land (\text{erKøbersMomsnummer exactly 0})) \] The result is shown in Figure 7. 5.2 Rule modeling - step II Having added the necessary attributes to the model we are ready to model the rule itself. Since the rule describes a situation where you do not have to pay VAT we model it as a subclass of Momsfritaget. Following our naming convention we name the class MomsfritagetSalgTilAndreEU-lande (translates into VATFreeSalesToOtherEUCountries). Based on the necessary and sufficient conditions captured in Table 6 we add the following necessary and sufficient conditions to MomsfritagetSalgTilAndreEU-lande: - harLeveranceType some Salg - Varer - harLeveranceSted some EU - erKøberMomsregistreret has true We note that the obligation to register the buyers VAT registration number is modeled indirectly, see Section 5.1. The result is shown in Figure 8. 6 Future work Since this is work in progress there are a lot of areas we need to address. In the near future we plan to integrate our model in a prototype ERP system as described in the introduction. This opens the possibility for modeling the parts of the Danish VAT legislation concerning depreciation and VAT reporting (since they are intertwined and contain a lot of technical requirements on the financial reports). We also need to model other countries VAT rules in order to confirm that Danish VAT rules are indeed representative with respect to the constructions that are needed in the modeling language. Based on this we need to refine our overall framework such that it captures the common structure and we need to identify what kinds of questions a model must be able to answer. The synthesized knowledge from modeling the VAT rules of other countries should also result in a more detailed analysis of what we can and cannot model. Based on all this we should design a minimal description logic extended with the needed functionality identified in the analysis just mentioned, such as predicates like \( x < 100 \) which are needed in some rules. We should also provide a reasoner for the logic together with an editor such that the above process can be repeated. Finally in order to compare our OWL model with a different approach we want to make a model using Datalog, which is the de facto standard language used to express rules in deductive databases, of the rules we have formalized in OWL already. It would also be interesting to try a hybrid solution e.g. OWL plus a rule language like SWRL. This work is independent of the tasks mentioned above and can be carried out in parallel. 7 Conclusion We have shown how to model a subset of Danish VAT rules concerning exemption from VAT using Protégé-OWL. First we created an overall framework for the VAT model with the property that legal rules and the concepts they involve can be modeled as subclasses of existing classes in the framework. This helps to ensure that related concepts are modeled in the same way and that a single concept is not modeled twice. The second step was an iterative process consisting of two steps repeated for each rule. The first step is to extend the model such that the rule in question can be modeled. This is done by modeling concepts from the legal source as classes in the model and by adding attributes to the necessary conditions of such classes. The second step is to model the rule itself. This is done by adding specific requirements for application of the rule to the necessary and sufficient conditions of the class modeling the rule. The step by step iterative modeling has been working fine in practice and an extension to cover several different VAT and duty rates does not seem to be problematic as long as they do not require us to model restrictions such as \( x < 100 \) which is not supported directly in OWL\(^7\). \(^7\)Whether this is a weakness of OWL, or just us trying to use OWL for something it was not designed to Apart from modeling inequalities we have not had modeling problems. One problem though is that reasoning about individuals in OWL models is not supported very well. Therefore we have tried to avoid the use of individuals wherever possible (using value partitions). References
{"Source-Url": "http://static-curis.ku.dk/portal/files/15432526/nielsen-simonsen-larsen.pdf", "len_cl100k_base": 5792, "olmocr-version": "0.1.53", "pdf-total-pages": 17, "total-fallback-pages": 0, "total-input-tokens": 30331, "total-output-tokens": 6806, "length": "2e12", "weborganizer": {"__label__adult": 0.0005960464477539062, "__label__art_design": 0.0008378028869628906, "__label__crime_law": 0.004302978515625, "__label__education_jobs": 0.003143310546875, "__label__entertainment": 0.00017762184143066406, "__label__fashion_beauty": 0.0003559589385986328, "__label__finance_business": 0.0219879150390625, "__label__food_dining": 0.0005831718444824219, "__label__games": 0.0010166168212890625, "__label__hardware": 0.0008802413940429688, "__label__health": 0.0010614395141601562, "__label__history": 0.0005669593811035156, "__label__home_hobbies": 0.0002722740173339844, "__label__industrial": 0.0015230178833007812, "__label__literature": 0.0008449554443359375, "__label__politics": 0.00147247314453125, "__label__religion": 0.0005064010620117188, "__label__science_tech": 0.1357421875, "__label__social_life": 0.0002219676971435547, "__label__software": 0.06475830078125, "__label__software_dev": 0.7568359375, "__label__sports_fitness": 0.0002951622009277344, "__label__transportation": 0.0015096664428710938, "__label__travel": 0.00036025047302246094}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27047, 0.03283]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27047, 0.4929]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27047, 0.90518]], "google_gemma-3-12b-it_contains_pii": [[0, 441, false], [441, 3066, null], [3066, 6293, null], [6293, 9240, null], [9240, 9285, null], [9285, 11413, null], [11413, 14056, null], [14056, 16914, null], [16914, 16973, null], [16973, 17729, null], [17729, 20469, null], [20469, 20627, null], [20627, 21903, null], [21903, 23567, null], [23567, 26231, null], [26231, 26496, null], [26496, 27047, null]], "google_gemma-3-12b-it_is_public_document": [[0, 441, true], [441, 3066, null], [3066, 6293, null], [6293, 9240, null], [9240, 9285, null], [9285, 11413, null], [11413, 14056, null], [14056, 16914, null], [16914, 16973, null], [16973, 17729, null], [17729, 20469, null], [20469, 20627, null], [20627, 21903, null], [21903, 23567, null], [23567, 26231, null], [26231, 26496, null], [26496, 27047, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 27047, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27047, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27047, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27047, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27047, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27047, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27047, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27047, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27047, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27047, null]], "pdf_page_numbers": [[0, 441, 1], [441, 3066, 2], [3066, 6293, 3], [6293, 9240, 4], [9240, 9285, 5], [9285, 11413, 6], [11413, 14056, 7], [14056, 16914, 8], [16914, 16973, 9], [16973, 17729, 10], [17729, 20469, 11], [20469, 20627, 12], [20627, 21903, 13], [21903, 23567, 14], [23567, 26231, 15], [26231, 26496, 16], [26496, 27047, 17]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27047, 0.02041]]}
olmocr_science_pdfs
2024-12-09
2024-12-09
37ad1b8f8d79111fa1e4a1001d291abfddda1c51
[REMOVED]
{"Source-Url": "https://practise.cs.tut.fi/files/publications/Serious/restful.pdf", "len_cl100k_base": 7314, "olmocr-version": "0.1.50", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 35469, "total-output-tokens": 8418, "length": "2e12", "weborganizer": {"__label__adult": 0.0003826618194580078, "__label__art_design": 0.0005307197570800781, "__label__crime_law": 0.0002932548522949219, "__label__education_jobs": 0.00060272216796875, "__label__entertainment": 4.988908767700195e-05, "__label__fashion_beauty": 0.00015842914581298828, "__label__finance_business": 0.00022518634796142575, "__label__food_dining": 0.0003364086151123047, "__label__games": 0.0003817081451416016, "__label__hardware": 0.0006842613220214844, "__label__health": 0.0003991127014160156, "__label__history": 0.0002467632293701172, "__label__home_hobbies": 7.551908493041992e-05, "__label__industrial": 0.00034737586975097656, "__label__literature": 0.00023698806762695312, "__label__politics": 0.00023734569549560547, "__label__religion": 0.0004737377166748047, "__label__science_tech": 0.006664276123046875, "__label__social_life": 7.045269012451172e-05, "__label__software": 0.0032291412353515625, "__label__software_dev": 0.9833984375, "__label__sports_fitness": 0.00031304359436035156, "__label__transportation": 0.0004906654357910156, "__label__travel": 0.0002366304397583008}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 41165, 0.01369]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 41165, 0.44989]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 41165, 0.9094]], "google_gemma-3-12b-it_contains_pii": [[0, 2758, false], [2758, 5991, null], [5991, 8054, null], [8054, 11465, null], [11465, 13938, null], [13938, 17055, null], [17055, 19260, null], [19260, 22239, null], [22239, 24525, null], [24525, 27522, null], [27522, 30250, null], [30250, 32076, null], [32076, 34800, null], [34800, 38212, null], [38212, 41165, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2758, true], [2758, 5991, null], [5991, 8054, null], [8054, 11465, null], [11465, 13938, null], [13938, 17055, null], [17055, 19260, null], [19260, 22239, null], [22239, 24525, null], [24525, 27522, null], [27522, 30250, null], [30250, 32076, null], [32076, 34800, null], [34800, 38212, null], [38212, 41165, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 41165, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 41165, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 41165, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 41165, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 41165, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 41165, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 41165, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 41165, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 41165, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 41165, null]], "pdf_page_numbers": [[0, 2758, 1], [2758, 5991, 2], [5991, 8054, 3], [8054, 11465, 4], [11465, 13938, 5], [13938, 17055, 6], [17055, 19260, 7], [19260, 22239, 8], [22239, 24525, 9], [24525, 27522, 10], [27522, 30250, 11], [30250, 32076, 12], [32076, 34800, 13], [34800, 38212, 14], [38212, 41165, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 41165, 0.09859]]}
olmocr_science_pdfs
2024-11-28
2024-11-28
67d183697f05519d173ba01a8cff38182b4962cf
Ontological Conjunctive Query Answering over Semi-Structured KBs Bruno Paiva Lima da Silva, Jean-François Baget, Madalina Croitoru To cite this version: HAL Id: lirmm-00618151 https://hal-lirmm.ccsd.cnrs.fr/lirmm-00618151 Submitted on 31 Aug 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. Ontological Conjunctive Query Answering over Semi-Structured KBs Bruno Paiva Lima da Silva #, Jean Francois Baget #, Madalina Croitoru # #EPI GraphIK LIRMM (CNRS - Université Montpellier II) INRIA Sophia Antipolis 161 Rue Ada, F-34392 Montpellier Cedex 5, France {bplsliva,baget,croitoru}@lirmm.fr Abstract—In the context of ontological conjunctive query answering different paradigms for representation and their subsequent manipulation by dedicated reasoning systems have been successfully studied in the past. However, new challenges, problems and issues have appeared in the context of knowledge representation in AI that involve the logical manipulation of increasingly large information sets (see for example the Semantic Web). In this paper we explain these challenges by the means of an example and try to further identify the difficulties ahead of our goal. I. INTRODUCTION The purpose of this paper is to present our current research question: “How to store large knowledge bases in order to be able to scale up ontological conjunctive query answering?” Let us further describe the context of this research question. Knowledge Representation and Reasoning (KRR) studies computational models for building explicit representations of knowledge processed by reasoning engines. Systems based upon such computational models are called knowledge-based systems (KBS). Their fundamental components are a knowledge base (KB) containing different kinds of knowledge and a reasoning engine which performs the inferences. First Order Logic (FOL) is the reference logic in KRR and most formalisms in this area can be translated into fragments (i.e., particular subsets) of FOL. A large part of research in this domain can be seen as studying trade-off between the expressivity of languages and the complexity of (sound and complete) reasoning in these languages. The fundamental problem in KRR formal languages is deduction (or consequence, entailment) checking: “can a given piece of knowledge be deduced from other pieces of knowledge (for instance the KB)?” Another important problem is consistency checking: “is a set of knowledge pieces (for instance the KB itself) consistent, i.e., is it sure that nothing absurd can be deduced from it?” Here we are interested in the ontological conjunctive query answering problem. In its decision form, it asks if the KB contains an answer to the query, and is equivalent to deduction in the special case of boolean queries (i.e., queries with a yes/no answer). Queries must be at least as expressive as conjunctive queries in databases (e.g., a conjunction of positive atoms in logical form); and the knowledge base is split into a factual component (that can be seen as a database or as a conjunction of positive atoms) and an ontological component, that is often expressed by formulas of a specific subset of FOL. Nevertheless, in this context, different paradigms for representation and their subsequent manipulation by dedicated reasoning systems have been successfully studied in the past. However, new challenges, problems and issues have appeared in the context of knowledge representation in AI that involve the logical manipulation of increasingly large knowledge sets (see for example the Semantic Web). Improvements in storage capacity and performance also affect the nature of KRR systems. Their focus has now shifted towards representational power and execution performance. Therefore, research into KRR must move towards investigating structures for representation optimally manipulated to perform large scale reasoning, given very new and different constraints to those existing only few years ago. While a plethora of systems dedicated to non relational structures (such as NoSQL1, which means “Not Only SQL”) for information storing and querying have lately received much attention, we are interested in the representation and reasoning with knowledge. Our querying mechanisms are more expressive than typical queries done in the above mentioned systems. On the other hand, a discussion solely on expressivity / reasoning and how it relates to other NoSQL systems might turn abstract very fast, with the storage issues hidden away. This is why we chose to present this paper solely by the means of a running example where we identify informally the problems we are facing. Our research interests2 follow the computational and logic-oriented approach of KRR: the different kinds of knowledge have a logical semantics and the reasoning corresponds to inferences in this logic, at least for the kernels of studied languages. The fundamental decision problem we want to address is (boolean) ontological conjunctive query answering, which can be expressed as a deduction problem: “is a (boolean) conjunctive query deductible from a KB?” The afore mentioned KB queries are supposed to be at least as expressive as the basic queries in databases, i.e., conjunctive queries, which can be seen as existentially closed conjunctions of atoms. A knowledge base is composed of a set of facts, and a set 1 http://nosql-database.org/ 2 http://www.lirmm.fr/graphik/index.html of rules (ontological knowledge). In this paper rules will be expressed using $\forall\exists$-rules, which have the same logical form as TGDs in databases, and which forms the core of Datalog$^\pm$ family of languages. $\forall\exists$-rules form an abstraction particularly well-suited to the representation of ontological knowledge since they generalize several specific knowledge representation languages adapted to query answering: RDFS [1] (the basic semantic web language), constraints in F-logic-Lite [2], [3] (a powerful subset of F-logic, a formalism for object-oriented deductive databases), as well as the core of new families of description logics tailored for conjunctive query answering [4], [5], [6], [7]. II. Example In this paper, we deliberately chose to present our work informally, by the means of an example. Through this example, we highlight some issues and the limits of current methods used in KRR. For the theoretical foundation of the formalisms detailed below please see: [8] for relational databases and Datalog evaluation techniques, [9] for our graph based representation and [10] for Datalog$^\pm$, that corresponds to the graph based rules as discussed in [11]. Let us consider a knowledge base representing the companies people work in and their practised sport. The knowledge base is composed of the following facts: - (1) “There is a person, named Bob, working for some Organisation (u). This person plays for some football team (p) which has “RueAda, Montpellier” as address. There is another person, named Tom, working for another Organisation (v), which is part of u, and who plays for some rugby team (q), which also has ” RueAda, Montpellier” as address.” The knowledge base is also composed of the following rules: - (2) “If x works for y, and y is part of z, then x also works for z” - (3) “If x and z work for y, then x and z are co-workers” - (4) “If x and z share the same address y, then there is a club t, which contains x and z and has y as address.” - (5) “If x plays in y, which is contained in z, then x is a member of z.” - (6) “If x and z are members of y, then they are in the same club.” Being given the above mentioned facts and rules we want to be able to answer the two following queries: - (7) “Is there a person which works in an organisation and plays in a football team?” - (8) “Are there two persons who are co-workers and share the same sports club?” Please note that query (7) can be answered directly on the facts in (1) i.e. without the application of any of the rules (2) – (6). However, query (8) can only be answered by applying the rules (2) – (6). Also, please note that rules (2), (3), (5) and (6) intuitively only add relations between existing entities, while rule (4) generates a new entity (club) that is added to the knowledge base$^3$. The next section (Section II-A) shows the logical translation of the knowledge base. Then in Section II-B we show the equivalent representation using relational databases. Sections II-C and II-D explain how query answering takes place (without and with rule application). In Section III we then illustrate how the knowledge base can be expressed using a graph based formalism and how query answering (without rules) is equivalent to a labelled graph homomorphism. A. First Order Logic translation In order to lay the logical foundations for the different models used later in this paper please find below the First Order Logic translation of the facts in the knowledge base mentioned in Section II. - (1) $\exists x, y, u, v, p, q \ (\ is-a(x, “Person”) \land name(x, “Bob”) \land works-for(x, u) \land is-a(u, “Organisation”) \land is-a(y, “Person”) \land name(y, “Tom”) \land works-for(y, v) \land is-a(v, “Organisation”) \land part-of(v, u) \land is-a(p, “FootballTeam”) \land plays-in(x, p) \land is-a(q, “RugbyTeam”) \land plays-in(y, q) \land address(p, “RueAda, Montpellier”) \land address(q, “RueAda, Montpellier”) )$ The rule set containing $\forall\exists$-rules: - (2) $\forall x, y, z \ works-for(x, y) \land part-of(y, z) \rightarrow works-for(x, z)$ - (3) $\forall x, y, z \ works-for(x, y) \land works-for(z, y) \rightarrow co-worker(x, z)$ - (4) $\forall x, y, z \land address(x, y) \land address(z, y) \rightarrow \exists t is-a(t, “Club”) \land contains(t, x) \land contains(t, z) \land address(t, y)$ - (5) $\forall x, y, z \land plays-in(x, y) \land contains(z, y) \rightarrow member(x, z)$ - (6) $\forall x, y, z \land member(x, y) \land member(z, y) \rightarrow same-club(x, z)$ And queries: - (7) $\exists x, y, z \ works-for(x, y) \land is-a(y, “Organisation”) \land plays-in(x, y) \land is-a(z, “FootballTeam”)$ $^3$One has to be careful with rules adding new constants or variables to the knowledge base since some of them could be fired forever (for example “Every person has another person as its parent”). For more information please see [12]. B. Equivalence with a Relational Database This section shows an encoding of the example formulas using a relational database containing the facts in the knowledge base introduced in Section II. For every n-ary predicate \( P \) in our facts, we create a new table \( P \) with \( n \) columns. Variables in the knowledge base are then frozen and replaced by fresh constants, since there are no variables in a relational database. After that, for every atom in the facts, a row is added to the table corresponding to the name of the predicate. Figures 1 to 4 represent the relational database for facts (1). <table> <thead> <tr> <th>name</th> <th>works-for</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>2</td> </tr> <tr> <td>&lt; x &gt;</td> <td>“Bob”</td> </tr> <tr> <td>&lt; y &gt;</td> <td>“Tom”</td> </tr> </tbody> </table> <table> <thead> <tr> <th>works-for</th> </tr> </thead> <tbody> <tr> <td>1</td> </tr> <tr> <td>&lt; x &gt;</td> </tr> <tr> <td>&lt; u &gt;</td> </tr> <tr> <td>&lt; y &gt;</td> </tr> <tr> <td>&lt; v &gt;</td> </tr> </tbody> </table> Fig. 1. name and works-for relations <table> <thead> <tr> <th>is-a</th> </tr> </thead> <tbody> <tr> <td>1</td> </tr> <tr> <td>&lt; x &gt;</td> </tr> <tr> <td>“Person”</td> </tr> <tr> <td>&lt; u &gt;</td> </tr> <tr> <td>“Organisation”</td> </tr> <tr> <td>&lt; y &gt;</td> </tr> <tr> <td>“Person”</td> </tr> <tr> <td>&lt; v &gt;</td> </tr> <tr> <td>“Organisation”</td> </tr> <tr> <td>&lt; p &gt;</td> </tr> <tr> <td>“FootballTeam”</td> </tr> <tr> <td>&lt; q &gt;</td> </tr> <tr> <td>“RugbyTeam”</td> </tr> </tbody> </table> Fig. 2. is-a relation <table> <thead> <tr> <th>part-of</th> <th>plays-in</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>2</td> </tr> <tr> <td>&lt; v &gt;</td> <td>&lt; u &gt;</td> </tr> <tr> <td>&lt; x &gt;</td> <td>&lt; p &gt;</td> </tr> <tr> <td>&lt; y &gt;</td> <td>&lt; q &gt;</td> </tr> </tbody> </table> Fig. 3. part-of and plays-in relations <table> <thead> <tr> <th>address</th> </tr> </thead> <tbody> <tr> <td>1</td> </tr> <tr> <td>&lt; p &gt;</td> </tr> <tr> <td>“Rue Ada, Montpellier”</td> </tr> <tr> <td>&lt; q &gt;</td> </tr> <tr> <td>“Rue Ada, Montpellier”</td> </tr> </tbody> </table> Fig. 4. address relation C. Rule Application Rule application allows to enrich the KB with new facts deduced from existing ones. In Datalog\(^k\), a rule is an expression of form \( \forall x_1, ..., x_k \ C \rightarrow C’ \) where \( x_1 \) to \( x_k \) are the variables present in the conjunction of atoms \( C \) and \( C’ \). \( C \) is called the head of the rule, while \( C’ \) is the tail. In Datalog\(^k\), the chase algorithm consists in enriching the database (directly, or just a local copy) with inferred information. It queries the head of the rule in the database using a SELECT-FROM-WHERE call, and if there is a positive answer to the query, a specification of the tail of the rule is then inserted to the base with an INSERT call. In the case of our example, rule (2) will fire since (1) \( <v> \) is part-of \( <u> \) and (2) \( <y> \) works-for \( <v> \). Therefore, the new row \( <y>, <u> \) will be added to the table works-for. Similarly, the rules (3), (5) and (6) will add new rows in corresponding tables. Please note though that the expressivity of the rules we are interested in is that of \( \forall \exists \)-rules as explained in the introduction. This means that we want to be able to add not only new rows but also new relations between pieces of information, which in this case would correspond to adding new tables or changing the relational schema of the database. This cannot be dealt with by Datalog itself. We point out that TGDS can add rows that use newly generated constants, which why the chase may not halt (the deduction problem is indeed undecidable). However, decidable subclasses of the problem have been studied (eg. [3], [11], [12]). D. Querying a Knowledge Base The SQL translation of the queries in the example is as follows: - (7) SELECT * FROM works-for,plays-in,is-a isa1,is-a isa2 WHERE works-for.2 = isa1.1 AND isa1.2 = “Organisation” AND plays-in.2 = isa2.1 AND isa2.2 = “FootballTeam” - (8) SELECT * FROM co-worker,same-club WHERE co-worker.1 = same-club.2 AND co-worker.2 = same-club.1 No rules need to be applied to answer the first query, however, 4 tables (the same table twice), need to be joined. More importantly, the second query can only be answered after the addition of new pieces of knowledge to the base. Consistency becomes a problem in this case since it is initially maintained by the fact that the data stored is supposed to be organized into normalized tables, in which independent sets of data are related by a key and in which redundancy is avoided. While this model seems appropriate when dealing with sets of structured data, the semi-structured nature of our data makes the relational model difficult to fit into. We can distinguish two different methods for rule application over a KB: forward-chaining and backwards-chaining. The forward-chaining method fires all rules looking for new pieces of information to be added to the base until an answer to the query is found. The large amount of joins when performing a request in the KB becomes quickly very costly, and things get even more difficult when new information has to be introduced to the base, since indexes and the database schema have to be updated several times. On the other hand, the backwards-chaining method does not add any new information to the KB, but has a major drawback as it can possibly create a huge number of queries. Scaling is also one of the real problems of those approaches since joins usually create new temporary tables in main memory. One should not forget our initial intentions to answer conjunctive queries when the knowledge base itself cannot be held any more in main memory. So far we have presented the relational approach and its drawbacks when scaling up. These drawbacks led us to look into graph appropriate storage for solving our problem. Let us further detail the graph model and highlight our specific needs for the conjunctive query answering problem. III. Graph-based representation In this section we represent the knowledge base using the graph based formalism detailed in [9]. In this representation, constants and variables are vertices in our (hyper)graph, while (hyper)edges between those vertices represent the atoms in our KB. \[ \text{name}(x, “Bob”) \] Fig. 5. A fact in the knowledge base and its graph representation on the right. Figure 5 shows the transformation of the facts of the KB in a graph, and Figure 6 represents the graph containing the facts in the KB for the given example. \[ \begin{align*} \text{works-for}(x, y) & \quad \text{plays-in}(y, z) \\ \text{is-a}(x) & \quad \text{is-a}(y) \\ \text{name}(x) & \quad \text{name}(y) \\ \text{“Organisation”} & \quad \text{“Football Team”} \\ \text{“Person”} & \quad \text{“Tom”} \\ \text{“Football Team”} & \quad \text{“Rugby Team”} \\ \text{“RueAda - Montpellier”} & \\ \end{align*} \] Fig. 6. Graph containing the facts (1) from Section II. A. Querying In a graph-based KB, queries are represented as graphs. Figures 7 and 8 show the graphs of both queries from Section II. \[ \begin{align*} \text{x} & \quad \text{works-for}(x, y) \\ \text{co-worker}(x, y) & \\ \text{same-club}(x, y) \\ \text{“Organisation”} & \quad \text{“Football Team”} \\ \end{align*} \] Fig. 7. Graph representing the query (7) from Section II. \[ \begin{align*} \text{x} & \quad \text{name}(x) \\ \text{co-worker}(x, y) & \\ \text{same-club}(x, y) \\ \text{“Organisation”} & \quad \text{“Football Team”} \\ \end{align*} \] Fig. 8. Graph representing the query (8) from Section II. B. Homomorphism Queries in a graph-based KB are answered by computing a labelled graph homomorphism from the graph representing the query \( Q \) to \( F \), the graph of facts. The fundamental theorem says that a logical formula \( Q \) can be deduced from another formula \( F \) iff there is a labelled graph homomorphism from the graph representing \( Q \) to the graph representing \( F \). Basically, a labelled graph homomorphism is a mapping, say \( \pi \), from the vertices of the graph \( Q \) (the query), to those of the graph \( F \) (the facts) that preserves both the constants labelling the nodes and the hyperedges and their type. More formally: - if \( x \) is a vertex of \( Q \) labelled by a constant \( c \), then the label of \( \pi(x) \) is also \( c \); - if there is a hyperedge labelled \( p \) between vertices \( (x_1, \ldots, x_q) \) in \( Q \), then there must also be a hyperedge labelled \( p \) between vertices \( (\pi(x_1), \ldots, \pi(x_q)) \) in \( F \). Since the labelled graph homomorphism problem is NP-Complete, a backtracking algorithm is used to enumerate all the possible matchings that answer the query. Let us now detail the execution of a backtracking algorithm for homomorphism finding. We consider a recursive algorithm that, at every loop, extends the current matching algorithm. We name the algorithm \( \text{Extend}() \). The algorithm takes as \[ \text{Extend}(\pi, x, y) \] \[ \text{co-worker}(x, y) \] \[ \text{same-club}(x, y) \] \[ \text{“Organisation”} \] \[ \text{“Football Team”} \] \[ \text{works-for}(x, y) \] \[ \text{plays-in}(y, z) \] \[ \text{is-a}(x) \] \[ \text{is-a}(y) \] \[ \text{name}(x) \] \[ \text{name}(y) \] \[ \text{“Organisation”} \] \[ \text{“Football Team”} \] \[ \text{“Person”} \] \[ \text{“Tom”} \] \[ \text{“Football Team”} \] \[ \text{“Rugby Team”} \] \[ \text{“RueAda - Montpellier”} \] \[ \text{is-a}(x) \] \[ \text{is-a}(y) \] \[ \text{name}(x) \] \[ \text{name}(y) \] \[ \text{“Organisation”} \] \[ \text{“Football Team”} \] \[ \text{“Person”} \] \[ \text{“Tom”} \] \[ \text{“Football Team”} \] \[ \text{“Rugby Team”} \] \[ \text{“RueAda - Montpellier”} \] parameters the set of already matched nodes couples, and the graphs representing query and facts. \textit{Extend(MatchedNodes, Query, Facts)} returns true if the number of couples in the matched nodes set is equal to the number of nodes in the query graph. If not, it selects a node \( n \) that has not yet been matched, and returns a list of relevant possible node matchings \( i \) of the node \( n \) according to MatchedNodes, Query and Facts. Then, for each of the possible matchings, the algorithm is recursively called with the couple \((n,i)\) added to the matched nodes set. Let us consider the first query that can be answered without rule application (detailed in the next section). To find a homomorphism from this query to the facts graph, the algorithm starts matching all the constant vertices from the query graph to the facts one. As we have seen on Figure 7, the constants in the query, “Organisation” and “FootballTeam”, are also present in the facts, and are added to the matched nodes set. After that, the algorithm will try to match the remaining variable nodes of the query graph. Node \( x \) has two outgoing relations to another variable: \texttt{works-for} and \texttt{plays-in}. Possible matchings for \( x \) then are nodes \( x \) and \( y \) from the graph of facts. When node \( x \) in query is matched with \( y \) in facts, \( y \) will then be then paired to \( v \) since it is an Organisation, and then \( z \) will not have any matching possibility since there is no node in the facts connected to \( y \) via \texttt{plays-in} relation and to “FootballTeam” via \texttt{is-a} relation. This branch will then be left and other branches will be explored in order to find a positive answer. On the other side, when \( x \) is paired with \( x \), \( y \) will then be paired to \( u \), and \( z \) to \( p \), which is a Football Team. True is then returned by the algorithm, meaning that there is in fact an homomorphism from \( Q \) to \( F \), and the matched nodes set \( \{(x,x),(y,u),(z,p)\} \) is the answer of our query. There are thus two elementary operations needed in order to calculate a homomorphism from the query graph to the facts: \begin{itemize} \item Matching a vertex from the query graph with another in the facts graph \footnote{We do not make the assumption that the facts graph is connected.} \item Accessing the neighborhood of both matched vertices to check whether their edges and adjacent vertices are compatible or not. \end{itemize} While matching vertices from two different graphs into a pair can be easily done in constant time, efficient access to the neighborhood of a vertex is primordial in order to have some real advantage over traditional relational database systems. For instance, for a \( n \)-ary predicate \( p \) of arity 4, the complexity of searching for the presence of an atom \( p(x,<c_1>,y,<c_2>) \) in a KB using a relational database is \( O(m^p) \), \( m^p \) being the size of the table \( p \). Using a graph-based KB instead, this complexity can be improved to \( O(d_{<c_1>}) \), with \( d \) being the size of the neighborhood of a given vertex, in this case \( <c_1> \), if there are optimized data structures and algorithms to quickly access the neighborhood of a vertex. This improvement is due to the fact that the encoding of semi-structured data into a graph does generate a graph with a very small density, in which good efficiency is obtained when accessing the neighborhood of a vertex. However, there is still no efficient method for doing it when the graph-based KB is stored in secondary memory. It is however impossible to have an answer for the second query without enriching the KB with new facts (or rewriting the query). Let us detail in the next section how rule application takes place. C. Rule application in a graph-based KB The forward-chaining method for rule application in a graph-based KB that will be described more precisely in this part of the paper mimics exactly the \textit{chase} method mentioned in Section II-C. \begin{figure}[h] \centering \includegraphics[width=0.5\textwidth]{fig9.png} \caption{Graph representing the Rule (2) from Section II.} \end{figure} In a graph-based KB, rules are represented using two pieces of graph: head (hypothesis) and tail (conclusion). Figure 9 and 10 show the graph representation of the Rules (2) and (4) from the example in Section II. \begin{figure}[h] \centering \includegraphics[width=0.5\textwidth]{fig10.png} \caption{Graph representing the Rule (4) from Section II.} \end{figure} Rule application works in two steps: first, the head of the rule needs to be deducted from the facts (using homomorphism). Then, if there is a homomorphism, the conclusion gets added to the graph respecting links between vertices in head and tail parts of the rule. The method we use to enrich the graph-based KB is called forward-chaining, which consists in applying all rules of the rule set until there is no more new information to be added to the KB. Note that while rule (2) only adds edges to the facts graph rule (4) can also introduce new variables to the KB. This is the reason why, apart from the efficient operations mentioned above, we need a flexible data structure that also allows quickly adding edges and nodes to the graph. Figure 11 shows the facts graph after applying rule (4). Once the graph saturated with all the rules, the second query can be answered in the same way as described before. ![Graph representation](image) Fig. 11. Graph after rule (4) application. Please note that the old graph vertices and edges are colored in grey. Old edges are also now dotted. The newly introduced vertices and edges are in black. IV. CONCLUSION Knowledge Representation and Reasoning (KRR) studies computational models for building explicit representations of knowledge processed by reasoning engines. Given the need for increasingly large knowledge, research into KRR must move now towards investigating structures for representation, optimally manipulated to perform large scale reasoning. In this work, we have compared two different approaches for the ontological conjunctive query answering. We have first introduced the method for performing reasoning over a KB using a relational database with a set rules. This method has already proved that it works very well when dealing with large sets of structured data, stored whether in main or in secondary memory. Then we have presented another approach for solving our problem using a graph-based KB with graph rules. As we have showed before, this approach ensures an unicity between the KB and the query languages and has theoretically better results than the first method when reasoning over semi-structured data. Nevertheless, our graph based approach for representation and reasoning\(^6\) only works well when the facts hold in main memory. This is why we are now interested in finding adequate storage solutions suitable for our graphs reasoning manipulations. More precisely, as shown in the previous sections, the reasoning mechanism we use on graphs is labelled graph homomorphism. When detailing our backtracking algorithm we identified two important qualities of the desired graph based storage: a good indexing on nodes (that facilitates the identification of potential candidates for matching) and an efficient structure of access to the neighbors of a given node, and, for these neighbors, its subsequent neighbors. Moreover, rule application will mean that our structure also needs to be flexible for the insertion of new nodes and edges. After having set the operations we need in order to perform reasoning over graphs, our future work will consist in evaluating current solutions to the ontological conjunctive query problem (such as AllegroGraph\(^8\), Neo4J\(^9\) or HyperGraphDB\(^10\)) and testing their large scale efficiency. In parallel, we will also investigate different graph paradigms for storage that allow efficient manipulation for the operations previously described. REFERENCES \(^{6}\)http://www.lirmm.fr/cogui/ \(^{7}\)http://cogitant.sourceforge.net/ \(^{8}\)http://www.franz.com/agraph/allegrograph/ \(^{9}\)http://neo4j.org/ \(^{10}\)http://www.kobrix.com/hgdb.jsp
{"Source-Url": "https://hal-lirmm.ccsd.cnrs.fr/lirmm-00618151/document", "len_cl100k_base": 7328, "olmocr-version": "0.1.53", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 26225, "total-output-tokens": 8538, "length": "2e12", "weborganizer": {"__label__adult": 0.0004279613494873047, "__label__art_design": 0.0005741119384765625, "__label__crime_law": 0.00086212158203125, "__label__education_jobs": 0.00284576416015625, "__label__entertainment": 0.0002084970474243164, "__label__fashion_beauty": 0.0002560615539550781, "__label__finance_business": 0.0006265640258789062, "__label__food_dining": 0.0006074905395507812, "__label__games": 0.0011119842529296875, "__label__hardware": 0.0008492469787597656, "__label__health": 0.0011138916015625, "__label__history": 0.0004982948303222656, "__label__home_hobbies": 0.00017273426055908203, "__label__industrial": 0.0007963180541992188, "__label__literature": 0.0013418197631835938, "__label__politics": 0.000499725341796875, "__label__religion": 0.0007371902465820312, "__label__science_tech": 0.42431640625, "__label__social_life": 0.00025343894958496094, "__label__software": 0.0242156982421875, "__label__software_dev": 0.53662109375, "__label__sports_fitness": 0.0003325939178466797, "__label__transportation": 0.0007338523864746094, "__label__travel": 0.00023603439331054688}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 31194, 0.01481]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 31194, 0.45591]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 31194, 0.89385]], "google_gemma-3-12b-it_contains_pii": [[0, 1116, false], [1116, 6244, null], [6244, 11152, null], [11152, 15697, null], [15697, 20231, null], [20231, 25472, null], [25472, 31194, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1116, true], [1116, 6244, null], [6244, 11152, null], [11152, 15697, null], [15697, 20231, null], [20231, 25472, null], [25472, 31194, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 31194, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 31194, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 31194, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 31194, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 31194, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 31194, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 31194, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 31194, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 31194, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 31194, null]], "pdf_page_numbers": [[0, 1116, 1], [1116, 6244, 2], [6244, 11152, 3], [11152, 15697, 4], [15697, 20231, 5], [20231, 25472, 6], [25472, 31194, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 31194, 0.17391]]}
olmocr_science_pdfs
2024-12-11
2024-12-11
84b522187090bb9b95fef27b43ea8a6e6f8f7c2b
How validation can help in testing business processes orchestrating web services Damian Grela¹∗, Krzysztof Sapiecha¹†, Joanna Strug¹‡ ¹Department of Computer Science, Cracow University of Technology, Warszawska 24, 31-155 Kraków, Poland Abstract – Validation and testing are important in developing correct and fault free SOA-based systems. BPEL is a high level language that makes it possible to implement business processes as an orchestration of web services. In general, the testing requires much more test scenarios than the validation. However, in the case of BPEL processes, which have very simple and well structured implementation, test scenarios limited to the validation may also be efficient. The paper describes an experiment that aims at answering a question whether or not the validation test scenarios are also adequate for testing an implementation of BPEL processes. The experiment employs a Software Fault Injector for BPEL Processes that is able to inject faults when the test scenarios are running. The results of the experiment seem very promising. Hence, it seems that validation tests might give a strong support for testing. 1 Introduction Recently, SOA (Service Oriented Architecture) [1] has become the most promising architecture for IT systems. It offers a way of composing systems from loosely coupled and interoperable services. The services are independent business functions made accessible over a network by remote suppliers. A developer of a SOA-based system should only select the most appropriate services and coordinate them into business processes that cover specification requirements for the system. BPEL (Business Process Execution Language) [2] is a high level language that makes it possible to implement business processes as an orchestration of web services. The How validation can help in testing business processes Orchestration consists in subsequent invoking the web services by a special element of the process, called its coordinator. It leads to a very simple and structured SOA where only the coordinator and communication links between the coordinator and the services need to be tested. A correctness of the services may be assumed, as they are provided as ready-to-use components and should be tested by their developers before being shared. Both, validation and testing may be performed with the help of test scenarios. In \cite{3, 4} a method of generation of test scenarios for validation of a BPEL process was given. Test scenarios obtained by means of the method cover all functional requirements for the process and provide high validation accuracy \cite{4}. This paper presents a case study that aims at answering a question to what extent such test scenarios are adequate for testing an implementation of the process. To this end an experiment employing Software Fault Injector for BPEL Processes (SFIBP) was carried out and fault coverage for the test scenarios was calculated. The paper is organised as follows. In Section 2 a related work is briefly described. In section 3 the problem is formulated. Section 4 defines fault coverage for the test scenarios. Section 5 contains a description of a case study. The paper ends with conclusions. ## 2 Related work The problem of testing the SOA-based systems is not new, but most researchers focused on test generation \cite{5, 6, 7, 8, 9, 10, 11, 12}. Their works fall loosely into two categories: developing efficient algorithms for selection of adequate tests \cite{6, 7, 8, 9} and automation of the selection process \cite{10, 11, 12}. Y. Yuan and Y. Yan \cite{6, 7} proposed the graph-based approaches to handle concurrency activities of BPEL processes, in addition to basic and structured activities. Their approach was extended, combined with other techniques and implemented by several other researchers \cite{8, 9}. M. Palomo-Duarte, A. Garcia-Dominguez, and I. Medina-Bulo based their approaches on the traditional white-box testing methods \cite{10, 11, 12} and used formal methods and hybrid approaches along with the ActiveBPEL \cite{13} and BPELUnit \cite{14} test library for generating tests. However, in the works there are not any studies concerning the adequacy of generated tests for both validation and testing of BPEL processes. The adequacy of tests can be measured with regard to some predefined metrics or by injecting faults and observing whether they are detected or not \cite{15}. Fault injection is a popular technique that has been already applied in the context of SOA-based systems\cite{16, 17, 18, 19}. The technique was often used for test generation \cite{15}. PUPPET (Pick UP Performance Evaluation Test-bed) \cite{16} is a tool for automatic generation of test-beds to empirically evaluate the QoS \cite{17} features of a Web Service under development. GENESIS \cite{18} generates executable web services from a description provided by the user and provides an environment in which the services can be tested prior to deployment in a production system. Another fault injection tool, WSInject \cite{19}, is a script-driven fault injector that is able to inject interface and communication faults. WSInject works at the SOAP level and intercepts SOAP messages. All of these approaches concern web-services or communication between a BPEL process and web-services (i.e. a fault is injected when a Web service is invoked). In the case of business processes various types of faults (e.g. replacement of input values) may appear. Therefore, SFIBP should be easily configurable to inject a rich variety of faults appearing in the very specific operational environment. 3 Problem statement Validation aims to determine whether a software system satisfies requirements specification or not \[20\]. Requirements specification defines, in a formal way, what the system is expected to do. Test scenarios derived from such specification may be successfully used for the validation. In \[3\] an effective method for generation of test scenarios for validation of BPEL processes against specification requirements defined in SCR \[21\] was given. However, specification requirements should not contain anything that is not of interest for a user. Thus, test scenarios derived from the specification can check all specified requirements, but not necessarily implementation details that are introduced in further stages of development of the system. Therefore, the system should be tested to detect implementation errors. As generation of tests is usually time consuming, it is of high importance to find out to what extent the validation test scenarios are useful for the testing. To this end, an experiment might be performed and the implementation error coverage for the test scenarios could be calculated. In general, the testing requires much more test scenarios than the validation. However, in the case of BPEL processes, which have very simple and well structured implementation, test scenarios limited to the validation may also be efficient. To measure the coverage of implementation errors by the validation test set, Software Fault Injector \[22\] for BPEL Processes will be applied. Implementation errors of BPEL process will be simulated by injecting faults when the test is running. 4 Faults in the SOA-based systems In the SOA-based systems faults may be caused by two reasons: 1. incorrect interaction between web-services, and 2. incorrect internal logic of the system components (web-services and/or coordinator). Interaction faults affect communication between different web-services or between the coordinator and the web-services. Internal logic errors are introduced by human developers or production facilities when components of the system are implemented. Eight types of interaction faults and four types of internal logic errors were identified \[23\]. Three out of them concern the systems orchestrating web services. These are the following: 1. Misbehaving execution flow. The fault occurs when a programmer invokes improper web-service\(^1\) (i.e. different from the specified one). Fig. 1 gives an example of an improper web-service invocation error (a) and a faulty free version of the code (b). ![AssignTicketRS](http://example.com) ![AssignTicketRS](http://example.com) Fig. 1. Improper (a) and correct (b) web service invocation. 2. Incorrect response. The fault is caused by incorrect processing, within a coordinator, of correct response of a web-service (other causes related to incorrect internal logic of a web-service, as defined in [23], are not considered due to the assumption of correctness of web-services). Incorrect processing means, that: - a response from a wrong output port is used (Fig. 2), - a response is assigned to a wrong variable (Fig. 3), or - a response is not assigned at all (Fig. 4). \(^1\)The invoked web-service should exist and the invocation should be correct with regard to the specification of the web-service (otherwise such error will be reported by the compiler). 3. **Parameter incompatibility.** It occurs when a web-service receives, as an input data, incorrect arguments or arguments of incorrect types. The following four errors introduced into the implementation of a coordinator cause such a fault: • a different operation of a web-service is invoked (Fig. 5). The operation should belong to the web-service (otherwise such error will be reported by a compiler). • a wrong input port is used (Fig. 6). The port used should be consistent with the one that should be used (otherwise such error will be reported by a compiler). • a wrong output port is used (Fig. 6), or • a wrong value is assigned to an input port (Fig. 7). Fig. 5. Different (a) and proper (b) operations of a web-service are invoked. Fig. 6. Wrong (a) and correct (b) input and output ports are used. Fig. 7. Wrong (a) and correct (b) values are assigned to an input port. Effects of the faults are visible because the faults make the external behaviour of the coordinator be different from the expected one. The cause-effect table is shown in Fig. 8. Fig. 8. Implementation errors, interaction and development faults and their effects. All other faults defined in [23] are not relevant for this work. These faults are either related to a physical layer or caused by providers of web-services (incorrectness of web-services or interaction between web-services). 5 Case study The goal of the case study is to evaluate the adequacy of validation test scenarios for testing BPEL processes. The test scenarios are evaluated based on their fault coverage calculated with respect to the faults generated by the SFIBP. The SFIBP generates the following three types of faults: 1. replacing web-service output parameters (OP), 2. replacing values of a web-service input parameters (IP), 3. replacing requested web-service with another one (WS). The faults generated by SFIBP give the same observable effects as those described in Section 4, but their injection does not require the implementation of a coordinator to be changed. The fault coverage for a set of test scenarios (FC) is expressed as a percentage of detected faults to all injected faults. \[ FC = \frac{F_D}{F_I} \cdot 100\% , \quad \text{where:} \] $F_D$ – a number of detected faults, $F_I$ – a total number of injected faults. As the faults are artificially generated and injected, their total number is known. However, it is not possible to determine the number and the types of all errors that might be the real source of the faults. Nevertheless, this is not shortcoming of the approach because only the coverage has considerable meaning. The subsequent subsections describe briefly SFIBP that was used in the experiment to generate and inject faults (Section 5.1), an example system and test scenarios generated for the system (Section 5.2), and the experiment and its results (Section 5.3). 5.1 Software Fault Injector for the BPEL Processes SFIBP is an execution-based injector [15], which is able to inject faults into the BPEL processes when test scenarios are running. The SFIBP has been implemented as a special local service that is invoked instead of the proper web-service. Such approach helps reduce costs of the experiment, as the faults are injected without changing the implementation of a coordinator. A configuration file produced by the SFIBP defines three parameters of the proper web-services: - identifiers of all methods provided by the web-services (ID), - names of the methods, - the number and names of parameters of the methods. It also incudes predefined values of input and output parameters, values of alternative web-services IDs that are used to generate faults and the probability that a fault will be injected. Information about the injected faults is stored in a log file. 5.2 Football Reservation System Football Reservation System (FRS) is a simple system allowing its users to book tickets for football games, hotels to stay during the games and plane or train tickets to arrive at the games. The system was implemented as a BPEL process orchestrating five web-services. Each of the services is accessible on a different server and the whole process of reservation is coordinated through a central coordinator (Fig. 9). Short descriptions of the web-services and their input and output parameters are given in Table 1. Types of the parameters are placed in brackets next to the parameters names. A set of test scenarios generated for the system consists of 4 test scenarios having between two and five input/output events. The total number of the events is 16. The test scenarios were generated by means of the checking path method presented in [3]. Their usage provided high validation accuracy for the system. Fig. 9. Service orchestration for a Football Reservation process. Table 1 <table> <thead> <tr> <th><strong>web-service ID</strong></th> <th><strong>description</strong></th> <th><strong>Parameters</strong></th> </tr> </thead> <tbody> <tr> <td><strong>Client</strong></td> <td>retrieves data from the client and sends information about order</td> <td>Date [String]</td> </tr> <tr> <td><strong>TicketRS</strong></td> <td>checks an availability of a football ticket at the given date</td> <td>Date [String]</td> </tr> <tr> <td><strong>HotelBS</strong></td> <td>checks an availability of a hotel room at the given date</td> <td>Date [String]</td> </tr> <tr> <td><strong>TrainTR</strong></td> <td>checks an availability of a train at the given date</td> <td>Date [String]</td> </tr> <tr> <td><strong>PlaneTR</strong></td> <td>checks an availability of a plane at the given date</td> <td>Date [String]</td> </tr> </tbody> </table> 5.3 The experiment The experiment consisted in: 1. implementing a fault free BPEL process for FRS and generating validation test scenarios, 2. configuring the SFIBP, 3. starting the SFIBP and running the BPEL process with the test scenarios, 4. comparing the outputs generated by the BPEL process with the expected ones given by test scenarios, 5. saving the results, 6. calculating the fault coverage. Steps 3, 4 and 5 were repeated 1000 times. At each of the iteration randomly generated faults were injected into the BPEL process. Table 2 shows the setting for all web-services of the FRS. The first row of the table shows IDs of web-service. The next two rows show the values of output and input parameters that are used to replace the proper ones when the faults are injected. IDs of web-services that are invoked instead of the proper ones are shown in the last row. The probability that a fault will occur was set to 33% for all faults. Table 2 <table> <thead> <tr> <th>Web-service</th> <th>TicketRS</th> <th>HotelBS</th> <th>TrainTR</th> <th>PlaneTR</th> </tr> </thead> <tbody> <tr> <td>output parameter</td> <td>„Yes”, „No”</td> <td>„OK”, „No”</td> <td>„Success”, „Failure”</td> <td>„True”, „False”</td> </tr> <tr> <td>alternative web-services</td> <td>„TicketRS”, „PlaneTR”, „TrainTR”</td> <td>„TicketRS”, „PlaneTR”, „TrainTR”</td> <td>„TicketRS”, „HotelBS”, „PlaneTR”</td> <td>„TicketRS”, „HotelBS”, „TrainTR”</td> </tr> </tbody> </table> The outputs generated by TicketRS, HotelBS, TrainTR and PlaneTR depend on an interval between a date of reservation and a date of football match. If the interval is equal or longer than it was assumed, then the respective web-service generates positive answer, otherwise the answer is negative. The intervals were set as follows: 15 days for TicketRS, 5 days for HotelBS, 1 day for TrainTR and 30 days for PlaneTR. These rules were introduced into the implementation of the web-services. In the experiment the reservation date is an actual date (a day on which the process was invoked) and the date of the football match is the date that was specified by the user during the FRS invocation. During the experiment the SFIBP could generate various combinations of the three types of faults (Section 5) or not introduce any fault. This gives eight different configurations of faults for each of the web-services and about 4000 for the whole system. At the end of the experiment its results were analyzed and the fault coverage for the test scenarios was calculated. Table 3 summarises the results. It reports, for each of the web-services, the total number of fault injected, and detected. The fault numbers were grouped based upon the type of faults. Table 3 <table> <thead> <tr> <th>Faults</th> <th>TicketRS</th> <th>HotelBS</th> <th>TrainTR</th> <th>PlaneTR</th> </tr> </thead> <tbody> <tr> <td></td> <td>IP</td> <td>OP</td> <td>WS</td> <td>IP</td> </tr> <tr> <td>injected</td> <td>304</td> <td>212</td> <td>348</td> <td>144</td> </tr> <tr> <td>detected</td> <td>295</td> <td>208</td> <td>348</td> <td>140</td> </tr> <tr> <td>FC</td> <td>97%</td> <td>98%</td> <td>100%</td> <td>97%</td> </tr> </tbody> </table> Due to the nature of the example majority of the injected faults is related to the first web-service (TicketRS) and the minority of them to the last web-service (PlaneTR). Almost all injected faults were detected by the test scenarios. The average fault coverage calculated based on the results of the experiments was 98%. 6 Conclusions The paper describes a statistical experiment carried out to evaluate the test scenarios generated for validation of BPEL processes in context of testing the processes. Test generation is a time consuming activity, thus the possibility of having one set of tests scenarios providing accurate results for both validation and testing, was worth investigating. The experiment was performed on a small example orchestrating five web-services. For the system, the SFIBP was able to generate three types of faults giving in total 4000 different fault configurations. For more complex systems the number of different fault configurations may be much higher than for the FRS. That is why not exhaustive but statistical testing was performed. It illustrates a general approach to the problem. The experimental results seem very promising. The calculated fault coverage shows that almost all injected faults (98%) were detected by the test scenarios. The results confirmed the earlier assumptions that in the case of BPEL processes validation test scenarios may be adequate, also when they are used for testing. Hence, it seems that validation tests might give a strong support for testing. However, the experiment was carried out only on one simple system and focused on faults that only simulate implementation errors. More experiments are needed in order to make the conclusions more general. This will be one of the main goals of our further research. How validation can help in testing business... References
{"Source-Url": "http://journals.umcs.pl/ai/article/download/3372/2566", "len_cl100k_base": 4350, "olmocr-version": "0.1.53", "pdf-total-pages": 13, "total-fallback-pages": 0, "total-input-tokens": 24761, "total-output-tokens": 6177, "length": "2e12", "weborganizer": {"__label__adult": 0.00030303001403808594, "__label__art_design": 0.0003120899200439453, "__label__crime_law": 0.0003333091735839844, "__label__education_jobs": 0.0006594657897949219, "__label__entertainment": 6.866455078125e-05, "__label__fashion_beauty": 0.00014710426330566406, "__label__finance_business": 0.0002512931823730469, "__label__food_dining": 0.00031948089599609375, "__label__games": 0.0004954338073730469, "__label__hardware": 0.0007724761962890625, "__label__health": 0.0004634857177734375, "__label__history": 0.00017905235290527344, "__label__home_hobbies": 5.495548248291016e-05, "__label__industrial": 0.00034356117248535156, "__label__literature": 0.0002884864807128906, "__label__politics": 0.00020492076873779297, "__label__religion": 0.00036072731018066406, "__label__science_tech": 0.0290374755859375, "__label__social_life": 9.018182754516602e-05, "__label__software": 0.0104522705078125, "__label__software_dev": 0.9541015625, "__label__sports_fitness": 0.0002149343490600586, "__label__transportation": 0.0003712177276611328, "__label__travel": 0.00016510486602783203}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 23701, 0.03236]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 23701, 0.54621]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 23701, 0.87125]], "google_gemma-3-12b-it_contains_pii": [[0, 1815, false], [1815, 5070, null], [5070, 7924, null], [7924, 8996, null], [8996, 9238, null], [9238, 9882, null], [9882, 11221, null], [11221, 13737, null], [13737, 14748, null], [14748, 17150, null], [17150, 19592, null], [19592, 23247, null], [23247, 23701, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1815, true], [1815, 5070, null], [5070, 7924, null], [7924, 8996, null], [8996, 9238, null], [9238, 9882, null], [9882, 11221, null], [11221, 13737, null], [13737, 14748, null], [14748, 17150, null], [17150, 19592, null], [19592, 23247, null], [23247, 23701, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 23701, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 23701, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 23701, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 23701, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 23701, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 23701, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 23701, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 23701, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 23701, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 23701, null]], "pdf_page_numbers": [[0, 1815, 1], [1815, 5070, 2], [5070, 7924, 3], [7924, 8996, 4], [8996, 9238, 5], [9238, 9882, 6], [9882, 11221, 7], [11221, 13737, 8], [13737, 14748, 9], [14748, 17150, 10], [17150, 19592, 11], [19592, 23247, 12], [23247, 23701, 13]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 23701, 0.13333]]}
olmocr_science_pdfs
2024-12-09
2024-12-09
d0567aad7b064a68f8e8659888c3359a84ff555a
New and Forthcoming Developments in the AMPL Modeling Language & System Robert Fourer AMPL Optimization www.ampl.com — 773-336-AMPL INFORMS Conference on Business Analytics and Operations Research San Antonio, Texas — 7-9 April 2013 Track 11, Software Tutorials Outline Essentials - Why AMPL? - AMPL’s users Enhancements: Building & maintaining models - More natural formulations - Logical conditions - Quadratic constraints - Integrated development environment (AMPL IDE) Enhancements: Deploying models - Application programming interfaces (AMPL API) - C++, Java, .NET, Python - MATLAB, R The Optimization Modeling Cycle **Steps** - Communicate with problem owner - Build model - Prepare data - Generate optimization problem - Submit problem to solver - CPLEX, Gurobi, Xpress, KNITRO, CONOPT, MINOS, ... - Report & analyze results - **Repeat!** **Goals** - Do this quickly and reliably - Get results before client loses interest - Deploy for application What Makes This Hard? “We do not feel that the linear programming user’s most pressing need over the next few years is for a new optimizer that runs twice as fast on a machine that costs half as much (although this will probably happen). Cost of optimization is just not the dominant barrier to LP model implementation. “The process required to manage the data, formulate and build the model, report on and analyze the results costs far more, and is much more of a barrier to effective use of LP, than the cost/performance of the optimizer.” Krabek, Sjoquist, Sommer, “The APEX Systems: Past and Future.” *SIGMAP Bulletin* 29 (April 1980) 3-23. Optimization Modeling Languages Two forms of an optimization problem - Modeler’s form - Mathematical description, easy for people to work with - Algorithm’s form - Explicit data structure, easy for solvers to compute with Idea of a modeling language - A computer-readable modeler’s form - You write optimization problems in a modeling language - Computers translate to algorithm’s form for solution Advantages of a modeling language - Faster modeling cycles - More reliable modeling and maintenance Algebraic Modeling Languages Formulation concept - Define data in terms of sets & parameters - Analogous to database keys & records - Define decision variables - Minimize or maximize a function of decision variables - Subject to equations or inequalities that constrain the values of the variables Advantages - Familiar - Powerful - Implemented The AMPL Modeling Language Features - Algebraic modeling language - Variety of data sources - Connections to all solver features - Interactive and scripted control Advantages - Powerful, general expressions - Natural, easy-to-learn design - Efficient processing scales well with problem size Introductory Example Multicommodity transportation . . . - Products available at factories - Products needed at stores - Plan shipments at lowest cost . . . with practical restrictions - Cost has fixed and variables parts - Shipments cannot be too small - Factories cannot serve too many stores Multicommodity Transportation *Given* - $O$ Set of origins (factories) - $D$ Set of destinations (stores) - $P$ Set of products *and* - $a_{ip}$ Amount available, for each $i \in O$ and $p \in P$ - $b_{jp}$ Amount required, for each $j \in D$ and $p \in P$ - $l_{ij}$ Limit on total shipments, for each $i \in O$ and $j \in D$ - $c_{ijp}$ Shipping cost per unit, for each $i \in O$, $j \in D$, $p \in P$ - $d_{ij}$ Fixed cost for shipping any amount from $i \in O$ to $j \in D$ - $s$ Minimum total size of any shipment - $n$ Maximum number of destinations served by any origin **Multicommodity Transportation** **Mathematical Formulation** **Determine** - $X_{ijp}$ Amount of each $p \in P$ to be shipped from $i \in O$ to $j \in D$ - $Y_{ij}$ 1 if any product is shipped from $i \in O$ to $j \in D$ 0 otherwise **to minimize** \[ \sum_{i \in O} \sum_{j \in D} \sum_{p \in P} c_{ijp} X_{ijp} + \sum_{i \in O} \sum_{j \in D} d_{ij} Y_{ij} \] Total variable cost plus total fixed cost Multicommodity Transportation Mathematical Formulation Subject to \[ \sum_{j \in D} X_{ijp} \leq a_{ip} \quad \text{for all } i \in O, p \in P \] Total shipments of product \( p \) out of origin \( i \) must not exceed availability \[ \sum_{i \in O} X_{ijp} = b_{jp} \quad \text{for all } j \in D, p \in P \] Total shipments of product \( p \) into destination \( j \) must satisfy requirements Multicommodity Transportation Mathematical Formulation Subject to \[ \sum_{p \in P} X_{ijp} \leq l_{ij} Y_{ij} \quad \text{for all } i \in O, j \in D \] When there are shipments from origin \( i \) to destination \( j \), the total may not exceed the limit, and \( Y_{ij} \) must be 1 \[ \sum_{p \in P} X_{ijp} \geq s Y_{ij} \quad \text{for all } i \in O, j \in D \] When there are shipments from origin \( i \) to destination \( j \), the total amount of shipments must be at least \( s \) \[ \sum_{j \in D} Y_{ij} \leq n \quad \text{for all } i \in O \] Number of destinations served by origin \( i \) must be as most \( n \) Multicommodity Transportation AMPL Formulation Symbolic data ``` set ORIG; # origins set DEST; # destinations set PROD; # products param supply {ORIG,PROD} >= 0; # availabilities at origins param demand {DEST,PROD} >= 0; # requirements at destinations param limit {ORIG,DEST} >= 0; # capacities of links param vcost {ORIG,DEST,PROD} >= 0; # variable shipment cost param fcost {ORIG,DEST} > 0; # fixed usage cost param minload >= 0; # minimum shipment size param maxserve integer > 0; # maximum destinations served ``` Multicommodity Transportation AMPL Formulation Symbolic model: variables and objective ``` var Trans {ORIG, DEST, PROD} >= 0; # actual units to be shipped var Use {ORIG, DEST} binary; # 1 if link used, 0 otherwise minimize Total_Cost: sum {i in ORIG, j in DEST, p in PROD} vcost[i,j,p] * Trans[i,j,p] + sum {i in ORIG, j in DEST} fcost[i,j] * Use[i,j]; ``` \[ \sum_{i \in O} \sum_{j \in D} \sum_{p \in P} c_{ijp} X_{ijp} + \sum_{i \in O} \sum_{j \in D} d_{ij} Y_{ij} \] Multicommodity Transportation AMPL Formulation Symbolic model: constraint subject to Supply \{i in ORIG, p in PROD\}: \[ \sum_{j in DEST} Trans[i,j,p] \leq supply[i,p]; \] \[ \sum_{j\in D} X_{ijp} \leq a_{ip}, \text{ for all } i \in O, p \in P \] Multicommodity Transportation AMPL Formulation Symbolic model: constraints subject to Supply \{i in ORIG, p in PROD\}: \[ \sum \{j in DEST\} Trans[i,j,p] \leq supply[i,p]; \] subject to Demand \{j in DEST, p in PROD\}: \[ \sum \{i in ORIG\} Trans[i,j,p] = demand[j,p]; \] subject to Multi \{i in ORIG, j in DEST\}: \[ \sum \{p in PROD\} Trans[i,j,p] \leq limit[i,j] \times Use[i,j]; \] subject to Min_Ship \{i in ORIG, j in DEST\}: \[ \sum \{p in PROD\} Trans[i,j,p] \geq minload \times Use[i,j]; \] subject to Max_Serve \{i in ORIG\}: \[ \sum \{j in DEST\} Use[i,j] \leq maxserve; \] Multicommodity Transportation AMPL Formulation Explicit data independent of symbolic model ```AMPL set ORIG := GARY CLEV PITT ; set DEST := FRA DET LAN WIN STL FRE LAF ; set PROD := bands coils plate ; param supply (tr): GARY CLEV PITT := bands 400 700 800 coils 800 1600 1800 plate 200 300 300 ; param demand (tr): FRA DET LAN WIN STL FRE LAF := bands 300 300 100 75 650 225 250 coils 500 750 400 250 950 850 500 plate 100 100 0 50 200 100 250 ; param limit default 625 ; param minload := 375 ; param maxserve := 5 ; ``` Multicommodity Transportation AMPL Formulation Explicit data (continued) ```plaintext param vcost := [*,*,bands]: FRA DET LAN WIN STL FRE LAF := GARY 30 10 8 10 11 71 6 CLEV 22 7 10 7 21 82 13 PITT 19 11 12 10 25 83 15 [*,*,coils]: FRA DET LAN WIN STL FRE LAF := GARY 39 14 11 14 16 82 8 CLEV 27 9 12 9 26 95 17 PITT 24 14 17 13 28 99 20 [*,*,plate]: FRA DET LAN WIN STL FRE LAF := GARY 41 15 12 16 17 86 18 CLEV 29 9 13 9 28 99 18 PITT 26 14 17 13 31 104 20 ; param fcost: FRA DET LAN WIN STL FRE LAF := GARY 3000 1200 1200 1200 2500 3500 2500 CLEV 2000 1000 1500 1200 2500 3000 2200 PITT 2000 1200 1500 1500 2500 3500 2200 ; ``` AMPL Solution Model + data = problem instance to be solved ``` ampl: model multimipG.mod; ampl: data multimipG.dat; ampl: option solver gurobi; ampl: solve; Gurobi 5.5.0: optimal solution; objective 235625 289 simplex iterations 28 branch-and-cut nodes ampl: display Use; Use [*,*] : DET FRA FRE LAF LAN STL WIN := CLEV 1 1 1 0 1 1 0 GARY 0 0 0 1 0 1 1 PITT 1 1 1 1 0 1 0 ; ``` Multicommodity Transportation Multicommodity Transportation AMPL Solution Solver choice independent of model and data ``` AMPL: model multimipG.mod; AMPL: data multimipG.dat; AMPL: option solver cplex; AMPL: solve; CPLEX 12.5.0.1: optimal integer solution; objective 235625 112 MIP simplex iterations 0 branch-and-bound nodes AMPL: display Use; Use [*,*] : DET FRA FRE LAF LAN STL WIN := CLEV 1 1 1 0 1 1 0 GARY 0 0 0 1 0 1 1 PITT 1 1 1 1 0 1 0 ; ``` **Multicommodity Transportation** **AMPL Solution** *Examine results* ```ampl ampl: display {i in ORIG, j in DEST} ampl? sum {p in PROD} Trans[i,j,p] / limit[i,j]; : DET FRA FRE LAF LAN STL WIN := CLEV 1 0.6 0.88 0 0.8 0.88 0 GARY 0 0 0 0.64 0 1 0.6 PITT 0.84 0.84 1 0.96 0 1 0 ; ampl: display Max_Serve.body; CLEV 5 GARY 3 PITT 5 ; ampl: display TotalCost, ampl? sum {i in ORIG, j in DEST} fcost[i,j] * Use[i,j]; TotalCost = 235625 sum {i in ORIG, j in DEST} fcost[i,j]*Use[i,j] = 27600 ``` Indexed over sets of pairs and triples set ORIG; # origins set DEST; # destinations set PROD; # products set SHIP within {ORIG,DEST,PROD}; # (i,j,p) in SHIP ==> can ship p from i to j set LINK = setof {(i,j,p) in SHIP} (i,j); # (i,j) in LINK ==> can ship some products from i to j var Trans {SHIP} >= 0; # actual units to be shipped var Use {LINK} binary; # 1 if link used, 0 otherwise minimize Total_Cost: sum {(i,j,p) in SHIP} vcost[i,j,p] * Trans[i,j,p] + sum {(i,j) in LINK} fcost[i,j] * Use[i,j]; Multicommodity Transportation AMPL “Sparse” Network Constraint for dense network subject to Supply {i in ORIG, p in PROD}: sum {j in DEST} Trans[i,j,p] <= supply[i,p]; Constraint for sparse network subject to Supply {i in ORIG, p in PROD}: sum {(i,j,p) in SHIP} Trans[i,j,p] <= supply[i,p]; Multicommodity Transportation AMPL Scripting Script to test sensitivity to serve limit ```AMPL model multmipG.mod; data multmipG.dat; option solver gurobi; for {m in 7..1 by -1} { let maxserve := m; solve; if solve_result = 'infeasible' then break; display maxserve, Max_Serve.body; } ``` Multicommodity Transportation AMPL Scripting Run showing sensitivity to serve limit ```plaintext ampl: include multimipServ.run; Gurobi 5.5.0: optimal solution; objective 233150 maxserve = 7 CLEV 5 GARY 3 PITT 6 Gurobi 5.5.0: optimal solution; objective 233150 maxserve = 6 CLEV 5 GARY 3 PITT 6 Gurobi 5.5.0: optimal solution; objective 235625 maxserve = 5 CLEV 5 GARY 3 PITT 5 Gurobi 5.5.0: infeasible ``` Multicommodity Transportation AMPL Scripting Script to generate n best solutions ```AMPL param nSols default 0; param maxSols; model multmipG.mod; data multmipG.dat; set USED {1..nSols} within {ORIG,DEST}; subject to exclude {k in 1..nSols}: sum {(i,j) in USED[k]} (1-Use[i,j]) + sum {(i,j) in {ORIG,DEST} diff USED[k]} Use[i,j] >= 1; option solver gurobi; repeat { solve; display Use; let nSols := nSols + 1; let USED[nSols] := {i in ORIG, j in DEST: Use[i,j] > .5}; } until nSols = maxSols; ``` Multicommodity Transportation AMPL Scripting Run showing 3 best solutions ```AMPL ampl: include multmipBest.run; Gurobi 5.5.0: optimal solution; objective 235625 : DET FRA FRE LAF LAN STL WIN := CLEV 1 1 1 0 1 1 0 GARY 0 0 0 1 0 1 1 PITT 1 1 1 1 0 1 0 ; Gurobi 5.5.0: optimal solution; objective 237125 : DET FRA FRE LAF LAN STL WIN := CLEV 1 1 1 1 0 1 0 GARY 0 0 0 1 0 1 1 PITT 1 1 1 0 1 1 0 ; Gurobi 5.5.0: optimal solution; objective 238225 : DET FRA FRE LAF LAN STL WIN := CLEV 1 0 1 0 1 1 1 GARY 0 1 0 1 0 1 0 PITT 1 1 1 1 0 1 0 ; ``` AMPL’s Users Business - Customer relationships - Customer areas - Project examples Government Academic AMPL's Users Business Customer Relationships Internal projects - We supply software & answer a few questions - Company’s employees build the models Training and consulting - Available on request AMPL's Users Business Customer Areas Transportation - Air, rail, truck Production - Planning - steel - automotive - Supply chain - consumer products Finance - Investment banking - Insurance Natural resources - Electric power - Gas distribution - Mining Information technology - Telecommunications - Internet services Consulting practices - Management - Industrial engineering AMPL's Users Business Customer Examples Three award-winning projects - Norske Skog (paper manufacturer) - ZARA (clothing retailer) - Carlson Rezidor (hotel operator) . . . finalists for Edelman Award for practice of Operations Research **Optimization of production and distribution** - Australasia - Europe - 640 binary variables - 524,000 continuous variables - 33,000 constraints **Optimization of shutdown decisions worldwide** - Multiple scenarios - Numerous sensitivity analyses - **Key role of AMPL models** - Implemented in a few weeks - Modified to analyze alternatives - Run interactively at meetings **Optimization of worldwide shipments** - Legacy process - New process - Piecewise-linear AMPL model with integer variables - Run once for each product each week - Decides how much of each size to ship to each store - Increases sales 3-4% --- **ZARA** **AMPLe's Users** --- *Robert Fourer, New & Forthcoming Developments in AMPL* **INFORMS Conf on Analytics — 7-9 April 2013 — Track 11, Software Tutorials*** Optimization of hotel room rates - Traditional process - Maximizes revenues, given . . . * Availability of prices at competing hotels * Objective measures of price elasticity of demand - Prototyped in AMPL with quadratic objective - Increases revenues 2-4% - New process **AMPL's Users** Carlson Rezidor AMPL’s Users Government Customers Financial agencies - United States - Canada - Sweden U.S. departments - Census Bureau - Army Corps of Engineers U.S. research centers - Argonne National Laboratory - Sandia National Laboratories - Lawrence Berkeley Laboratory AMPL's Users Academic Customers Research - Over 250 university installations worldwide - Nearly 1000 citations in scientific papers - engineering, science, economics, management Teaching - Linear & nonlinear optimization - Graph optimization - Stochastic programming - Operations Research - Specialized courses - Supply chain modeling - Electric power system planning - Transportation logistics - Communication network design & algorithms Over 70 courses so far in 2013 Enhancements Building & maintaining models - More natural formulations - Logical conditions - Quadratic constraints - AMPL IDE (Integrated Development Environment) - Unified editor & command processor - Built on the Eclipse platform Deploying models - AMPL API (Application Programming Interfaces) - Programming languages: C++, Java, .NET, Python - Analytics languages: MATLAB, R More Natural Modeling Logical Conditions Common “not linear” expressions - Disjunctions (or), implications (==>) - Counting expressions (count), Counting constraints (atleast, atmost) - Aggregate constraints (alldiff, numberof) Variety of solvers - CPLEX mixed-integer solver * Applied directly * Applied after conversion to MIP - Constraint solvers * IBM ILOG CP * Gecode * JaCoP (coming soon) Example: Multi-Commodity *(revisited)* Minimum-shipment constraints - From each origin to each destination, *either* ship nothing *or* ship at least minload units Conventional linear mixed-integer formulation ```plaintext var Trans {ORIG, DEST, PROD} >= 0; var Use {ORIG, DEST} binary; ....... subject to Multi {i in ORIG, j in DEST}: sum {p in PROD} Trans[i,j,p] <= limit[i,j] * Use[i,j]; subject to Min_Ship {i in ORIG, j in DEST}: sum {p in PROD} Trans[i,j,p] >= minload * Use[i,j]; ``` Multi-Commodity Zero-One Alternatives Mixed-integer formulation using implications subject to Multi_Min_Ship {i in ORIG, j in DEST}: Use[i,j] = 1 ==> minload <= sum {p in PROD} Trans[i,j,p] <= limit[i,j] else sum {p in PROD} Trans[i,j,p] = 0; Solved directly by CPLEX ampl: model multmipImpl.mod; ampl: data multmipG.dat; ampl: option solver cplex; ampl: solve; CPLEX 12.5.0.1: optimal integer solution; objective 235625 175 MIP simplex iterations 0 branch-and-bound nodes Multi-Commodity Non-Zero-One Alternatives Disjunctive constraint ``` subject to Multi_Min_Ship {i in ORIG, j in DEST}: sum {p in PROD} Trans[i,j,p] = 0 or minload <= sum {p in PROD} Trans[i,j,p] <= limit[i,j]; ``` Solved by CPLEX after automatic conversion ``` ampl: model multmipDisj.mod; ampl: data multmipG.dat; ampl: solve; CPLEX 12.5.0.1: logical constraint not indicator constraint. ampl: option solver ilogcp; ampl: option ilogcp_options 'optimizer cplex'; ampl: solve; ilogcp 12.4.0: optimal solution 0 nodes, 175 iterations, objective 235625 ``` Example: Optimal Arrangement *Optimally line up a group of people* - Given a set of adjacency preferences, maximize the number that are satisfied **Decision variables** - For each preference “i1 adjacent to i2”: \[ \text{Sat}[i_1, i_2] = 1 \text{ iff this is satisfied in the lineup} \] - \( \text{Pos}[i] \) is the position of person \( i \) in the line \[ \ldots \text{fewer variables, larger domains} \] "CP-Style" Alternative All-different constraint ```AMPL param nPeople integer > 0; set PREFS within {i1 in 1..nPeople, i2 in 1..nPeople: i1 <> i2}; var Sat {PREFS} binary; var Pos {1..nPeople} integer >= 1, <= nPeople; maximize NumSat: sum {(i1,i2) in PREFS} Sat[i1,i2]; subject to OnePersonPerPosition: alldiff {i in 1..nPeople} Pos[i]; subject to SatDefn {(i1,i2) in PREFS}: Sat[i1,i2] = 1 <==> Pos[i1]-Pos[i2] = 1 or Pos[i2]-Pos[i1] = 1; subject to SymmBreaking: Pos[1] < Pos[2]; ``` Arrangement “CP-Style” Alternative (cont’d) 11 people, 20 preferences ```ampl ampl: model photo.mod; ampl: data photo11.dat; ampl: option solver ilogcp; ampl: solve; ilogcp 12.5.0: optimizer cp ilogcp 12.5.0: optimal solution 8837525 choice points, 8432821 fails, objective 12 ampl: option solver gecode; ampl: solve; gecode 3.7.3: optimal solution 589206448 nodes, 294603205 fails, objective 12 ampl: ``` AMPL IDE Integrated Development Environment - Unified editor & command processor - Included in the AMPL distribution - Easy upgrade path - Command-line, batch versions remain available - Built on the Eclipse platform Planned availability . . . **AMPL IDE** Sample Screenshot **AMPL IDE** **Planned Availability** **Rollout dates** - Beta test - May-June 2013 - *Seeking beta testers now* - Release - Summer-Fall 2013 - Available with all new downloads **Development details** - Partnership with OptiRisk Systems - "AMPLDEV" advanced IDE to be marketed by OptiRisk - Offers full stochastic programming support AMPL API Application Programming Interface - Programming languages: C++, Java, .NET, Python - Analytics languages: MATLAB, R Facilitates use of AMPL for - Complex algorithmic schemes - Embedding in other applications - Deployment of models **AMPL API** **Deployment Alternatives** **Stand-alone:** *Give (temporary) control to AMPL* - Write needed files - Invoke AMPL to run some scripts - Read the files that AMPL leaves on exit **API:** *Interact with AMPL* - Execute AMPL statements individually - Read model, data, script files when convenient - Exchange data tables directly with AMPL * populate sets & parameters * invoke any available solver * extract values of variables & result expressions . . . *all embedded within your program’s logic* **AMPL API** **Example: Java** **Efficient frontier: Initialize, read files** ```java AMPL ampl = createAMPL(); int steps = 30; try{ ampl.interpretFile(Utils.getResFileName("qpmv.mod","qpmv",true),false); ampl.interpretFile(Utils.getResFileName("qpmv.dat","qpmv",true),true); } catch (IOException e){ e.printStackTrace(); return -1; } VariableMap portfolioReturn = ampl.getVariable('portret'); ParameterMap averageReturn = ampl.getParameter('averret'); ParameterMap targetReturn = ampl.getParameter('targetret'); ObjectiveMap deviation = ampl.getObjective('cst'); ``` Example: Java (cont’d) Efficient frontier: Solve, set up for loop ```java ampl.interpret("option solver afortmp;"); ampl.interpret("let stockopall:={ }; let stockrun:=stockall;"酹); ampl.interpret("option relax_integrality 1;"酹); ampl.solve() double minret = portfolioReturn.get().value(); double maxret = findMax(averageReturn.getDouble()); double stepsize = (maxret-minret)/steps; double[] returns = new double[steps]; double[] deviations = new double[steps]; ``` **Example: Java (cont’d)** **Efficient frontier: Loop over solves** ```java for(int i=0; i<steps; i++) { System.out.println(String.format ("Solving for return = %f", maxret - (i-1)*stepsize)); targetReturn.let(maxret - (i-1)*stepsize); ampl.interpret("let stockopall:={ }; let stockrun:=stockall;"); ampl.interpret("options relax_integrality 1;"); ampl.solve(); ampl.interpret("let stockrun2:={i in stockrun:weights[i]>0};"); ampl.interpret(" let stockrun:=stockrun2;"); ampl.interpret(" let stockpall:={i in stockrun:weights[i]>0.5};"); ampl.interpret("options relax_integrality 0;"); ampl.solve(); returns[i] = maxret - (i-1)*stepsize; deviations[i] = deviation.get().value(); } ``` **AMPL API** **Example: MATLAB** *Efficient frontier: Initialize, read files* ```plaintext ampl = initAMPL; steps = 30; ampl.interpretFile('qpmv.mod', false) ampl.interpretFile('qpmv.dat', true) portfolioReturn = ampl.getVariable('portret'); averageReturn = ampl.getParameter('averret'); targetReturn = ampl.getParameter('targetret'); deviation = ampl.getObjective('cst'); ``` Example: MATLAB (cont’d) Efficient frontier: Solve, set up for loop ```ampl ampl.interpret('option solver afortmp;'); ampl.interpret('let stockopall:={}; let stockrun:=stockall;'); ampl.interpret('option relax_integrality 1;'); ampl.solve() minret = portfolioReturn.getDouble(); maxret = max(averageReturn.getDouble()); stepsize = (maxret-minret)/steps; returns = zeros(steps, 1); deviations = zeros(steps, 1); ``` Example: MATLAB (cont’d) Efficient frontier: Loop over solves ```matlab for i=1:steps fprintf('Solving for return = %f\n', maxret - (i-1)*stepsize) targetReturn.let(maxret - (i-1)*stepsize); ampl.interpret('let stockopall:={}; let stockrun:=stockall;'); ampl.interpret('option relax_integrality 1;'); ampl.solve(); ampl.interpret('let stockrun2:={i in stockrun:weights[i]>0};'); ampl.interpret('let stockrun:=stockrun2;'); ampl.interpret('let stockopall:={i in stockrun:weights[i]>0.5};'); ampl.interpret('option relax_integrality 0;'); ampl.solve(); returns(i) = maxret - (i-1)*stepsize; deviations(i) = deviation.getDouble(); end plot(returns, deviations) ``` **AMPL API** **Planned Availability** **Rollout dates** - Beta test (Java, MATLAB, ...) - Summer 2013 - *Seeking beta testers now* - Release - Fall 2013 - Available with all new downloads **Development details** - Partnership with OptiRisk Systems - At least 6 languages to be provided Readings *(AMPL)* Readings *(Interfaces)*
{"Source-Url": "https://ampl.com/MEETINGS/TALKS/2013_04_San_Antonio_T11.pdf", "len_cl100k_base": 7556, "olmocr-version": "0.1.50", "pdf-total-pages": 58, "total-fallback-pages": 0, "total-input-tokens": 88008, "total-output-tokens": 10838, "length": "2e12", "weborganizer": {"__label__adult": 0.0005583763122558594, "__label__art_design": 0.0004472732543945313, "__label__crime_law": 0.0006046295166015625, "__label__education_jobs": 0.0036830902099609375, "__label__entertainment": 0.00017070770263671875, "__label__fashion_beauty": 0.00028014183044433594, "__label__finance_business": 0.002925872802734375, "__label__food_dining": 0.0006070137023925781, "__label__games": 0.0013055801391601562, "__label__hardware": 0.0012149810791015625, "__label__health": 0.0009436607360839844, "__label__history": 0.0005178451538085938, "__label__home_hobbies": 0.00017511844635009766, "__label__industrial": 0.0023403167724609375, "__label__literature": 0.0004317760467529297, "__label__politics": 0.00045871734619140625, "__label__religion": 0.0005588531494140625, "__label__science_tech": 0.2088623046875, "__label__social_life": 0.00019419193267822263, "__label__software": 0.0341796875, "__label__software_dev": 0.73486328125, "__label__sports_fitness": 0.0006556510925292969, "__label__transportation": 0.0036411285400390625, "__label__travel": 0.00036978721618652344}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 25743, 0.03037]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 25743, 0.11497]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 25743, 0.61481]], "google_gemma-3-12b-it_contains_pii": [[0, 264, false], [264, 606, null], [606, 975, null], [975, 1623, null], [1623, 2136, null], [2136, 2487, null], [2487, 2781, null], [2781, 3080, null], [3080, 3661, null], [3661, 4075, null], [4075, 4476, null], [4476, 5112, null], [5112, 5664, null], [5664, 6151, null], [6151, 6403, null], [6403, 7015, null], [7015, 7636, null], [7636, 8484, null], [8484, 8948, null], [8948, 9387, null], [9387, 9944, null], [9944, 10471, null], [10471, 10775, null], [10775, 11075, null], [11075, 11501, null], [11501, 12025, null], [12025, 12742, null], [12742, 12848, null], [12848, 13052, null], [13052, 13441, null], [13441, 13681, null], [13681, 14070, null], [14070, 14488, null], [14488, 14810, null], [14810, 15074, null], [15074, 15562, null], [15562, 15959, null], [15959, 16371, null], [16371, 16871, null], [16871, 17359, null], [17359, 17930, null], [17930, 18344, null], [18344, 18847, null], [18847, 19256, null], [19256, 19507, null], [19507, 19539, null], [19539, 19889, null], [19889, 20131, null], [20131, 20654, null], [20654, 21241, null], [21241, 21710, null], [21710, 22453, null], [22453, 22833, null], [22833, 23250, null], [23250, 23962, null], [23962, 24262, null], [24262, 25074, null], [25074, 25743, null]], "google_gemma-3-12b-it_is_public_document": [[0, 264, true], [264, 606, null], [606, 975, null], [975, 1623, null], [1623, 2136, null], [2136, 2487, null], [2487, 2781, null], [2781, 3080, null], [3080, 3661, null], [3661, 4075, null], [4075, 4476, null], [4476, 5112, null], [5112, 5664, null], [5664, 6151, null], [6151, 6403, null], [6403, 7015, null], [7015, 7636, null], [7636, 8484, null], [8484, 8948, null], [8948, 9387, null], [9387, 9944, null], [9944, 10471, null], [10471, 10775, null], [10775, 11075, null], [11075, 11501, null], [11501, 12025, null], [12025, 12742, null], [12742, 12848, null], [12848, 13052, null], [13052, 13441, null], [13441, 13681, null], [13681, 14070, null], [14070, 14488, null], [14488, 14810, null], [14810, 15074, null], [15074, 15562, null], [15562, 15959, null], [15959, 16371, null], [16371, 16871, null], [16871, 17359, null], [17359, 17930, null], [17930, 18344, null], [18344, 18847, null], [18847, 19256, null], [19256, 19507, null], [19507, 19539, null], [19539, 19889, null], [19889, 20131, null], [20131, 20654, null], [20654, 21241, null], [21241, 21710, null], [21710, 22453, null], [22453, 22833, null], [22833, 23250, null], [23250, 23962, null], [23962, 24262, null], [24262, 25074, null], [25074, 25743, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 25743, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 25743, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 25743, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 25743, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 25743, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 25743, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 25743, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 25743, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 25743, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 25743, null]], "pdf_page_numbers": [[0, 264, 1], [264, 606, 2], [606, 975, 3], [975, 1623, 4], [1623, 2136, 5], [2136, 2487, 6], [2487, 2781, 7], [2781, 3080, 8], [3080, 3661, 9], [3661, 4075, 10], [4075, 4476, 11], [4476, 5112, 12], [5112, 5664, 13], [5664, 6151, 14], [6151, 6403, 15], [6403, 7015, 16], [7015, 7636, 17], [7636, 8484, 18], [8484, 8948, 19], [8948, 9387, 20], [9387, 9944, 21], [9944, 10471, 22], [10471, 10775, 23], [10775, 11075, 24], [11075, 11501, 25], [11501, 12025, 26], [12025, 12742, 27], [12742, 12848, 28], [12848, 13052, 29], [13052, 13441, 30], [13441, 13681, 31], [13681, 14070, 32], [14070, 14488, 33], [14488, 14810, 34], [14810, 15074, 35], [15074, 15562, 36], [15562, 15959, 37], [15959, 16371, 38], [16371, 16871, 39], [16871, 17359, 40], [17359, 17930, 41], [17930, 18344, 42], [18344, 18847, 43], [18847, 19256, 44], [19256, 19507, 45], [19507, 19539, 46], [19539, 19889, 47], [19889, 20131, 48], [20131, 20654, 49], [20654, 21241, 50], [21241, 21710, 51], [21710, 22453, 52], [22453, 22833, 53], [22833, 23250, 54], [23250, 23962, 55], [23962, 24262, 56], [24262, 25074, 57], [25074, 25743, 58]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 25743, 0.0]]}
olmocr_science_pdfs
2024-12-03
2024-12-03
86e8c43dfee7de47933c9c8a28cbd3deec958cbc
Formal Modelling in the Concept Phase of Product Development Mathijs Schuts\textsuperscript{1}, and Jozef Hooman\textsuperscript{2,3} \textsuperscript{1}Philips HealthTech, Best, The Netherlands \textsuperscript{2}Embedded Systems Innovation (ESI) by TNO, Eindhoven, The Netherlands \textsuperscript{3}Radboud University, Nijmegen, The Netherlands Abstract—The traditional process framework for product realisation in industry often leads to a long and difficult integration phase. An important reason is that in the concept phase only informal descriptions are made about the required product, its decomposition, and the interfaces between components. We propose a formal modelling approach for the concept phase, using a new light-weight modelling tool to formalize system behaviour, decomposition and interfaces. The confidence in the product concept is increased by simulation, both manual and automatic with random system characteristics. By means of a dedicated graphical user interface, communication with different stakeholders is improved. We discuss the application of the proposed approach at Philips HealthTech. Keywords: Formal models; software engineering; concept definition; simulation 1. Introduction We propose a method to improve the concept phase of product realisation by means of formal techniques. A traditional development process from concept to a validated product is depicted in Figure 1, see for instance [1]. It describes six distinct phases between concept and product. During the concept phase an informal document is being created with a high level description of the concept. This document is reviewed and agreed upon by all stakeholders. The document consists of a decomposition of the developed product, the different hardware and software components it consists of, the responsibilities per component, and the interaction between the components, possibly with an informal interface description. From the concept description, different development groups concurrently start developing the component they are responsible for. This may also include 3rd party components developed by other companies. Such a process framework provides a structured way to come from concept to product and allows the concept to be decomposed into different components such that multiple development groups can concurrently work on the different components. A frequently occurring problem in industry, however, is that the integration and validation phase takes a large amount of time and is rather uncontrollable because many problems are detected in this phase and might require a redesign of components. An important reason for these problems is the informal nature of the concept phase. Clearly, this leads to ambiguities and inconsistencies. Moreover, only a part of the complete behaviour is described in an informal document, often only a part of the basic functional behaviour without taking errors or non-functional aspects into account. The complete behaviour is defined during the implementation phase of the different components. Hence, a large part of system behaviour is implicitly defined during the implementation phase. If multiple development groups work in parallel in realizing the concept, the integration phase can take a lot of time because the independently developed components do not work together seamlessly. Another problem is that during the integration phase sometimes issues are found in which hardware is involved. Then it is usually too late to change the hardware and a workaround in software has to be found. To prevent these types of problems, we propose the use of formal modelling techniques in the concepts phase, because it is early in the process and all consecutive phases can benefit from an improved unambiguous concept description. Moreover, errors made in this phase are very costly to repair in a later phase [2], [3]. By making a formal model of the system in the concept phase, ambiguities, contradictions and errors are removed from the informal concept description. During modelling one is forced to think about the exceptional behaviour early in the development process. Many questions needs to be answered which would be implicitly defined during the implementation phase otherwise. Moreover, by formalizing interface descriptions, less problems during the integration phase are expected. Figure 2 depicts a graphical representation of the proposed extension of the product realisation framework. The formal model is developed incrementally to allow updates after aligning with stakeholders and to incorporate new insights frequently. Before choosing a formal method, we first list the aspects that are important in the concept phase: - The definition of complete system behaviour, including error scenarios. - A clear and unambiguous definition of interfaces and concepts to support parallel development in subsequent phases. - The possibilities to explore concepts and design decisions fast. - Communication with stakeholders to obtain agreement on the concepts and externally visible behaviour of the product. - The possibility to deal with a combination of hardware and software components. Furthermore, the formal method should be easy to use by industrial engineers and scalable to large and complex systems. Based on earlier experiences, see, e.g., [4], we decided not to aim for exhaustive model checking. Since our applications consist of many asynchronous components with queues and also timing aspects are important, one almost immediately runs into state-space explosion problems. As an alternative to increase the confidence in the system model, we will use simulation. Formal models are expressed using the Parallel Object Oriented Specification Language (POOSL). The language is supported by a simulator and a new Eclipse Integrated Development Environment (IDE). The tooling can easily be combined with a dedicated graphical user interface to support communication with all stakeholders. 2. POOSL The long-term goal of the POOSL tooling is to shorten the development time of complex high-tech systems by providing a lightweight modelling and simulation approach. It is targeted at the early phases of system development, where requirements might not yet be very clear and many decisions have to be taken about the structure of the system, the responsibilities and behaviour of the components, and their interaction. The approach fills a gap between expensive commercial modelling tools (like MATLAB [11] and Rational Rhapsody [12]) that require detailed modelling, often close to the level of code, and drawing tools (such as Visio and UML drawing tools) that do not allow simulation. More related to the POOSL approach is the OMG specification called the Semantics of a Foundational Subset for Executable UML Models (fUML) [13] with, e.g., the Cameo Simulation Toolkit [14]. In Section 2.1 we introduce the POOSL modelling language and describe the available tool support in Section 2.2. 2.1 POOSL modelling language POOSL is a modelling language for systems that include both software and digital hardware. It is not intended for continuous aspects, e.g., modelling physical processes by differential equations is not possible. POOSL is an object-oriented modelling language with the following aspects: - **Concurrent parallel processes** A system consists of a number of parallel processes. A process is an instance of a process class which describes the behaviour of the process by means of an imperative language. A process has a number of ports for message-based communication with its environment. - **Hierarchical structure** A number of processes can be grouped into a cluster. A cluster is an instance of a cluster class which has a number of external ports and specifies how the ports of its processes are connected. - **System definition** A system is defined by a number of instances of processes and clusters and the connections between the ports of its instances. - **Synchronization** Processes communicate by synchronous message passing along ports, similar to CSP [15] and CCS [16]. That is, both sender and receiver of a message have to wait until a corresponding communication statement is ready to execute. A process may contain parallel statements which communicate by shared memory. - **Timing** Progress of time can be represented by statements of the form $\text{delay}(d)$. It postpones the execution of the process by $d$ time units. All other statements do not take time. Delay statements are only executed if no other statement can be executed. - **Object-oriented data structures** Processes may use data objects that are instances of data classes. Data objects are passive sequential entities which can be created dynamically. A number of structures are predefined, such as set, queue, stack, array, matrix, etc. - **Stochastic behaviour** The language supports stochastic distribution functions; a large number of standard distribution functions are predefined, such as DiscreteUniform, Exponential, Normal, and Weibull. The formal semantics of POOSL has been defined in [17] by means of a probabilistic structural operational semantics for the process layer and a probabilistic denotational semantics for the data layer. 2.2 POOSL tooling As explained in [17], the operational semantics of POOSL has been implemented in a high-speed simulation engine called Rotalumis. It supports the Software/Hardware Engineering (SHE) methodology [18]. The tool SHESim [19] is intended for editing POOSL models and validating them by interactive simulation. Recently, a modern Eclipse IDE has been developed on top of an improved Rotalumis simulation engine. The combination of the last two tools have been used for the application described in this paper. The Eclipse IDE is free available [20] and supports advanced textual editing with early validation and extensive model debugging. Model validation is convenient to detect modelling errors early, before they appear during simulation. It includes checks on undeclared variables and ports, types, unconnected ports, and mismatches between send and receive statements. The debugging view shown below allows step-wise execution of models, inspection of variables, setting of breakpoints, and a running sequence diagram during simulation. 3. Application at Philips The proposed approach has been applied at Philips HealthTech, in the context of the innovation of interventional X-ray systems. These systems are intended for minimally invasive treatment of mainly cardiac and vascular diseases. The system provides advanced X-ray images to guide the physician through the arteries of the patient to the point of interest and to execute a certain medical procedure, such as placing a stent. For a new product release, we have created a new concept for starting up and shutting down the system. This section briefly describes the informal concepts of the new start-up/shut-down (SU/SD) behaviour. An interventional X-ray system contains a number of IT devices such as computers and touch screen modules. All IT devices can communicate with each other via an internal Ethernet control network. The IT devices are configured in such a way that they immediately start-up once they are powered. There is a central SU/SD controller which coordinates SU/SD scenarios. A user of the system can initiate a SU/SD scenario by pressing a button on the User Interface (UI). The SU/SD controller will then instruct the power distribution component to switch power taps on or off and send notification messages to the various IT devices over the internal Ethernet network. Another scenario can be initiated by the Uninterruptable Power Supply (UPS), for instance, when a mains disconnector switch (MDS) can be used to power the complete system. An example of a SU/SD scenario is the shut-down scenario. When all segments are powered and the SU/SD controller detects that the AllSegmentOff button is pressed by the user, it will send an AllSegmentOff-pressed notification to all registered IT devices. Next all IT devices go through the following shut-down phases: - The applications and services running on the IT device are stopped. - The IPMI disabled IT devices will register themselves and ask the SU/SD controller to observe their shut-down. This is needed because the controller does not know which IPMI disabled devices are connected to a power tap. The IPMI enabled devices are known to the controller by configuration. - Once the applications and services are stopped, the OS will be shut down. The scenario ends when the SU/SD controller has detected that all IT devices are shut down. IPMI disabled IT devices are pinged to observe that they are shut down and IPMI enabled IT devices are requested for their state via IPMI to detect that they are shut down. Next the SU/SD controller will instruct the power distribution component to turn off the switchable power taps with which the IPMI disabled IT devices are powered. The IT tap that powers the IPMI enabled IT devices remains powered while these devices are in the standby state. In the past, an abstract model of the current start-up and shut-down concept for a simpler version of the system has been made for three model checkers: mCRL2 [22], FDR2 [23] and CADP [24]. For reasons of comparison, exactly the same model was made for all three tools, leading to 78,088,550 states and 122,354,296 transitions. Model checking such a model easily takes hours. The new concept described here is far more complex because of the many asynchronous IT devices that all exhibit different behaviour. For example, the IT devices can sometimes fail to start-up or shut down. Also the timing and order in which they start-up and shut down might be different. Hence, the new concept is too complex to model check. Consequently, we decided to model the system in POOSL and used simulation to increase the confidence in the concepts. 4. Modeling the SU/SD Concept in POOSL This section describes the incremental approach to model the SU/SD concepts in POOSL. The scope of the model and the simulation environment is described in Section 4.1. Section 4.2 contains the modelling steps. A few details of the POOSL models can be found in Section 4.3. Our approach to test models automatically is presented in Section 4.4. 4.1 Modelling Scope and Simulator The aim was to model the Control & Devices part of Figure 3 in POOSL. Besides the SU/SD Controller and the Power Distribution, the model should contain all four types of IT devices, i.e., all combinations of segments (A and B) and IPMI support. Moreover, to capture as much as possible of the timing and ordering behaviour, we decided to include two instances of each type. To be able to discuss the main concepts to stakeholders, we connect the POOSL model to a simulation of the environment of the Control & Devices part. We created a Simulator in Java with the use of WindowBuilder in Eclipse to allow the manual execution of scenarios. It allows sending commands from the User Interface and power components to the model and displaying information received from the model. Additionally, one can observe the status of IT devices and even influence the behaviour of these devices, e.g., to validate scenarios in which one or more IT devices do not start-up or shut down properly. The next figure shows a screenshot of the SU/SD simulator. There are three main columns: - On the top, the state and the UI buttons to control the SU/SD controller are displayed. - In the middle, the tap state of the segments is displayed. - On the bottom, the UPS triggers are displayed. - The middle part contains a column for the B segment and one for the A segment; each contains a row for the IPMI disabled IT devices and one for the IPMI enabled IT devices. For each IT device the state is displayed. The start-up and shut-down behaviour of an IT device can be simulated automatically or it can be set to manual to simulate error scenarios, where the system might fall into a Timeout (see the Internal Event in the column of the SU/SD controller). - In the right column, the status updates of the model are displayed. The Java simulation is connected to POOSL by means of a socket. The structure of the POOSL system model is depicted in the next figure. The system part to be modelled (the Control & Devices part) is represented by cluster ControlDevicesCluster. It has 10 external ports, one to communicate with the SU/SD controller (simc), one for power commands (simp) and 8 for the IT devices: sim1, sim2, sim3, and sim4 for IPMI disabled devices; sim11, sim12, sim13, sim14 for IPMI enabled devices. These ports are connected to corresponding ports of the SimulationEnvironmentCluster. This cluster contains an instance of the standard Socket class provided by the POOSL library. Class UIInterface is responsible for the translation between strings of the socket interface and the SU/SD system interface. 4.2 Modelling steps After the simulator was build, the ControlDevicesCluster has gradually been defined in POOSL. The proposed framework defines Fig. 4: Structure of the POOSL model of the ControlDevicesCluster an incremental approach to build the model of the concept. We have used the simulator to validate the intermediate models and align the behaviour with internal stakeholders. We started with a model of an IPMI disabled IT device and a model of the SU/SD controller for shutting down these IT devices of the A segment. In this model there were two instantiations of IPMI disabled IT devices. Note that POOSL supports a partial model where not all ports are used. This model has been extended gradually to a model where all 8 instances of IT devices are present. Next, the SU/SD controller was extended with error behaviour to verify, for instance, that the system is always in a defined state after shut-down, which is an important requirement. Finally, we added a model of the interface between the IT device and the SU/SD controller, because these two components will be developed concurrently. Hence, it is important to specify this contract formally and to verify it. Every IT device has an instance of the same interface model, which is implemented in such a way that the system will deadlock if the formal interface is violated. Hence, interface compliance is verified continuously during simulation. The structure of the resulting model of this incremental approach is depicted in Figure 4. 4.3 Modelling Devices and Control This section provides some details of the POOSL models. The first part of the model of an IT device with IPMI is shown below. It imports a library which, e.g., defines queues. Next the process class is defined, including two parameters for the IP address and the segment. All IT devices have an IP address to be able to connect them to the same network. Subsequently, the ports, the messages (only one is shown here), the variables and the initial method are defined. Note that the variables define two queues. In the initial method `init()`, the queues are initialized, which are FIFO by default. Next the method defines three parallel activities. The first activity defines a state machine, where the states are represented by methods. It starts the state machine by calling the initial state `ItDevNotPowered()`. Below we show a typical definition of a state, in this case state `ItDevShuttingDown()`. The state is defined as a method with local variable `m`. It selects the next state based on the contents of the `ipmiQueue` or the receipt (indicated by `?`) of a particular message on one of its ports. Since switching a power tap on or off is instantaneous and cannot be refused by a process, all states allow the receipt of messages On and Off via port `outlet`. The other two parallel activities of the `init()` method are used to model the asynchronous nature of the Ethernet communication. Method `MsgReceiveBuffer` receives messages on port `con` and stores them in queue `msgQueue`. ```java MsgReceiveBuffer(m) | m : String, ip : Integer | | con ? RecvEvent(m, ip | ip = ipAddr); | msgQueue.add(m); delay(1); MsgReceiveBuffer() ``` Note that POOSL allows a condition on the receive statement to express that only messages with the corresponding IP address are received. Similarly, method `IpmiReceiveBuffer` stores messages in `ipmiQueue`. ### 4.4 Extensive Model Testing The simulator has been used to align the behaviour with internal stakeholders and to get confidence in the correctness of the behaviour. To increase the confidence without the need of many manual mouse clicks, we created a separate test environment in POOSL. Therefore, a stub is connected to every IT device. A stub is a process which randomizes the start-up and shut-down timing of an IT device. In addition, a stub randomly decides if a device fails to start-up or shut-down. Also in these random cases the system has to respond well and it needs to be forced into defined states. The next POOSL fragment depicts how the random timing and random behaviour is implemented in the Stubs. ```plaintext 1. process class ProbStubWithoutIpmiClass (ipAddr : Integer, StartUpProp : Real, ShutDownProp : Real) 2. ports sim, tester ... 3. Loop() | message : String | ([msgQueue.isEmpty] message := msgQueue.remove(); if message = "Booting" then delay(random * 5.0); if random <= StartUpProp then sim ! Started; tester ! StatusUpdate(ipAddr, "Started") else tester ! StatusUpdate(ipAddr, "StartFailed") fi; fi; ``` The stubs are configured such that they fail to start-up or shut-down in 10% of the cases. // stubs for ipmi disabled devices itDev1Stub: ProbStubWithoutIpmiClass(ipAddr := 1, StartUpProp := 0.9, ShutDownProp := 0.5) // stubs for ipmi enabled devices itDev1Stub: ProbStubWithIpmiClass(ipAddr := 1, StartUpProp := 0.9, ShutDownProp := 0.5) In reality the IT devices are quite reliable, but to reduce testing time it is more convenient to make the IT devices less reliable. Moreover, we are interested in the error handling behaviour of the system and not in the statistical behaviour. For the execution of scenarios initiated by a user and the UPS, a Tester process has been created to automatically drive the system. Every stub has a feedback channel to the Tester to report the status of an IT device. The next figure depicts how the Tester and Stubs are connected to the system. The definition of the Tester is such that it leads to a deadlock when the SU/SD controller or the IT devices do not behave as intended. Already during the first simulation run we experienced such a deadlock. The cause of the problem was found using the debug possibilities of the new POOSL IDE. We simulated the model in debug mode and inspected the sequence diagram when the deadlock occurred. In this sequence diagram we saw a problem with a message about the IPMI status of an IT device. Next we inspected the variables window shown below. <table> <thead> <tr> <th>Name</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>delayedBatteryLow</td> <td>false</td> </tr> <tr> <td>ipmiQueue</td> <td>Empty</td> </tr> <tr> <td>Occupation</td> <td>0</td> </tr> <tr> <td>PrimQueue</td> <td>nil</td> </tr> <tr> <td>QueuingPolicy</td> <td>&quot;FIFO&quot;</td> </tr> <tr> <td>Size</td> <td>-1</td> </tr> <tr> <td>Unbounded</td> <td>-1</td> </tr> <tr> <td>eSQueue</td> <td>Empty</td> </tr> </tbody> </table> It revealed that the ipmiQueue was empty, which was not expected at this point in the execution. When checking the code that handles the IPMI queue, we found that the queue was emptied after the IPMI status request has been send. The race condition was fixed by changing the order: first empty the queue and then send the IPMI status request. After fixing the race condition, the model has been executed 100 000 random start-up and shut-down cycles without experiencing a single deadlock. ### 5. Concluding Remarks In the concept phase of product definition, we have used a formal system description in POOSL in combination with a graphical user interface to align stakeholders and get confidence in the behaviour of the system. We have added a model with a formal interface description between two important components of the system that will be developed concurrently. To increase the confidence in the concept, we created an automated test driver for the system with stubs that exhibit random behaviour and random timing. While modelling, we found several issues that were not foreseen in the draft concept. We had to address issues that would otherwise have been postponed to the implementation phase and which might easily lead to integration problems. We observed that the definition of a formal executable model of the SU/SD system required a number of design choices. We give two examples of such choices. - If all segments are on and the UPS indicates that the mains power input fails, then the system will shut down the A segment. If, however, during this transition one or more of the IPMI enabled IT devices fail to shut down, then the SU/SD controller has no way to force these IT devices into the right state. This could be solved by an additional tap, but given the costs of an extra tap and the small chance that this will happen (both mains power and shut down of an IT device should fail), we have decided to leave it this way. If the user experiences unexpected behaviour of the system, the user can always recover the system by turning it off and on again. - An early version of the SU/SD controller did not track if an IPMI enabled IT device did in fact start up. However, if something is wrong with the start-up or shut-down of an IPMI enabled IT device, we want to toggle the power during shut-down in the hope that a reset will solve the issue. Once we found the described issue with the simulator, we extended the model of the SU/SD controller with a storage of the start-up status of an IPMI enabled IT device. In addition, the model triggered many discussions about the combined behaviour of the hardware and software involved in start-up and shut-down. This resulted in a clear description of responsibilities in the final concept. Also the exceptional system behaviour when errors occur has been elaborated much more compared to the traditional approach. Note that the modelling approach required a relatively small investment. The main POOSL model and the Java simulator were made in 40 hours; the tester and the stubs required another 10 hours. The application of exhaustive model-checking techniques to the full model is not feasible, give the large number of concurrent processes and the use of queues for asynchronous communication. Scalability problems are, for instance, reported in [25], where a transformation of POOSL models to Uppaal [26], a model-checker for timed systems, is applied to an industrial application. However, it might be possible to apply these techniques to verify certain aspects on an abstraction of the model. In the future, we want to use the test driver for the model. To validate the behaviour of the SU/SD controller by means of model-based testing. Since the interface between the test driver and the model is equal to the interface between test driver and the real implementation, we might also use our test approach for the realized system when it become available. The idea is to use the test driver and a thin manually written adapter that makes an Ethernet connection between the test driver and the real implementation. References
{"Source-Url": "http://repository.ubn.ru.nl/bitstream/handle/2066/155762/155762.pdf?sequence=1", "len_cl100k_base": 5686, "olmocr-version": "0.1.50", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 22238, "total-output-tokens": 7646, "length": "2e12", "weborganizer": {"__label__adult": 0.00037980079650878906, "__label__art_design": 0.00037026405334472656, "__label__crime_law": 0.00027370452880859375, "__label__education_jobs": 0.0006108283996582031, "__label__entertainment": 6.252527236938477e-05, "__label__fashion_beauty": 0.00017881393432617188, "__label__finance_business": 0.0003581047058105469, "__label__food_dining": 0.0003628730773925781, "__label__games": 0.0006709098815917969, "__label__hardware": 0.00258636474609375, "__label__health": 0.0006341934204101562, "__label__history": 0.000270843505859375, "__label__home_hobbies": 0.00011420249938964844, "__label__industrial": 0.0007944107055664062, "__label__literature": 0.00022518634796142575, "__label__politics": 0.0002186298370361328, "__label__religion": 0.0005130767822265625, "__label__science_tech": 0.055511474609375, "__label__social_life": 7.18235969543457e-05, "__label__software": 0.006290435791015625, "__label__software_dev": 0.92822265625, "__label__sports_fitness": 0.0003364086151123047, "__label__transportation": 0.0007634162902832031, "__label__travel": 0.00021588802337646484}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 32138, 0.02189]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 32138, 0.45205]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 32138, 0.9149]], "google_gemma-3-12b-it_contains_pii": [[0, 0, null], [0, 5983, false], [5983, 9911, null], [9911, 13947, null], [13947, 17119, null], [17119, 19862, null], [19862, 24632, null], [24632, 32138, null]], "google_gemma-3-12b-it_is_public_document": [[0, 0, null], [0, 5983, true], [5983, 9911, null], [9911, 13947, null], [13947, 17119, null], [17119, 19862, null], [19862, 24632, null], [24632, 32138, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 32138, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 32138, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 32138, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 32138, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 32138, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 32138, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 32138, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 32138, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 32138, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 32138, null]], "pdf_page_numbers": [[0, 0, 1], [0, 5983, 2], [5983, 9911, 3], [9911, 13947, 4], [13947, 17119, 5], [17119, 19862, 6], [19862, 24632, 7], [24632, 32138, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 32138, 0.06748]]}
olmocr_science_pdfs
2024-12-02
2024-12-02
b1676d20484c688378b86db831e4b899784bc244
[REMOVED]
{"Source-Url": "http://www.dr-hato.se/research/digitaldashboard2013.pdf", "len_cl100k_base": 5148, "olmocr-version": "0.1.53", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 21972, "total-output-tokens": 6056, "length": "2e12", "weborganizer": {"__label__adult": 0.0002846717834472656, "__label__art_design": 0.0008730888366699219, "__label__crime_law": 0.0003554821014404297, "__label__education_jobs": 0.0009679794311523438, "__label__entertainment": 0.00011044740676879884, "__label__fashion_beauty": 0.00013005733489990234, "__label__finance_business": 0.0003025531768798828, "__label__food_dining": 0.0002951622009277344, "__label__games": 0.0004286766052246094, "__label__hardware": 0.00138092041015625, "__label__health": 0.0002913475036621094, "__label__history": 0.0004444122314453125, "__label__home_hobbies": 9.840726852416992e-05, "__label__industrial": 0.0005326271057128906, "__label__literature": 0.0002727508544921875, "__label__politics": 0.00025844573974609375, "__label__religion": 0.00034928321838378906, "__label__science_tech": 0.1064453125, "__label__social_life": 0.00012058019638061523, "__label__software": 0.067138671875, "__label__software_dev": 0.81787109375, "__label__sports_fitness": 0.00019490718841552737, "__label__transportation": 0.0006170272827148438, "__label__travel": 0.00022995471954345703}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 26836, 0.01651]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 26836, 0.67549]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 26836, 0.8868]], "google_gemma-3-12b-it_contains_pii": [[0, 2745, false], [2745, 5318, null], [5318, 6644, null], [6644, 8100, null], [8100, 10850, null], [10850, 14106, null], [14106, 17436, null], [17436, 20661, null], [20661, 23905, null], [23905, 26836, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2745, true], [2745, 5318, null], [5318, 6644, null], [6644, 8100, null], [8100, 10850, null], [10850, 14106, null], [14106, 17436, null], [17436, 20661, null], [20661, 23905, null], [23905, 26836, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 26836, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 26836, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 26836, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 26836, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 26836, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 26836, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 26836, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 26836, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 26836, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 26836, null]], "pdf_page_numbers": [[0, 2745, 1], [2745, 5318, 2], [5318, 6644, 3], [6644, 8100, 4], [8100, 10850, 5], [10850, 14106, 6], [14106, 17436, 7], [17436, 20661, 8], [20661, 23905, 9], [23905, 26836, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 26836, 0.0]]}
olmocr_science_pdfs
2024-12-05
2024-12-05
00857ef690cd709b50a0397016ca4edc22c3e694
[REMOVED]
{"Source-Url": "https://link.springer.com/content/pdf/10.1007%2F11552055_24.pdf", "len_cl100k_base": 5590, "olmocr-version": "0.1.50", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 21487, "total-output-tokens": 6273, "length": "2e12", "weborganizer": {"__label__adult": 0.0006566047668457031, "__label__art_design": 0.0004284381866455078, "__label__crime_law": 0.0037841796875, "__label__education_jobs": 0.0008106231689453125, "__label__entertainment": 0.0001722574234008789, "__label__fashion_beauty": 0.000278472900390625, "__label__finance_business": 0.0003802776336669922, "__label__food_dining": 0.0003829002380371094, "__label__games": 0.001842498779296875, "__label__hardware": 0.020416259765625, "__label__health": 0.0008921623229980469, "__label__history": 0.00033664703369140625, "__label__home_hobbies": 0.00016760826110839844, "__label__industrial": 0.0006728172302246094, "__label__literature": 0.0003788471221923828, "__label__politics": 0.00039505958557128906, "__label__religion": 0.0006561279296875, "__label__science_tech": 0.197509765625, "__label__social_life": 0.0001285076141357422, "__label__software": 0.1624755859375, "__label__software_dev": 0.60595703125, "__label__sports_fitness": 0.0003483295440673828, "__label__transportation": 0.0005059242248535156, "__label__travel": 0.0001800060272216797}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 29578, 0.01883]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 29578, 0.41398]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 29578, 0.92423]], "google_gemma-3-12b-it_contains_pii": [[0, 2541, false], [2541, 5630, null], [5630, 8411, null], [8411, 11182, null], [11182, 14141, null], [14141, 17009, null], [17009, 19861, null], [19861, 23717, null], [23717, 27133, null], [27133, 29578, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2541, true], [2541, 5630, null], [5630, 8411, null], [8411, 11182, null], [11182, 14141, null], [14141, 17009, null], [17009, 19861, null], [19861, 23717, null], [23717, 27133, null], [27133, 29578, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 29578, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 29578, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 29578, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 29578, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 29578, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 29578, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 29578, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 29578, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 29578, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 29578, null]], "pdf_page_numbers": [[0, 2541, 1], [2541, 5630, 2], [5630, 8411, 3], [8411, 11182, 4], [11182, 14141, 5], [14141, 17009, 6], [17009, 19861, 7], [19861, 23717, 8], [23717, 27133, 9], [27133, 29578, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 29578, 0.16522]]}
olmocr_science_pdfs
2024-11-29
2024-11-29
111dd005b59756263dc13639f3bfda44eb3fcec7
[REMOVED]
{"Source-Url": "http://www.researchgate.net/profile/Carlos_Pedrinaci2/publication/221050857_Multi-level_Monitoring_and_Analysis_of_Web-Scale_Service_Based_Applications/links/0fcfd50d2ee6a070f3000000.pdf", "len_cl100k_base": 6689, "olmocr-version": "0.1.53", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 36827, "total-output-tokens": 9178, "length": "2e12", "weborganizer": {"__label__adult": 0.0003237724304199219, "__label__art_design": 0.0006756782531738281, "__label__crime_law": 0.0005369186401367188, "__label__education_jobs": 0.0015459060668945312, "__label__entertainment": 0.0001614093780517578, "__label__fashion_beauty": 0.00020325183868408203, "__label__finance_business": 0.0029296875, "__label__food_dining": 0.0004470348358154297, "__label__games": 0.0005202293395996094, "__label__hardware": 0.0013704299926757812, "__label__health": 0.0006508827209472656, "__label__history": 0.00049591064453125, "__label__home_hobbies": 0.00011581182479858398, "__label__industrial": 0.0008492469787597656, "__label__literature": 0.0004703998565673828, "__label__politics": 0.0004093647003173828, "__label__religion": 0.0004315376281738281, "__label__science_tech": 0.25146484375, "__label__social_life": 0.00015211105346679688, "__label__software": 0.06689453125, "__label__software_dev": 0.66796875, "__label__sports_fitness": 0.00021529197692871096, "__label__transportation": 0.0007176399230957031, "__label__travel": 0.0002548694610595703}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 41130, 0.02476]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 41130, 0.19211]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 41130, 0.91647]], "google_gemma-3-12b-it_contains_pii": [[0, 2052, false], [2052, 3718, null], [3718, 6616, null], [6616, 9822, null], [9822, 12832, null], [12832, 14309, null], [14309, 16820, null], [16820, 19982, null], [19982, 23066, null], [23066, 26243, null], [26243, 28013, null], [28013, 31266, null], [31266, 34527, null], [34527, 37524, null], [37524, 41130, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2052, true], [2052, 3718, null], [3718, 6616, null], [6616, 9822, null], [9822, 12832, null], [12832, 14309, null], [14309, 16820, null], [16820, 19982, null], [19982, 23066, null], [23066, 26243, null], [26243, 28013, null], [28013, 31266, null], [31266, 34527, null], [34527, 37524, null], [37524, 41130, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 41130, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 41130, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 41130, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 41130, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 41130, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 41130, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 41130, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 41130, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 41130, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 41130, null]], "pdf_page_numbers": [[0, 2052, 1], [2052, 3718, 2], [3718, 6616, 3], [6616, 9822, 4], [9822, 12832, 5], [12832, 14309, 6], [14309, 16820, 7], [16820, 19982, 8], [19982, 23066, 9], [23066, 26243, 10], [26243, 28013, 11], [28013, 31266, 12], [31266, 34527, 13], [34527, 37524, 14], [37524, 41130, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 41130, 0.0]]}
olmocr_science_pdfs
2024-12-10
2024-12-10
7682f2a58e6116b7f8bb1596be70828ee9884417
[REMOVED]
{"Source-Url": "https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/20030018863.pdf", "len_cl100k_base": 4733, "olmocr-version": "0.1.53", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 26010, "total-output-tokens": 6422, "length": "2e12", "weborganizer": {"__label__adult": 0.00037741661071777344, "__label__art_design": 0.0005235671997070312, "__label__crime_law": 0.00044083595275878906, "__label__education_jobs": 0.0008258819580078125, "__label__entertainment": 0.0001385211944580078, "__label__fashion_beauty": 0.00021719932556152344, "__label__finance_business": 0.00025963783264160156, "__label__food_dining": 0.0003888607025146485, "__label__games": 0.0008563995361328125, "__label__hardware": 0.004283905029296875, "__label__health": 0.0007157325744628906, "__label__history": 0.0005092620849609375, "__label__home_hobbies": 0.00014913082122802734, "__label__industrial": 0.0011138916015625, "__label__literature": 0.0002371072769165039, "__label__politics": 0.00037479400634765625, "__label__religion": 0.0007014274597167969, "__label__science_tech": 0.362060546875, "__label__social_life": 0.00010514259338378906, "__label__software": 0.014801025390625, "__label__software_dev": 0.60888671875, "__label__sports_fitness": 0.0005426406860351562, "__label__transportation": 0.001129150390625, "__label__travel": 0.00032138824462890625}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 28320, 0.01804]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 28320, 0.27689]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 28320, 0.89644]], "google_gemma-3-12b-it_contains_pii": [[0, 2539, false], [2539, 5708, null], [5708, 8072, null], [8072, 10740, null], [10740, 12449, null], [12449, 15414, null], [15414, 18050, null], [18050, 19688, null], [19688, 21380, null], [21380, 24302, null], [24302, 27428, null], [27428, 28320, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2539, true], [2539, 5708, null], [5708, 8072, null], [8072, 10740, null], [10740, 12449, null], [12449, 15414, null], [15414, 18050, null], [18050, 19688, null], [19688, 21380, null], [21380, 24302, null], [24302, 27428, null], [27428, 28320, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 28320, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 28320, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 28320, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 28320, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 28320, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 28320, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 28320, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 28320, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 28320, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 28320, null]], "pdf_page_numbers": [[0, 2539, 1], [2539, 5708, 2], [5708, 8072, 3], [8072, 10740, 4], [10740, 12449, 5], [12449, 15414, 6], [15414, 18050, 7], [18050, 19688, 8], [19688, 21380, 9], [21380, 24302, 10], [24302, 27428, 11], [27428, 28320, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 28320, 0.0]]}
olmocr_science_pdfs
2024-12-09
2024-12-09
d792ccaa6dff2d8ddc53a1006f2e7451c37c1f1b
Enabling Automatic Certification of Online Auctions Wei Bai Department of Computer Science University of Liverpool England, UK Wei.Bai@liverpool.ac.uk Emmanuel M. Tadjouddine Department of Computer Science and Software Engineering Xi’an Jiaotong-Liverpool University SIP, Suzhou, China Emmanuel.Tadjouddine@xjtlu.edu.cn Yu Guo School of Computer Science and Technology University of Science and Technology of China Hefei, China guoyu@ustc.edu.cn We consider the problem of building up trust in a network of online auctions by software agents. This requires agents to have a deeper understanding of auction mechanisms and be able to verify desirable properties of a given mechanism. We have shown how these mechanisms can be formalised as semantic web services in OWL-S, a good enough expressive machine-readable formalism enabling software agents, to discover, invoke, and execute a web service. We have also used abstract interpretation to translate the auction’s specifications from OWL-S based on description logic, to Coq based on typed lambda calculus, in order to enable automatic verification of desirable properties of the auction by the software agents. For this language translation, we have discussed the syntactic transformation as well as the semantics connections between both concrete and abstract domains. This work contributes to the implementation of the vision of agent-mediated e-commerce systems. 1 Introduction Trust is an important issue in building up markets for rational participants. At the heart of markets lie the mechanism that spells out the rules of engagements for any participant. If the rules lack robustness, then participants may exploit the perceived loop holes to their benefit. To illustrate this statement, let us consider the example of the LIBOR (London Inter Bank Offered Rate) scandal, see for example [14]. The LIBOR relies on a simple mechanism wherein leading banks in London report estimates of interest rates that they would be charged if they borrow from other banks; we then drop the four highest and the four lowest rates and then calculate the arithmetic mean of the remaining rates. This mechanism clearly relies upon trust: banks will report their rates truthfully. However, a small change in the LIBOR rate could generate large payments to a bank giving incentives to certain banks to influence the LIBOR rate. The so-called LIBOR scandal arose from a misreporting of interest rates by collusion and manipulation. The question is can we ensure that participants are truthful in their reports? In a much more general setting, can we ensure trust in the market? In this paper, we consider electronic markets wherein software agents can buy or sell goods through online auction houses. This implies software agents will be engaging financial transactions and entering legally binding contracts on behalf of their owners. We would like to enable agents to check that the auction house is trustworthy before entering it and bid for items on sale. For that purpose, we assume that electronic institutions publish the specifications of their protocols in a high-level language specifying who can bid, in what order, and how the winners and payments are determined. A roaming agent who arrives at a foreign institution can download a protocol and analyze it in order to make a decision about whether or not to participate, and what strategy to use. To illustrate these requirements, we need to bear in mind that an auction is typically defined by a winner determination algorithm; there are several in the literature, see [6]. This provides the winning criteria and therefore implicitly determines the optimal strategy for participating agents. These winner determination algorithms are designed with desirable properties such as truthful bidding is optimal. If an electronic auction house is using such a protocol, it is not sufficient for the auctioneer to claim that a given bidding strategy is optimal. The fact is that sincerity cannot be assumed in open systems. These kinds of requirements are necessary to fully exploit the potential of e-commerce systems and to eventually achieve the vision of agent mediated e-commerce. In summary, the motivation for this work comes from the belief that verifying certain properties of a trading platform are useful to agents in open e-commerce environments only if: i) their protocols can be published in a machine-readable form; ii) their properties can be automatically verified by a software agent. Our focus is to address these requirements by providing a suitable specification language and associated proof procedures. The Semantic Web not only enables greater access to content but also to service on the Web. OWL-S [13] ontology is a language to describe Web services. It can be used to describe the properties and capabilities of a Web service in an unambiguous and computer-interpretable form. As a result, we have formalised an online auction as a semantic web service by using OWL-S since this provides machine-understandable specifications for software agents. To enable automatic verification procedures by agents, we present a translation framework that maps OWL-S into Coq specifications so that verification can be carried out as we have shown in our previous work [1] wherein we have implemented a verification procedure using the proof-carrying code paradigm from within Coq. The OWL-S-to-Coq language translation relies upon the abstract interpretation approach [5] allowing us to reason within Coq and then deduce properties for OWL-S. The contributions of this ongoing work are two-fold: i) we have provided a machine readable formalism for online auctions by using OWL-S thus enabling software agents to automatically discover, invoke and execute an online auction; ii) we have shown how to map OWL-S auction into Coq specifications by using abstract interpretation so as to enable automatic verification by relying upon a well-established theorem prover. 2 Background and Model Generally speaking a combinatorial auction [6] is composed of a set I of m items to be sold to n potential buyers. A bid is formulated as a pair \((B(x), b(x))\) in which \(B(x) \subseteq I\) is a bundle of items and \(b(x) \in \mathbb{R}^+\) is the price offer for the items in \(B\). The combinatorial auction problem (CAP) is to find a set \(X_0 \subseteq X\) such that, for a given a set of \(k\) bids, \(X = \{(B(x_1), b(x_1)), (B(x_2), b(x_2)), \ldots, (B(x_k), b(x_k))\}\), the quantity \(\sum_{x \in X_0} b(x)\) is maximal subject to the constraints expressed as for all \(x_i, x_j \in X_0\): \(B(x_i) \cap B(x_j) = \emptyset\) meaning an item can be found in only one accepted bid. We assume free disposal meaning that items may remain unallocated at the end of the auction. As shown in [16], the CAP is NP-hard implying that approximation algorithms are used to find a near-optimal solutions or restrictions are imposed in order to find tractable instances of the CAP [21] wherein polynomial time algorithms can be found for a restricted class of combinatorial auctions. A combinatorial auction can be sub-additive (for all bundles \(B_i, B_j \subseteq I\) such that \(B_i \cap B_j = \emptyset\), the price offer for \(B_i \cup B_j\)) is less than or equals to the sum of the price offers for \(B_i\) and \(B_j\)) or super-additive (for all \(B_i, B_j \subseteq I\) such that \(B_i \cap B_j = \emptyset\), the price offer for \(B_i \cup B_j\) is greater than or equals to the sum of the price offers for \(B_i\) and \(B_j\)). Game theory mechanism, see for example [6], is usually used to describe auctions, thus providing decision procedures that determine the set of winners for the auction according to some desired objective. An objective may be that the mechanism should maximise the social welfare, which can be for example the sum of all agents’ utilities in the auction. Such a mechanism is termed efficient. For open multi-agent systems, another desirable property for the mechanism designer can be strategyproofness (truth telling is a dominant strategy for all agents). A mechanism that is strategyproof has a dominant strategy equilibrium. A well known class of mechanisms that is efficient and strategyproof is the Vickrey-Clarke-Groves (VCG), see for example [6]. The VCG mechanism is performed by finding (i) the allocation that maximises the social welfare and (ii) a pricing rule allowing each winner to benefit from a discount according to his contribution to the overall value for the auction. To formalise the VCG mechanism, let us introduce the following notations: - $\mathcal{X}$ is the set possible allocations - $v_i(x)$ is the true valuation of $x \in \mathcal{X}$ for bidder $i$ - $b_i(x)$ is the bidding value of $x \in \mathcal{X}$ for bidder $i$ - $x^* \in \arg\max_{x \in \mathcal{X}} \sum_{i=1}^{n} b_i(x)$ is the optimal allocation for the submitted bids. - $x^*_{-i} \in \arg\max_{x \in \mathcal{X}} \sum_{j \neq i} b_j(x)$ is the optimal allocation if agent $i$ were not to bid. - $u_i$ is the utility function for bidder $i$. The VCG payment $p_i$ for bidder $i$ is defined as $$p_i = b_i(x^*) - \left( \sum_{j=1}^{n} b_j(x^*) - \sum_{j=1, j \neq i}^{n} b_j(x^*_{-i}) \right) = \sum_{j=1, j \neq i}^{n} b_j(x^*_{-i}) - \sum_{j=1, j \neq i}^{n} b_j(x^*)$$ and then, the utility $u_i$ for agent $i$ is a quasi-linear function of its valuation $v_i$ for the received bundle and payment $p_i$. $$u_i(v_i, p_i) = v_i - p_i$$ Let $p_i^*$ and $p_i$ be the payments for agent $i$ when it bids its true valuation $v_i$ and any number $b_i$ respectively. Note $p_i, p_i^*$ are functions of $b_{-i}$. The strategyproofness of the mechanism amounts to the following verification: $$\forall i, \forall v_i, \forall b_i u_i(v_i, p_i^*(b_{-i})) \geq u_i(v_i, p_i(b_{-i})).$$ In the equation (1), the quantity $\sum_{j=1, j \neq i}^{n} b_j(x^*_{-i})$ is called the Clark tax. Another interesting property of this VCG mechanism is that it is weakly budget balanced meaning the sum of all payments is greater than or equal to zero. For the VCG properties (e.g. strategyproof) to hold, the auctioneer must solve $n+1$ hard combinatorial optimisation problems (the optimal allocation in the presence of all bidders followed by $n$ optimal allocations with each bidder removed) exactly. Single item auctions are a particular case of combinatorial auctions wherein one item is sold at a time. Common single item auctions are the English, Dutch or Vickrey auctions, see for example [5]. For the Vickrey auction, the payment for agent $i$ is defined as: $$p_i = b_i(x^*) - \left( \sum_{j=1}^{n} b_j(x^*) - \sum_{j=1, j \neq i}^{n} b_j(x^*_{-i}) \right) = \sum_{j=1, j \neq i}^{n} b_j(x^*_{-i}) = \text{the second highest bid}.$$ For the English auction, the payment for agent $i$ is defined as: $$ p_i = b_i(x^i) = \text{the highest bid.} $$ (5) The utilities of the Vickrey and English auctions are defined as in equation (2). We assume that an online auction will run over a fixed time period $T$ and that the seller may have a reserve revenue under which items cannot be sold. This reserve revenue can typically be the reserve price for single item auctions. After a bid, the seller waits for some time before accepting the bid if it yields a revenue that is greater or equal to the reserve one or waits for the expiry time before deciding whether to reject or accept the bid. In this work, we aim at describing online auctions by using the semantic web, e.g., the OWL-S specification language and then translate the resulting description into COQ specifications in order to carry out the verification of desirable properties. 3 OWL-S Specifications Online auctions of software agents is a good application wherein data can be processed by automated reasoning tools. Logic-based languages are useful tools to model and reason about systems. They allow us to specify behavioral requirements of components of a system and formulate desirable properties for an individual component or the entire system. The semantic web enables us to describe and reason about web services by using ontologies. Ontologies permit us to describe the semantics of terms representing an area of knowledge. OWL, a W3C standard, is a description logic-based language that enables us to describe ontologies by using basic constructs such as concept definitions and relations between them. It has been used in a wide range of areas including biology, medicine, or aerospace [7]. In this work, we view an auction as a web service with enough logical attachments enabling a software agent to understand the auction rules and to carry out verifications of claimed properties. Logic-based languages are usually chosen for their expressivity or on the fact that their underlying logic is sound, complete or decidable. Expressivity provides us with powerful constructs to describe things that may not be otherwise expressed. Soundness ensures that if a property $\phi$ can be deduced from a system (a set of statements) $\Gamma$ ($\Gamma \vdash \phi$), then $\phi$ is true as long as $\Gamma$ is ($\Gamma \models \phi$). Completeness states that any true statement can be established by proof steps in the logic’s calculus. Formally $\Gamma \models \phi$ implies $\Gamma \vdash \phi$. A logic is decidable if for any statement we can construct an algorithm that decides if it is true or false. 3.1 Auction Ontology Ontology can be used to formally describe the semantics of terms representing an area of knowledge and give explicit meaning to the information. This allows for automated reasoning, semantic search and knowledge management in a specific area of knowledge. The ontology of auction domain contains the following constructs: classes, relations, axioms, individuals and assertions. We have used the ontology language OWL-S, which is used to describe Semantic Web Services within the OWL-based framework in order to build up the auction ontology. Figure 1 displays the top level concepts of our online auction ontology. The top-level classes are Agent and AuctionService. The class Winner is a subclass of the class Agent. The relations between classes are defined as properties. There are two kinds of properties: object properties and datatype properties. The object properties link individuals to individuals while the datatype properties link individuals to data values. In the following section, we show how to encode this ontology within the OWL-S language. 3.2 The OWL-S Description Language In this section, we argue that we can describe online auction houses as web services by using the OWL-S language, which provides us with a machine readable formalism and logical reasoning capabilities for software agents. We will start by showing that OWL-S is expressive enough to enable us to describe online auction mechanisms. To describe online auctions, we may ask why not XML (Extensible Markup Language) as a description language for this task. XML provide a syntactic approach but no logical base for reasoning. The meaning of the relationships between XML elements can not be encoded. A language that builds upon XML and allows for reasoning is the OWL-DL (Web Ontology Language), which is based on DL (Description Logic). Description logics are a family of logics that are decidable fragments of first-order logic. OWL-DL is sound, complete, and decidable but with limited expressivity. For example, we cannot express the statement that ‘an agent’s utility is its valuation minus its payment’. To extend OWL-DL, the SWRL (Semantic Web Rule Language) combines OWL-DL with RULEML that includes among others, MATHML and Horn rules. As a result, SWRL is more expressive than OWL-DL but SWRL is not decidable [10]. However, in SWRL, we cannot express the statement that ‘while newbid >currentbid do’. Furthermore, auction mechanisms can be viewed as functions with inputs, outputs, preconditions or postconditions. They may contain complex programming constructs such as branching or iterations. OWL-S enables us to describe online auctions as Web Services. An OWL-S description is mainly composed of a service profile for advertising and discovering services; a process model, which describes the operation of a service; and the grounding, which specifies how to access a service. In our case, the process contains information about inputs, outputs, and a natural language description of the auction, e.g., this is a Vickrey auction. The grounding contains information on the service location so that an agent can run the service by using the OWL-S API. The process model is described as follows: ```xml <process:CompositeProcess rdf:ID="Auction"> <process:hasInput> ... <process:hasOutput> ... <process:hasPrecondition> ... <process:hasResult> ... <process:AtomicProcess rdf:ID="WinDetermAlgo"> ... <process:AtomicProcess rdf:ID="PayeAndUtil"> ... </process:CompositeProcess> ``` The auction process model is basically composed of inputs, outputs, preconditions, results and a composition of two processes, which are the winner determination algorithm WinDetermAlgo and PayeAndUtil that calculates the payments as well as the utilities for the buyer agents. In OWL-S, we can also express auction properties such as the one defined by Equation (3) by using composite processes to define utility calculation as a kind of function and perform operations. Note that OWL-S allows to express the forall operation in a first-order logic formula. We omit the OWL-S code for Equation (3) for clarity and lack of space. ### 3.3 Implementation Issues We have implemented this agent-mediated semantic web service in JADE (Java Agent DEvelopment) framework [2] by using a Yellow Pages service. This permits seller agents to publish their services, so that buyer agents can find and exploit them. All the information of the buyer agents, such as bid and valuation of each agent, are translated into an OWL file, which is imported by the OWL-S service file containing the auction mechanism. We run this service using the OWL-S API to ensure the auction runs as expected. Eventually, the seller agent sends the result to each participant. The ACL language [2] is used for communicating messages between the agents. ### 4 From OWL-S to COQ Specifications In Section[3] we have shown how online auction mechanisms can be described using the OWL-S description language in order to have machine-understandable protocols by software agents. On the other hand, we have illustrated that auction mechanisms can be specified within COQ so as to develop machine-checkable proofs of desirable mechanism properties. The verification approach relies upon the proof-carrying code approach to enable the agents to gain confidence at the auction house by automatically verifying desirable properties. To bridge the gap between these two processes, we propose to transform OWL-S into COQ specifications by 1. devise an interpretation that maps the OWL-S semantics into COQ’s so as verified properties by COQ can be deduced in the OWL-S domain. 2. translate OWL-S into a tailored subset of COQ specifications so that an OWL-S program or logical formula can be transformed into a COQ one in an automated fashion. To carry out the above two tasks, we rely upon abstract interpretation, see for example [5]. The OWL-S specifications provide the following: (i) a semantic domain \( \mathcal{D} \) of states formed by vocabularies in terms of classes, subclasses, and properties; (ii) for each OWL-S program, an operational semantics \([p] \subseteq \mathcal{D} \times \mathcal{D} \) with some initial domain \( \mathcal{D}_0 \), (iii) for a given program \( p \), the collecting semantics \([p] \) is defined as the set of reachable states of \( \mathcal{D} \) starting by an initial state in \( \mathcal{D}_0 \). An abstraction \( \alpha : (2^\mathcal{D}, \subseteq, \cap, \cup) \rightarrow (2^\mathcal{D}, \subseteq^\#, \cap^\#, \cup^\#) \) wherein \( \mathcal{D}^\# \) is an abstract domain with a lattice structure enables us to map concrete elements into abstract ones. The partial orders \( \subseteq \) and \( \subseteq^\# \) model the precision of the concrete and abstract elements in \( 2^\mathcal{D} \) and \( \mathcal{D}^\# \) respectively. To define the abstract semantics in the abstract domain, we use a concretisation function \( \gamma : (2^\mathcal{D}, \subseteq, \cap, \cup) \rightarrow (2^\mathcal{D}, \subseteq, \cap, \cup) \) such that: \[ \forall \ p \ \alpha(p) \subseteq^\# p^\# \Rightarrow [p] \subseteq \gamma(p^\#). \] The abstraction \( \alpha \) can be semantics-preserving if it does not use approximations in the abstract domain. If approximations are used then, conservative analyses are usually used. In this case, it is required that \( \alpha \) be at least a sound abstraction so as to ensure that for a given program and a property \( f \), \( f^\# = \alpha(f) = true \Rightarrow f = true \). If \( f^\# \) is false in the abstract domain, then we pick the counter-example found in the abstract domain, translate it into the concrete domain and simulate it to discover if it is indeed a counter-example of the concrete program. If this is the case, then \( f \) does not hold, see [9]. ### 4.1 Translating Specifications We have used classical set operations to define OWL descriptions such as classes, properties, individuals and data values within Coq. The following table lists part of the mapping; more details are available upon request. <table> <thead> <tr> <th>OWL descriptions</th> <th>CoQ equivalent definitions</th> </tr> </thead> <tbody> <tr> <td>Individual</td> <td>Variable Individual : Set.</td> </tr> <tr> <td>Class</td> <td>Definition Class := set Individual.</td> </tr> <tr> <td>ObjectProperty</td> <td>Definition ObjectProperty := set (prod Individual Individual).</td> </tr> <tr> <td>DatatypeProperty</td> <td>Definition DataProperty := set (prod Individual Value).</td> </tr> <tr> <td>SomeValuesFrom()</td> <td>Definition someValuesFrom (op: ObjectProperty) (c: Class) : Class := fun i =&gt; exists y, set_in (i, y) op ( \setminus ) (y &lt;- c).</td> </tr> <tr> <td>AllValuesFrom()</td> <td>Definition allValuesFrom (op: ObjectProperty) (c: Class) : Class := forall y, set_in (i, y) op -&gt; (y &lt;- c).</td> </tr> </tbody> </table> By mapping the OWL-S constructs into Coq equivalent definitions, we can transform an OWL-S specification into a Coq counterpart as illustrated below. ```coq <Class IRI="#Agent"/> <Class IRI="#Agent_1"/> <NamedIndividual IRI="#agent_1"/> <Class IRI="#Agent_2"/> <NamedIndividual IRI="#agent_2"/> Inductive Individual : Set := | agent (n : nat). | Definition Agent : Class := set_add (agent_2) (set_add (agent_1) empty_class). ``` In the OWL-S code on the left, we define a class Agent and two individuals Agent_1 and Agent_2 that belongs to the class Agent. On the right, we show what will be the result of translating the OWL-S code fragment into CoQ. Such a translation will rely on compiler technology. 4.2 Verifying Desirable Properties In previous work [1], we have relied upon the Proof-Carrying Code (PCC) ideas since it allows us to shift the burden of proof from the buyer agent to the auctioneer who can spend time to prove a claimed property once for all so that it can be checked by a software agent willing to join the auction house. The certification procedure works as follows. The buyer agent arriving at the auction house can download its specification and the claimed proof of a desirable property. Then, the buyer installs the proof checker, which is a standalone verifier for COQ proofs. After the proof checker is installed to the consumer side, the buyer can now perform all verifications of claimed properties of the auction before deciding whether to join and with which bidding strategy. COQ [22] is an interactive theorem prover based on the calculus of inductive constructions allowing definitions of data types, predicates, and functions. It also enables us to express mathematical theorems and to interactively develop proofs that are checked from within the system. We have used COQ because it has been developed for more than twenty years and is widely used for formal proof development in a variety of contexts related to software and hardware correctness and safety. For example, COQ was used to develop and certify a compiler [11]. A fully computer-checked proof of the Four Colour Theorem was created in [8]. In [23], a COQ-formalised proof that all non-cooperative and sequential games have a Nash equilibrium point is presented. It turns out that COQ is a good example of combination of logic and computation as it allows for the formalisation of different types of logic (e.g., first order logic, etc.) while providing the possibility of defining functions, which are the cornerstone of computation. A well-defined auction mechanism can be viewed as a function that maps a set of typed agents into outcomes characterised by utilities usually defined as pseudo-linear equations, see Section 2. Not only, we need to specify rules and properties but we also need to carry out some calculations. The constructive approach provided by COQ offers possibilities to describe auctions along with desirable properties and prove them. In [1], we have developed the COQ proof of the well-known statement that bidding its true valuation is the dominant strategy for each agent in a Vickrey or English auction. Another important property that can be checked is that the auction is a well-defined function and that it does implement its specifications through certified code generation [3]. More challenging properties to be checked might be that the auction mechanism is collusion-free or that it is free from fictitious bidding. In this work, we focus on the mapping of auction specifications from OWL-S to COQ so as to enable the verification in a more dedicated and powerful proof development tool. 5 Related Work There are several related works about auction ontologies. In [25], a framework called TAGA is used to simulate the automated trading in dynamic markets. TAGA uses semantic web language to specify and publish underlying common ontologies. However, the specification of auction services in this paper does not describe the explicit process and rules of different auctions. In [20], a shared negotiation ontology is used to help agents negotiate with each other with a possible application to simulate online auction competition. The simulation was not a real implementation but just an illustration. In [17], the authors integrate semantic web technologies into agent architecture to represent the knowledge and behavior of agent. Although, this paper is mainly about distributed knowledge management, the presented approach can help us building up an agent mediated and automatically processed online auction service. The idea of software agents automatically checking desirable properties has been investigated in [19] by using a model checking approach. The computational complexity of such costly verification procedures are investigated in [18]. More recently, a proof-carrying code approach relying on proof develop- ment tools to enable automatic certification of auction mechanisms has been investigated in [1, 3]. Our work is aimed at bridging the gap between the need for a machine-readable formalism to specify online auction mechanisms and the ability of software agents to check possibly complex auction properties. In the context of specifications translation, the work reported in [12] has illustrated a case of transformation from OWL to Z specifications. The soundness of this mapping is shown using an algebraic institution morphism by viewing the underlying logics of OWL and Z as institutions. In [15], OWL-S was mapped into Frame logic for the use of first order logic based model checking to verify certain properties of semantic web service systems. In [24], a matching approach was used to select appropriate component software in a computer program translation scheme by inspecting the component software specifications. In our work, we define a syntactic translation scheme followed by a semantics interpretation based on the abstract interpretation paradigm. 6 Concluding Remarks In this paper, we have considered the problem of trust in a network of online auctions by software agents. We have focused on the specifications of auction mechanisms required to be machine-understandable and have proposed an OWL-S formalisation of the mechanisms. We have discussed how OWL-S is expressive enough for the description of these mechanisms. To enable automatic verification of auction properties by software agents, we have relied upon the well-established proof development COQ based on lambda calculus by translating the auction specifications from OWL-S to COQ. For this translation, we have illustrated the syntactic transformation and have used abstract interpretation to connect the concrete semantics of the OWL-S domain into the semantics of COQ. Future work includes the followings. We first need to formally establish the soundness (possibly the completeness) of the translation of auction specifications from OWL-S to COQ. We will then build up the infrastructure that connects the agents simulation tool JADE to COQ in an automated fashion. In JADE, we should be able to simulate two or three auction services and a number of software agents capable of understanding those auctions thanks to their OWL-S description, translate their specifications from OWL-S to COQ so that proofs of desirable properties of those mechanisms can be developed from within COQ, and then finally, enable a software agent to connect to COQ in order to certify a given property by using the proof-carrying code as shown in [1]. Note that the translation from OWL-S to COQ relies upon compiler construction technology. Such an infrastructure will enable us to simulate artificial markets (since they are mediated by software agents) that will shed some light on real markets by making assumptions and analysing their effects on the specified artificial societies. References
{"Source-Url": "http://export.arxiv.org/pdf/1404.0854", "len_cl100k_base": 6678, "olmocr-version": "0.1.53", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 31995, "total-output-tokens": 8985, "length": "2e12", "weborganizer": {"__label__adult": 0.0003991127014160156, "__label__art_design": 0.0004074573516845703, "__label__crime_law": 0.0007090568542480469, "__label__education_jobs": 0.0010900497436523438, "__label__entertainment": 0.00010591745376586914, "__label__fashion_beauty": 0.00020742416381835935, "__label__finance_business": 0.002544403076171875, "__label__food_dining": 0.00046443939208984375, "__label__games": 0.0012636184692382812, "__label__hardware": 0.0007543563842773438, "__label__health": 0.0007338523864746094, "__label__history": 0.00030612945556640625, "__label__home_hobbies": 0.000125885009765625, "__label__industrial": 0.0005755424499511719, "__label__literature": 0.0004124641418457031, "__label__politics": 0.0005807876586914062, "__label__religion": 0.0003669261932373047, "__label__science_tech": 0.06170654296875, "__label__social_life": 9.91225242614746e-05, "__label__software": 0.01212310791015625, "__label__software_dev": 0.91357421875, "__label__sports_fitness": 0.0003132820129394531, "__label__transportation": 0.0006704330444335938, "__label__travel": 0.0002589225769042969}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 34805, 0.03358]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 34805, 0.29181]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 34805, 0.87341]], "google_gemma-3-12b-it_contains_pii": [[0, 3242, false], [3242, 7545, null], [7545, 10771, null], [10771, 14495, null], [14495, 16034, null], [16034, 19238, null], [19238, 22873, null], [22873, 27035, null], [27035, 30746, null], [30746, 34805, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3242, true], [3242, 7545, null], [7545, 10771, null], [10771, 14495, null], [14495, 16034, null], [16034, 19238, null], [19238, 22873, null], [22873, 27035, null], [27035, 30746, null], [30746, 34805, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 34805, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 34805, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 34805, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 34805, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 34805, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 34805, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 34805, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 34805, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 34805, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 34805, null]], "pdf_page_numbers": [[0, 3242, 1], [3242, 7545, 2], [7545, 10771, 3], [10771, 14495, 4], [14495, 16034, 5], [16034, 19238, 6], [19238, 22873, 7], [22873, 27035, 8], [27035, 30746, 9], [30746, 34805, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 34805, 0.06383]]}
olmocr_science_pdfs
2024-12-08
2024-12-08
b4fd26a3b00bb7ccb4d42331c594ae04b6cc621c
How \#includes Affect Build Time in Large Systems József Mihalicza Department of Programming Languages and Compilers, Eötvös Loránd University Abstract The \#include concept, present in numerous mainstream languages like C, C++, Objective C, has unexpectedly bad effects on build times. Many current large systems using the \#include technique suffer from unacceptable long build procedure. Long builds waste many valuable manhours or even man months, elongate development and as a result make keeping deadlines harder. Using a different approach in a large system is proven to result in even 10 times faster builds. This paper compares various widely used freeware software packages and shows both the overhead the \#includes cause and the gain achieved by applying the mentioned approach. Keywords: C++, build time 1. Introduction C++ [1] is a widely spread programming language, many industrial projects are developed in it. Though it has numerous advantages, the long compilation time is one of its drawbacks, especially if we compare it to other languages. The total build time of a software system affects the time a compilation error is identified in continuous integration [2] environments. From a developer’s perspective the time of incremental builds is what rather counts, but after a synchronisation with the source repository a full build might be necessary. The probability of that grows with the number of developers working on the same source base. If the QA team works based on packages made by a build automation tool (e.g. CruiseControl) the minimum time a new package can get to them is also determined by the full build time. Bad build performance leads to various consequences. The long waits during a develop-test-develop-test cycle can distract the developer’s focus. In case of widely used headers (e.g. one included in the precompiled header) sometimes a worse solution is chosen intentionally merely to avoid long compilation. These choices are rarely replaced by the optimal ones afterwards. With template [3] metaprograms one can make the compiler run even quite complex algorithms [8]. C++ templates are proven to be Turing complete [4]. In [6] a profiler framework is presented to detect slow components in these metaprograms. In [7] the \#include mechanism is proven to be one of the main sources of bad build performance. There a program transformation is presented which can help in radically reducing the full compilation time. The purpose of this paper is the evaluation of that program transformation method by applying it to three open source C++ libraries. In section 2 I briefly show the method itself. Then in section 3 I describe what exact libraries I chose for the test and present the steps of their transformation, mainly focusing on the problematic points. Section 4 summarizes and discusses the results in numbers. Section 5 contains a brief conclusion and some ideas for future work. 2. The method The idea is the following: instead of compiling numerous .cpp files one by one separately, we concatenate them together using the \#include directive and compile at once. This way if there is a header file included in many original source files, it will be processed only once. The build flow changes from: source\_1 \hspace{1cm} \begin{aligned} \text{prepr.} & \rightarrow \text{preprocessed}\_1 \\ & \text{compiler} \rightarrow \text{object}\_1 \\ & \text{linker} \rightarrow \text{target} \end{aligned} \vdots source\_n \hspace{1cm} \begin{aligned} \text{prepr.} & \rightarrow \text{preprocessed}\_n \\ & \text{compiler} \rightarrow \text{object}\_n \\ & \text{linker} \rightarrow \text{target} \end{aligned} \text{source\_1, source\_n} \begin{aligned} \text{script or} & \text{include "source}\_1" \\ & \text{linker \circ compiler \circ prepr.} \rightarrow \text{target} \\ & \text{manually} \rightarrow \text{include "source}\_n" \end{aligned} For example, instead of compiling ``` lib_1_file_a.cpp lib_1_file_b.cpp lib_1_file_c.cpp ``` separately, we will have a file, to say lib_1_all.cpp with the following contents: ``` #include "lib_1_file_a.cpp" #include "lib_1_file_b.cpp" #include "lib_1_file_c.cpp" ``` This transformation can bring in new errors because of different reasons. Section 3 discusses them in details. Moreover, this new configuration can hide serious dependency violations. As the code evolves, obviously erroneous code fragments can remain unrecognized and cause unforeseen trouble later. To avoid this side effect it is advisable to maintain also a configuration that does not apply the described transformation. Integrated development environments (IDE) raise the question of whether to remove the original source files from the project. Many of them allows exclusion of source modules piecewise within a configuration. If this is not possible, having both the ...all.cpp files and the original sources in the project would result in double compilation and double definition of all symbols later at link time. Removing the sources, however, may prevent the IDE from helping the developer navigating in the source files. Fortunately most modern IDEs parse also the included files for symbols regardless whether they are added to the project. As discussed before, maintaining a transformationless configuration is recommended. Either this can be achieved by excluding the original and the ...all.cpp files in two separate build configurations respectively, or by using preprocessor directives as shown below: ```cpp lib_1_all.cpp: #include "lib_1_file_a.cpp" #include "lib_1_file_b.cpp" #define FAST_COMPILATION #endif lib_1_file_a.cpp: #endif #ifdef FAST_COMPILATION ```n This latter approach has the advantage that it works in all environments and does not need a separate build configuration. Though in this case the compiler should preprocess all source files even in the fast configuration, it will remain fast since the whole file is disabled and will not include further sources. In Makefile based projects we can either create a rule for the composition of the ...all.cpp files, or just create them manually. The procedure has an interesting side effect. Having all files included together into a single file, we get a centralized place where each compilation unit of the library can be enabled or disabled easily with precompiler directives. Suppose, for example, that lib_1 has some independent subcomponents, which are not big enough to be separate libraries, but still we would like to handle them together. In this case we can dedicate preprocessor directives to these subcomponents and control their inclusion in the resulting library: ```cpp #include "lib_1_base_file_a.cpp" #include "lib_1_base_file_b.cpp" #ifdef LIB_1_SUBCOMPONENT1 #include "lib_1_subcomponent_1_file_a.cpp" #include "lib_1_subcomponent_1_file_b.cpp" #endif #ifdef LIB_1_SUBCOMPONENT2 #include "lib_1_subcomponent_2_file_a.cpp" ... ``` 3. Transformation case studies The program transformation described in section 2 has been applied to three open source libraries: **OpenSceneGraph 2.8.2** 3D graphics toolkit **wxWidgets 2.8.10** Widget toolkit for creating GUIs **Xerces 3.0.1** XML parser library C++ units are not typically designed for being included together, they can use arbitrary local symbols that are not unique among the source files. Therefore our transformation easily leads to compilation errors. Based on the experience with the libraries above, this section presents what modifications may be needed to make the code compile again after the transformation. We will see what constructs we have to be careful with when using this technique. **unwanted sources** If scripts are used to gather the source files to be included together, be careful not to add a file that is otherwise not part of the project. In OpenSceneGraph for example, there is a `Matrix_implementation.cpp` which acts like a template. It contains a generic implementation of a matrix type, where the actual class type is everywhere `Matrix_implementation`, a type which is not defined earlier in that file. `Matrixd.cpp` and `Matrixf.cpp` use this generic implementation, defining the `Matrix_implementation` before including the `.cpp`: ```cpp // specialise Matrix_implementation to be Matrixd #define Matrix_implementation Matrixd ... // now compile up Matrix via Matrix_implementation #include "Matrix_implementation.cpp" ``` This is a pattern [9] for simulating templates. Here I had just to remove the inclusion of the generic implementation from the `.all.cpp` file. **double definition of inline function** The generic matrix implementation, see above, uses an inline function defined in the `.cpp` file. After including together `Matrixd.cpp` and `Matrixf.cpp` this inline function was defined twice in the same compilation unit, which is an error. The solution is a header guard-like prevention from double definition: ```cpp #ifndef Matrix_implementation_cpp_included #define Matrix_implementation_cpp_included template <class T> inline T SGL_ABS(T a) { return (a >= 0 ? a : -a); } #endif ``` ```cpp // ifndef Matrix_implementation_cpp_included #define Matrix_implementation_cpp_included # ifndef Matrix_implementation_cpp_included #define Matrix_implementation_cpp_included template <class T> inline T SGL_ABS(T a) { return (a >= 0 ? a : -a); } #endif ``` local symbols with identical names This is the most frequent conflict type. Originally different compilation units chose the same identifier to denote a local element. In OpenSceneGraph for example these were mainly typedefs, static variables and complete classes. I had to assign distinct names for these variables. In abc.cpp for example I changed ```cpp typedef buffered_value< ref_ptr<abc::Extensions> > BufferedExtensions; static BufferedExtensions s_extensions; ``` to ```cpp typedef buffered_value< ref_ptr<abc::Extensions> > abc_BufferedExtensions; static abc_BufferedExtensions s_abc_extensions; ``` where abc was one of BlendEquation, BlendFunc, BufferObject etc. multiply defined macros As the compilation no longer ends at the end of the source file, we have to add #undef directives for each corresponding #define introduced in the given unit. Each original source file assumes that no custom macros (except for those coming from the environment or make file) are defined at the 0. position of the file. It can happen that we do not even notice that a macro from a previous file remained active in thenext included file. These bugs are very difficult to find afterwards, so the best is to follow the simple rule of thumb: #undef every macro at the end. This step can easily be automated though it is not that exhaustive to do manually. macro redefinition In some files I had to put #ifndef guards around the definition of an otherwise standard macro. Probably the original intent was not to include the whole world because of this sole macro definition. conflict with a header included in a preceding unit This is an evil one. It happens when some previously included header file contains such definitions that cause conflicts in another file later on. If the problematic symbol is a macro, a well placed #undef should solve it, otherwise renaming [10] may be necessary. In my case the min and max macros (of windef.h) conflicted with numeric_limits::min and numeric_limits::max respectively. In some cases the conflict is not, or not easily resolvable. We always have the option to put these conflicting sources into separate _all.cpp files. In the Xerces library some sources include windows.h, which in turn includes winsock.h. Another source later includes winsock2.h which conflicts with the definitions coming from winsock.h. Though this concrete conflict could have been resolved in numerous other ways, I chose to let this case be a demonstrative example. I put the sources including winsock2.h into a separate _all.cpp file, NetAccessor_all.cpp. using namespace vs. local symbol The usage of using namespace can easily lead to name clashes in our method. The solution is preferably removing the using directive or alternatively renaming the conflicting local symbol. The following table shows what amount of change was needed to make the transformed libraries compile: <table> <thead> <tr> <th>Library</th> <th>Files</th> <th>Modified files</th> <th>Characters added</th> <th>Average bytes per modified file</th> </tr> </thead> <tbody> <tr> <td>OpenSceneGraph</td> <td>1661</td> <td>31</td> <td>2418</td> <td>78</td> </tr> <tr> <td>wxWidgets</td> <td>825</td> <td>82</td> <td>12100</td> <td>148</td> </tr> <tr> <td>Xerces</td> <td>811</td> <td>50</td> <td>5082</td> <td>102</td> </tr> </tbody> </table> As the numbers show, 2-10% of the source files has to be adapted to the new compilation method. These changes are safe and simple, in most cases only renames. 4. Results Now let us see the effects of the transformation in numbers. The following tables will show the change both in the compilation time and in the summed up preprocessed source size in LOC metric, for all the three libraries: <table> <thead> <tr> <th>Target</th> <th>original time</th> <th>transformed time</th> <th>ratio</th> <th>original LOC</th> <th>transformed LOC</th> <th>ratio</th> </tr> </thead> <tbody> <tr> <td>osg plugin</td> <td>626</td> <td>18</td> <td>2.9%</td> <td>5388153</td> <td>75279</td> <td>1.4%</td> </tr> <tr> <td>Osg</td> <td>669</td> <td>41</td> <td>6.1%</td> <td>5344590</td> <td>150242</td> <td>2.8%</td> </tr> <tr> <td>osgUtil</td> <td>229</td> <td>53</td> <td>23.1%</td> <td>1814422</td> <td>83677</td> <td>4.6%</td> </tr> <tr> <td>osgDB</td> <td>143</td> <td>19</td> <td>13.3%</td> <td>1373930</td> <td>93451</td> <td>6.8%</td> </tr> <tr> <td>osgGA</td> <td>95</td> <td>11</td> <td>11.6%</td> <td>877402</td> <td>66304</td> <td>7.6%</td> </tr> <tr> <td>osgViewer</td> <td>114</td> <td>24</td> <td>21.1%</td> <td>872151</td> <td>124964</td> <td>14.3%</td> </tr> <tr> <td>osgText</td> <td>58</td> <td>15</td> <td>25.9%</td> <td>461226</td> <td>68671</td> <td>14.9%</td> </tr> <tr> <td>OpenThreads</td> <td>7</td> <td>2</td> <td>28.6%</td> <td>166959</td> <td>72085</td> <td>43.2%</td> </tr> <tr> <td>osgviewer app</td> <td>13</td> <td>13</td> <td>100.0%</td> <td>67380</td> <td>67380</td> <td>100.0%</td> </tr> <tr> <td>all</td> <td>1954</td> <td>196</td> <td>10.0%</td> <td>16366213</td> <td>802053</td> <td>4.9%</td> </tr> </tbody> </table> Table 1: OpenSceneGraph We can see that though the source size compression was maximal at wxWidgets, it is not reflected in the time ratio. The reason is the heavy usage of precompiled headers. Similarly, though Xerces has twice as big size ratio, still the time ratio is almost the same as of OpenSceneGraph. Table ?? shows the overhead of preprocessing before and after the transformation. It seems in Xerces either there is less coupling between the modules, or the #include dependencies were consciously kept minimal. ### Table 2: wxWidgets <table> <thead> <tr> <th>Target</th> <th>original LOC</th> <th>transformed LOC</th> <th>ratio</th> <th>original LOC</th> <th>transformed LOC</th> <th>ratio</th> </tr> </thead> <tbody> <tr> <td>core</td> <td>19394804</td> <td>192829</td> <td>1.0%</td> <td></td> <td></td> <td></td> </tr> <tr> <td>base</td> <td>6534236</td> <td>129696</td> <td>2.0%</td> <td></td> <td></td> <td></td> </tr> <tr> <td>xrc</td> <td>4868302</td> <td>99163</td> <td>2.0%</td> <td></td> <td></td> <td></td> </tr> <tr> <td>adv</td> <td>2171443</td> <td>109069</td> <td>5.0%</td> <td></td> <td></td> <td></td> </tr> <tr> <td>html</td> <td>2111128</td> <td>100901</td> <td>4.8%</td> <td></td> <td></td> <td></td> </tr> <tr> <td>wxtiff</td> <td>1937586</td> <td>69857</td> <td>3.6%</td> <td></td> <td></td> <td></td> </tr> <tr> <td>net</td> <td>895406</td> <td>80094</td> <td>8.9%</td> <td></td> <td></td> <td></td> </tr> <tr> <td>richtext</td> <td>824870</td> <td>109411</td> <td>13.3%</td> <td></td> <td></td> <td></td> </tr> <tr> <td>aui</td> <td>532399</td> <td>97514</td> <td>18.3%</td> <td></td> <td></td> <td></td> </tr> <tr> <td>media</td> <td>450098</td> <td>95189</td> <td>21.1%</td> <td></td> <td></td> <td></td> </tr> <tr> <td>xml</td> <td>148692</td> <td>75148</td> <td>50.5%</td> <td></td> <td></td> <td></td> </tr> <tr> <td>qa</td> <td>147088</td> <td>85731</td> <td>58.3%</td> <td></td> <td></td> <td></td> </tr> <tr> <td>odbc</td> <td>147088</td> <td>73544</td> <td>50.0%</td> <td></td> <td></td> <td></td> </tr> <tr> <td>gl</td> <td>85731</td> <td>85731</td> <td>100.0%</td> <td></td> <td></td> <td></td> </tr> <tr> <td>dbgrid</td> <td>85731</td> <td>85731</td> <td>100.0%</td> <td></td> <td></td> <td></td> </tr> <tr> <td>wxjpeg</td> <td>76217</td> <td>12665</td> <td>16.6%</td> <td></td> <td></td> <td></td> </tr> <tr> <td>wxexpat</td> <td>69164</td> <td>31842</td> <td>46.0%</td> <td></td> <td></td> <td></td> </tr> <tr> <td>wxpng</td> <td>45500</td> <td>14843</td> <td>32.6%</td> <td></td> <td></td> <td></td> </tr> <tr> <td>wxregex</td> <td>13345</td> <td>7693</td> <td>57.6%</td> <td></td> <td></td> <td></td> </tr> <tr> <td>wxzlib</td> <td>11213</td> <td>5810</td> <td>51.8%</td> <td></td> <td></td> <td></td> </tr> <tr> <td>all</td> <td>40550041</td> <td>1562461</td> <td>3.9%</td> <td></td> <td></td> <td></td> </tr> </tbody> </table> ### Table 3: Xerces <table> <thead> <tr> <th>Library</th> <th>original LOC</th> <th>preprocessed LOC</th> <th>ratio</th> </tr> </thead> <tbody> <tr> <td>OpenSceneGraph</td> <td>91205</td> <td>16366213</td> <td>17944.43%</td> </tr> <tr> <td>OpenSceneGraph transformed</td> <td>802053</td> <td>879.40%</td> <td></td> </tr> <tr> <td>wxWidgets</td> <td>357642</td> <td>40550041</td> <td>11338.17%</td> </tr> <tr> <td>wxWidgets transformed</td> <td>1562461</td> <td>436.88%</td> <td></td> </tr> <tr> <td>Xerces</td> <td>122396</td> <td>2398884</td> <td>193.48%</td> </tr> <tr> <td>Xerces transformed</td> <td>236810</td> <td>9.87%</td> <td></td> </tr> </tbody> </table> ### Table 4: Preprocessing overhead 5. Conclusion and future works The results showed that the presented method for reducing full compilation time can lead to as much as even 10 times faster builds. The ratio of the preprocessed and the original source size gets dropped down radically (to 4-10%), under 1000% in all cases, 200% for Xerces, which means that the preprocessed source does not reach the double of the original size. On the other hand, manual code modifications may be necessary to make the transformed source work again, and some rules and limitations are to be followed in order to keep the method working. Future works may include the automation of an error free transformation, the development of a coding style to help remaining compatible with the approach, or further studies on eliminating the overhead of `#includes`. References [8] Alexandrescu, A., Modern C++ design: generic programming and design patterns applied Addison-Wesley (2001)
{"Source-Url": "http://icai.ektf.hu/pdf/ICAI2010-vol2-pp343-350.pdf", "len_cl100k_base": 5119, "olmocr-version": "0.1.53", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 20729, "total-output-tokens": 5450, "length": "2e12", "weborganizer": {"__label__adult": 0.0002961158752441406, "__label__art_design": 0.00025177001953125, "__label__crime_law": 0.00023853778839111328, "__label__education_jobs": 0.00028824806213378906, "__label__entertainment": 4.13060188293457e-05, "__label__fashion_beauty": 9.500980377197266e-05, "__label__finance_business": 0.0001143813133239746, "__label__food_dining": 0.00026702880859375, "__label__games": 0.00030612945556640625, "__label__hardware": 0.0005993843078613281, "__label__health": 0.0002551078796386719, "__label__history": 0.00012767314910888672, "__label__home_hobbies": 5.745887756347656e-05, "__label__industrial": 0.00021326541900634768, "__label__literature": 0.00012564659118652344, "__label__politics": 0.0001552104949951172, "__label__religion": 0.0003361701965332031, "__label__science_tech": 0.0034656524658203125, "__label__social_life": 6.431341171264648e-05, "__label__software": 0.004306793212890625, "__label__software_dev": 0.98779296875, "__label__sports_fitness": 0.0002135038375854492, "__label__transportation": 0.00029921531677246094, "__label__travel": 0.00017464160919189453}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 19715, 0.0533]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 19715, 0.28411]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 19715, 0.83895]], "google_gemma-3-12b-it_contains_pii": [[0, 2029, false], [2029, 4432, null], [4432, 6925, null], [6925, 9354, null], [9354, 11930, null], [11930, 14888, null], [14888, 17621, null], [17621, 19715, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2029, true], [2029, 4432, null], [4432, 6925, null], [6925, 9354, null], [9354, 11930, null], [11930, 14888, null], [14888, 17621, null], [17621, 19715, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 19715, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 19715, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 19715, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 19715, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 19715, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 19715, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 19715, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 19715, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 19715, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 19715, null]], "pdf_page_numbers": [[0, 2029, 1], [2029, 4432, 2], [4432, 6925, 3], [6925, 9354, 4], [9354, 11930, 5], [11930, 14888, 6], [14888, 17621, 7], [17621, 19715, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 19715, 0.26667]]}
olmocr_science_pdfs
2024-12-09
2024-12-09
551c5b56475bf23c5772655cdde3a435b008c67a
SML CSE 307 – Principles of Programming Languages Stony Brook University http://www.cs.stonybrook.edu/~cse307 Functional Programming • *Function evaluation* is the basic concept for a programming paradigm that has been implemented in *functional programming languages*. • The language ML (“Meta Language”) was originally introduced in the 1970’s as part of a theorem proving system, and was intended for describing and implementing proof strategies in the Logic for Computable Functions (LCF) theorem prover (whose language, pplambda, a combination of the first-order predicate calculus and the simply typed polymorphic lambda calculus, had ML as its metalanguage) • Standard ML of New Jersey (SML) is an implementation of ML. • The basic mode of computation in SML is the use of the definition and application of functions. Install Standard ML - Download from: - [http://www.smlnj.org](http://www.smlnj.org) - Start Standard ML: - Type `sml` from the shell (run command line in Windows) - Exit Standard ML: - `Ctrl-Z` under Windows - `Ctrl-D` under Unix/Mac • The basic cycle of SML activity has three parts: • read input from the user, • evaluate it, • print the computed value (or an error message). First SML example - SML prompt: - - Simple example: - 3; val it = 3 : int - The first line contains the SML prompt, followed by an expression typed in by the user and ended by a semicolon. - The second line is SML’s response, indicating the value of the input expression and its type. Interacting with SML - SML has a number of built-in operators and data types. - It provides the standard arithmetic operators - 3+2; val it = 5 : int - The Boolean values true and false are available, as are logical operators such as not (negation), andalso (conjunction), and orelse (disjunction). - not(true); val it = false : bool - true andalso false; val it = false : bool As part of the evaluation process, SML determines the type of the output value using methods of type inference. Simple types include int, real, bool, and string. One can also associate identifiers with values - val five = 3+2; val five = 5 : int and thereby establish a new value binding - five; val it = 5 : int The general form of a function definition in SML is: ```sml fun <identifier> (<parameters>) = <expression>; ``` For example, ```sml - fun double(x) = 2*x; val double = fn : int -> int ``` declares `double` as a function from integers to integers, i.e., of type `int \rightarrow int`. Apply a function to an argument of the wrong type results in an error message: ```sml - double(2.0); ``` Error: operator and operand don’t agree ... The user may also explicitly indicate types: - fun max(x:int,y:int,z:int) = if ((x>y) andalso (x>z)) then x else (if (y>z) then y else z); val max = fn : int * int * int -> int - max(3,2,2); val it = 3 : int Recursive Definitions - The use of recursive definitions is a main characteristic of functional programming languages, and these languages encourage the use of recursion over iterative constructs such as while loops: - fun factorial(x) = if x=0 then 1 else x*factorial(x-1); val factorial = fn : int -> int - The definition is used by SML to evaluate applications of the function to specific arguments. - factorial(5); val it = 120 : int - factorial(10); val it = 3628800 : int Example: Greatest Common Divisor - The greatest common divisor (gcd) of two positive integers can be defined recursively based on the following observations: 1. $\text{gcd}(n, n) = n$, 2. $\text{gcd}(m, n) = \text{gcd}(n, m)$, and 3. $\text{gcd}(m, n) = \text{gcd}(m - n, n)$, if $m > n$. - These identities suggest the following recursive definition: ``` fun gcd(m,n):int = if m=n then n else if m>n then gcd(m-n,n) else gcd(m,n-m); ``` - Examples: - $\text{gcd}(12, 30) = 6$ - $\text{gcd}(1, 20) = 1$ - $\text{gcd}(125, 56345) = 5$ (c) Paul Fodor (CS Stony Brook) More recursive functions - fun exp(b,n) = if n=0 then 1.0 else b * exp(b,n-1); val exp = fn : real * int -> real - exp(2.0,10); val it = 1024.0 : real Tuples in SML - In SML tuples are finite sequences of arbitrary but fixed length, where different components need not be of the same type. - `(1, "two") `val it = (1,"two") : int * string` - `val t1 = (1,2,3);` `val t1 = (1,2,3) : int * int * int` - `val t2 = (4,(5.0,6));` `val t2 = (4,(5.0,6)) : int * (real * int)` - The components of a tuple can be accessed by applying the built-in functions `#i`, where `i` is a positive number. - `#1(t1);` `val it = 1 : int` - `#2(t2);` `val it = (5.0,6) : real * int` If a function `#i` is applied to a tuple with fewer than `i` components, an error results. Polymorphic functions - fun id x = x; val id = fn : 'a -> 'a - (id 1, id "two") val it = (1,"two") : int * string - fun fst(x,y) = x; val fst = fn : 'a * 'b -> 'a - fun snd(x,y) = y; val snd = fn : 'a * 'b -> 'b - fun switch(x,y) = (y,x); val switch = fn : 'a * 'b -> 'b * 'a Lists in SML - A list in SML is a finite sequence of objects, all of the same type: - \([1,2,3]\); - \([true,false,true]\); - \([[1,2,3],[4,5],[6]]\); - The last example is a list of lists of integers. Lists in SML - All objects in a list must be of the same type: - [1,[2]]; Error: operator and operand don’t agree - An empty list is denoted by one of the following expressions: - []; val it = [] : 'a list - nil; val it = [] : 'a list - Note that the type is described in terms of a type variable 'a. Instantiating the type variable, by types such as int, results in (different) empty lists of corresponding types. Operations on Lists - SML provides various functions for manipulating lists. - The function \texttt{hd} returns the first element of its argument list. \begin{verbatim} - hd[1,2,3]; val it = 1 : int - hd[[1,2],[3]]; val it = [1,2] : int list \end{verbatim} Applying this function to the empty list will result in an error. - The function \texttt{tl} removes the first element of its argument lists, and returns the remaining list. \begin{verbatim} - tl[1,2,3]; val it = [2,3] : int list - tl[[1,2],[3]]; val it = [[3]] : int list list \end{verbatim} The application of this function to the empty list will also result in an error. Operations on Lists - Lists can be constructed by the (binary) function :: (read cons) that adds its first argument to the front of the second argument. - 5::[]; val it = [5] : int list - 1::[2,3]; val it = [1,2,3] : int list - [1,2]::[[3],[4,5,6,7]]; val it = [[1,2],[3],[4,5,6,7]] : int list list The arguments must be of the right type (such that the result is a list of elements of the same type): - [1]::[2,3]; Error: operator and operand don’t agree Operations on Lists - Lists can also be compared for equality: - \([1,2,3]]=[1,2,3]\); val it = true : bool - \([1,2]=[2,1]\); val it = false : bool - \(\text{tl}[1] = []\); val it = true : bool Defining List Functions • Recursion is particularly useful for defining functions that process lists. • For example, consider the problem of defining an SML function that takes as arguments two lists of the same type and returns the concatenated list. • In defining such list functions, it is helpful to keep in mind that a list is either – an empty list \([]\) or – of the form \(x: y\) • In designing a function for concatenating two lists \( x \) and \( y \) we thus distinguish two cases, depending on the form of \( x \): • If \( x \) is an empty list \([\ ]\), then concatenating \( x \) with \( y \) yields just \( y \). • If \( x \) is of the form \( x1 :: x2 \), then concatenating \( x \) with \( y \) is a list of the form \( x1 :: z \), where \( z \) is the result of concatenating \( x2 \) with \( y \). • We can be more specific by observing that \( x = \text{hd}(x) :: \text{tl}(x) \). Concatenation - fun concat(x,y) = if x=[] then y else hd(x)::concat(tl(x),y); val concat = fn : ''a list * ''a list -> ''a list - Applying the function yields the expected results: - concat([1,2],[3,4,5]); val it = [1,2,3,4,5] : int list - concat([], [1,2]); val it = [1,2] : int list - concat([1,2], []); val it = [1,2] : int list The following function computes the length of its argument list: \[ \begin{align*} \text{fun } & \text{length}(L) = \text{if } (L=\text{nil}) \text{ then } 0 \\ & \text{else } 1 + \text{length}(\text{tl}(L)) ; \end{align*} \] \[ \text{val length } = \text{fn} : ''a \text{ list} \rightarrow \text{int} \] - \text{length}[1,2,3]; \text{val it } = 3 : \text{int} - \text{length}[[5],[4],[3],[2,1]]; \text{val it } = 4 : \text{int} - \text{length}[]; \text{val it } = 0 : \text{int} The following function doubles all the elements in its argument list (of integers): - fun doubleall\( (L) \) = if \( L = [] \) then [] else (2*hd(L))::doubleall(tl(L)); val doubleall = fn : int list -> int list - doubleall[1,3,5,7]; val it = [2,6,10,14] : int list Reversing a List - Concatenation of lists, for which we gave a recursive definition, is actually a built-in operator in SML, denoted by the symbol @. - We use this operator in the following recursive definition of a function that reverses a list. ```sml fun reverse(L) = if L = nil then nil else reverse(tl(L)) @ [hd(L)]; val reverse = fn : ''a list -> ''a list - reverse [1,2,3]; val it = [3,2,1] : int list ``` This method is not efficient: $O(n^2)$ Reversing a List - This way (using an accumulator) is better: $O(n)$ fun reverse_helper(L, L2) = if L = nil then L2 else reverse_helper(tl(L), hd(L) :: L2); fun reverse(L) = reverse_helper(L, []); Removing List Elements - The following function removes all occurrences of its first argument from its second argument list. ``` fun remove(x, L) = if (L=[]) else if x=hd(L) then remove(x, tl(L)) else hd(L)::remove(x, tl(L)); ``` val remove = fn : ''a * ''a list -> ''a list - remove(1, [5,3,1]); val it = [5,3] : int list - remove(2, [4,2,4,2,4,2,2,2]); val it = [4,4,4] : int list The remove function can be used in the definition of another function that removes all duplicate occurrences of elements from its argument list: - `fun removedupl(L) =` `if (L=[]) then []` `else hd(L)::removedupl(remove(hd(L),tl(L)))`; val removedupl = fn : 'a list -> 'a list - `removedupl([3,2,4,6,4,3,2,3,4,3,2,1]);` val it = [3,2,4,6,1] : int list Definition by Patterns - In SML functions can also be defined via patterns. - The general form of such definitions is: \[ \text{fun } \langle\text{identifier}\rangle(\langle\text{pattern1}\rangle) = \langle\text{expression1}\rangle \\ | \langle\text{identifier}\rangle(\langle\text{pattern2}\rangle) = \langle\text{expression2}\rangle \\ | \ldots \\ | \langle\text{identifier}\rangle(\langle\text{patternK}\rangle) = \langle\text{expressionK}\rangle; \] where the identifiers, which name the function, are all the same, all patterns are of the same type, and all expressions are of the same type. - Example: - \[ \begin{align*} \text{fun } \text{reverse}(\text{nil}) & = \text{nil} \\ | \text{reverse}(x::xs) & = \text{reverse}(xs) @ [x]; \end{align*} \] \[ \text{val } \text{reverse} = \text{fn} : \text{'a list } \rightarrow \text{'a list} \] fun member(X,L) = if L=[]> then false else if X=hd(L) then true else member(X,tl(L)); OR fun member(X,[]) = false | member(X,Y::Ys) = if (X=Y) then true else member(X,Ys); member(1,[1,2]); (* true *) member(1,[2,1]); (* true *) member(1,[2,3]); (* false *) fun union(L1,L2) = if L1=[] then L2 else if member(hd(L1),L2) then union(tl(L1),L2) else hd(L1)::union(tl(L1),L2); union([1,5,7,9],[2,3,5,10]); (* [1,7,9,2,3,5,10] *) union([], [1,2]); (* [1,2] *) union([1,2], []); (* [1,2] *) fun union([], L2) = L2 | union(X::Xs, L2) = if member(X, L2) then union(Xs, L2) else X::union(Xs, L2); union([1,5,7,9],[2,3,5,10]); (* [1,7,9,2,3,5,10] *) union([], [1,2]); (* [1,2] *) union([1,2], []); (* [1,2] *) fun intersection(L1,L2) = if L1=[] then [] else if member(hd(L1),L2) then hd(L1)::intersection(tl(L1),L2) else intersection(tl(L1),L2); intersection([1,5,7,9],[2,3,5,10]); (* [5] *) fun intersection([],L2) = [] | intersection(L1,[]) = [] | intersection(X::Xs,L2) = if member(X,L2) then X::intersection(Xs,L2) else intersection(Xs,L2); intersection([1,5,7,9],[2,3,5,10]); (* [5] *) fun subset([],L2) = true | subset(L1,[]) = if(L1=[]) then true else false | subset(X::Xs,L2) = if member(X,L2) then subset(Xs,L2) else false; subset([1,5,7,9],[2,3,5,10]); (* false *) subset([5],[2,3,5,10]); (* true *) fun minus([],L2) = [] | minus(L1,[]) = L1 | minus(X::Xs,L2) = if member(X,L2) then minus(Xs,L2) else X::minus(Xs,L2); minus([1,5,7,9],[2,3,5,10]); (* [1,7,9] *) fun product_one(X, []) = [] | product_one(X, Y::Ys) = (X, Y)::product_one(X, Ys); product_one(1, [2, 3]); (* [(1,2), (1,3)] *) fun product([], L2) = [] | product(X::Xs, L2) = union(product_one(X, L2), product(Xs, L2)); product([1, 5, 7, 9], [2, 3, 5, 10]); (* [(1,2), (1,3), (1,5), (1,10), (5,2), (5,3), (5,5), (5,10), (7,2), (7,3), ... ] *) fun insert_all(E,L) = if L=[] then [] else (E::hd(L)) :: insert_all(E,tl(L)); insert_all(1,[[],[2],[3],[2,3]]); fun powerSet(L) = if L=[] then [[]] else powerSet(tl(L)) @ insert_all(hd(L),powerSet(tl(L))); powerSet([]); powerSet([1,2,3]); powerSet([2,3]); Records - Records are structured data types of heterogeneous elements that are labeled - \{x=2, \ y=3\}; - The order does not matter: - \{make="Toyota", \ model="Corolla", \ year=2017, \ color="silver"\} = \{model="Corolla", \ make="Toyota", \ color="silver", \ year=2017\}; val it = true : bool - fun full_name{first:string, last:string, age:int, balance:real}:string = first ^ " " ^ last; (* ^ is the string concatenation operator *) val full_name=fn:{age:int, balance:real, first:string, last:string} -> string User defined data types - datatype shape = Rectangle of real*real | Circle of real | Line of (real*real)list; datatype shape = Circle of real | Line of (real * real) list | Rectangle of real * real Higher-Order Functions - In functional programming languages functions can be used in definitions of other, so-called higher-order, functions. - The following function, map, applies its first argument (a function) to all elements in its second argument (a list of suitable type): ``` fun map(f,L) = if (L=[])) then [] else f(hd(L))::(map(f,tl(L))); val map = fn : (''a -> 'b) * ''a list -> 'b list ``` - We may apply map with any function as argument: ``` fun square(x) = (x:int)*x; val square = fn : int -> int - map(square,[2,3,4]); val it = [4,9,16] : int list ``` Higher-Order Functions - More map examples - Anonymous functions: - `map(fn x=>x+1, [1,2,3,4,5]);` ``` val it = [2,3,4,5,6] : int list ``` - `fun incr(list) = map (fn x=>x+1, list);` ``` val incr = fn : int list -> int list ``` - `incr[1,2,3,4,5];` ``` val it = [2,3,4,5,6] : int list ``` McCarthy's 91 function: - **fun mc91(n) = if n>100 then n-10 else mc91(mc91(n+11));** - **val mc91 = fn : int -> int** - **map mc91 [101, 100, 99, 98, 97, 96];** - **val it = [91,91,91,91,91,91] : int list** Filter - Filter: keep in a list only the values that satisfy some logical condition/boolean function - fun filter(f, l) = if l=[] then [] else if f(hd l) then (hd l)::(filter (f, tl l)) else filter(f, tl l); val filter = fn : ('a -> bool) * 'a list -> 'a list - filter((fn x => x>0), [~1,0,1]); val it = [1] : int list Permutations - fun myInterleave(x,[]) = [[x]] | myInterleave(x,h::t) = | (x::h::t)::(map((fn l => h::l), myInterleave(x,t))); - myInterleave(1,[]); val it = [[[1]] : int list list - myInterleave(1,[2]); val it = [[[1,2],[2,1]] : int list list - myInterleave(1,[2,3]); val it = [[[1,2,3],[2,1,3],[2,3,1]] : int list list Permutations - fun appendAll(nil) = nil | appendAll(z::zs) = z @ (appendAll(zs)); - appendAll([[1,2],[2,1]]); val it = [[[1,2],[2,1]]] : int list list - fun permute(nil) = [[]] | permute(h::t) = appendAll( map((fn l => myInterleave(h,l)), permute(t))); - permute([1,2,3]); val it = [[[1,2,3],[2,1,3],[2,3,1],[1,3,2],[3,1,2],[3,2,1]] : int list list Currying - fun f(a)(b)(c) = a+b+c; val f = fn : int -> int -> int -> int OR - fun f a b c = a+b+c; - val incl1 = f(1); val incl1 = fn : int -> int -> int - val incl12 = incl1(2); val incl12 = fn : int -> int - incl12(3); val it = 6 : int Composition - Composition is another example of a higher-order function: \[ \text{fun comp}(f, g)(x) = f(g(x)) \] \[ \begin{align*} \text{val comp} &= \text{fn : ('a -> 'b) * ('c -> 'a) -> 'c -> 'b} \\ \text{val f} &= \text{comp(Math.sin, Math.cos)}; \\ \text{val f} &= \text{fn : real -> real} \\ \text{SAME WITH:} \\ \text{val g} &= \text{Math.sin \circ Math.cos}; \\ (* \text{Composition "o" is predefined} *) \\ \text{val g} &= \text{fn : real -> real} \\ \text{val it} &= 0.824270418114 : \text{real} \\ \text{val it} &= 0.824270418114 : \text{real} \end{align*} \] Mutually recursive function definitions - fun odd(n) = if n=0 then false else even(n-1) and even(n) = if n=0 then true else odd(n-1); val odd = fn : int -> bool val even = fn : int -> bool - even(1); val it = false : bool - odd(1); val it = true : bool We next design a function for sorting a list of integers: The function is recursive and based on a method known as Merge-Sort. To sort a list L: - first split L into two disjoint sublists (of about equal size), - then (recursively) sort the sublists, and - finally merge the (now sorted) sublists. This recursive method is known as **Merge-Sort**. It requires suitable functions for - splitting a list into two sublists \( \text{AND} \) - merging two sorted lists into one sorted list We split a list by applying two functions, take and skip, which extract alternate elements; respectively, the elements at odd-numbered positions and the elements at even-numbered positions (if any). The definitions of the two functions mutually depend on each other, and hence provide an example of mutual recursion, as indicated by the SML-keyword and: ```sml - fun take(L) = if L = nil then nil else hd(L)::skip(tl(L)) and skip(L) = if L=nil then nil else take(tl(L)); val take = fn : ''a list -> ''a list val skip = fn : ''a list -> ''a list - take[1,2,3]; val it = [1,3] : int list - skip[1,2,3]; val it = [2] : int list ``` (c) Paul Fodor (CS Stony Brook) Merging - Merge pattern definition: \[ \begin{align*} &\text{fun merge([],M) = M} \\ &\quad | \text{merge(L,[]) = L} \\ &\quad | \text{merge(x::xl,y::yl) =} \\ &\quad \quad \begin{cases} x\text{:<int)} < y & \text{then x::merge(xl,y::yl)} \\ \text{else} & y::merge(x::xl,yl); \end{cases} \end{align*} \] val merge = fn : int list * int list \to int list - merge([1,5,7,9],[2,3,5,5,10]); val it = [1,2,3,5,5,5,7,9,10] : int list - merge([],[1,2]); val it = [1,2] : int list - merge([1,2],[]); val it = [1,2] : int list - fun sort(L) = if L=[] then [] else merge(sort(take(L)),sort(skip(L))); val sort = fn : int list -> int list fun tartan_column(i,j,n) = if j=n+1 then "\n" else if (i+j) mod 2=1 then concat(["* ",tartan_column(i,j+1,n)]) else concat(["+ ",tartan_column(i,j+1,n)]); fun tartan_row(i,n) = if i=n+1 then "" else concat([tartan_column(i,1,n), tartan_row(i+1,n)]); fun tartan(n) = tartan_row(1,n); print(tartan(30)); string and char - "a"; val it = "a" : string - #"a"; val it = #"a" : char - explode("ab"); val it = [#"a",#"b"] : char list - implode([#"a",#"b"]); val it = "ab" : string - "abc" ^ "def" = "abcdef"; val it = true : bool - size ("abcd"); val it = 4 : int string and char - String.sub("abcde",2); val it = #"c" : char - substring("abcdefgij",3,4); val it = "defg" : string - concat ["AB"," ","CD"]; val it = "AB CD" : string - str(#"x"); val it = "x" : string
{"Source-Url": "http://www3.cs.stonybrook.edu/~pfodor/courses/CSE307/L01_SML.pdf", "len_cl100k_base": 6928, "olmocr-version": "0.1.53", "pdf-total-pages": 56, "total-fallback-pages": 0, "total-input-tokens": 83645, "total-output-tokens": 9521, "length": "2e12", "weborganizer": {"__label__adult": 0.0003895759582519531, "__label__art_design": 0.0004723072052001953, "__label__crime_law": 0.00037932395935058594, "__label__education_jobs": 0.006496429443359375, "__label__entertainment": 0.0001112222671508789, "__label__fashion_beauty": 0.0001742839813232422, "__label__finance_business": 0.0001984834671020508, "__label__food_dining": 0.0006127357482910156, "__label__games": 0.0008740425109863281, "__label__hardware": 0.0009279251098632812, "__label__health": 0.0006661415100097656, "__label__history": 0.00028014183044433594, "__label__home_hobbies": 0.000171661376953125, "__label__industrial": 0.000621795654296875, "__label__literature": 0.0004193782806396485, "__label__politics": 0.0002999305725097656, "__label__religion": 0.0005946159362792969, "__label__science_tech": 0.031494140625, "__label__social_life": 0.00017499923706054688, "__label__software": 0.006092071533203125, "__label__software_dev": 0.947265625, "__label__sports_fitness": 0.00040030479431152344, "__label__transportation": 0.0005698204040527344, "__label__travel": 0.0002448558807373047}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 20404, 0.04447]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 20404, 0.9445]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 20404, 0.63579]], "google_gemma-3-12b-it_contains_pii": [[0, 111, false], [111, 830, null], [830, 1075, null], [1075, 1225, null], [1225, 1519, null], [1519, 1910, null], [1910, 2228, null], [2228, 2672, null], [2672, 2886, null], [2886, 3389, null], [3389, 3981, null], [3981, 4134, null], [4134, 4785, null], [4785, 5072, null], [5072, 5282, null], [5282, 5712, null], [5712, 6417, null], [6417, 6893, null], [6893, 7107, null], [7107, 7500, null], [7500, 8022, null], [8022, 8374, null], [8374, 8866, null], [8866, 9144, null], [9144, 9612, null], [9612, 9812, null], [9812, 10204, null], [10204, 10567, null], [10567, 11450, null], [11450, 11722, null], [11722, 11998, null], [11998, 12230, null], [12230, 12426, null], [12426, 12632, null], [12632, 12870, null], [12870, 13045, null], [13045, 13421, null], [13421, 13692, null], [13692, 14228, null], [14228, 14438, null], [14438, 15034, null], [15034, 15367, null], [15367, 15577, null], [15577, 15911, null], [15911, 16241, null], [16241, 16602, null], [16602, 16844, null], [16844, 17444, null], [17444, 17710, null], [17710, 18201, null], [18201, 18934, null], [18934, 19493, null], [19493, 19608, null], [19608, 19930, null], [19930, 20190, null], [20190, 20404, null]], "google_gemma-3-12b-it_is_public_document": [[0, 111, true], [111, 830, null], [830, 1075, null], [1075, 1225, null], [1225, 1519, null], [1519, 1910, null], [1910, 2228, null], [2228, 2672, null], [2672, 2886, null], [2886, 3389, null], [3389, 3981, null], [3981, 4134, null], [4134, 4785, null], [4785, 5072, null], [5072, 5282, null], [5282, 5712, null], [5712, 6417, null], [6417, 6893, null], [6893, 7107, null], [7107, 7500, null], [7500, 8022, null], [8022, 8374, null], [8374, 8866, null], [8866, 9144, null], [9144, 9612, null], [9612, 9812, null], [9812, 10204, null], [10204, 10567, null], [10567, 11450, null], [11450, 11722, null], [11722, 11998, null], [11998, 12230, null], [12230, 12426, null], [12426, 12632, null], [12632, 12870, null], [12870, 13045, null], [13045, 13421, null], [13421, 13692, null], [13692, 14228, null], [14228, 14438, null], [14438, 15034, null], [15034, 15367, null], [15367, 15577, null], [15577, 15911, null], [15911, 16241, null], [16241, 16602, null], [16602, 16844, null], [16844, 17444, null], [17444, 17710, null], [17710, 18201, null], [18201, 18934, null], [18934, 19493, null], [19493, 19608, null], [19608, 19930, null], [19930, 20190, null], [20190, 20404, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 20404, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 20404, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 20404, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 20404, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 20404, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 20404, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 20404, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 20404, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 20404, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 20404, null]], "pdf_page_numbers": [[0, 111, 1], [111, 830, 2], [830, 1075, 3], [1075, 1225, 4], [1225, 1519, 5], [1519, 1910, 6], [1910, 2228, 7], [2228, 2672, 8], [2672, 2886, 9], [2886, 3389, 10], [3389, 3981, 11], [3981, 4134, 12], [4134, 4785, 13], [4785, 5072, 14], [5072, 5282, 15], [5282, 5712, 16], [5712, 6417, 17], [6417, 6893, 18], [6893, 7107, 19], [7107, 7500, 20], [7500, 8022, 21], [8022, 8374, 22], [8374, 8866, 23], [8866, 9144, 24], [9144, 9612, 25], [9612, 9812, 26], [9812, 10204, 27], [10204, 10567, 28], [10567, 11450, 29], [11450, 11722, 30], [11722, 11998, 31], [11998, 12230, 32], [12230, 12426, 33], [12426, 12632, 34], [12632, 12870, 35], [12870, 13045, 36], [13045, 13421, 37], [13421, 13692, 38], [13692, 14228, 39], [14228, 14438, 40], [14438, 15034, 41], [15034, 15367, 42], [15367, 15577, 43], [15577, 15911, 44], [15911, 16241, 45], [16241, 16602, 46], [16602, 16844, 47], [16844, 17444, 48], [17444, 17710, 49], [17710, 18201, 50], [18201, 18934, 51], [18934, 19493, 52], [19493, 19608, 53], [19608, 19930, 54], [19930, 20190, 55], [20190, 20404, 56]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 20404, 0.0]]}
olmocr_science_pdfs
2024-12-09
2024-12-09
e709435533da3df49b9ba496def6ed194b8c9f7d
A Pattern-based Framework to Address Abstraction, Reuse, and Cross-domain Aspects in Domain Specific Visual Languages David Oglesby, Kirk Schloegel, Devesh Bhatt, Eric Engstrom Honeywell Laboratories 3660 Technology Drive, Minneapolis, MN 55418 August 19, 2001 Abstract The history of software development has shown a trend towards higher levels of abstraction, code reuse and automatic code generation. This trend has continued with the development of Domain Specific Visual Languages (DSVL). We have developed a framework for the creation, use, and management of Patterns for DSVL environments that supports high levels of abstraction and high degrees of reuse and code generation, as well as multi-domain aspect modeling. We describe the power, flexibility, and use of these patterns and give an example of an implementation of a real-world design pattern under this framework. 1 Introduction The history of software development has shown a trend towards higher levels of abstraction. Each level allows the developer to focus more directly on solving the problem at hand rather than implementation details. As software developers target more complex problems, it is important to provide better tools that support increasing levels of abstraction. Domain Specific Visual Languages (DSVLs) represent the developers’ concerns at a different (usually higher) level of abstraction using concepts from the developers’ own domains rather than modeling strictly in terms of software entities (e.g., UML modeling). Automatic code generators then translate domain-specific designs to the software domain. This approach has been demonstrated to be more efficient with respect to development time than designing directly with software entities [5]. Unfortunately, DSVLs are difficult and costly to build, usually requiring their own significant development effort. In addition, each domain supported by a tool is specific to a certain type of problem; thus each tool has a limited market. Metamodeling tools reduce the cost of creating domain specific tools by allowing a user to specify the syntax and semantics of a language in the form of a metamodel and by creating the supporting tools automatically. Thus metamodeling tools lower the barriers to developing domain specific tools by significantly reducing the time and cost involved in their development and modification. However, our experience with DSVLs and metamodeling tools suggests three areas for improvement. 1. DSVL environments (e.g. metamodeling tools) should support even higher levels of abstraction by providing a domain-independent capability to compose arbitrary high-level constructs within the domain-specific models from the low-level components. For example, the UML does not itself support hierarchical abstraction. However, we would like to be able to use hierarchical composition within UML models. Such hierarchical models could then be flattened into valid UML models prior to any UML-specific use. 2. DSVLs should support greater degrees of reuse within domains. Among existing metamodeling tools, Vanderbilt’s GME supports metamodel reuse [4], and DOME’s [7] archetypes support reuse within a model (see Section 1.2.1); but none of the metamodeling packages provide much support for reuse of model elements within and throughout modeling domains. 3. DSVL environments should provide support for modeling cross-domain aspects. Complex systems span multiple modeling domains and can contain crosscutting aspects. For example, embedded systems include software entities that consume a certain number of floating-point operations per call and hardware entities that provide a certain number of floating-point operations per second. Modeling this aspect (floating point operations) across both domains is necessary to analyze a system to ensure that the hardware can provide enough power for the software to meet performance requirements. We also discuss cross-domain modeling issues in depth in [6]. 1.1 Patterns Provide a Mechanism for Abstraction, Reuse, and Multiple-Domain Compositions We have developed a framework for the creation, use, and management of patterns for DSVL environments that addresses all of the challenges listed above. Patterns are defined in [2] as “solutions to problems in a context.” Typical object-oriented patterns prescribe a class structure for solving recurring problems in the software domain. It is left to the developer to create the appropriate corresponding classes for his or her implementation. We are working to implement patterns as first-class objects in arbitrary modeling environments. This will allow developers to easily build up models by simply dropping existing parameterized patterns into domain-specific models and by creating new patterns to be used in other models. Automatic code generation will create the appropriate classes for the developer. The higher level of abstraction that our pattern-support framework provides comes from the hierarchical composition of domain model elements and/or patterns. A pattern is a node on a graph that has internal details with which the user need not be concerned. Each pattern has one or more implementations, which are sets of one or more subdiagrams. A subdiagram is a hierarchical construct that allows the representation of a complicated portion of a graph as a simple node or arc. This node or arc then acts as a placeholder, simplifying the graph for the user who may choose to view the subdiagram at his or her leisure. Each pattern instance uses only one implementation that is selected via parameters on the pattern. Patterns also support domain-level reuse. A given pattern may be applied to multiple models within a domain (some can be applied in multiple domains as well). Instances of patterns may share one implementation, so changes to the implementation will affect all of those instances. In addition, since patterns can be included in the implementation of other patterns, it is easy to create new patterns by extending existing ones. Patterns can model cross-domain aspects by defining multiple subdiagrams from different domains. Pattern instances sharing an implementation allow for aspect weaving. This provides a single point of concern for the aspect being modeled. 1.2 PREVIOUS WORK In this section, we describe the previous work done in support of the challenge areas enumerated above. 1.2.1 DOME Support for DSVLs and Reuse The Domain Modeling Environment [7] (DOME) from Honeywell Laboratories is a metamodeling tool for designing and using domain specific visual languages. Its specification language is graphical—using nodes and edges—and is supported by a special metamodeling editor. Once a visual syntax has been specified, DOME can interpret the specification on the fly. In this respect it is a metamodeling environment (hence the name). This makes it uniquely suited to cross-domain modeling because all models run within the DOME environment making it possible to regulate cross-model interactions. DOME formalizes support for reuse with its **archetype** and **shelf** concepts. Archetypes support reuse of common structures or templates within any domain-specific visualization. The shelf provides access to the collections of available archetypes. It is a specialized model browser that provides a view of design graphs in terms of component archetypes. Archetypes are automatically created and managed by the component shelf, and archetypes can be reused by cloning instances of them into graphs from the shelf. The component shelf also automatically maintains traceability from archetypes to instances. The shelf and archetype features are the basis for our new expanded and generalized pattern-support tool. DOME supports code generation and document generation libraries, accessed through its macro language, Alter. These simplify the task of generating deliverable artifacts directly from the model. This approach has the added benefit of increasing consistency throughout the product configuration. While DOME’s archetypes provide a convenient starting point, they fall short of patterns in several respects. They are specific to a model, so an archetype cannot be applied to different models even if they are in the same domain. Furthermore, they cannot be arbi trarily parameterized to support context-sensitive design details. Similarly DOME’s code generation capabilities will have to be extended. Currently, code generation is specific to a single modeling domain, but patterns will introduce cross-domain issues. 1.2.2 Pattern Modeling in the UML Two UML concepts support pattern modeling: mechanisms, and frameworks [1]. A mechanism is a way to specify design patterns. It is a collaboration among classes that describes both structure (class diagram) and behavior (sequence diagram). A collaboration can be parameterized by the use of template classes as parameters. When a parameterized collaboration is instantiated, specific application classes in the instantiation context can be bound to the specific parameters of the collaboration. Thus, a collaboration can be used to specify additional relationships among application classes. This is also a severe limitation since only simple import-type bindings to classes are supported. Furthermore, inheritance from higher-level abstract classes and other properties of the application classes are often assumed in the collaboration class diagram but not explicitly specified. A framework is just a collection of collaborations, without any additional structural attributes. The limited pattern specification capabilities in the UML allow the capture and automated instantiation of only simple design patterns. Our work presented in this paper overcomes many of these limitations. In particular, support is provided for capturing multiple domains of the design (e.g. class diagrams, data flow, hardware diagrams) in a single pattern. A pattern can be instantiated in different models and behaves according to the syntax and semantics of that model. Different types of entities inside a pattern can be parameterized and attached to pattern portals for different types of bindings in the instantiation context. Both import and export types of bindings are supported. Hence, a pattern can supply parameterized information to complete the instantiation context, and conversely, the instantiation context can supply parameterized information to complete the internal structure of a pattern. This allows for the specification of complex patterns that encompass multiple aspects of software structure and control/data flow. 1.2.3 Template based parameterization in SAGE The Systems and Applications Genesis Environment (SAGE) tool set [3] provides support for the development of parameterized templates as well as a shelf where these templates can be archived for instantiation in application models. These are extensions of the archetypes and shelf from DOME as described in section 1.2.1. Templates provide two capabilities: (i) the capture of function blocks, their ports and data-striping; and (ii) the hierarchical composition of function blocks. While templates are not powerful enough to allow the capture of arbitrary patterns, they do provide some capabilities desirable in a DSVL. These include (i) alternate structures and code-generation schemes within a template, (ii) the addition of constraints and semantics, and (iii) the automated customization of the instantiation user interface based upon template properties. The SAGE capabilities, although implemented as special cases, give us a flavor of some important features needed in DSVLs as well as the need for underlying generalized mechanisms for implementing such features. 2 Pattern Support A number of issues have to be addressed to support powerful and flexible pattern usage. Patterns need to be connected to model entities by arcs defined within the modeling domain. They need to allow for flexible connection types so users can specify the appropriate connection for a given instance of the pattern. Pattern instances need to be tailored to their contexts. Finally, patterns need to support code generation in conjunction with both the code generators of the models in which they are instantiated and the particular details of their implementations. In this section, we describe our scheme for addressing these issues. 2.1 Portals Semantically, connections to a pattern complete a connection to one or more elements within the pattern. Consider a UML class diagram as an example. Connecting a class to a pattern using a generalization arc has no meaning within the UML domain. Instead, the generalization arc should continue through the pattern edge to a valid entity within the pattern. To make such connections clear, we introduce the notion of portals. The portal is something of a window into the pattern's implementation, allowing arcs to be connected across pattern edges. It also ensures that these connections are made to only those types of objects the pattern designer has specified. Through portals, a user completes an instantiation of a pattern or completes the instantiation of a model with elements from within the pattern. In a pattern design, a developer can connect a portal to any entity in any domain by any arc type defined in that domain. A portal on a pattern instance, on the other hand, can be connected only by the kinds of arcs in the directions specified in the pattern design (except for the be arc described below). Arcs connecting to one side of a portal should have a corresponding connection on the other side that completes the connection. When the pattern is flattened, the portal is replaced by an arc from the origin node (on one side of the portal) to the destination node (on its other side). 2.2 Be Arc Some pattern designs may involve multiple arcs connected to either or both sides of a portal. Such a state can lead to difficulty in interpreting composed models and/or constructing flattened diagrams when multiple arcs of different types or directions are connected to one side of a portal. The rules that govern the connection of arcs to portals indicate that if \(n\) nodes are connected (by \(n\) arcs) to one side of a portal and \(m\) nodes are connected to its other side (by \(m\) arcs), then the flattened diagram will contain \(nm\) arcs between the \(n+m\) nodes. Each node will be attached to all of the others from the other side of the portal. For example, Figure 1(a) shows a case with three UML classes on one side and two classes on the other. The flattened UML class diagram is shown in Figure 1(b). In this example, all of the arcs are of the same type and direction. If multiple arcs that are not of the same type and direction connect to a portal, then no normal connection can be made to its other side such that the flattened diagram contains $nm$ arcs. Figure 2 illustrates this problem. Here, three arcs of different type and direction are connected to one side of a portal. Any one arc can be connected between either D or E and the right side of the portal. However, the resulting flattened diagram will include unmatched arcs. Hence the semantic meaning of the pattern will be lost. In order to address this problem, we have defined a special arc that is usable in any modeling domain to connect nodes to portals. We refer to this as the *be* arc\(^1\). The *be* arc can be thought of as a wildcard arc. In the flattened diagram, *be* arcs are replaced by every arc that connects to the other side of the portal. Hence, flattened diagrams never contain the *be* arc, and so only contain domain-specific arc and node entities (see Figure 3). ![Diagram](image) **Figure 3:** Using the *be* arc to connect multiple types of connectors in different directions through a portal. The *be* arc can also be used within a pattern as a kind of an *export arc*. This is because the use of the *be* arc gives the semantic appearance that the portal is equivalent to the entity to which it is connected. Therefore the user is allowed to connect to the portal in whatever manner makes sense for that application. The reverse situation is also true whenever the *be* arc is attached to the outside of a pattern. Here, the appearance is that information propagates into of the pattern. Also, using the *be* arc outside of a pattern allows a user to connect to the pattern with less concern for the details of its implementation. When *be* arcs attach to both sides of a portal, the nodes on either side are considered to be the equivalent. This feature is especially useful for specifying a pattern inside another pattern from the outside of it (see section 3 Examples). \(^1\) The *be* arc got its name because it indicates that the portal should appear to be the object to which it is connected. 2.3 Parameters Some pattern implementations may be dependent upon certain instance-specific details. Consider the watchdog communication pattern (see Figure 4). In this pattern, communications are monitored. If an error occurs, the watchdog thread puts the system into a safe state. This pattern is flexible to a degree in that the communication may occur over TCP or UDP. We would like to be able to support such flexibility. Therefore, we allow patterns to have user-defined properties. These are used to select among optional implementation details. In the watchdog pattern, the code generator can select among communication protocols based on a quality-of-service property (for example, the maximum communication error rate) specified on the pattern. Portals can have parameters also. These parameters can be propagated across and even between patterns. For example, a portal may have a periodicity attached to it. This value could propagate through the pattern to the entities connected to it through a corresponding output portal. The property could follow a chain of portals in order to complete the instantiation of a model (see Figure 5). 2.4 **Multiple Implementations** Many patterns have a number of different implementations. Logically, a pattern has one specific meaning, but its implementations may vary depending on the circumstances of its use. While parameters allow for adaptations to an implementation of a pattern (such as TCP versus UDP), multiple implementations accommodate fundamentally different implementation approaches. For example, a pattern may be implemented differently on different kinds of middleware or a “notification” pattern can use two implementations to allow for lazy or eager evaluation. These differences need to be captured for code generation and system analysis. The context in which a pattern is used may change the implementation significantly, but not the logical use of the pattern. Implementations can be selected on a pattern instance via parameters. 2.5 **Pattern Interaction** An important aspect of patterns is the ability to combine them. Many of the examples in [2] show how one pattern can be used to help implement another. Similarly, our patterns can both be embedded in other patterns and connected at the portals. While the ability to tie pattern instances together can be powerful, it is important to consider the side effects that might occur since the user may not see the underlying implementation. In general, patterns are self-contained with objects interacting only through portals. This encapsulation simplifies pattern interaction. However, portal parameter propagation across patterns needs to be considered. 2.6 **Code Generation** Automatic code generators are extremely important components of graphical modeling tool sets. Current state-of-the-art generators typically utilize code generation *templates* that are executed (or interpreted) to build up generated code. Such templates consist of (i) text that is copied directly into the generated code, (ii) special purpose subroutine calls that output text into the generated code, (iii) template-file include statements that can be used like subroutine calls, and (iv) comment text that is ignored by the code generators. As an example, consider the following two templates. The first is the top-level template for generating C++ header files given UML class diagrams. It contains a comment section (bold) followed by straight text to be copied directly into the generated code. It ends with a template include statement (italics). This template include statement directs the code generator to load and execute the template named `classDeclarationTemplate`. The purpose of this utility template is to write out individual class declarations given a specific UML model. It contains a comment section followed by template subroutine calls (underlined) interspersed with straight text. It is our position that such code generation templates should be encapsulated within patterns. This approach has a number of advantages. - Such encapsulation is beneficial from a software-engineering standpoint as code generation details for a pattern are hidden within it. Typically, the pattern developer will take care of the code generation details associated with the specific pattern during its design. - Encapsulation explicitly links templates to model entities. This removes the requirement that top-level templates contain hard-coded knowledge of every possible utility template. Instead, the model is simply traversed, and as each pattern is encountered, its template is executed. - Encapsulation allows for the dynamic resolution of multiple pattern implementations during code generation. Managing complexity is a key issue for the design of code generation tools. This is because the complexity of the model increases with the richness and flexibility of the desired level of code generation. That is, if you want to generate code for many different attributes of a system, then all of these attributes must be modeled. Our framework lets the user control the internal pattern complexity by allowing for multiple implementations of a single pattern as well as multiple instances and types of subdiagrams within various implementations. In their most basic form, patterns can be used as simply as other first-class modeling entities to build up complex models. On the other hand, they can allow for arbitrary amounts of additional specification (by means of multiple implementations and subdiagrams) in order to support rich code generation. However, even with multiple implementations and subdiagrams built from diverse modeling domains, pattern interfaces remain simple and straightforward to use. As such, patterns give us nice, small, easily understood, compact units of composition that can specify arbitrarily complex, multi-attribute, and hierarchical structures to maximize code generation while also managing complexity. 3 Examples The three patterns below cooperate to implement the Composite pattern described in [2]. The Composite pattern allows a client to treat groups of components as individual components, presenting a single interface to the client. The essential structure of the pattern is shown in figure 6(a). The Component inherits from another class that is outside the pattern. This external class is an abstract class that is specific to a context and specifies the operations that the components must implement. The Composite class contains another pattern, MethodImpl. This pattern may expand to any number of methods, and expects to be supplied with method implementations. This use of the MethodImpl pattern allows the Composite pattern to compose components with an arbitrary number of methods. It also allows for different kinds of reductions across the corresponding child methods. Consider the instance in figure 6(b). In this example, the Draw() operation on the composite can simply iterate over all children and call Draw() on each of them. However, if the components provided a getSize() operation, then the composite operation would need to calculate its size based on the sizes of its children. Hence it would not only need to call the operation on all children, but also accumulate their return values. (This would require a slightly different implementation of the SimpleIteration pattern than the first case.) The MethodImpl pattern combined with the portal to which it connects allow us the flexibility to specify an arbitrary number of operations with multiple types of iteration or reduction across the children while still supporting rich code generation. The SimpleIteration pattern shown in figure 6(b) is an example of a pattern that takes one or more operations as input and generates the corresponding composition operations according to some rule. For example, iterate over all children and call the operation on each child. This pattern exports one operation for every imported operation. Conclusion There are synergies between domain specific visualizations and patterns that have not been fully exploited. DSVLs help insulate the developer from implementation concerns outside the scope of the problem in the same way third-generation languages hide the details of register allocation. Their domain-specific nature makes them powerful because they are specialized and easy to learn and use because they work with concepts that are familiar to experts within the domain. Patterns provide developers with a library of solutions to common problems. They are powerful because they are flexible and well-designed solutions that have been proven through multiple applications. They also comprise a language among developers that make designs easier to understand. Our pattern framework allows for patterns in and across diverse modeling domains. These patterns insulate developers from their implementations and behave according to the syntax and semantics of the domain in which they are applied. They also provide reuse through pattern composition, cross-domain aspect modeling, and support for powerful code generation. Figure 6: The internal details of the Composite pattern (on the left) and an example of external connectivity to it (on the right). As we delve further into the implementation of the pattern framework, we will need to address the issue of consistency checking. For example, the be arc can be used to connect a portal with any model entity or another portal. However, this flexibility can lead to incorrect and/or inconsistent models. For example, if the entity is a UML object in a class diagram, the syntax of the model does not allow the object to connect to anything via any arc type. Also, two portals connected via a be arc require arcs of the same type in opposite directions (into one portal and out of the other) on their other sides. This problem requires that a consistency check be performed before any flattening operation. Since flattening will proceed any analysis or code generation, inconsistent models will be avoided during these phases. 2 E. Gamma, R. Helm, R. Johnson, J. Vlissides, *Design Patterns: Elements of Reusable Object-Oriented Software*, Addison-Wesley, 1995. 7 DOME is an open source research project and is available from [http://www.htc.honeywell.com/dome](http://www.htc.honeywell.com/dome).
{"Source-Url": "http://w3.isis.vanderbilt.edu/OOPSLA2K1/Papers/Oglesby.pdf", "len_cl100k_base": 5116, "olmocr-version": "0.1.53", "pdf-total-pages": 13, "total-fallback-pages": 0, "total-input-tokens": 25902, "total-output-tokens": 5830, "length": "2e12", "weborganizer": {"__label__adult": 0.00029206275939941406, "__label__art_design": 0.00030422210693359375, "__label__crime_law": 0.00023925304412841797, "__label__education_jobs": 0.0004322528839111328, "__label__entertainment": 3.8743019104003906e-05, "__label__fashion_beauty": 0.00011491775512695312, "__label__finance_business": 0.00013899803161621094, "__label__food_dining": 0.0002598762512207031, "__label__games": 0.0002903938293457031, "__label__hardware": 0.0005426406860351562, "__label__health": 0.0002884864807128906, "__label__history": 0.00015783309936523438, "__label__home_hobbies": 6.270408630371094e-05, "__label__industrial": 0.00028061866760253906, "__label__literature": 0.00015425682067871094, "__label__politics": 0.0002014636993408203, "__label__religion": 0.0003497600555419922, "__label__science_tech": 0.0040283203125, "__label__social_life": 6.121397018432617e-05, "__label__software": 0.0034656524658203125, "__label__software_dev": 0.9873046875, "__label__sports_fitness": 0.0002582073211669922, "__label__transportation": 0.00039505958557128906, "__label__travel": 0.0001766681671142578}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27803, 0.02871]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27803, 0.64667]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27803, 0.9029]], "google_gemma-3-12b-it_contains_pii": [[0, 2275, false], [2275, 5408, null], [5408, 8295, null], [8295, 11729, null], [11729, 14629, null], [14629, 15172, null], [15172, 16827, null], [16827, 17977, null], [17977, 20137, null], [20137, 21723, null], [21723, 24809, null], [24809, 26073, null], [26073, 27803, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2275, true], [2275, 5408, null], [5408, 8295, null], [8295, 11729, null], [11729, 14629, null], [14629, 15172, null], [15172, 16827, null], [16827, 17977, null], [17977, 20137, null], [20137, 21723, null], [21723, 24809, null], [24809, 26073, null], [26073, 27803, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 27803, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27803, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27803, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27803, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27803, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27803, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27803, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27803, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27803, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27803, null]], "pdf_page_numbers": [[0, 2275, 1], [2275, 5408, 2], [5408, 8295, 3], [8295, 11729, 4], [11729, 14629, 5], [14629, 15172, 6], [15172, 16827, 7], [16827, 17977, 8], [17977, 20137, 9], [20137, 21723, 10], [21723, 24809, 11], [24809, 26073, 12], [26073, 27803, 13]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27803, 0.0]]}
olmocr_science_pdfs
2024-12-06
2024-12-06
f77b08f826614c6ae99233cdc59eb8bf42be5ada
Exploring Design Principles for Business Model Transformation Tools Dominik Augenstein Karlsruhe Institute of Technology Fritz-Erler-Str. 23, 76133 Karlsruhe dominik.augenstein@kit.edu Alexander Maedche Karlsruhe Institute of Technology Fritz-Erler-Str. 23, 76133 Karlsruhe alexander.maedche@kit.edu Abstract Today's companies have to respond to fast-changing markets and new customer demands to maintain their competitive standing. Therefore, business models must be able to reply flexibly to new requirements and simultaneously their execution must be ensured. However, existing business model concepts and tools are too rigid and often remain on a rather abstract level. We present a research-in-progress design science project with the aim of designing a business model configuration tool enabling higher executability. Based on a comprehensive problem analysis and literature study, we derive a first set of meta-requirements and design principles. Additionally, we demonstrate a first prototypical instantiation and demonstrate its feasibility in a case study. The presented tool enables practitioners and theorists to observe and analyze changes in business models rapidly. Furthermore, impacts of changes can be seen directly through the tools' configuration character. Finally, this research fosters cooperation between different company levels as an imperative capability. Keywords: Business Model, Business Model Canvas, Design Science, Development Tools. Introduction Increasing global competition and new opportunities driven by a growing number of services and digitalization force companies to adapt their business models (BM) to the new environment (Teece 2010). Next to traditional products, services become more and more important in companies' strategies. This is because consumers are more than ever able to compare products and services on the markets. Therefore companies have to rethink their traditional way of doing business (Piccinini et al. 2015). Companies increasingly concentrate on redesigning BMs focusing on digital services (Ostrom et al. 2015). To support business modelling, several methods, techniques and tools exist (Ebel et al. 2016). The most well-known is the BM canvas of Alexander Osterwalder (2004). While BMs become more and more important in different research disciplines like strategic management, entrepreneurship or marketing, there is still a huge potential for research inter alia in the field of information systems and the context of the digital transformation in particular (Pagani 2013; Veit et al. 2014). Having a closer look at the often cited BM canvas of Osterwalder, it becomes obvious that the focus of the concept is rather strategic and less focused on the operationalization of the defined BMs (Osterwalder 2004). However, this is important for a successful transformation of a company, as for example several work in BM innovation states (e.g. Chesbrough 2006). However, a high degree of openness of a BM in a way, that it is considering operational levels is important. This is because a BM transformation can be seen as an unstructured and unplanned management approach as it is caused by an external shock (Chesbrough 2006; Demil, Lecocq 2010; Wirtz 2011). As a result, BM approaches like the BM Canvas have to consider operational elements to be able to find an adequate representation in a short period of time. Therefore, an adequate tool should provide as much information as possible for such a transformation but also only as much information as needed. Thus, different advancements and frameworks of this canvas have been suggested to make the concept more operational (Lindgren, Rasmussen 2013; Ebel et al. 2016). Zott et al. (2011) mention that BM innovation is a key to firm performance and with that, the need of flexibility in BMs rises to support the innovation process. As a result, the knowledge of BM innovation can be used to extinct the current BM concepts from the strategic level to the operational level. This is because in current BM concepts like the BM canvas (Osterwalder, Pigneur 2010) or the BM cube (Lindgren, Rasmussen 2013) rigidity is quite high. These concepts focus mainly on the strategic view of a company (Osterwalder, Pigneur 2013). In sum most of these models provide guidance rather on a higher abstraction level. Besides, information systems research started to link the operational level to the rather strategic BM level and emphasizes the importance of making BMs more operational (Di Valentin et al. 2012; Bonakdar et al. 2013). This implies the chance for practitioners as well as in theory to support a transformation with the existing BM concepts, if a tool is suitable enough to support this transformation (Veit et al. 2014). Having a look at strategy execution research, Richardson (2008) stresses the need of supporting the execution of strategic frameworks. Richardson (2008) further claims, that a BM is neither a strategy nor a table of actions to execute the strategy (see also Morris et al. 2005; Di Valentin et al. 2012). The key question is, how to improve the executability of BMs impacting operational levels in organizations to fulfil the path of strategy to execution (Alt, Zimmermann 2001; Zott et al. 2011). In special, there is a need to develop meta-capabilities to overcome rigidity and explicitly enable innovation via BMs (Doz, Kosonen 2010). To summarize, current BM tools have limitations with regards to operationalization (Alt, Zimmermann 2001; Doz, Kosonen 2010; Zott et al. 2011; Veit et al. 2014). Thus, we focus on the following key research question: *Which design principles of business model transformation tools enable better transformation results of the defined business models as they proposed results closer to the company’s characteristics?* To answer this question, we propose a design science research (DSR) project (Vaishnavi, Kuechler 2004). While existing research mainly focuses on strategic and conceptual aspects in BMs, we want to derive new design principles which contribute to the demanded requirements of executability. From a scientific point of view, we contribute to the design knowledge base for building BM tools. When building BM tools according to our identified principles, practitioners should be able to represent more comprehensive aspects of their daily business, respond faster on internal and external changes and ensure a consequent execution of the defined BM at the same time. The tool itself thereby builds a service for companies, as it helps them to find an adequate BM, which considers individual characteristics and key concepts of a company. The remainder of this paper is as follows: First, we provide an overview of the related work in chapter 2. Second, we describe our research methodology and the planned cycles in the design science research project in chapter 3. Based on the literature, we derive requirements and design principles in chapter 4. In chapter 5, we describe a first version of the proposed artefact instantiation. Finally, we present preliminary results of the qualitative evaluation and provide a short summary and an outlook on future work in chapter 6. **Foundations and Related Work** This section introduces foundational concepts of our work. We present the current tools and the related literature to find adequate principles for our research. **Business Model Representations** Several authors like Gordijn et al. (2000), Petrovic et al. (2001) or Veit et al. (2014) focus on definition of business models. One possible definition of Timmers (1998) defines business models as: “an architecture for the product, service and information flows, including a description of the various business actors and their roles; and a description of the potential benefits for the various actors; and description of the sources of revenue”. In order to increase business models, several scientists found more than twenty BM frameworks with different purposes of use and field of study (Lambert 2010; Wirtz 2011). As common feature, all of these frameworks have six key decision areas (Morris et al. 2005) and 17 evaluation criteria for classification of the BMs (Burkhart et al. 2011). However, the introduction of Osterwalder’s ontology for BMs (Osterwalder As mentioned above, an adequate tool should consider the design principles of operationalization as well as simplicity and transparency. As part of operationalization, the tool should also be able to allow changes in the underlying model, as their need is shown in the following section (Zott, Amit 2010). Business Model Transformation Disruptive changes can affect companies in a way that they have to adapt and change their BMs significantly (Wirtz 2011). Existing approaches try to represent a clear and transparent representation of how a company creates value (Kinder 2002; Akkermans, Gordijn 2003; Kley et al. 2011) and should enable a mediation between strategic and operational levels (Osterwalder et al. 2005; Di Valentin et al. 2012). Beside this, it is shown, that they do not provide the whole potential of support (Ebel et al. 2016). The BM research stream focuses on this challenge by adapting BMs after disruptive situations (Zott, Amit 2007, 2010; Johnson et al. 2008). Analogical to marketing channels, three kinds of flow in BMs are identified: Flow of goods, representing the way of products, ownership and risk; flow of information as well as flow of funds (Berman 1996; Rosenbloom 2012). Regarding partial BMs as part of a superior BM, these three kinds of flow between different partial models cause response relationships of the model and represent their development (Magretta 2002; Wirtz 2011). Regarding the BM canvas, the categories “Key Activities” and “Key Resources” would build partial models, which have interlinks between each other, because the resources are used in the activities or at least addresses the same questions of customer relationship and revenue streams (Osterwalder, Pigneur 2010). The intention in practice as well as in theory is to show the interaction of BM parts and the development of the whole BM, so changes in environment and the related development could be regarded better (Wirtz 2011). In general, after disruptive changes in a company’s environment (e.g. collapse of the “new economy” bubble), a BM innovation is necessary, as Chesbrough (2006), Zott, Amit (2007), Zott, Amit (2010), Johnson et al. (2008) and Gambardella, McGahan (2010) explored in their research. Their work provides approaches for BM innovation and adaption to new situations of companies. The implementation of BM innovation using a transformation tool should be done in a structured management process (Johnson et al. 2008; Zott, Amit 2010). As design elements, they propose information about the flow of goods, information and funds and consider effects of activities in the innovation process (Zott, Amit 2007, 2010). In general, a BM tool should consider the current and target state of a company and should be aligned to the processes of the operational level (Chatterjee 2013; Ebel et al. 2016). We want to tie up here and improve the BM canvas in a way, that it considers more the activities of lower levels and is therefore more adequate in replying on changes. The method we want to use is shown in the following section. **Methodology** Aiming to design BM tools with a higher operationalization, we follow the suggestion of Veit et al. (2014) and apply the Design Science Research approach of Vaishnavi, Kuechler (2004). We consider this approach as a promising possibility to not only understand the factors of increasing operationalization, but also to find an adequate software tool. This software tool should build a service for companies to find their individual target state during a transformation project. Concerning the practical motivation, a more operational model would help companies to break down their strategies more easily and tailor BMs more suitable as mediator between strategy and operational level. For this, we decide to involve companies in our research, which are experts in the field of business modelling. Therefore, we collaborate with consulting company which is interested in using the results of the project. This company has 174,000 employees in more than 155 countries in 2016 and has inter alia great experience in strategy implementation. As such strategy implementation and the related BMs is one of their core competences, the information of the partner is of high quality and with a lot of practical experience. We see this as a key success factor for building a BM tool, which satisfies the demand for operationalization from a theoretical and a practical side. The access to individual usage of the tool in companies enables us to collect data in document analyses and interviews (Benbasat et al. 1987). According to Vaishnavi, Kuechler (2004) we plan our DSR project in three cycles as shown in the following picture. In cycle one we select our business partner because of its’ knowledge of strategy implementation in different companies and the related BMs. At the beginning, we want to analyse the different requirements of a BM concerning flexibility and operationalization through a literature review. Therefore, we did more than ten exploratory interviews with a consulting company, Siemens AG and HSAG about their use of BMs in the digital transformation and their needs. In the interviews, experts with deep knowledge about BM were asked about the limits of the current BM frameworks and general limits of using them in practice. The questions we derive from the limitations of related work (e.g. Sosna et al. 2010; Veit et al. 2014). For example Sosna et al. (2010) mention of resistance of managers is derived in the question: Which features should a BM tool have, that manager will use the software? Besides this, we follow the requirements of a literature review to build a first prototype. Thereby we first have a look at the different existing approaches and how they relate to each other. Additionally, we evaluated the limitations of the approaches. As a result of the interviews and the literature review, we formulated requirements, which will be shown in the following section. To evaluate it, we will do a feasibility test and show, that our mock-up rebuilds a BM of a real business case. As a pre-evaluation, we let 20 students in groups of four people model a BM transformation with BM canvas templates. Afterwards we compare the outcomes with the outcomes of using the tool for this transformation. Using the tool results in at least as good results and measurements than the BM canvas. groups. For a seamless feasibility test, we use the insights from experience reports (e.g. Augenstein et al. 2016). Based on the results of the evaluation of the first cycle, we will realize a first running version of the BM configuration tool and perform a lab based evaluation of the software artefact in the second cycle. Finally, in cycle 3 we will deploy the software in the field in cooperation with our industry partner. The purpose of the field experiment is to evaluate how our tool actually contributes an increase of flexibility and operationalization in real-life. The outcome will be design knowledge about the functions of the tool and their effects. For this, we want to introduce the concepts in the following chapter. Conceptualization Practitioners face several challenges through changing environments. In our interviews, we found out that the use of the BM Canvas is quite common in today’s business. However, it is restricted to some limitations in executability, as we find out through the interview with the consulting company. Existing research addresses such challenges as the formation and adaptation of BMs in different business areas (Veit et al. 2014). In general, it is relatively easy to model the current state and a target state, representing the future situation of the company with the BM canvas (Osterwalder, Pigneur 2010). However, various challenges in the transformation process exist. For example, when mapping the current and target situation, some elements cannot be reused in their context or might be obsolete. As a result, some gaps exist, which force a decision for example to fill the gap e.g. through internal or external capacities (Lindgardt et al. 2009). Focusing on the BM canvas, a mapping seems to be difficult, as the priority lays mainly on the value creation logic (Timmers 1998; Osterwalder 2004). We found out in our interviews, that the view thereby should rather be on increasing the operability of the BM canvas. So business transformations or long-term observations of a company’s BM are possible. Therefore, we target the first requirement: **RQ1. In order to increase the executability, the status quo of a companies' business model(s) should be combinable with the target business model(s).** Mapping the current BM with the target BM is important, because one can see fast, which elements are not mapped and are therefore obsolete (in the “current state”) or need to be added (in the “target state”). Hereby, we understand the “current state” BM as representative of the current operational level of a company as it represents the value creation logic. For us, the “target state” model is representing the goals of a company. As a consequence, mapping the elements means to link the different levels of a company as it is the demand of a BM. Thus it is possible to mediate between these levels and show, how the levels work together (Timmers 1998; Osterwalder 2004; Al-Debei, Avison 2010). After mapping the elements, it should be possible to perform a gap analysis, which shows the need for action to realize the target state. For example, a company can decide between an internal or external resource with different effects on revenue and costs. To find an optimum, we demand the second requirement: **RQ2. In order to increase mediation of different business levels, business model configuration should explicitly show the consequences of different alternatives.** These mentioned requirements should be addressed in our design science project. All in all, the operability should be reflected in the design principles (DP). Related to the operability the first DP is: **DP1. Status quo and target business models should be captured using semantic models to allow different configurations.** As Mylopoulos et al. (1999) stress the importance of semantic data modelling in programming practice, we build on the BM canvas ontology proposed by Osterwalder (Osterwalder 2004; Osterwalder, Pigneur 2004; Osterwalder et al. 2005; Ilayperuma 2007). To enrich the canvas models with additional semantics, we extend the core ontology with further relations between the concepts and enable their instantiation. Entities of our tool are the nine dimensions of the canvas, which are represented as black nodes. Further entities are concrete instances of these concepts, which are visualized as hatched nodes. By doing so we create a conceptual model similar to UML-class diagrams or entity relationship models (Pan 2009) or ontology-based languages such as the Resource Description Framework Schema (RDF-S) (Miller 1998). We also enable instantiation of the conceptual models using the Resource Description Framework (RDF). Instances refer to a concept, connections between instances are shown through arrows between them. Furthermore, we allow for the explicit modelling of key performance indicators (KPIs), and assign them to the concepts of the BM canvas. The semantic models enable a more precise reflection of how a company is doing its business today and in the future. Following this, the different elements (for example common elements) and their categorization as well as other relevant aspects should be reflected (Lindgren, Rasmussen 2013). Additionally, it could be a base for a gap analysis, when mapping the elements of different BMs. Therefore, the current and the target state could be modelled as a semantic graph. The two semantic graphs can then be compared. Thereby, equal notes in both graphs will be detected. One can see fast, where in the target state adaptions have to be done. This leads to the next design principle: **DP2. A mapping between status quo and target business models should be enabled to understand transformation dependencies.** Mapping the different situations enables a better comparison of existing, obsolete and missing elements in different situations. Related to a comparison between a current and a target state, it reveals needs for actions. In particular, a gap analysis could reveal needs for action in arranging the realization of the target state. If different alternatives to realize the model exist, it would be helpful to see the effects of each alternative on the selected KPIs, according to the proposition by Veit et al. (2014). This leads to the design principle: **DP3. Business implications of changes performed within the transformation should be reflected in key performance indicators referring to the corresponding elements.** Through this, changes in the BM can be quickly discovered. For a transformation as well as a long-term observation of BMs it is very helpful but requires that each element is related to at least one KPI, so that the importance of an element can be seen in the model (Wirtz 2011). All in all, these three design principles enable a modelling and an analysis of a business transformation. How it could be done is shown in the following section. **Instantiation** We have instantiated the design principles in a first conceptual prototype (mock up) based on a real-world transformation case. We use the example of the company “Hilti”, which is delivering “high-end” machines for the crafts business. As Hilti wants to change from products to services, they improved their current BM. The company successfully defined the model “fleet management”, where customers can rent machines instead of buying them (Hilti USA 2016). They see the need of the customers not in actually owning a machine, but using them. To make the offer more attractive, further services such as repair and optimization of the tool consumption are delivered. As crafts business is divided into online and offline affine segments, they used the existing channels. This can be seen in the current and target state graphs, where these elements are included in each graph. However, for instance the repair service is not part of their current BM. The graph of the target state thereby includes the node “repair service”, but the current state graph does not. Therefore, this part of the BM has to be created from scratch. An initial model of the situation of Hilti as classical product seller is shown in figure 2. Following our design principle DP1, we suggest to first create a semantic BM canvas of the present (Pre) and a possible target state. We define the traditional BM of manufacturing and selling machines as “Pre-State” and the service-based-fleet model as “Target-State”. Additionally, we model a part of the situation with a semantic model in our current version of the tool. We also connected KPIs with nodes in the graph representing their “values”. By clicking on a KPI, one can see which elements are related to it. One can also set new KPIs and connect them with related nodes, depending on the specific BM. This can be seen in the bottom left window (Fig 2.). The KPIs reflect changes in the model like higher costs for a special key resource. Additionally, the influence on different KPIs can be shown through the size of the nodes. In our figure, we renounce on different sizes, to keep the example easy understandable. The following figure shows the latest status of our tool and a mock-up of planned features. In this figure, an exemplary BM Canvas for the Hilti case is shown on the top-left side. There we show the BM of Hilti as a traditional tool producer. On the bottom left side, we show the comparison of the BM as a tool producer (current state) and the BM of Hilti’s fleet management (target state). For a better overview, we only focus on the categories of customer relationship, customer segments and channels. The right side of the figure shows the latest functions of our tool. Modelling the BM Canvas, arranging the nodes and connecting nodes with KPIs are currently possible. Exemplary, a part of the BM Canvas of Hilti is shown. Following DP2, we allow mapping of the “Pre State” and the “Target State” as shown in the bottom left window. By doing so one can recognize which elements could be covered through the current state of the company. Having a look for example at the websites and the call centre, they exist in the current situation and are part of the target situation. Therefore, these elements can be reused. In this case it means that the crafts business can order via the existing website or hotline. As it can be seen in the “Pre State”, “Agents” are obsolete because in the “Target State” they are no longer part of the model. This is because Hilti focuses in his fleet strategy only on the online and the phone channels. The “Agents” channel will not be kept in the new strategy of Hilti. Furthermore, in the “Target State” the node “Repairers” is shown, because Hilti wants to offer a repair service in its’ strategy. In the “Pre State” this node is not included, because repairers are not part of the product-focused BM. As a result, “Repairers” is set as square because there is no equivalent in the “Pre state”. In the analysis part (DP3) on the bottom left side, the set of KPIs is shown and their current value. To support a decision, one can try out different alternatives and see the impact of the changes. In our example one can think of internal or external repair teams. Comparable to a configurator, the tool yields direct feedback through the belonging KPIs. One can then decide for the configuration with the highest improvement of the set KPIs. Furthermore, with the KPIs and the connections of the different elements, an “as-is-analysis” is also thinkable, but not part of the tool yet. **Conclusion** In this paper we present our research in progress exploring design principles to improve existing BMs with a higher degree of operability and flexibility. In our design science project we use the BM canvas of (Osterwalder 2004) and extend it in a way that it is more flexible and operational. We use the BM canvas as a starting point, as it is a widely adopted concept in practice and theory. We extend the BM canvas ontology and allow its instantiation. Furthermore, we semantically model status quo and target states and allow for mappings. This satisfies inter alia the demand of the BM as mediator between the strategic and the operational level (Osterwalder, Pigneur 2010; Wirtz 2011). Existing BM tools are too strategic or contain too many views. This makes a comprehensive understanding of how value is actually created harder because the tools do not use all possibilities provided by the latest techniques (Veit, 2014). The extended BM canvas... offers the possibility to model not only in a more operational way, but also to support innovations or fast changes following a configuration paradigm. Through the semantic model, also a gap analysis becomes possible. Additionally, the tool has a configuration character, where the best alternatives can be found. All in all, for practitioners, observing a current BM and deciding about adequate changes to transformation to target state are supported. However, our work has some limitations. On the practitioner’s side, requirements can differ between different branches. So the tool might not be suitable for each industry or has to be adapted. Furthermore, the semantic model depends on the canvas. The canvas can be filled differently by various persons and still describes the same model. This has the consequence that the semantic model may look differently and a gap analysis is harder to perform. Therefore, a common method, how to fill the canvas should be used or it should be done at least consistently. Further limitations include the loss of abstraction on the strategic side. So the developed canvas cannot give the information on the same abstraction level, which is suitable for a strategic view. Future work will include to develop the software, to evaluate and to improve it. As a part of design cycle 2, we first plan to evaluate the advantages of executability in a lab experiment. We will compare the performance of two groups, while one group will work with a traditional BM canvas. Another group will use our semantic BM transformation tool. As part of the evaluation, decisions on operational changes have to be taken and will be evaluated. Additionally, future work from a conceptual point of view with regards to extending design principles may also cope with the fact, that many different focus of BMs exist. Different semantic models could also be interlinked through partial models and additional models. For example, when clicking on the “Key Partner: Logistics”, the BM of this partner will be opened and one can directly see the partner’s BM. Another idea involves the BM of the partner to be added to the model of the company. Another possibility is, that by clicking on an internal instance, a partial model can be opened, which shows more detailed information and relations. Furthermore, it is possible to expand the approach by including additional KPIs like “customer satisfaction” or “time”. Moreover, a consideration of the whole organisation in the comparison of the current and target state is possible. Thereby, not only the organisation is considered, but also its alignment to the individuals or IT architecture (Zimmermann et al. 2015). Changing (parts of) an organisation can mean a change of conditions for the employees or changes in technology. Future work will consider these impacts. With our research we want to close the gap between BMs and the operational levels to support exchange between different company levels. The presented tool shows a possibility to link the existing value creation logic of a company with their targets. As mentioned, a transformation or a new strategy in general is caused by different factors as changes in environment and many more. Responding on this changes adequately makes a company competitive and grants its success. References Bourne, Mike; Neely, Andy; Mills, John; Platts, Ken (2003): Implementing performance measurement systems. A literature review. “IJBPM” (5:1). Di Valentin, Christina; Burkhart, Thomas; Vanderhaeghen, Dominik; Werth, Dirk; Loos, Peter (2012): Towards a framework for transforming business models into business processes. “AMCIS 2012 Proceedings”. Lindgård, Zhenya; Reeves, Martin; Stalk, George; Deimler, Michael S. (2009): Business model innovation. In When the Game Gets Tough, Change the Game, The Boston Consulting Group, Boston, MA. Osterwalder, Alexander; Pigneur, Yves (Eds.) (2004): Setting up an Ontology of Business Models. “CAiSE Workshops” (3). Speckbacher, Gerhard; Bischof, Juergen; Pfeiffer, Thomas (2003): A descriptive analysis on the implementation of Balanced Scorecards in German-speaking countries. “Management Accounting Research” (14:4), pp. 361–388.
{"Source-Url": "https://publikationen.bibliothek.kit.edu/1000076420/4757001", "len_cl100k_base": 6610, "olmocr-version": "0.1.50", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 26238, "total-output-tokens": 9750, "length": "2e12", "weborganizer": {"__label__adult": 0.0010099411010742188, "__label__art_design": 0.0141143798828125, "__label__crime_law": 0.001194000244140625, "__label__education_jobs": 0.0284881591796875, "__label__entertainment": 0.0004367828369140625, "__label__fashion_beauty": 0.0007567405700683594, "__label__finance_business": 0.27294921875, "__label__food_dining": 0.0012979507446289062, "__label__games": 0.0018320083618164065, "__label__hardware": 0.002269744873046875, "__label__health": 0.0022144317626953125, "__label__history": 0.0016050338745117188, "__label__home_hobbies": 0.0006670951843261719, "__label__industrial": 0.004077911376953125, "__label__literature": 0.0023021697998046875, "__label__politics": 0.0012750625610351562, "__label__religion": 0.0013093948364257812, "__label__science_tech": 0.237060546875, "__label__social_life": 0.00034427642822265625, "__label__software": 0.0335693359375, "__label__software_dev": 0.387939453125, "__label__sports_fitness": 0.0005397796630859375, "__label__transportation": 0.00212860107421875, "__label__travel": 0.0006890296936035156}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 39252, 0.0376]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 39252, 0.21306]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 39252, 0.89971]], "google_gemma-3-12b-it_contains_pii": [[0, 3406, false], [3406, 8282, null], [8282, 10981, null], [10981, 14684, null], [14684, 19796, null], [19796, 24483, null], [24483, 27147, null], [27147, 31703, null], [31703, 35933, null], [35933, 39252, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3406, true], [3406, 8282, null], [8282, 10981, null], [10981, 14684, null], [14684, 19796, null], [19796, 24483, null], [24483, 27147, null], [27147, 31703, null], [31703, 35933, null], [35933, 39252, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 39252, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 39252, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 39252, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 39252, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 39252, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 39252, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 39252, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 39252, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 39252, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 39252, null]], "pdf_page_numbers": [[0, 3406, 1], [3406, 8282, 2], [8282, 10981, 3], [10981, 14684, 4], [14684, 19796, 5], [19796, 24483, 6], [24483, 27147, 7], [27147, 31703, 8], [31703, 35933, 9], [35933, 39252, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 39252, 0.0]]}
olmocr_science_pdfs
2024-11-28
2024-11-28
91b04c1a5fec47dd0a3a1688bbd94cdcc1652dd8
A novel approach for integrating security policy enforcement with dynamic network virtualization Original Availability: This version is available at: 11583/2592157 since: 2021-01-28T18:13:32Z Publisher: IEEE Published DOI:10.1109/NETSOFT.2015.7116152 Terms of use: This article is made available under terms and conditions as specified in the corresponding bibliographic description in the repository Publisher copyright IEEE postprint/Author's Accepted Manuscript ©2015 IEEE. Personal use of this material is permitted. Permission from IEEE must be obtained for all other uses, in any current or future media, including reprinting/republishing this material for advertising or promotional purposes, creating new collecting works, for resale or lists, or reuse of any copyrighted component of this work in other works. (Article begins on next page) A novel approach for integrating security policy enforcement with dynamic network virtualization Cataldo Basile, Antonio Lioy, Christian Pitscheider, Fulvio Valenza and Marco Vallini Politecnico di Torino, Dip. Automatica e Informatica, Torino, Italy (e-mail: {cataldo.basile, antonio.lioy, christian.pitscheider, fulvio.valenza, marco.vallini}@polito.it). Abstract—Network function virtualization (NFV) is a new networking paradigm that virtualizes single network functions. NFV introduces several advantages compared to classical approaches, such as the dynamic provisioning of functionality or the implementation of scalable and reliable services (e.g., adding a new instance to support demands). NFV also allows the deployment of security controls, like firewalls or VPN gateways, as virtualized network functions. However, currently there is not an automatic way to select the security functions to enable and to configure the selected ones according to a set of user’s security requirements. This paper presents a first approach towards the integration of network and security policy management into the NFV framework. By adding to the NFV architecture a new software component, the Policy Manager, we provide NFV with an easy and effective way for users to specify their security requirements and a process that hides all the details of the correct deployment and configuration of security functions. To perform its tasks, the Policy Manager uses policy refinement techniques. I. INTRODUCTION Computer networks continue to grow in size and importance therefore the reduction of deployment and (re)configuration times has become critical. Nowadays, computing services are deployed on virtualized infrastructures but network and security functions still run on dedicated hardware. Network Functions Virtualization (NFV) tries to solve this disadvantage by defining a virtualized infrastructure for network functions. These functions, named Virtual Network Functions (VNF) are implemented as virtual machines, therefore can be dynamically added and removed on-demand reducing administration tasks, response times and costs. Recent works on NFV proposed to allow each tenant to customize its network infrastructure by inserting custom functions. This possibility enables the deployment of security functions as well (such as firewall, logging, proxies, VPN concentrators). Adopting this NFV-based approach also for managing security functions may drastically reduce the deployment time and costs, but the increase in the overall management complexity may strongly reduce its impact. Therefore, automating the support of security functions is fundamental. This paper modifies the NFV architecture addressing the following challenges: (1) identify security functions to provision, (2) decide where selected security functions will be deployed, and (3) generate the necessary configurations to implement a set of user-defined security policies. At last, these features must be offered to end-users, with low technical skills, and to expert users that typically have specific needs (e.g., configuration tuning). This paper adds to the NFV architecture a new software component, the Policy Manager. By using a user-oriented approach to specify security requirements, Policy Manager implements an automatic process for generation and deployment of related configurations. Although the proposed approach is suitable for every type of security features, this paper is focused on functions for filtering traffic (including stateful packet filtering, traffic inspection, etc.). These features can be joined to offer an integrated solution, e.g., parental control. The Policy Manager acts as an intermediary between users and NFV, offering two interfaces. The user’s interface supports the definition of the policies and the NFV interface sends configuration commands to the NFV orchestrator. The Policy Manager uses policy refinement techniques to select the VNFs to use and derive their configurations. Policy refinement is the process “to determine the resources needed to satisfy policy requirements, to translate high-level policies into operational policies that may be enforced by the system, to verify that the set of lower level policies actually meets the requirements of the high-level policy” [1]. Policy refinement allows the separation of policy specification and VNF configuration. By providing a high-level view of the desired behaviour of the system, the user is not distracted by specific details of a function implementation and can focus on the desired outcome. Policy refinement is well studied in literature for legacy systems to translate user policies into configuration commands, but, to the best of our knowledge, it has never been proposed to configure NFV security functions. The High-Level Policies language (HLP) is used to capture user’s security requirements. HLP is an authorization language whose policies can be represented with sentences close to natural language. Examples of HLP policies are “do not download malware”, “do not access blacklisted site”. As evident, HLP policies are technology, function and implementation independent. The Policy Manager refines HLP policies into the concrete configuration of each VNF. Practically, it identifies the VNFs to enforce the user security requirements and derives configurations. When more VNFs are available for satisfy the same requirement (e.g., different types of firewall), an optimization to choose among VNFs will take place. Finally, configuration are passed by the orchestrator to the correct security VNFs. As alternative, VNFs are selected by the user. To avoid errors, the Policy Manager performs non-enforceability analysis to check compatibility between user’s requirements and selected VNFs. This analysis informs the user providing indications and remediation tips. To make this complex refinement feasible, our approach divides the process into two steps by passing through an intermediate format, the medium-level policies (MLP). We define three policy abstraction layers (HLP, MLP and the concrete VNF configurations), and two translation modules. The former translator refines HLP into MLP and the latter translates MLP into concrete VNF configurations. The rest of this paper is structured as follows: Section II presents the most important concepts used in this paper; Section III gives a general overview of the proposed approach; Section IV describes the refinement process in detail; Section V summarizes the paper. II. BACKGROUND This section gives a short introduction of NFV, policy refinement, and non-enforceability. This introduction may help the reader for better understanding the proposed architecture. Furthermore a general overview of the research results in this areas is presented. A. Network function virtualization (NFV) The new Network Function Virtualization (NFV) concept decouples software implementation of network functions (e.g., router, firewall, NAT) from the compute, storage and networking resources through a virtualization layer. In this context, the ETSI standards organization is working on the definition of an architecture and the requirements for the deployment of any Virtual Network Functions (VNFs). Those VNFs can run on a range of industry standard server hardware, and can be moved and instantiated in any locations in the network, without the need of new equipment installation [2]. Recently a new kind of flexibility is achieved both from the Network Service Provider (NSP) and end-users sides through this new technology, as users traffic can be processed by any NSP-provided VNFs as well by any third-parties VNFs. Unfortunately, even if a great number of research activities analysed in depth the deployment of a generic VNFs in the NSP network [3], [4], at the best of our knowledge, none seems to address which effects could have the virtualization of a network security functions, (i.e., firewall, IDS, etc.) and which aspects must be taken into account. Other research focuses on function description and how to correctly integrate third-parties VNFs in the NSP network: Koslovski et al. [5] proposes a language to describe storage and computing resources for a given function; wears Spinoso et al. [6] proposes that a VNF programmer must provide a functional description in order to correctly integrate and configure such VNF. However more detailed informations are required to support third-parties security functions in the provider network. B. Refinement Policy refinement has been well studied in literature and has been proven to be a mature and efficient process. Although policy refinement can be applied to all kind of policies, this paper only considers security policies. Bartal et al. propose a solution named Firmato [7], it was one of the first solution proposals in this area and supports only packet filter firewalls. It is based on a entity-relationship model of the security policy and of the network topology. Verma et al. [8] used a similar approach, the authors present a firewall analysis and configuration engine named FACE. It takes as inputs the network topology and a global security policy written in a high-level language. Garcia-Alfaro et al. [9] proposed MIRAGE, a management tool for the analysis and deployment of configuration policies. It is based on the same principles as Firmato [7] and FACE [8], but it is also capable of configuring intrusion detection systems IDS and VPN routers. MIRAGE can also perform conflict analysis on already deployed configurations. Basile et al. [10] proposes to use ontologies for security policy translation. Network filtering rules are derived from security policies that refer to high-level concepts such as users and services. To map these high-level concepts to low-level network concepts such as IP address, port, protocol, an ontology is used. In [11], Guarnieri et al. proposed a model-driven security approach for the design and generation of concrete security configurations for software architectures. In this approach the system architect models the architecture of the system by means of UML class diagrams, and then the security administrator adds security requirements to the model by means of Security4UML, a UML profile. From the model enriched with security requirements, the concrete security configuration is derived in a semi-automated way. According to [12], a good security policy must be implementable through system administration procedures (e.g., publishing of acceptable use guidelines) and enforceable with security tools or controls, where appropriate, and with sanctions, where actual prevention is not technically feasible. However in a real scenario, some policies may be less precisely enforceable on some systems than others or in worst case, completely non-enforceable. Unfortunately, in literature, non-enforceability analysis has received little or no attention and it has not been investigated in-depth. For example, as suggested by [13], the access control on traditional UNIX systems is much less granular when compared with ACLs on modern implementations and some policies are not fully supported. In particular, two situations can be detected: high-level constrains require a set of functions that are not available (non-enforceable) or only a subset of them is available (partial enforceable). Therefore the policy should be accompanied by an indication of how to handle these situations, e.g., warning the user, suggesting a more relaxed policy, adding a third-party software or install a different VNF to compensate the absent functionality. Verma et al. in [8] propose an iterative process (that includes topological analysis) to identify an unimplementable policy and suggesting how to make it implementable. III. Approach The proposed approach modifies the NFV architecture adding a new component named Policy Manager. The integration of this component with NFV architecture is sketched in Fig. 1, where Policy Manager transparently enforces user security requirements in agreement with the other network requirements, providing an additional layer between the end-user and the NFV orchestrator. The Policy Manager performs the refinement of security requirements expressed with a high-level policies (HLP) into the concrete configuration of each VNF. Practically, the Policy Manager first identifies the security VNFs that can be used to enforce the user security requirements then derives the needed configurations. These configurations are later passed by the orchestrator to the correct security VNFs. By separating the security requirements from the effective required VNFs and their security configurations. the end-user does not need to take in consideration the aspects related to VNFs configuration, focusing on the overall impact of his policy. To make this refinement feasible, we split the process into two steps by using an intermediate format, the medium-level policies (MLP). Therefore, the Policy Manager adopts three policy abstraction layers (i.e., HLP, MLP, and the concrete VNF configurations) and two translation modules (to refine HLP into MLP and to translate MLP into concrete VNF configurations). It is worth noting that our proposal follows the design principles proposed by Strassner for policy-based network management, where the HLP maps to “Business/System View”-layer, the MLP maps to the “Administrative View”-layer and the concrete configurations map to the “Device/Instance View”-layer [14]. By introducing HLP and MLP in the architecture, the refinement process becomes independent from VNF implementations. ### A. Policy abstractions. Although the full specification of policy abstraction is out of the scope of this paper, in this section we provide a brief introduction of HLP and MLP. As introduced before, the users specify their security requirements with the HLP. We designed the HLP (starting from our previous works [15], [16]) as an authorization language that follows the subject-action-object-attribute paradigm (also referred to as target-effect-condition) [17]. A security requirement is expressed as a set of sentences close to natural language, e.g., “do not download malware”, “do not access gambling sites”, “allow Internet traffic from 18:30 to 20:00 for Alice”. The elements of a sentence (subject, object, etc.) are chosen by the user from a predefined set and implemented in a GUI editor as different lists, i.e., a list for each element (e.g., action, subject). This approach is transparent for users (avoiding to learn new language) and makes it possible to map each element of a sentence to the related HLP component. It is clear that, users can customize some elements of a sentence, for example to define timing constraints, particular URL, etc.. Again, to simplify the definition of a complex security policy, a template-based approach is provided. A template contains a set of HLP that participate to a common goal. For example, the template “enable parental control” implements simple HLPs as “do not access blacklisted site”, “log access to websites” and “permit access to Internet from 20:00 to 22:00”. Elements as “blacklisted site” contains a predefined set of URLs initially collected from a list managed by a trusted authority. However, the user can modify that list adding or removing some URLs. As a consequence, HLP policies are technology, function and implementation independent, therefore a HLP can be enforced with different VNFs of different vendors. MLP has been designed to abstract the configurations of security VNFs. Unfortunately, defining this abstraction is not trivial because each security control has a specific language. To this purpose, MLP follows the approach of [18] and organized by security functions. A security function is a basic feature1 offered by a VNF (e.g., channel protection, filtering, anti-virus, parental control). Therefore, MLP is composed by a general model that defines the high-level concepts (policies, rules, conditions, actions, etc.) and a set of sub-models to capture the semantics specific concepts as attributes, condition types, methods (e.g., HTTP GET), etc. For instance, MLP supports the configuration of a packet filter, or the options related to the configuration of an anti-virus. Expert users may have specific needs (e.g., fine tuning) for the configuration of security features. To satisfy these requirements, users may directly use statements offered by MLP to write abstract configurations. After, those are passed as input to the Policy Manager as depicted in Fig. 1. ### B. Translation. The refinement of HLP policies into MLP policies is a very complex task. First of all, it requires to identify the security functions (i.e., capability) needed to enforce the policy. Then, suitable VNFs to enforce the policy must be selected. However, several VNFs with the same security function are typically available. Therefore, the process must choose among them. Different implementations and combinations of VNFs may have different side-effects on the overall performance, throughput, latency and/or bandwidth. For example, a particular VNF implementation requires more processing resources than the others, or significantly reduces the network throughput. For this reason, the Policy Manager adopts a set of optimization techniques (as presented in Section IV) to choose among alternatives. When the set of optimal VNFs is identified, the HLP are mapped into MLP statements. For example, “allow web traffic” is easily translated into a rule whose action is allow and the condition selects all the IP traffic towards the destination port 80. In the same way, other concepts are expanded with predefined values, like “gambling sites” that can be determined by a set of URLs (also maintained and obtained by third parties) or by a set of DNS servers that do not perform reverse translation of specific URLs (like OpenDNS). On the other hand, the transformation of MLP policies into VNF configurations mainly involves a change of syntax, as MLP has been designed to share the same semantics as the VNFs. Each VNF implementation typically has a different configuration language and VNF-specific translation module is needed. This actually maps MLP policies into a concrete configuration. For example, the refinement process requires a --- 1 A VNF may implement more than a single security feature, e.g., a firewall can implement at the same time stateless packet filter and stateful filtering. The proposed refinement process also support this case. However, for simplicity, we avoid to explicitly distinguish these cases in this paper. firewall VNF and generates the corresponding MLP. Then, the translation module transforms the MLP configuration into the firewall settings. IV. HLP REFINEMENT The HLP refinement process is performed by the Policy Manager and presented in Fig. 2. The VNFs can be manually selected by the user, or automatically by using an ad hoc process. The former is named *function-driven* VNFs selection, the latter *policy-driven* VNFs selection. As introduced before, different VNFs provide different security functions. Examples of such functions are “packet filtering”, “deep packet inspection”, “signature-based malware detection”, “traffic anonymization”, “traffic encryption” and “transparent proxying”. For instance, the HLP policy “enable parental control” can be implemented by using either a single VNF (that contains all the required security functions) or by using a set of VNFs (e.g., a virtual packet filter, a VNF for logging traffic/sessions, a virtual web proxy). This choice may impact on performance, cost and/or efficiency. In the function-driven approach (depicted and surrounded by the dashed line in Fig. 2), the user specifies her/his HLP policy and selects the set of VNFs she/he wants to use. Moreover, the user has the opportunity to decide which policy should be enforced with a particular VNF. Before starting the generation of MLP, the Policy Manager checks if the required VNFs support the security functions required to enforce the user’s policies. In practice, actions, objects and attributes are statically mapped to a set of security functions that are required to enforce an HLP. Then, each VNF supports a subset of that functions. Therefore, starting from an HLP it is possible to identify which security functions are required and which VNFs satisfy that policy. If the selected VNFs do not satisfy these requirements, the user is warned and a set of remediations strategies is proposed. This step is named *early non-enforceability*. The *early non-enforceability* analysis is performed in real-time to identify only the macroscopic errors that lead the refinement process to failure. For example, this analysis is useful when the user specifies a parental control policy but the selected VNFs do not support this security function. In this case, the refinement is aborted after the analysis. If the early enforcement does not detect any lack of functions, the generation of MLP is automatically performed for each security control of a VNF(s) (the “abstract VNF configuration phase” in Fig. 2). During the generation of MLP other cases of non-enforceability may appear. For example, when a policy requires to inspect the content of a HTTP protocol field, but the selected VNF does not support this feature, the policy is not enforceable. Similarly, when it does not support a particular option, the policy is partially enforceable. Let us consider a parental control scenario to protect children access to Internet, where applications with different features are available. Two distinct VNFs, VNF1 and VNF2, are available, both capable of enforcing a parental control policy but with different functions. VNF1 includes an “application content inspection” function and a “URL filtering” function. VNF2 supports the functions of VNF1 and a feature to specify time-based policies for “URL filtering”. Hence, if a user wants to specify that access to Facebook web site is permitted only after dinner from 20 pm to 22 pm, VNF1, he is not allowed to enforce that policy. Therefore, the abstract VNF configuration phase produces a complete non-enforceability report (CNE report) where all types of enforceability errors/issues are shown to the user. The function-driven approach is recommended only for expert users, as it can lead to several issues, e.g., sub-optimal configurations, lack of performance, costs, non-enforceability. Each VNF specifies the set of available functions (e.g., “application content inspection”, “URL filtering”), the supported features (e.g., user’s defined set of URL, time-based policies) and other tuning options. A user skilled user could select a VNF that does not completely satisfy the required network throughput requirements, or in the worst case cannot satisfy the security policy at all. Therefore a wrong VNF selection leads to a non-enforceable security policy. The policy-driven approach (depicted and surrounded by a continuous line in Fig. 2) selects the required VNF automatically from a catalogue of available VNFs. Each VNF available in the catalogue is associated to a set of security functions. Therefore, when high-level policy requirements matched the related functions, a set of candidate VNFs is selected. The selection can be straightforward (when only one VNF is available with a required function) or may be based on various criteria (such as cost, performance, reliability or reputation) when multiple VNFs offer a required function. This may result in a trade-off among different criteria and the user must specify its preferences. Examples of these criteria are: ![Fig. 2: Policy-driven and Function-driven VNFs selection](image-url) adopt open-source VNF; choose applications with low network latency (e.g., to match QoS requirements); adopt applications that are reliable to faults or that have a better reputation (according to an expert review). Since several VNFs may be identified to enforce the policies a selection criterion (i.e., optimization target functions) must be defined. The user may choose among a set of Policy Manager-provided profiles that specify a predefined set of target functions (e.g., maximize performance, minimize costs). In particular, for performance a set of different categories should be considered: e.g., CPU usage, RAM, network throughput. Once a profile or a criterion is selected by the user, the refinement process: formulates a Mixed integer linear programming (MILP) problem (considering a specific target functions and related constraints derived from selected profile), invokes an external solver to perform the optimization, analyses solver results and identifies the set of VNFs to adopt. For the sake of simplicity, we avoid to present full details on how an optimization problem is formulated. V. Conclusions The innovations in NFV made it possible to deploy complex network structures based on virtualized functions with a reduced cost and time. Although the infrastructure is flexible enough to accommodate these improvements and to configure the interconnections between the VNFs, there is no efficient method to select and configure security functions within a dynamic virtualized network. This paper proposes a novel approach to solve this problem by defining an extension, named Policy Manager, for the existing NFV architecture. The Policy Manager introduces an additional layer between the user and the NFV orchestrator. The user defines his security policies with the High-level Policy language (HLP) and the Policy manager refines them into configurations for the required VNFs. The required VNFs are selected either manually by the expert users (function-driven) or automatically by the Policy Manager (policy-driven) for the end-users. The policy-driven approach uses a selection criteria defined by the end-user to find the best possible combination of VNFs. In the function-driven approach the expert users selects his desired VNFs and also specifies which VNF enforces which policy. Both approaches perform an enforceability analysis and warn the user in case of some policies cannot be enforced. The proposed extension has major advantages over the current architecture. First, it enables end-users, with low technical skills, to configure the network and related services. Second, the policy definition is independent from VNF implementations and therefore one VNF can be substituted with another without reconfiguring the whole network. Currently, our approach has been implemented only for a limited set of HLP policies, mainly related to filtering requirements, and only for a very limited set of VNF (packet filters, stateful firewalls, L7 filters, basic content inspection). However the proposed approach can be easily extended, adding new security feature and/or VNFs. Therefore, as future work, we will extend the Policy Manager adding other types of security functions (e.g., VPN, proxy, IPS/IDS) and supporting more VNFs. Other improvements are expected in the optimization process used in the policy-driven approach with the support of more multi-objective target functions. ACKNOWLEDGMENT The research described in this paper is part of the Secured Information Standards, Tech. Rep., January 2013. REFERENCES
{"Source-Url": "https://iris.polito.it/retrieve/handle/11583/2592157/e384c432-d454-d4b2-e053-9f05fe0a1d67/2015Netsoft_author.pdf", "len_cl100k_base": 5560, "olmocr-version": "0.1.53", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 17622, "total-output-tokens": 7210, "length": "2e12", "weborganizer": {"__label__adult": 0.0003838539123535156, "__label__art_design": 0.0004792213439941406, "__label__crime_law": 0.0010242462158203125, "__label__education_jobs": 0.0005693435668945312, "__label__entertainment": 0.0001767873764038086, "__label__fashion_beauty": 0.00017595291137695312, "__label__finance_business": 0.0007414817810058594, "__label__food_dining": 0.0003180503845214844, "__label__games": 0.0007328987121582031, "__label__hardware": 0.003509521484375, "__label__health": 0.0006060600280761719, "__label__history": 0.0003364086151123047, "__label__home_hobbies": 0.0001132488250732422, "__label__industrial": 0.0007658004760742188, "__label__literature": 0.00031495094299316406, "__label__politics": 0.0004880428314208984, "__label__religion": 0.00042319297790527344, "__label__science_tech": 0.39306640625, "__label__social_life": 0.00012409687042236328, "__label__software": 0.07769775390625, "__label__software_dev": 0.5166015625, "__label__sports_fitness": 0.0002620220184326172, "__label__transportation": 0.0005064010620117188, "__label__travel": 0.00021195411682128904}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 32129, 0.02855]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 32129, 0.30379]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 32129, 0.89476]], "google_gemma-3-12b-it_contains_pii": [[0, 1238, false], [1238, 7275, null], [7275, 13941, null], [13941, 19898, null], [19898, 25019, null], [25019, 32129, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1238, true], [1238, 7275, null], [7275, 13941, null], [13941, 19898, null], [19898, 25019, null], [25019, 32129, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 32129, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 32129, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 32129, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 32129, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 32129, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 32129, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 32129, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 32129, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 32129, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 32129, null]], "pdf_page_numbers": [[0, 1238, 1], [1238, 7275, 2], [7275, 13941, 3], [13941, 19898, 4], [19898, 25019, 5], [25019, 32129, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 32129, 0.0]]}
olmocr_science_pdfs
2024-12-06
2024-12-06
053d16e03355ee429a31bad20cb0ffec2761a027
Constraint Programming Constraint Programming - **Basic idea:** Programming with constraints, i.e. constraint solving embedded in a programming language - **Constraints:** linear, non-linear, finite domain, Boolean, . . . - **Programming:** logic, functional, object-oriented, imperative, concurrent, . . . - **Systems:** Prolog III/IV, CHIP, ECLIPSE, ILOG, OCRE, NCL, . . . Constraint satisfaction problem (CSP) - $n$ variables $x_1, \ldots, x_n$ - For each variable $x_j$ a finite domain $D_j$ of possible values, often $D_j \subseteq \mathbb{N}$. - $m$ constraints $C_1, \ldots, C_m$, where $C_i \subseteq D_{i_1} \times \ldots \times D_{i_{k_i}}$ is a relation between $k_i$ variables $x_{i_1}, \ldots, x_{i_{k_i}}$. Write also $C_{i_1, \ldots, i_{k_i}}$. - A solution is an assignment of a value $D_j$ to $x_j$, for each $j = 1, \ldots, n$, such that all relations $C_i$ are satisfied. Decide whether a map can be colored by 3 colors such that neighboring regions get different colors. For each region a variable $x_j$ with domain $D_j = \{\text{red, green, blue}\}$. For each pair of variables $x_i, x_j$ corresponding to two neighboring regions, a constraint $x_i \neq x_j$. NP-complete problem. • Instantiate the variables in some order. • As soon as all variables in a constraint are instantiated, determine its truth value. • If the constraint is not satisfied, backtrack to the last variable whose domain contains unassigned values, otherwise continue instantiation. 1. If the domain $D_j$ of a variable $x_j$ contains a value $v$ that does not satisfy $C_j$, this will be the cause of repeated instantiation followed by immediate failure. 2. If we instantiate the variables in the order $x_1, x_2, \ldots, x_n$, and for $x_i = v$ there is no value $w \in D_j$, for $j > i$, such that $C_{ij}(v, w)$ is satisfied, then backtracking will try all values for $x_j$, fail and try all values for $x_{j-1}$ (and for each value of $x_{j-1}$ again all values for $x_j$), and so on until it tries all combinations of values for $x_{i+1}, \ldots, x_j$ before finally discovering that $v$ is not a possible value for $x_j$. The identical failure process may be repeated for all other sets of values for $x_1, \ldots, x_{j-1} \text{ with } x_i = v$. Local Consistency - Consider CSP with unary and binary constraints only. - Constraint graph $G$ - For each variable $x_i$ a node $i$. - For each pair of variables $x_i, x_j$ occurring in the same binary constraint, two arcs $(i, j)$ and $(j, i)$. - The node $i$ is consistent if $C_i(v)$, for all $v \in D_i$. - The arc $(i, j)$ is consistent, if for all $v \in D_i$ with $C_i(v)$ there exists $w \in D_j$ with $C_j(w)$ such that $C_{ij}(v, w)$. - The graph is node consistent resp. arc consistent if all its nodes (resp. arcs) are consistent. Algorithm AC-3 (Mackworth 77): begin for $i \leftarrow 1$ until $n$ do $D_i \leftarrow \{v \in D_i \mid C_i(v)\}$; $Q \leftarrow \{(i,j) \mid (i,j) \in \text{arcs}(G), i \neq j\}$ while $Q$ not empty do begin select and delete an arc $(i,j)$ from $Q$; if REVISE$(i,j)$ then $Q \leftarrow Q \cup \{(k,i) \mid (k,i) \in \text{arcs}(G), k \neq i, k \neq j\}$ end end end procedure REVISE\(i,j\): begin DELETE ← false for each \(v \in D_i\) do if there is no \(w \in D_j\) such that \(C_{ij}(v,w)\) then begin delete \(v\) from \(D_i\); DELETE ← true end; return DELETE end Crossword Puzzle Word List Aft Aft Ale Eel Hike Eel Hoses Heel Knot Knot Laser Laser Lee Lee Line Line Sails Sails Sheet Sheet Steer Steer Tie Tie Dechter 92 Apply local consistency dynamically during search - **Forward Checking**: After assigning to $x$ the value $v$, eliminate for all uninstantiated variables $y$ the values from $D_y$ that are incompatible with $v$. - **Partial Lookahead**: Establish arc consistency for all $(y, y')$, where $y, y'$ have not been instantiated yet and $y$ will be instantiated before $y'$. - **Full Lookahead**: Establish arc consistency for all uninstantiated variables. n-Queens Problem Place $n$ queens in an $n \times n$ chessboard such that no two queens threaten each other. - **Variables** $x_i$, $i = 1, \ldots, n$ with domain $D_i = \{1, \ldots, n\}$ indicating the column of the queen in line $i$. - **Constraints** - $x_i \neq x_j$, for $1 \leq i < j \leq n$ (vertical) - $x_i \neq x_j + (j - i)$, for $1 \leq i < j \leq n$ (diagonal 1) - $x_i \neq x_j - (j - i)$, for $1 \leq i < j \leq n$ (diagonal 2) Forward Checking ``` <table> <thead> <tr> <th></th> <th>A</th> <th>B</th> <th>C</th> <th>D</th> <th>E</th> <th>F</th> <th>G</th> <th>H</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>Q</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>2</td> <td>X</td> <td>X</td> <td>Q</td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td>3</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td>Q</td> <td></td> <td></td> <td></td> </tr> <tr> <td>4</td> <td>X</td> <td>Q</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td></td> <td></td> </tr> <tr> <td>5</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td></td> <td></td> </tr> <tr> <td>6</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td></td> <td>X</td> <td>X</td> <td>X</td> </tr> <tr> <td>7</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td></td> <td>X</td> </tr> <tr> <td>8</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> </tr> </tbody> </table> ``` Values: - 1A - 2C - 3E - 4BG - 5B - 6D - 5D - 4H - 5B - 6D - 7F - 6 (no more value) - 5D - 4 (no more value) - 3F 4013 Partial Lookahead 1A 2C 3E (delete 4B and 5D) 4GH 5B (no value left for 6) 3F (delete 6D and 6E) 4BH (failed, backtrack to 4) 3G (delete 5D and 7E) 4B No value for queen 6 Typical structure of a constraint program - Declare the variables and their domains - State the constraints - Enumeration (labeling) The constraint solver achieves only local consistency. In order to get global consistency, the domains have to be enumerated. Labeling - Assigning to the variables their possible values and constructing the corresponding search tree. Important questions 1. In which order should the variables be instantiated (variable selection) ? 2. In which order should the values be assigned to a selected variable (value selection) ? Static vs. dynamic orderings Heuristics Dynamic variable/value orderings - **Variable orderings** - Choose the variable with the smallest domain “first fail” - Choose the variable with the smallest domain that occurs in most of the constraints “most constrained” - Choose the variable which has the smallest/largest lower/upper bound on its domain. - **Value orderings** - Try first the minimal value in the current domain. - Try first the maximal value in the current domain. - Try first some value in the middle of the current domain. ## Constraint programming systems <table> <thead> <tr> <th>System</th> <th>Avail.</th> <th>Constraints</th> <th>Language</th> <th>Web site</th> </tr> </thead> <tbody> <tr> <td>B-prolog</td> <td>comm.</td> <td>FinDom</td> <td>Prolog</td> <td><a href="http://www.probp.com">www.probp.com</a></td> </tr> <tr> <td>CHIP</td> <td>comm.</td> <td>FinDom, Boolean, Linear $\mathbb{Q}$ Hybrid</td> <td>Prolog, C, C++</td> <td><a href="http://www.cosytec.com">www.cosytec.com</a></td> </tr> <tr> <td>Choco</td> <td>free</td> <td>FinDom</td> <td>Claire</td> <td>choco-constraints.net</td> </tr> <tr> <td>Eclipse</td> <td>free non-profit</td> <td>FinDom, Hybrid</td> <td>Prolog</td> <td><a href="http://www.icparc.ic.ac.uk/eclipse/">www.icparc.ic.ac.uk/eclipse/</a></td> </tr> <tr> <td>GNU Prolog</td> <td>free</td> <td>FinDom</td> <td>Prolog</td> <td>gnu-prolog.inria.fr</td> </tr> <tr> <td>IF/Prolog</td> <td>comm.</td> <td>FinDom, Boolean, Linear $\mathbb{R}$</td> <td>Prolog</td> <td><a href="http://www.ifcomputer.co.jp">www.ifcomputer.co.jp</a></td> </tr> <tr> <td>ILOG</td> <td>comm.</td> <td>FinDom, Hybrid</td> <td>C++, Java</td> <td><a href="http://www.ilog.com">www.ilog.com</a></td> </tr> <tr> <td>NCL</td> <td>comm.</td> <td>FinDom</td> <td></td> <td><a href="http://www.enginest.com">www.enginest.com</a></td> </tr> <tr> <td>Mozart</td> <td>free</td> <td>FinDom</td> <td>Oz</td> <td><a href="http://www.mozart-oz.org">www.mozart-oz.org</a></td> </tr> <tr> <td>Prolog IV</td> <td>comm.</td> <td>FinDom, nonlinear intervals</td> <td>Prolog</td> <td><a href="http://www.prologia.fr">www.prologia.fr</a></td> </tr> <tr> <td>Sicstus</td> <td>comm.</td> <td>FinDom, Boolean, linear $\mathbb{R}/\mathbb{Q}$</td> <td>Prolog</td> <td><a href="http://www.sics.se/sicstus/">www.sics.se/sicstus/</a></td> </tr> </tbody> </table> Practical Problem Solving - Model building: Language - Model solving: Algorithms ## IP vs. CP: Language <table> <thead> <tr> <th></th> <th>IP</th> <th>CP</th> </tr> </thead> <tbody> <tr> <td>Variables</td> <td>0-1</td> <td>Finite domain</td> </tr> <tr> <td>Constraints</td> <td>Linear equations and inequalities</td> <td>Arithmetic constraints</td> </tr> <tr> <td></td> <td></td> <td>Symbolic/global constraints</td> </tr> </tbody> </table> ### Example - **Variables**: $x_1, \ldots, x_n \in \{0, \ldots, m - 1\}$ - **Constraint**: Pairwise different values Example (2) - Integer programming: Only linear equations and inequalities \[ x_i \neq x_j \iff x_i < x_j \lor x_i > x_j \] \[ x_i \leq x_j - 1 \lor x_i \geq x_j + 1 \] - Eliminating disjunction \[ x_i - x_j + 1 \leq my_i, \quad x_j - x_i + 1 \leq my_j, \quad y_i + y_j = 1, \] \[ y_i, y_j \in \{0, 1\}, \quad 0 \leq x_i, x_j \leq m - 1, \] - New variables: \( z_{ik} = 1 \) iff \( x_i = k \), \( i = 1, ..., n \), \( k = 0, ..., m - 1 \) \[ z_{i0} + \cdots + z_{im-1} = 1, \quad z_{1k} + \cdots + z_{nk} \leq 1, \] - Constraint programming \( \rightsquigarrow \) symbolic constraint \[ \text{alldifferent}(x_1, ..., x_n) \] Symbolic/global constraints - **alldifferent**([x₁, ..., xₙ]) - **cumulative**([s₁, ..., sₙ], [d₁, ..., dₙ], [r₁, ..., rₙ], c, e). ▶ n tasks: starting time sᵢ, duration dᵢ, resource demand rᵢ ▶ resource capacity c, completion time e. ![Examples of cumulative constraints](cumulative_constraints.png) **Diffn Constraint** Beldiceanu/Contejean'94 - Nonoverlapping of n-dimensional rectangles $[O_1, \ldots, O_n, L_1, \ldots, L_n]$, where $O_i$ resp. $L_i$ denotes the origin resp. length in dimension $i$ - $\text{diffn}([[O_{11}, \ldots, O_{1n}, L_{11}, \ldots, L_{1n}], \ldots, [O_{m1}, \ldots, O_{mn}, L_{m1}, \ldots, L_{mn}]])$ - General form: $\text{diffn}(\text{Rectangles, Min\_Vol, Max\_Vol, End, Distances, Regions})$ ### IP vs. CP: Algorithms <table> <thead> <tr> <th></th> <th>IP</th> <th>CP</th> </tr> </thead> <tbody> <tr> <td><strong>Inference</strong></td> <td>Linear programming</td> <td>Domain filtering</td> </tr> <tr> <td></td> <td>Cutting planes</td> <td>Constraint propagation</td> </tr> <tr> <td><strong>Search</strong></td> <td>Branch-and-relax</td> <td>Branch-and-bound</td> </tr> <tr> <td></td> <td>Branch-and-cut</td> <td></td> </tr> <tr> <td><strong>Bounds on</strong></td> <td>Two-sided</td> <td>One-sided</td> </tr> <tr> <td>the objective</td> <td>function</td> <td></td> </tr> <tr> <td><strong>function</strong></td> <td></td> <td></td> </tr> </tbody> </table> Local vs. global reasoning Linear arithmetic constraints \[ 3x + y \leq 7, \] \[ 3y + x \leq 7, \] \[ x + y = z, \] \[ x, y \in \{0, ..., 3\} \] Global reasoning in CP ? \( \leadsto \) global constraints ! CP \( x, y \leq 2, z \leq 4 \) LP \( x, y \leq 2, z \leq 3.5 \) IP \( x, y \leq 2, z \leq 3 \) Global reasoning in CP Example - \( x_1, x_2, x_3 \in \{0, 1\} \) - pairwise different values - **Local** consistency: 3 disequalities: \( x_1 \neq x_2, x_1 \neq x_3, x_2 \neq x_3 \) \( \leadsto x_1, x_2, x_3 \in \{0, 1\} \), i.e., no domain reduction is possible - **Global** constraint: \texttt{alldifferent}(x_1, x_2, x_3) \( \leadsto \) detects infeasibility (uses bipartite matching) Global reasoning in CP: inside global constraints ### Summary <table> <thead> <tr> <th>Language</th> <th>ILP</th> <th>CP(FD)</th> </tr> </thead> <tbody> <tr> <td>Linear arithmetic</td> <td>—</td> <td>Arithmetic constraints</td> </tr> <tr> <td></td> <td></td> <td>Symbolic constraints</td> </tr> <tr> <td>Algorithms</td> <td>Global consistency (LP)</td> <td>Local consistency</td> </tr> <tr> <td></td> <td>Cutting planes</td> <td>Domain reduction</td> </tr> <tr> <td></td> <td>Branch-and-bound</td> <td>User-defined enumeration</td> </tr> <tr> <td></td> <td>Branch-and-cut</td> <td></td> </tr> </tbody> </table> - Symbolic constraints $\Rightarrow$ more expressivity + more efficiency - Unifying framework for CP and IP: *Branch-and-infer* (Bockmayr/Kasper 98) Discrete Tomography - Binary matrix with \( m \) rows and \( n \) columns - Horizontal projection numbers \((h_1, \ldots, h_m)\) - Vertical projection numbers \((v_1, \ldots, v_n)\) - Properties - Horizontal convexity \((h)\) - Vertical convexity \((v)\) - Connectivity (polyomino) \((p)\) - Complexity (Woeginger’01) - Polynomial: \((\ )\), \((p,v,h)\) - NP-complete: \((p,v)\), \((p,h)\), \((v,h)\), \((v)\), \((h)\), \((p)\) **IP Model** - **Variables** \[ x_{ij} = \begin{cases} 0 & \text{cell}(i,j) \text{ is labeled white} \\ 1 & \text{cell}(i,j) \text{ is labeled black} \end{cases} \] - **Constraints I: Projections** \[ \sum_{j=1}^{n} x_{ij} = h_i, \quad \sum_{i=1}^{m} x_{ij} = v_j \] - **Constraints II: Convexity** \[ h_i x_{ik} + \sum_{l=k+h_i}^{n} x_{il} \leq h_i, \quad v_j x_{kj} + \sum_{l=k+v_j}^{m} x_{lj} \leq v_j, \] Constraints III: Connectivity \[ \sum_{k=j}^{j+h_i-1} x_{ik} - \sum_{k=j}^{j+h_i-1} x_{(i+1)k} \leq h_i - 1 \] Various linear arithmetic models possible, e.g. convexity Enormous differences in size and running time, e.g. 1 day vs. < 1 sec Large number of constraints (~ 3mn in the above model) **Finite Domain Model** - **Variables** - $x_i$ start of horizontal convex block in row $i$, for $1 \leq i \leq m$ - $y_j$ start of vertical convex block in column $j$, for $1 \leq j \leq n$ - **Domain** - $x_i \in [1, \ldots, n - h_i + 1]$, for $1 \leq i \leq m$ - $y_j \in [1, \ldots, m - v_j + 1]$, for $1 \leq j \leq n$ Conditional Propagation - Projection/Convexity modelled by FD variables - Compatibility of $x_i$ and $y_j$ $$x_i \leq j < x_i + h_i \iff y_j \leq i < y_j + v_j$$ for $1 \leq i \leq m$ and $1 \leq j \leq n$ - Conditional propagation if $x_i \leq j$ then (if $j < x_i + h_i$ then $(y_j \leq i, i < y_j + v_j)$) Connectivity Block $i$ must start before the end of block $i + 1$ $$x_i \leq x_{i+1} + h_{i+1} - 1, \text{ for } 1 \leq i \leq m - 1$$ Block $i + 1$ must start before the end of block $i$ $$x_{i+1} \leq x_i + h_i - 1, \text{ for } 1 \leq i \leq m - 1$$
{"Source-Url": "http://www.mi.fu-berlin.de/wiki/pub/Main/GunnarKlauP1winter0708/discMath_klau_CP.pdf", "len_cl100k_base": 5381, "olmocr-version": "0.1.53", "pdf-total-pages": 37, "total-fallback-pages": 0, "total-input-tokens": 62635, "total-output-tokens": 6012, "length": "2e12", "weborganizer": {"__label__adult": 0.00035381317138671875, "__label__art_design": 0.0003254413604736328, "__label__crime_law": 0.00046753883361816406, "__label__education_jobs": 0.0018310546875, "__label__entertainment": 7.37309455871582e-05, "__label__fashion_beauty": 0.0001881122589111328, "__label__finance_business": 0.0003268718719482422, "__label__food_dining": 0.0004198551177978515, "__label__games": 0.0012140274047851562, "__label__hardware": 0.0010852813720703125, "__label__health": 0.0005383491516113281, "__label__history": 0.0002815723419189453, "__label__home_hobbies": 0.0001806020736694336, "__label__industrial": 0.0007343292236328125, "__label__literature": 0.00024127960205078125, "__label__politics": 0.0002853870391845703, "__label__religion": 0.0005125999450683594, "__label__science_tech": 0.0379638671875, "__label__social_life": 0.00012099742889404296, "__label__software": 0.00592803955078125, "__label__software_dev": 0.94580078125, "__label__sports_fitness": 0.0004346370697021485, "__label__transportation": 0.0006136894226074219, "__label__travel": 0.00021851062774658203}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 14278, 0.03381]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 14278, 0.35188]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 14278, 0.61515]], "google_gemma-3-12b-it_contains_pii": [[0, 23, false], [23, 379, null], [379, 899, null], [899, 1214, null], [1214, 1491, null], [1491, 2265, null], [2265, 2818, null], [2818, 3259, null], [3259, 3499, null], [3499, 3659, null], [3659, 3659, null], [3659, 4114, null], [4114, 4566, null], [4566, 5093, null], [5093, 5267, null], [5267, 5267, null], [5267, 5529, null], [5529, 5871, null], [5871, 6382, null], [6382, 7648, null], [7648, 7730, null], [7730, 8359, null], [8359, 8999, null], [8999, 9312, null], [9312, 9741, null], [9741, 10691, null], [10691, 10996, null], [10996, 11442, null], [11442, 12188, null], [12188, 12633, null], [12633, 13068, null], [13068, 13366, null], [13366, 13700, null], [13700, 14021, null], [14021, 14278, null], [14278, 14278, null], [14278, 14278, null]], "google_gemma-3-12b-it_is_public_document": [[0, 23, true], [23, 379, null], [379, 899, null], [899, 1214, null], [1214, 1491, null], [1491, 2265, null], [2265, 2818, null], [2818, 3259, null], [3259, 3499, null], [3499, 3659, null], [3659, 3659, null], [3659, 4114, null], [4114, 4566, null], [4566, 5093, null], [5093, 5267, null], [5267, 5267, null], [5267, 5529, null], [5529, 5871, null], [5871, 6382, null], [6382, 7648, null], [7648, 7730, null], [7730, 8359, null], [8359, 8999, null], [8999, 9312, null], [9312, 9741, null], [9741, 10691, null], [10691, 10996, null], [10996, 11442, null], [11442, 12188, null], [12188, 12633, null], [12633, 13068, null], [13068, 13366, null], [13366, 13700, null], [13700, 14021, null], [14021, 14278, null], [14278, 14278, null], [14278, 14278, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 14278, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 14278, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 14278, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 14278, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 14278, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 14278, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 14278, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 14278, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 14278, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 14278, null]], "pdf_page_numbers": [[0, 23, 1], [23, 379, 2], [379, 899, 3], [899, 1214, 4], [1214, 1491, 5], [1491, 2265, 6], [2265, 2818, 7], [2818, 3259, 8], [3259, 3499, 9], [3499, 3659, 10], [3659, 3659, 11], [3659, 4114, 12], [4114, 4566, 13], [4566, 5093, 14], [5093, 5267, 15], [5267, 5267, 16], [5267, 5529, 17], [5529, 5871, 18], [5871, 6382, 19], [6382, 7648, 20], [7648, 7730, 21], [7730, 8359, 22], [8359, 8999, 23], [8999, 9312, 24], [9312, 9741, 25], [9741, 10691, 26], [10691, 10996, 27], [10996, 11442, 28], [11442, 12188, 29], [12188, 12633, 30], [12633, 13068, 31], [13068, 13366, 32], [13366, 13700, 33], [13700, 14021, 34], [14021, 14278, 35], [14278, 14278, 36], [14278, 14278, 37]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 14278, 0.15734]]}
olmocr_science_pdfs
2024-12-08
2024-12-08
dac1e5dfa45afa0e4f710a926fd986d9c994c544
Function Point Analysis FPA on A Team Planning Website Based on PHP and MYSQL Lassen, Anders Published in: Journal of Information Technology and Software Engineering DOI: 10.4172/2165-7866.1000237 Publication date: 2018 Document version Publisher's PDF, also known as Version of record Document license: Unspecified Citation for published version (APA): Function Point Analysis FPA on A Team Planning Website Based on PHP and MYSQL Lassen A* Department of Computer Science, University of Copenhagen, Copenhagen, Denmark Abstract A function point analysis (FPA) has been carried out on a custom team planning website based on PHP and MYSQL. The FPA was done after the development was finished (retrospective) and a constructive cost model analysis (COCOMO) was carried out to assess source lines of code (SLOC). In the present study the function point analysis is based on entities of the relational database evaluated as internal logical files, and evaluation of PHP source code with dynamic SQL as either external input files or external inquiry files. The complexity for a custom team planning website was found to be 510 total adjusted function points (TAFP) (UAF=580 FP, TDI=23, VAF=0, 88, TAFP=510FP). The function point estimate was classified as an organic project in a COCOMO analysis, and it was concluded that the complexity corresponds to 27742 LOC (or 27, 4 KDSI). The estimate of 66-82 person-months project would correspond to a 4 crew team in 16-21 months. The estimate was compared to the actual source code count of 22300 LOC. Keywords: Function point analysis; Dynamic SQL Introduction Function point analysis (FPA) is one way to determine the overall complexity of a system. In the current study a custom website is analyzed for complexity. Function point analysis is attributed to Allan Albright in 1979 [1] and JE Gaffney [2] and further developed in the MK2 report [3]. More recent work on function point analysis, a software tool (Unified code count (UCC)) [4,5]. Function point analysis can be evaluated using UML [6,7]. Made a literature review based on reported keywords identifying improvements to the accuracy of function point analysis [8]. They included 18 primary studies. The improvements were categorized into three categories: 1) “weights and complexities”; 2) ‘technological in-dependence” of the method; and 3) calculating the ‘adjusted functional size’. Literature review for productivity [9]. A study of Henderson and coworkers study perception of function point analysis from a manger viewpoint and a developer viewpoint based 13 desirable properties with 3 key findings: SLOC-count is less complicated than FP; developers better perceive the benefits of FP than Managers; the difference in values between managers and developers inhibit communication necessary to reach informed decisions [10]. The FPA Allows for quantifying different properties of the system, in LOW, AVERAGE or HIGH complexity, totaling the unadjusted function points (UAF). Use SIMPLE, AVERAGE and COMPLEX, where SIMPLE and COMPLEX are well defined; and use an AVERAGE, MEDIAN, RANGE(LOW, HIGH) classification for complexity [2]. The unadjusted function points can then be adjusted for technical complexity as the total adjusted function points (TAFP). It is this measure that can be converted to project size in terms of man years based on lines of code (LOC) for the used programming language [11]. A function point measure for a list of languages. To assess PHP we use the LOC per function point for java and C++ [12]. The system examined is custom build website supporting planning tasks and in-site-postings for Danish yachtracing crews participating in international match race. The website domain myteam.dk was built and in operation in the years 2008-2014 by Hans Jacob Simonsen [13]. The system supports in-site blogging, planning, logging comments to training and events, handling expenses, sending out reminders by SMS. The result of the function point analysis is further analyzed using constructive cost model (COCOMO) analysis by Boehm BW [14]. Bearing in mind that the COCOMO measure is the total lines of code delivered by the development team. Finally the result of the COCOMO-analysis is compared to a simple source code count of delivered source code. Comparing the Total Adjusted Function Points to Delivered Source Lines of Code (SLOC), similar to the two step work effort validation [2] (Figure 1). Method Persistent store The website database was a relational database of type MYSQL version 5.3 (or lower). The tables were defined with primary keys, unique index and auto-increment. No foreign keys constraints, triggers or stored procedures. Web-tier. Most of the source files were PHP files with HTML, CSS - files and some libraries in java Script. PHP class definitions were part of the code so both structured programming and object-oriented programming was present. The model-layer was object-oriented. The system is evaluated using function point analysis [12]. The metric is evaluated for: internal logical files (ILF), external interface files (EIF), external Input (EI), external output (EO) and external inquiry (EQ). Internal logical files (ILF): Entity (Table 1) count in the relational database schema. The complexity of the entities graded initially as: below 8 attributes - (LOW), 8-16 attributes - (AVERAGE) and above 16 attributes (HIGH). External interface files (EIF): Was not initially found relevant, but library calls could be considered. For example, the calendar functions. External input (EI): PHP-files including DML-statements INSERT, UPDATE and DELETE executed as dynamic SQL. The search was a done by ‘search in files’ with notepad++, and visual inspection (Notepad++ 2007-2018). Server side code was considered and no stored procedures *Corresponding author: Anders L, Department of Computer Science, University of Copenhagen, Copenhagen, Denmark. E-mail: krh487@di.ku.dk, krh@di.ku.dk, plan@lassena.dk Received March 27, 2018; Accepted May 10, 2018; Published May 18, 2018 Citation: Lassen A (2018) Function Point Analysis FPA on A Team Planning Website Based on PHP and MYSQL. J Inform Tech Softw Eng 8: 237. doi:10.4172/2165-7866.1000237 Copyright: © 2018 Lassen A. 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 author and source are credited. or triggers found to include. The complexity was assessed by counting and weighing the DML statements found in each file. External inquiry (EQ): PHP files with SELECT statements as Dynamics SQL. Files with INSERT, UPDATE and DELETE statements are not counted but treated as external input files. External output (EO): These are reports, screens, messages. SMS messaging is an example of external output considered from these weighted measures according to unadjusted function points (UAF) was calculated [1]. General system characteristics (GSC) were evaluated for their degree of influence (DOI) summing to the total degrees of influence (TDI); data communication; distributed data processing; performance; heavily used configuration; transaction rate; on-line data entry; end-user efficiency; online update; complex processing; reusability; installation ease; operational ease; multiple sites; and facilitate change. Each GSC was rated for degree of influence (DOI) on a scale from 0 to 5: not present or no influence (0); incidental influence (1); moderate influence (2); average influence (3); significant influence (4); and strong influence (5). The value adjustment factor (VAF) was calculated as 0.01 times TDI + 0.65. The total adjusted function points (TAFP) was calculated as the unadjusted function points (UAF) times the value adjustment factor (VAF) \[ VAF = (TDI \times 0.01) + 0.65 \] \[ FP = UAF \times VAF \] Once calculated, the adjusted function points (FP) was used to assess the project size using the constructive cost model (COCOMO). The function point conversion table was examined and initially PHP was compared to java or C++ [1]. The conversion rate for java or C++ are the same. Average source LOC per function point is 53, and average source LOC for a 210 FP application is 11130 LOC. Since we have the source code [13], the actual LOC can be counted and compared to the estimated project size. Results The evaluation of the database relations was done in one pass. The evaluation of the PHP-files was done in several passes. Count-1: Simple file count. Count-2: Inspection of files for SELECT statements. Presence of Select in comments was disregarded and file Complexity was based on the number of SELECT-statements. Count-3: Same evaluation based on inspection for INSERT-statements. Count-4: Same evaluation based on inspection for UPDATE- and DELETE-statements. Internal logical files (ILF) Every relation in the database was considered. Some of the relations have media files. Media are implemented as attributes of type LONGBLOB or BLOB. All these relations are AVERAGE candidates. External measures External Interface files (EIF): No external interface files are determined at this point, unless the website configuration is to be considered. An external interface file must be generated or maintained by another system [1]. This measure is initially set to count 10 and weight AVERAGE (Table 1). External Input (EI): These are input screen. Here the PHP code is inspected to determine user input. The initial file count done in Notepad++ by simple keyword search is tagged count-1 in Table 2. The result of the first count was 30 files with INSERT-statements, 49 files with UPDATE statements and 38 files with DELETE statements. Initially set to complexity AVERAGE Further passes are done with code inspection carefully. Keywords in comments and variable are discarded from counts. Files with several DML statements are judged for complexity and account for recurring files in the first count. A file with SELECT and DML modification statements (INSERT, UPDATE, DELETE) should only be classified as an external input file. EI should be reduced. After the final pass, assessment of complexity is complete. Many overlaps of data manipulation statements are present in the same files and the total number of files included is 29. Files in the ‘classes’ folder are model-classes for the major relational entities and implement SELECT, INSERT, UPDATE and DELETE statements in various member functions. The final count is given in Table 2 (11 LOW, 7 AVERAGE, 11 HIGH). External output (EO): These are reports, screens, messages. Here we know the SMS service is very important, but how many places are the SMS services called? Likewise we account for an email service. We estimate is 10 files, average complexity. External Inquiry (EQ): Enquiry forms are listings; screens that are informational; SELECT statements. All files with keyword ‘SELECT’ were inspected using ‘find in files’ in notepad++ (Notepad++ 2007-2018). The initial file count was 86. In the most cases SELECT’s would be simple, say 80%, so 86 files are divided into 16 files of AVERAGE and 70 files with LOW complexity. SELECT-statements and dropdown html are the vast candidates. Select is used in a HTML-tag for one option in a dropdown box. Select also is found in comments. Upload is a library used that is not included, even though some coding efforts must be done to facilitate upload (40 LOW, 13 AVERAGE, 5 HIGH). Two further passes were done to inspect for data modifications statements. After inspection for INSERT, UPDATE and DELETE statements files initially classified External Inquiry (EQ) are classified as External input files and the EQ count reduced accordingly. In the last pass several UPDATE and DELETE-statements found and moved several EQ-AVERAGE and EQ-HIGH file to EI-files. The final assessment of complexity for External inquiry files (EQ) are Table 1: Relations and their complexity. LOW 0-7. AVERAGE 6-15. HIGH 23-30 plus binary objects. SQL-DML reference in PHP code with table name. Cardinality is the number of tuples in each relation. <table> <thead> <tr> <th>Relation</th> <th>Attributes</th> <th>Complexity (low, Average, High)</th> <th>Referenced in code (notepad++)</th> <th>Cardinality (tuples)</th> </tr> </thead> <tbody> <tr> <td>Availability</td> <td>5</td> <td>LOW</td> <td>10 hits in 2 files</td> <td>100</td> </tr> <tr> <td>Comments</td> <td>6</td> <td>LOW</td> <td>69 hits in 20 files</td> <td>73</td> </tr> <tr> <td>Contents (media, blob)</td> <td>9</td> <td>AVERAGE</td> <td>112 hits in 23 files</td> <td>318</td> </tr> <tr> <td>Diary (media, blob)</td> <td>5</td> <td>AVERAGE</td> <td>258 hits in 18 files</td> <td>98</td> </tr> <tr> <td>Equalizations</td> <td>7</td> <td>LOW</td> <td>14 hits in 3 files</td> <td>294</td> </tr> <tr> <td>Events</td> <td>15</td> <td>AVERAGE</td> <td>321 in 49 files</td> <td>1175</td> </tr> <tr> <td>Expenses</td> <td>7</td> <td>LOW</td> <td>42 hits in 4 files</td> <td>594</td> </tr> <tr> <td>Expense ToPers</td> <td>2</td> <td>LOW</td> <td>10 hit in 2 files</td> <td>2454</td> </tr> <tr> <td>Faqs</td> <td>5</td> <td>LOW</td> <td>5 hits in 3 files</td> <td>6</td> </tr> <tr> <td>Gallery</td> <td>8</td> <td>AVERAGE</td> <td>336 hits in 24 files</td> <td>56</td> </tr> <tr> <td>Help Table</td> <td>2</td> <td>LOW</td> <td>2 hits in 2 files</td> <td>6</td> </tr> <tr> <td>Links</td> <td>6</td> <td>AVERAGE</td> <td>44 hits in 15 files</td> <td>119</td> </tr> <tr> <td>Main Team (media, longblob)</td> <td>23</td> <td>HIGH</td> <td>65 hits in 20 files</td> <td>38</td> </tr> <tr> <td>No SMS</td> <td>2</td> <td>LOW</td> <td>12 hits in 4 files</td> <td>1</td> </tr> <tr> <td>Pers Category</td> <td>4</td> <td>LOW</td> <td>12 hits in 6 files</td> <td>123</td> </tr> <tr> <td>Pics (media, longblob)</td> <td>11</td> <td>AVERAGE</td> <td>51 hits in 13 files</td> <td>981</td> </tr> <tr> <td>Positions</td> <td>11</td> <td>AVERAGE</td> <td>77 hits in 4 files</td> <td>100</td> </tr> <tr> <td>PosNeg</td> <td>3</td> <td>LOW</td> <td>64 hits in 16 files</td> <td>10127</td> </tr> <tr> <td>Race Diary</td> <td>15</td> <td>AVERAGE</td> <td>78 hits in 5 files</td> <td>5</td> </tr> <tr> <td>reminderLog</td> <td>8</td> <td>LOW</td> <td>40 hits in 6 files</td> <td>9218</td> </tr> <tr> <td>Sponsor (media, blob)</td> <td>8</td> <td>AVERAGE</td> <td>56 hits in 5 files</td> <td>0</td> </tr> <tr> <td>Stat</td> <td>6</td> <td>AVERAGE</td> <td>613 hits in 61 files</td> <td>382501</td> </tr> <tr> <td>team (media, blob x2)</td> <td>30</td> <td>HIGH</td> <td>Common name 1949 hits in 99 files</td> <td>209</td> </tr> <tr> <td>Team To Member</td> <td>5</td> <td>LOW</td> <td>67 files in 11 files</td> <td>177</td> </tr> </tbody> </table> Table 2: DML modification statements (INSERT, UPDATE, DELETE). After the final pass many overlaps in files have been identified. The total number of files included is 29. <table> <thead> <tr> <th>DML</th> <th>Complexity</th> <th>Files</th> </tr> </thead> <tbody> <tr> <td>IUD</td> <td>LOW</td> <td>11</td> </tr> <tr> <td>IUD</td> <td>AVERAGE</td> <td>7</td> </tr> <tr> <td>IUD</td> <td>HIGH</td> <td>11</td> </tr> <tr> <td>SUM</td> <td></td> <td>29</td> </tr> </tbody> </table> Table 3: The complexity external inquiry, after four passes. summarized in Table 3 (31 LOW, 5 AVERAGE, 1 HIGH). Computing the unadjusted function points The unadjusted function points in Table 4 are calculated using the weights [12]. The ILF complexity is taken from Table 1. The EIF Complexity is not determined and set ad hoc to (10 files and AVERAGE complexity). EI is set to the file count with INSERT, UPDATE and DELETE, corrected for recurrence, comments and variable- and function names. EO is set to the SMS estimate (10 AVERAGE). Further inspection will change this. EQ is adjusted for recurrence of SELECT’s and conflicting data manipulation statements. Total unadjusted function point = 580. The external UAF count is higher than the internal UAF count. Initially we found that the external UAF counts out performed the internal UAF count, but final inspection has reduced this concern. one system characteristic (Multiple Sites) was set to average influence (3) as the application could be refurbished to several platforms, and the site give rise to 2 code bases. Seven system characteristics were set to moderate influence (2): Data Communication, On-line Data Entry, End User Efficiency, Online Update, Reusability, Installation Ease, and Operational Ease. Five system characteristics were set to incidental influence (1): Performance, Heavily Used Configuration, Transaction Rate, Complex Processing, and Facilitate Change. One system characteristic was set to not present or no influence (0): Distributed data processing. The value adjustment factor for this study was found to be 0.88. A lower degree of influence than presented by Jack TM [12]. The total adjusted functions points (TAFP) for this project was 510 FP. **COCOMO (Constructive cost model)** The COCOMO analysis takes the total adjusted function point measure and converts to a measure of lines of delivered source code (LOC). In our case PHP and java script are taken as the java and C++ measure of 53 LOC per function point and 1130 average source LOC for a 210 FP application [12] (equation 4). My expectation for the current 510 FP measure for TAFP would be 2.4 * 1130 lines of code = 27442 LOC (when UAF = 580 and TAFP = 510), see equation 5. Which I hope will be found to be an over estimation for the original PHP site [13]. The estimated number of lines of code can then be converted to 27,4 KDSI (1000 delivered source instructions = 1000 LOC) by dividing by 1000 (equation 6). \[ \text{Estimated LOCMar} = \left( \frac{\text{TAFP}}{210 \text{ FP}} \right) \times 11300 \frac{\text{LOC}}{53 \text{ FP}} = 27442 \text{ LOC} \quad (5) \] \[ \text{Estimated KDSI} = \frac{27442 \text{ LOC}}{1000 \text{ LOC/KDSI}} = 27.4 \text{ KDSI} \quad (6) \] In COCOMO a man-month is 152 hours. In COCOMO first decide if the project is organic (expect few problems), Embedded (expect problems) or semi-detached (in-between). An embedded project scales to 3.6 * KDSI. KDSI = 27.4 gives 191 Person-Months. I would go with the lower project classification (organic to semi-detached), 77-122 person-months. The estimate is 19-30 months for a 4 crew team, or 2+ years (Table 6). The actual lines of code counted is about 43000 LOC including 20700 LOC for 3-party code. The KDSI measure of COCOMO is a measure of delivered source code instructions. This amounts to 43000-20700 = 22300 lines of delivered source code (22.3 KDSI). Compared to the result of the constructive cost model estimate of 27.4 KDSI, this is an overestimation by 23%. **Discussion** The first key question here is training. The subjective measure of complexity in a smaller custom website, compared to corporate wide systems. Does this lead to overestimation? Yes. In this function point analysis only the relational tables an their complexity was held against the PHP code as an external application. The function point analysis was calculated from a database standpoint. There are other factors that have only been touched. It was surprising that function point analysis of a custom website developed by one programmer and operational over a period of 6 years had the estimation of 510 function points (FP) converting to an expected 27000 lines of code. I had expected less complexity. Experience with FPA will give more precise estimates for each parameter and even bring the FPA closer to the source code count. In this study the boundary elements considered were primarily entity- and transactional complexity. They seemed a tangible constraint on metrics explored. Other metrics could be considered. A metric for algorithmic complexity (AT) that also is an interesting metric, but may be more academic than operational even in systems of modest size [4]. The Java code calibration is a candidate for debate. In this study it worked out well, but I must also note some complex PHP and Java script-files were not included. This would only increase the measure. And training would cater for this. In the COCOMO analysis overestimation could also be biased by my ad hoc setting of the various degrees of influence. A reason to retrospective make a function point analysis in this case was the author's lack of luck to debug and support the site after the creator passed away and the vendor upgraded the PHP-version, rendering the site down. This lack of skills can be attributed in some part to Fredric Brooks – “The mythical man month” [5] but also the teachings of Peter Naur, 'Computing a human activity' and ‘Programming as theory building’ [15-17]. In the section ‘program life, death and revival’ that also was an interesting metric, but may be more academic than operational even in systems of modest size [4]. The Java code calibration is a candidate for debate. In this study it worked out well, but I must also note some complex PHP and Java script-files were not included. This would only increase the measure. And training would cater for this. In the COCOMO analysis overestimation could also be biased by my ad hoc setting of the various degrees of influence. **Table 5:** Calculation of the value adjustment factor (VAF) and the total adjusted function point (TAFP) or just function points (FP). <table> <thead> <tr> <th>General System Characteristic</th> <th>Degree of influence</th> <th>Degree of influence</th> </tr> </thead> <tbody> <tr> <td>Data Communication</td> <td>3</td> <td>2</td> </tr> <tr> <td>Distributed data processing</td> <td>0</td> <td>0</td> </tr> <tr> <td>Performance</td> <td>4</td> <td>1</td> </tr> <tr> <td>Heavily Used Configuration</td> <td>3</td> <td>1</td> </tr> <tr> <td>Transaction Rate</td> <td>3</td> <td>1</td> </tr> <tr> <td>On-line Data Entry</td> <td>4</td> <td>2</td> </tr> <tr> <td>End User Efficiency</td> <td>4</td> <td>2</td> </tr> <tr> <td>Online Update</td> <td>3</td> <td>2</td> </tr> <tr> <td>Complex Processing</td> <td>3</td> <td>1</td> </tr> <tr> <td>Reusability</td> <td>2</td> <td>2</td> </tr> <tr> <td>Installation Ease</td> <td>3</td> <td>2</td> </tr> <tr> <td>Operational Ease</td> <td>3</td> <td>2</td> </tr> <tr> <td>Multiple Sites</td> <td>1</td> <td>3</td> </tr> <tr> <td>Facilitate Change</td> <td>2</td> <td>1</td> </tr> <tr> <td>Total degrees of influence (TDI)</td> <td>40</td> <td>23</td> </tr> </tbody> </table> **VALUE ADJUSTMENT FACTOR (VAF)** \[ vaf = (40 \times 0.01) + 0.65 = 1.05 \quad (7) \] \[ vaf = (tdi \times 0.01) + 0.65 \quad (8) \] \[ \text{Estimated LOCMar} = \left( \frac{\text{TAFP}}{210 \text{ FP}} \right) \times 11300 \frac{\text{LOC}}{53 \text{ FP}} = 27442 \text{ LOC} \quad (5) \] \[ \text{Estimated KDSI} = \frac{27442 \text{ LOC}}{1000 \text{ LOC/KDSI}} = 27.4 \text{ KDSI} \quad (6) \] **Table 6:** Calculating person months and team months for a four person team (person-month divided by 4) based on KDSI=27.4. than admitted; it is the wiser choice to re-implement the code in face of rejection of the initial strategy. Support for this argument can also be in comparing computing as text production to theory building [16]. In this case the following observations contribute to understand the current system down: Broken links. Possible missing URL resolutions; Application state could not be debugged and restored; Vendor upgrade coincided with mourning period. Conclusion The Internal Logical File complexity holds for the number of files/entities, but the complexity (LOW; AVERAGE; HIGH) could be overestimated for a smaller custom website. Using DML (Data Manipulation Language) as a marker for EI an EQ in a website seems operational in a retrospective study (where the coding has been done). The initial keyword search identifies key participating potential relevant external files. A code inspection is necessary to assess complexity and relevance. It was found that the “myteam” custom website consist UAF=580 FP unadjusted function points, TDI=23 Total degrees of influence, Value adjustment factor, VAF=0,88; Total adjusted function points TAFP=510FP. The COCOMO analysis showed an estimated project size of 27,4 KDSI or 27442 LOC. Based on 27,4 KDSI the project type was classified as organic to semi-detached, and project estimate of 66-82 person-months or 16-21 team-months for a four person team. An overestimation of 23% is found compared to the current count of the actual lines of code. The function point analysis explained the complexity quite well. References
{"Source-Url": "https://static-curis.ku.dk/portal/files/216974914/Function_point_analysis_fpa_on_a_team_planning_website_based_on_php_and_mysql_2165_7866_1000237.pdf", "len_cl100k_base": 6317, "olmocr-version": "0.1.53", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 17895, "total-output-tokens": 7096, "length": "2e12", "weborganizer": {"__label__adult": 0.0003266334533691406, "__label__art_design": 0.0002529621124267578, "__label__crime_law": 0.0002434253692626953, "__label__education_jobs": 0.0014524459838867188, "__label__entertainment": 4.976987838745117e-05, "__label__fashion_beauty": 0.0001285076141357422, "__label__finance_business": 0.0005135536193847656, "__label__food_dining": 0.0002884864807128906, "__label__games": 0.000408172607421875, "__label__hardware": 0.0006723403930664062, "__label__health": 0.0004887580871582031, "__label__history": 0.00019812583923339844, "__label__home_hobbies": 0.00010442733764648438, "__label__industrial": 0.0002682209014892578, "__label__literature": 0.00024771690368652344, "__label__politics": 0.00012922286987304688, "__label__religion": 0.0002636909484863281, "__label__science_tech": 0.0110626220703125, "__label__social_life": 0.00011867284774780272, "__label__software": 0.007213592529296875, "__label__software_dev": 0.974609375, "__label__sports_fitness": 0.00023448467254638672, "__label__transportation": 0.0003921985626220703, "__label__travel": 0.0001885890960693359}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 28073, 0.0455]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 28073, 0.21885]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 28073, 0.89051]], "google_gemma-3-12b-it_contains_pii": [[0, 574, false], [574, 6709, null], [6709, 12203, null], [12203, 17088, null], [17088, 24205, null], [24205, 28073, null]], "google_gemma-3-12b-it_is_public_document": [[0, 574, true], [574, 6709, null], [6709, 12203, null], [12203, 17088, null], [17088, 24205, null], [24205, 28073, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 28073, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 28073, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 28073, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 28073, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 28073, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 28073, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 28073, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 28073, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 28073, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 28073, null]], "pdf_page_numbers": [[0, 574, 1], [574, 6709, 2], [6709, 12203, 3], [12203, 17088, 4], [17088, 24205, 5], [24205, 28073, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 28073, 0.28655]]}
olmocr_science_pdfs
2024-12-06
2024-12-06